@chevre/domain 22.1.0 → 22.2.0-alpha.1
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/lib/chevre/repo/paymentService.d.ts +3 -1
- package/lib/chevre/repo/product.d.ts +3 -1
- package/lib/chevre/service/assetTransaction/registerService/factory.d.ts +3 -1
- package/lib/chevre/service/assetTransaction/reserve/start/createSubReservations.js +52 -21
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createReservation.js +9 -2
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.d.ts +23 -0
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.js +109 -0
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +2 -0
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.js +9 -30
- package/lib/chevre/service/offer/event/authorize.d.ts +2 -0
- package/lib/chevre/service/offer/product/factory.js +6 -1
- package/lib/chevre/service/order/placeOrder/factory.js +11 -9
- package/lib/chevre/service/payment/any/factory.d.ts +2 -1
- package/lib/chevre/service/payment/any/factory.js +17 -3
- package/lib/chevre/service/payment/any/fixConfirmationNumberAsNeeded.d.ts +11 -0
- package/lib/chevre/service/payment/any/fixConfirmationNumberAsNeeded.js +32 -0
- package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.d.ts +22 -0
- package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.js +79 -0
- package/lib/chevre/service/payment/any.d.ts +5 -1
- package/lib/chevre/service/payment/any.js +19 -18
- package/lib/chevre/service/payment/paymentCard.js +5 -2
- package/lib/chevre/service/task/authorizePayment.js +2 -0
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +14 -7
- package/package.json +3 -3
- package/example/src/chevre/investigateMovieTicketIdentifier.ts +0 -78
|
@@ -37,7 +37,9 @@ export declare class PaymentServiceRepo {
|
|
|
37
37
|
/**
|
|
38
38
|
* 決済サービスを検索する
|
|
39
39
|
*/
|
|
40
|
-
searchPaymentServices(conditions: ISearchConditions4paymentService, inclusion: IKeyOfProjection4paymentService[], exclusion: IKeyOfProjection4paymentService[]): Promise<factory.service.paymentService.IService
|
|
40
|
+
searchPaymentServices(conditions: ISearchConditions4paymentService, inclusion: IKeyOfProjection4paymentService[], exclusion: IKeyOfProjection4paymentService[]): Promise<(factory.service.paymentService.IService & {
|
|
41
|
+
id: string;
|
|
42
|
+
})[]>;
|
|
41
43
|
deletePaymentServiceById(params: {
|
|
42
44
|
id: string;
|
|
43
45
|
}): Promise<void>;
|
|
@@ -41,7 +41,9 @@ export declare class ProductRepo {
|
|
|
41
41
|
/**
|
|
42
42
|
* プロダクトを検索する
|
|
43
43
|
*/
|
|
44
|
-
searchProducts(conditions: ISearchConditions4product, inclusion: IKeyOfProjection4product[], exclusion: IKeyOfProjection4product[]): Promise<factory.product.IProduct
|
|
44
|
+
searchProducts(conditions: ISearchConditions4product, inclusion: IKeyOfProjection4product[], exclusion: IKeyOfProjection4product[]): Promise<(factory.product.IProduct & {
|
|
45
|
+
id: string;
|
|
46
|
+
})[]>;
|
|
45
47
|
deleteProductById(params: {
|
|
46
48
|
id: string;
|
|
47
49
|
}): Promise<void>;
|
|
@@ -12,7 +12,9 @@ export declare function createPointAward(params: {
|
|
|
12
12
|
*/
|
|
13
13
|
export declare function createServiceOutput(params: {
|
|
14
14
|
dateIssued: Date;
|
|
15
|
-
product: factory.product.IProduct
|
|
15
|
+
product: factory.product.IProduct & {
|
|
16
|
+
id: string;
|
|
17
|
+
};
|
|
16
18
|
acceptedOffer: factory.assetTransaction.registerService.IAcceptedOfferWithoutDetail;
|
|
17
19
|
offer: factory.product.ITicketOffer;
|
|
18
20
|
transactionNumber: string;
|
|
@@ -271,43 +271,70 @@ function validateAdvanceBookingRequirement(params) {
|
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
function validateProgramMembershipUsed(params) {
|
|
274
|
-
// tslint:disable-next-line:max-func-body-length
|
|
274
|
+
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
275
275
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
276
|
-
var _a, _b, _c;
|
|
276
|
+
var _a, _b, _c, _d, _e;
|
|
277
277
|
const now = new Date();
|
|
278
278
|
let programMembershipUsed;
|
|
279
279
|
const requestedProgramMembershipUsed = (_b = (_a = params.acceptedOffer.itemOffered) === null || _a === void 0 ? void 0 : _a.serviceOutput) === null || _b === void 0 ? void 0 : _b.programMembershipUsed;
|
|
280
280
|
if (typeof requestedProgramMembershipUsed === 'string') {
|
|
281
|
-
throw new factory.errors.Argument('acceptedOffer.itemOffered.serviceOutput.programMembershipUsed', 'must be
|
|
281
|
+
throw new factory.errors.Argument('acceptedOffer.itemOffered.serviceOutput.programMembershipUsed', 'must be permit');
|
|
282
|
+
}
|
|
283
|
+
if ((requestedProgramMembershipUsed === null || requestedProgramMembershipUsed === void 0 ? void 0 : requestedProgramMembershipUsed.typeOf) === 'Ticket') {
|
|
284
|
+
throw new factory.errors.Argument('acceptedOffer.itemOffered.serviceOutput.programMembershipUsed', 'must be permit');
|
|
282
285
|
}
|
|
283
286
|
const programMembershipUsedIdentifier = requestedProgramMembershipUsed === null || requestedProgramMembershipUsed === void 0 ? void 0 : requestedProgramMembershipUsed.identifier;
|
|
284
287
|
const issuedThroughId = (_c = requestedProgramMembershipUsed === null || requestedProgramMembershipUsed === void 0 ? void 0 : requestedProgramMembershipUsed.issuedThrough) === null || _c === void 0 ? void 0 : _c.id;
|
|
285
|
-
|
|
286
|
-
|
|
288
|
+
const issuedThroughTypeOf = (_d = requestedProgramMembershipUsed === null || requestedProgramMembershipUsed === void 0 ? void 0 : requestedProgramMembershipUsed.issuedThrough) === null || _d === void 0 ? void 0 : _d.typeOf;
|
|
289
|
+
if (typeof programMembershipUsedIdentifier === 'string') {
|
|
290
|
+
if (typeof issuedThroughId !== 'string' || issuedThroughId === '') {
|
|
287
291
|
throw new factory.errors.ArgumentNull('acceptedOffer.itemOffered.serviceOutput.programMembershipUsed.issuedThrough.id');
|
|
288
292
|
}
|
|
289
293
|
let permitIssuedThrough;
|
|
290
294
|
// まずメンバーシップを検索して、存在しなければCreditCardを検索(どちらが発行元サービスか不明なので)
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
295
|
+
if (issuedThroughTypeOf === factory.product.ProductType.MembershipService) {
|
|
296
|
+
permitIssuedThrough = (yield repos.product.searchProducts({
|
|
297
|
+
limit: 1,
|
|
298
|
+
page: 1,
|
|
299
|
+
id: { $eq: issuedThroughId },
|
|
300
|
+
typeOf: { $eq: factory.product.ProductType.MembershipService }
|
|
301
|
+
}, ['_id', 'typeOf', 'project', 'serviceType', 'serviceOutput'], [])).shift();
|
|
302
|
+
if (permitIssuedThrough === undefined) {
|
|
303
|
+
throw new factory.errors.NotFound(factory.product.ProductType.MembershipService);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
else if (issuedThroughTypeOf === factory.service.paymentService.PaymentServiceType.CreditCard) {
|
|
298
307
|
permitIssuedThrough = (yield repos.paymentService.searchPaymentServices({
|
|
299
308
|
limit: 1,
|
|
300
309
|
page: 1,
|
|
301
310
|
id: { $eq: issuedThroughId },
|
|
302
311
|
typeOf: { $eq: factory.service.paymentService.PaymentServiceType.CreditCard }
|
|
303
312
|
}, ['_id', 'typeOf', 'project', 'serviceType', 'serviceOutput'], [])).shift();
|
|
313
|
+
if (permitIssuedThrough === undefined) {
|
|
314
|
+
throw new factory.errors.NotFound(factory.service.paymentService.PaymentServiceType.CreditCard);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
else if (issuedThroughTypeOf === factory.service.paymentService.PaymentServiceType.FaceToFace) {
|
|
318
|
+
// プロダクトは存在しないので特に検証なし
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
throw new factory.errors.Argument('acceptedOffer.itemOffered.serviceOutput.programMembershipUsed', `invalid issuedThrough.typeOf: ${issuedThroughTypeOf}`);
|
|
304
322
|
}
|
|
305
323
|
if (typeof (permitIssuedThrough === null || permitIssuedThrough === void 0 ? void 0 : permitIssuedThrough.typeOf) !== 'string') {
|
|
306
324
|
throw new factory.errors.NotFound(`Permit issuer service [${issuedThroughId}]`);
|
|
307
325
|
}
|
|
308
|
-
// permitIssuedThrough =
|
|
309
|
-
// await repos.product.findById({ id: issuedThroughId }, ['_id', 'typeOf', 'project', 'serviceType', 'serviceOutput'], []);
|
|
310
326
|
switch (permitIssuedThrough.typeOf) {
|
|
327
|
+
case factory.service.paymentService.PaymentServiceType.FaceToFace:
|
|
328
|
+
// 問答無用に受け入れる
|
|
329
|
+
programMembershipUsed = {
|
|
330
|
+
typeOf: factory.permit.PermitType.Permit,
|
|
331
|
+
identifier: programMembershipUsedIdentifier,
|
|
332
|
+
issuedThrough: {
|
|
333
|
+
id: '',
|
|
334
|
+
typeOf: permitIssuedThrough.typeOf
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
break;
|
|
311
338
|
// 発行サービスがCreditCardのケースに対応(2023-09-01~)
|
|
312
339
|
case factory.service.paymentService.PaymentServiceType.CreditCard:
|
|
313
340
|
// 決済サービスのserviceOutputにPermitが存在すれば、設定されたメンバーシップ区分のPermitをprogramMembershipUsedとして適用する
|
|
@@ -320,7 +347,6 @@ function validateProgramMembershipUsed(params) {
|
|
|
320
347
|
}
|
|
321
348
|
if ((issuedThroughServiceType === null || issuedThroughServiceType === void 0 ? void 0 : issuedThroughServiceType.typeOf) === 'CategoryCode') {
|
|
322
349
|
programMembershipUsed = {
|
|
323
|
-
project: permitIssuedThrough.project,
|
|
324
350
|
typeOf: factory.permit.PermitType.Permit,
|
|
325
351
|
identifier: programMembershipUsedIdentifier,
|
|
326
352
|
issuedThrough: {
|
|
@@ -354,12 +380,17 @@ function validateProgramMembershipUsed(params) {
|
|
|
354
380
|
.isBefore(moment(now))) {
|
|
355
381
|
throw new factory.errors.Argument('acceptedOffer.itemOffered.serviceOutput.programMembershipUsed', 'unavailable programMembership');
|
|
356
382
|
}
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
383
|
+
if (((_e = permitIssuedThrough.serviceType) === null || _e === void 0 ? void 0 : _e.typeOf) === 'CategoryCode') {
|
|
384
|
+
programMembershipUsed = {
|
|
385
|
+
typeOf: serviceOutput.typeOf,
|
|
386
|
+
identifier: programMembershipUsedIdentifier,
|
|
387
|
+
issuedThrough: {
|
|
388
|
+
id: permitIssuedThrough.id,
|
|
389
|
+
serviceType: permitIssuedThrough.serviceType,
|
|
390
|
+
typeOf: permitIssuedThrough.typeOf
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
}
|
|
363
394
|
break;
|
|
364
395
|
default:
|
|
365
396
|
throw new factory.errors.Argument('acceptedOffer.itemOffered.serviceOutput.programMembershipUsed', `${permitIssuedThrough.typeOf} not implemented`);
|
|
@@ -197,11 +197,18 @@ function validateEligibleMembershipType(params) {
|
|
|
197
197
|
// 使用メンバーシップがeligibleMembershipに含まれればよい
|
|
198
198
|
const eligibleMembershipType = params.availableOffer.eligibleMembershipType;
|
|
199
199
|
if (Array.isArray(eligibleMembershipType)) {
|
|
200
|
-
if (
|
|
200
|
+
if ((programMembershipUsed === null || programMembershipUsed === void 0 ? void 0 : programMembershipUsed.typeOf) !== factory.permit.PermitType.Permit) {
|
|
201
201
|
throw new factory.errors.Argument('programMembershipUsed', 'programMembership required');
|
|
202
202
|
}
|
|
203
|
+
const { identifier, issuedThrough } = programMembershipUsed;
|
|
204
|
+
if (typeof identifier !== 'string' || identifier === '') {
|
|
205
|
+
throw new factory.errors.Argument('programMembershipUsed', 'programMembership.identifier required');
|
|
206
|
+
}
|
|
203
207
|
// programMembershipUsed.issuedThrough.serviceTypeで検証する
|
|
204
|
-
const isEligible = eligibleMembershipType.some((membershipType) =>
|
|
208
|
+
const isEligible = eligibleMembershipType.some((membershipType) =>
|
|
209
|
+
// FaceToFaceについては問答無用に受け入れる(2024-08-14~)
|
|
210
|
+
issuedThrough.typeOf === factory.service.paymentService.PaymentServiceType.FaceToFace
|
|
211
|
+
|| membershipType.codeValue === issuedThrough.serviceType.codeValue);
|
|
205
212
|
if (!isEligible) {
|
|
206
213
|
throw new factory.errors.Argument('programMembershipUsed', `${programMembershipUsed.identifier} is not eligible for the offer ${params.availableOffer.id}`);
|
|
207
214
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as factory from '../../../../../factory';
|
|
2
|
+
import type { JWTCredentials } from '../../../../../credentials/jwt';
|
|
3
|
+
import type { ActionRepo } from '../../../../../repo/action';
|
|
4
|
+
import type { AuthorizationRepo } from '../../../../../repo/authorization';
|
|
5
|
+
import type { OwnershipInfoRepo } from '../../../../../repo/ownershipInfo';
|
|
6
|
+
import type { TicketRepo } from '../../../../../repo/ticket';
|
|
7
|
+
/**
|
|
8
|
+
* チケット化された適用メンバーシップをPermitに変換する
|
|
9
|
+
*/
|
|
10
|
+
declare function requestedProgramMembershipUsed2permit(params: {
|
|
11
|
+
project: {
|
|
12
|
+
id: string;
|
|
13
|
+
};
|
|
14
|
+
programMembershipUsed?: factory.assetTransaction.reserve.IAcceptedProgramMembershipUsed;
|
|
15
|
+
}): (repos: {
|
|
16
|
+
action: ActionRepo;
|
|
17
|
+
authorization: AuthorizationRepo;
|
|
18
|
+
ownershipInfo: OwnershipInfoRepo;
|
|
19
|
+
ticket: TicketRepo;
|
|
20
|
+
}, credentials: {
|
|
21
|
+
jwt: JWTCredentials;
|
|
22
|
+
}) => Promise<factory.assetTransaction.reserve.IProgramMembershipUsedAsPermit | undefined>;
|
|
23
|
+
export { requestedProgramMembershipUsed2permit };
|
|
@@ -0,0 +1,109 @@
|
|
|
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.requestedProgramMembershipUsed2permit = void 0;
|
|
13
|
+
const factory = require("../../../../../factory");
|
|
14
|
+
const CodeService = require("../../../../code");
|
|
15
|
+
/**
|
|
16
|
+
* チケット化された適用メンバーシップをPermitに変換する
|
|
17
|
+
*/
|
|
18
|
+
// tslint:disable-next-line:max-func-body-length
|
|
19
|
+
function requestedProgramMembershipUsed2permit(params) {
|
|
20
|
+
return (repos, credentials) => __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
let programMembershipUsedAsPermit;
|
|
23
|
+
const { programMembershipUsed } = params;
|
|
24
|
+
// トークン化されたメンバーシップがリクエストされた場合、実メンバーシップ情報へ変換する
|
|
25
|
+
if (typeof programMembershipUsed === 'string') {
|
|
26
|
+
const { authorizedObject } = yield CodeService.verifyToken({
|
|
27
|
+
project: { id: params.project.id },
|
|
28
|
+
agent: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
29
|
+
token: String(programMembershipUsed)
|
|
30
|
+
})(repos, credentials);
|
|
31
|
+
const permitOwnershipInfo = authorizedObject;
|
|
32
|
+
if (Array.isArray(permitOwnershipInfo)) {
|
|
33
|
+
throw new factory.errors.NotImplemented('programMembershipUsed as an array not implemented');
|
|
34
|
+
}
|
|
35
|
+
if (permitOwnershipInfo.typeOf !== 'OwnershipInfo') {
|
|
36
|
+
throw new factory.errors.Argument('programMembershipUsed', 'must be OwnershipInfo');
|
|
37
|
+
}
|
|
38
|
+
if (permitOwnershipInfo.typeOfGood.typeOf !== factory.permit.PermitType.Permit) {
|
|
39
|
+
throw new factory.errors.Argument('programMembershipUsed', 'must be Permit');
|
|
40
|
+
}
|
|
41
|
+
const typeOfGood = permitOwnershipInfo.typeOfGood;
|
|
42
|
+
if (typeof ((_a = typeOfGood.issuedThrough) === null || _a === void 0 ? void 0 : _a.id) !== 'string') {
|
|
43
|
+
throw new factory.errors.NotFound('itemOffered.serviceOutput.programMembershipUsed.issuedThrough.id');
|
|
44
|
+
}
|
|
45
|
+
const issuedThroughTypeOf = typeOfGood.issuedThrough.typeOf;
|
|
46
|
+
if (issuedThroughTypeOf !== factory.product.ProductType.MembershipService
|
|
47
|
+
&& issuedThroughTypeOf !== factory.service.paymentService.PaymentServiceType.CreditCard
|
|
48
|
+
&& issuedThroughTypeOf !== factory.service.paymentService.PaymentServiceType.FaceToFace) {
|
|
49
|
+
throw new factory.errors.Argument('programMembershipUsed', `invalid issuedThrough.typeOf: ${issuedThroughTypeOf}`);
|
|
50
|
+
}
|
|
51
|
+
programMembershipUsedAsPermit = {
|
|
52
|
+
identifier: String(typeOfGood.identifier),
|
|
53
|
+
issuedThrough: { id: typeOfGood.issuedThrough.id, typeOf: issuedThroughTypeOf },
|
|
54
|
+
typeOf: factory.permit.PermitType.Permit
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
else if ((programMembershipUsed === null || programMembershipUsed === void 0 ? void 0 : programMembershipUsed.typeOf) === 'Ticket') {
|
|
58
|
+
const { ticketToken } = programMembershipUsed;
|
|
59
|
+
if (typeof ticketToken === 'string') {
|
|
60
|
+
const ticket = (yield repos.ticket.search({
|
|
61
|
+
limit: 1,
|
|
62
|
+
page: 1,
|
|
63
|
+
project: { id: { $eq: params.project.id } },
|
|
64
|
+
ticketToken: { $eq: ticketToken }
|
|
65
|
+
})).shift();
|
|
66
|
+
if (ticket === undefined) {
|
|
67
|
+
throw new factory.errors.NotFound('Ticket');
|
|
68
|
+
}
|
|
69
|
+
// 承認を参照
|
|
70
|
+
const { object } = yield repos.authorization.findValidOneByCode({
|
|
71
|
+
project: { id: params.project.id },
|
|
72
|
+
code: ticket.ticketToken
|
|
73
|
+
});
|
|
74
|
+
if (object.typeOf !== 'OwnershipInfo') {
|
|
75
|
+
throw new factory.errors.Argument('programMembershipUsed', 'invalid authorization');
|
|
76
|
+
}
|
|
77
|
+
const ownershipInfoId = object.id;
|
|
78
|
+
const permitOwnershipInfo = (yield repos.ownershipInfo.search({
|
|
79
|
+
limit: 1,
|
|
80
|
+
page: 1,
|
|
81
|
+
project: { id: { $eq: params.project.id } },
|
|
82
|
+
ids: [ownershipInfoId]
|
|
83
|
+
})).shift();
|
|
84
|
+
if (permitOwnershipInfo === undefined) {
|
|
85
|
+
throw new factory.errors.NotFound('OwnershipInfo');
|
|
86
|
+
}
|
|
87
|
+
if (permitOwnershipInfo.typeOfGood.typeOf !== factory.permit.PermitType.Permit) {
|
|
88
|
+
throw new factory.errors.Argument('programMembershipUsed', 'ownershipInfo.typeOfGood.typeOf must be Permit');
|
|
89
|
+
}
|
|
90
|
+
if (typeof ((_b = permitOwnershipInfo.typeOfGood.issuedThrough) === null || _b === void 0 ? void 0 : _b.id) !== 'string') {
|
|
91
|
+
throw new factory.errors.Argument('programMembershipUsed', 'ownershipInfo.typeOfGood.issuedThrough.id undefined');
|
|
92
|
+
}
|
|
93
|
+
const issuedThroughTypeOf = permitOwnershipInfo.typeOfGood.issuedThrough.typeOf;
|
|
94
|
+
if (issuedThroughTypeOf !== factory.product.ProductType.MembershipService
|
|
95
|
+
&& issuedThroughTypeOf !== factory.service.paymentService.PaymentServiceType.CreditCard
|
|
96
|
+
&& issuedThroughTypeOf !== factory.service.paymentService.PaymentServiceType.FaceToFace) {
|
|
97
|
+
throw new factory.errors.Argument('programMembershipUsed', `invalid issuedThrough.typeOf: ${issuedThroughTypeOf}`);
|
|
98
|
+
}
|
|
99
|
+
programMembershipUsedAsPermit = {
|
|
100
|
+
identifier: permitOwnershipInfo.typeOfGood.identifier,
|
|
101
|
+
issuedThrough: { id: permitOwnershipInfo.typeOfGood.issuedThrough.id, typeOf: issuedThroughTypeOf },
|
|
102
|
+
typeOf: factory.permit.PermitType.Permit
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return programMembershipUsedAsPermit;
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
exports.requestedProgramMembershipUsed2permit = requestedProgramMembershipUsed2permit;
|
|
@@ -7,6 +7,7 @@ import type { EventRepo, IMinimizedIndividualEvent } from '../../../../repo/even
|
|
|
7
7
|
import type { OfferRepo } from '../../../../repo/offer';
|
|
8
8
|
import type { OfferCatalogRepo } from '../../../../repo/offerCatalog';
|
|
9
9
|
import type { OfferCatalogItemRepo } from '../../../../repo/offerCatalogItem';
|
|
10
|
+
import type { OwnershipInfoRepo } from '../../../../repo/ownershipInfo';
|
|
10
11
|
import type { PaymentServiceRepo } from '../../../../repo/paymentService';
|
|
11
12
|
import type { SeatRepo } from '../../../../repo/place/seat';
|
|
12
13
|
import type { PriceSpecificationRepo } from '../../../../repo/priceSpecification';
|
|
@@ -45,6 +46,7 @@ declare function processStartReserve4chevre(params: {
|
|
|
45
46
|
offerCatalog: OfferCatalogRepo;
|
|
46
47
|
offerCatalogItem: OfferCatalogItemRepo;
|
|
47
48
|
offerRateLimit: OfferRateLimitRepo;
|
|
49
|
+
ownershipInfo: OwnershipInfoRepo;
|
|
48
50
|
paymentService: PaymentServiceRepo;
|
|
49
51
|
product: ProductRepo;
|
|
50
52
|
productOffer: ProductOfferRepo;
|
|
@@ -12,8 +12,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.processStartReserve4chevre = void 0;
|
|
13
13
|
const factory = require("../../../../factory");
|
|
14
14
|
const ReserveTransactionService = require("../../../assetTransaction/reserve");
|
|
15
|
-
const CodeService = require("../../../code");
|
|
16
15
|
const factory_1 = require("./factory");
|
|
16
|
+
const requestedProgramMembershipUsed2permit_1 = require("./processStartReserve4chevre/requestedProgramMembershipUsed2permit");
|
|
17
17
|
function processStartReserve4chevre(params, options) {
|
|
18
18
|
return (repos, credentials) => __awaiter(this, void 0, void 0, function* () {
|
|
19
19
|
const { event, transaction, transactionNumber } = params;
|
|
@@ -46,39 +46,18 @@ function processStartReserve4chevre(params, options) {
|
|
|
46
46
|
exports.processStartReserve4chevre = processStartReserve4chevre;
|
|
47
47
|
function validateObjectWithoutDetail(params) {
|
|
48
48
|
return (repos, credentials) => __awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
var _a, _b, _c
|
|
49
|
+
var _a, _b, _c;
|
|
50
50
|
const objectWithoutDetail = params.object;
|
|
51
51
|
if (Array.isArray(objectWithoutDetail.acceptedOffer)) {
|
|
52
52
|
const validatedAcceptedOffersWithoutDetail = [];
|
|
53
53
|
for (let acceptedOffer of objectWithoutDetail.acceptedOffer) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
})(repos, credentials);
|
|
62
|
-
const permitOwnershipInfo = authorizedObject;
|
|
63
|
-
if (Array.isArray(permitOwnershipInfo)) {
|
|
64
|
-
throw new factory.errors.NotImplemented('programMembershipUsed as an array not implemented');
|
|
65
|
-
}
|
|
66
|
-
if (permitOwnershipInfo.typeOf !== 'OwnershipInfo') {
|
|
67
|
-
throw new factory.errors.Argument('programMembershipUsed', 'must be OwnershipInfo');
|
|
68
|
-
}
|
|
69
|
-
if (permitOwnershipInfo.typeOfGood.typeOf !== factory.permit.PermitType.Permit) {
|
|
70
|
-
throw new factory.errors.Argument('programMembershipUsed', 'must be Permit');
|
|
71
|
-
}
|
|
72
|
-
const typeOfGood = permitOwnershipInfo.typeOfGood;
|
|
73
|
-
const issuedThroughId = (_c = typeOfGood.issuedThrough) === null || _c === void 0 ? void 0 : _c.id;
|
|
74
|
-
if (typeof issuedThroughId !== 'string' || issuedThroughId.length === 0) {
|
|
75
|
-
throw new factory.errors.NotFound('itemOffered.serviceOutput.programMembershipUsed.issuedThrough.id');
|
|
76
|
-
}
|
|
77
|
-
programMembershipUsed = {
|
|
78
|
-
identifier: String(typeOfGood.identifier),
|
|
79
|
-
issuedThrough: { id: issuedThroughId }
|
|
80
|
-
};
|
|
81
|
-
acceptedOffer = Object.assign(Object.assign({}, acceptedOffer), { itemOffered: Object.assign(Object.assign({}, acceptedOffer.itemOffered), { serviceOutput: Object.assign(Object.assign({}, (_d = acceptedOffer.itemOffered) === null || _d === void 0 ? void 0 : _d.serviceOutput), { typeOf: factory.reservationType.EventReservation, programMembershipUsed }) }) });
|
|
54
|
+
const programMembershipUsedAsPermit = yield (0, requestedProgramMembershipUsed2permit_1.requestedProgramMembershipUsed2permit)({
|
|
55
|
+
project: { id: params.project.id },
|
|
56
|
+
programMembershipUsed: (_b = (_a = acceptedOffer.itemOffered) === null || _a === void 0 ? void 0 : _a.serviceOutput) === null || _b === void 0 ? void 0 : _b.programMembershipUsed
|
|
57
|
+
})(repos, credentials);
|
|
58
|
+
// 適用メンバーシップがあればacceptedOfferを強制的に上書き
|
|
59
|
+
if (programMembershipUsedAsPermit !== undefined) {
|
|
60
|
+
acceptedOffer = Object.assign(Object.assign({}, acceptedOffer), { itemOffered: Object.assign(Object.assign({}, acceptedOffer.itemOffered), { serviceOutput: Object.assign(Object.assign({}, (_c = acceptedOffer.itemOffered) === null || _c === void 0 ? void 0 : _c.serviceOutput), { typeOf: factory.reservationType.EventReservation, programMembershipUsed: programMembershipUsedAsPermit }) }) });
|
|
82
61
|
}
|
|
83
62
|
validatedAcceptedOffersWithoutDetail.push(acceptedOffer);
|
|
84
63
|
}
|
|
@@ -9,6 +9,7 @@ import type { OfferCatalogRepo } from '../../../repo/offerCatalog';
|
|
|
9
9
|
import type { OfferCatalogItemRepo } from '../../../repo/offerCatalogItem';
|
|
10
10
|
import type { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
|
|
11
11
|
import type { OrderNumberRepo } from '../../../repo/orderNumber';
|
|
12
|
+
import type { OwnershipInfoRepo } from '../../../repo/ownershipInfo';
|
|
12
13
|
import type { PaymentServiceRepo } from '../../../repo/paymentService';
|
|
13
14
|
import type { SeatRepo } from '../../../repo/place/seat';
|
|
14
15
|
import type { PriceSpecificationRepo } from '../../../repo/priceSpecification';
|
|
@@ -33,6 +34,7 @@ interface IAuthorizeRepos {
|
|
|
33
34
|
offerRateLimit: OfferRateLimitRepo;
|
|
34
35
|
orderInTransaction: OrderInTransactionRepo;
|
|
35
36
|
orderNumber: OrderNumberRepo;
|
|
37
|
+
ownershipInfo: OwnershipInfoRepo;
|
|
36
38
|
paymentService: PaymentServiceRepo;
|
|
37
39
|
priceSpecification: PriceSpecificationRepo;
|
|
38
40
|
product: ProductRepo;
|
|
@@ -26,10 +26,15 @@ function createRegisterServiceStartParams(params) {
|
|
|
26
26
|
// ]
|
|
27
27
|
},
|
|
28
28
|
object: params.object.map((o) => {
|
|
29
|
+
// 許可証コードは自動発行されているはず
|
|
30
|
+
const permitIdentifier = o.itemOffered.serviceOutput.identifier;
|
|
31
|
+
if (typeof permitIdentifier !== 'string' || permitIdentifier === '') {
|
|
32
|
+
throw new factory.errors.ArgumentNull('itemOffered.serviceOutput.identifier');
|
|
33
|
+
}
|
|
29
34
|
return {
|
|
30
35
|
typeOf: o.typeOf,
|
|
31
36
|
id: String(o.id),
|
|
32
|
-
itemOffered: o.itemOffered
|
|
37
|
+
itemOffered: Object.assign(Object.assign({}, o.itemOffered), { serviceOutput: Object.assign(Object.assign({}, o.itemOffered.serviceOutput), { identifier: permitIdentifier }) })
|
|
33
38
|
};
|
|
34
39
|
}),
|
|
35
40
|
expires: moment(params.transaction.expires)
|
|
@@ -9,16 +9,17 @@ function createPaymentMethods(params) {
|
|
|
9
9
|
let price = 0;
|
|
10
10
|
// 決済方法をセット
|
|
11
11
|
params.authorizePaymentActions.forEach((a) => {
|
|
12
|
-
var _a, _b, _c
|
|
12
|
+
var _a, _b, _c;
|
|
13
13
|
const resultAsInvoice = (Array.isArray(a.result))
|
|
14
|
-
?
|
|
15
|
-
|
|
14
|
+
// ? a.result?.find(({ typeOf }) => typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
15
|
+
? a.result[0]
|
|
16
|
+
: undefined;
|
|
16
17
|
if (resultAsInvoice === undefined) {
|
|
17
18
|
throw new factory.errors.NotFound('authorizePaymentAction.resultAsInvoice'); // resultは必ず存在するはず
|
|
18
19
|
}
|
|
19
|
-
const paymentMethodAmountCurrencyByAuthorizeAction = (
|
|
20
|
+
const paymentMethodAmountCurrencyByAuthorizeAction = (_b = (_a = resultAsInvoice.paymentMethodAsObject) === null || _a === void 0 ? void 0 : _a.amount) === null || _b === void 0 ? void 0 : _b.currency;
|
|
20
21
|
// 決済方法区分は必ず存在するはず(2023-08-15~)
|
|
21
|
-
const paymentMethodType = (
|
|
22
|
+
const paymentMethodType = (_c = resultAsInvoice.paymentMethodAsObject) === null || _c === void 0 ? void 0 : _c.typeOf;
|
|
22
23
|
if (typeof paymentMethodType !== 'string') {
|
|
23
24
|
throw new factory.errors.NotFound('authorizePaymentAction.result.paymentMethodAsObject.typeOf');
|
|
24
25
|
}
|
|
@@ -34,11 +35,12 @@ function createPaymentMethods(params) {
|
|
|
34
35
|
// 決済方法から注文金額の計算
|
|
35
36
|
price += params.authorizePaymentActions
|
|
36
37
|
.reduce((a, b) => {
|
|
37
|
-
var _a
|
|
38
|
+
var _a;
|
|
38
39
|
const resultAsInvoice = (Array.isArray(b.result))
|
|
39
|
-
?
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
// ? b.result?.find(({ typeOf }) => typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
41
|
+
? b.result[0]
|
|
42
|
+
: undefined;
|
|
43
|
+
const jpyAmount = (((_a = resultAsInvoice === null || resultAsInvoice === void 0 ? void 0 : resultAsInvoice.totalPaymentDue) === null || _a === void 0 ? void 0 : _a.currency) === factory.priceCurrency.JPY)
|
|
42
44
|
? resultAsInvoice.totalPaymentDue.value
|
|
43
45
|
: 0;
|
|
44
46
|
return a + jpyAmount;
|
|
@@ -28,7 +28,8 @@ export declare function createMovieTicket(params: factory.action.trade.pay.IMovi
|
|
|
28
28
|
export declare function createAuthorizeResult(params: {
|
|
29
29
|
object: factory.action.authorize.paymentMethod.any.IObjectIncludingPaymentMethodDetails;
|
|
30
30
|
payTransaction: factory.assetTransaction.pay.ITransaction;
|
|
31
|
-
|
|
31
|
+
permit?: Pick<factory.ownershipInfo.IPermitAsGood, 'identifier'>;
|
|
32
|
+
}): factory.action.authorize.paymentMethod.any.IResult;
|
|
32
33
|
/**
|
|
33
34
|
* 通知対象としてのアクションを最適化
|
|
34
35
|
*/
|
|
@@ -129,8 +129,6 @@ function createAuthorizeResult(params) {
|
|
|
129
129
|
accountId: (typeof ((_e = payTransactionObject.paymentMethod) === null || _e === void 0 ? void 0 : _e.accountId) === 'string')
|
|
130
130
|
? payTransactionObject.paymentMethod.accountId
|
|
131
131
|
: '',
|
|
132
|
-
// 廃止(2023-08-07~)
|
|
133
|
-
// amount: params.object.amount,
|
|
134
132
|
issuedThrough,
|
|
135
133
|
// 完全廃止(paymentMethodAsObjectへ完全移行)(2023-08-16~)
|
|
136
134
|
// paymentMethod: params.object.paymentMethod,
|
|
@@ -146,7 +144,23 @@ function createAuthorizeResult(params) {
|
|
|
146
144
|
additionalProperty: (Array.isArray(params.object.additionalProperty)) ? params.object.additionalProperty : [],
|
|
147
145
|
typeOf: factory.action.authorize.paymentMethod.any.ResultType.Payment
|
|
148
146
|
};
|
|
149
|
-
|
|
147
|
+
// tslint:disable-next-line:no-suspicious-comment
|
|
148
|
+
// TODO 保留 resultにメンバーシップを追加(2024-08-13~)
|
|
149
|
+
// let resultAsPermit: factory.action.authorize.paymentMethod.any.IResultAsPermit | undefined;
|
|
150
|
+
// if (typeof params.permit?.identifier === 'string') {
|
|
151
|
+
// resultAsPermit = {
|
|
152
|
+
// typeOf: factory.permit.PermitType.Permit,
|
|
153
|
+
// identifier: params.permit.identifier,
|
|
154
|
+
// issuedThrough: { serviceType: params.permit.issuedThrough?.serviceType }
|
|
155
|
+
// };
|
|
156
|
+
// }
|
|
157
|
+
// Arrayに統一(2023-09-04~)
|
|
158
|
+
// if (resultAsPermit !== undefined) {
|
|
159
|
+
// return [resultAsInvoice, resultAsPermit];
|
|
160
|
+
// } else {
|
|
161
|
+
// return [resultAsInvoice];
|
|
162
|
+
// }
|
|
163
|
+
return [resultAsInvoice];
|
|
150
164
|
}
|
|
151
165
|
exports.createAuthorizeResult = createAuthorizeResult;
|
|
152
166
|
function payActionObject2invoice(params) {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as factory from '../../../factory';
|
|
2
|
+
import type { ConfirmationNumberRepo } from '../../../repo/confirmationNumber';
|
|
3
|
+
import type { TransactionRepo } from '../../../repo/transaction';
|
|
4
|
+
declare function fixConfirmationNumberAsNeeded(params: {
|
|
5
|
+
purpose: factory.action.authorize.paymentMethod.any.IPurpose;
|
|
6
|
+
paymentServiceType: factory.service.paymentService.PaymentServiceType;
|
|
7
|
+
}): (repos: {
|
|
8
|
+
transaction: TransactionRepo;
|
|
9
|
+
confirmationNumber: ConfirmationNumberRepo;
|
|
10
|
+
}) => Promise<string | undefined>;
|
|
11
|
+
export { fixConfirmationNumberAsNeeded };
|
|
@@ -0,0 +1,32 @@
|
|
|
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.fixConfirmationNumberAsNeeded = void 0;
|
|
13
|
+
const factory = require("../../../factory");
|
|
14
|
+
const publishConfirmationNumberIfNotExist_1 = require("../../transaction/placeOrder/publishConfirmationNumberIfNotExist");
|
|
15
|
+
function fixConfirmationNumberAsNeeded(params) {
|
|
16
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
// MovieTicketの場合、確認番号を発行(着券に連携するため)(2024-05-27~)
|
|
18
|
+
let confirmationNumber;
|
|
19
|
+
if (params.paymentServiceType === factory.service.paymentService.PaymentServiceType.MovieTicket) {
|
|
20
|
+
confirmationNumber = yield (0, publishConfirmationNumberIfNotExist_1.publishConfirmationNumberIfNotExist)({
|
|
21
|
+
id: params.purpose.id,
|
|
22
|
+
status: { $in: [factory.transactionStatusType.InProgress] },
|
|
23
|
+
object: { orderDate: new Date() }
|
|
24
|
+
})({
|
|
25
|
+
confirmationNumber: repos.confirmationNumber,
|
|
26
|
+
transaction: repos.transaction
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return confirmationNumber;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
exports.fixConfirmationNumberAsNeeded = fixConfirmationNumberAsNeeded;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as factory from '../../../factory';
|
|
2
|
+
import type { AuthorizationRepo } from '../../../repo/authorization';
|
|
3
|
+
import type { OwnershipInfoRepo } from '../../../repo/ownershipInfo';
|
|
4
|
+
import type { TicketRepo } from '../../../repo/ticket';
|
|
5
|
+
type IObjectWithoutDetail = factory.action.authorize.paymentMethod.any.IObjectWithoutDetail & {
|
|
6
|
+
ticketToken?: string;
|
|
7
|
+
};
|
|
8
|
+
declare function verifyTicketTokenAsNeeded(params: {
|
|
9
|
+
project: {
|
|
10
|
+
id: string;
|
|
11
|
+
};
|
|
12
|
+
object: IObjectWithoutDetail;
|
|
13
|
+
paymentServiceType: factory.service.paymentService.PaymentServiceType;
|
|
14
|
+
purpose: factory.action.authorize.paymentMethod.any.IPurpose;
|
|
15
|
+
}): (repos: {
|
|
16
|
+
authorization: AuthorizationRepo;
|
|
17
|
+
ownershipInfo: OwnershipInfoRepo;
|
|
18
|
+
ticket: TicketRepo;
|
|
19
|
+
}) => Promise<{
|
|
20
|
+
permit: Pick<factory.ownershipInfo.IPermitAsGood, 'identifier'> | undefined;
|
|
21
|
+
}>;
|
|
22
|
+
export { verifyTicketTokenAsNeeded };
|
|
@@ -0,0 +1,79 @@
|
|
|
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.verifyTicketTokenAsNeeded = void 0;
|
|
13
|
+
const factory = require("../../../factory");
|
|
14
|
+
function verifyTicketTokenAsNeeded(params) {
|
|
15
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
var _a;
|
|
17
|
+
const { paymentServiceType, object, project } = params;
|
|
18
|
+
const { ticketToken } = object;
|
|
19
|
+
let permit;
|
|
20
|
+
switch (paymentServiceType) {
|
|
21
|
+
case factory.service.paymentService.PaymentServiceType.CreditCard:
|
|
22
|
+
case factory.service.paymentService.PaymentServiceType.FaceToFace:
|
|
23
|
+
// トークン化されたメンバーシップがリクエストされた場合、実メンバーシップ情報へ変換する
|
|
24
|
+
if (typeof ticketToken === 'string' && ticketToken !== '') {
|
|
25
|
+
let authorizedObject;
|
|
26
|
+
const ticket = (yield repos.ticket.search({
|
|
27
|
+
limit: 1,
|
|
28
|
+
page: 1,
|
|
29
|
+
project: { id: { $eq: project.id } },
|
|
30
|
+
ticketToken: { $eq: ticketToken }
|
|
31
|
+
})).shift();
|
|
32
|
+
if (ticket === undefined) {
|
|
33
|
+
throw new factory.errors.NotFound('Ticket');
|
|
34
|
+
}
|
|
35
|
+
// 承認を参照
|
|
36
|
+
const validAuthorization = yield repos.authorization.findValidOneByCode({
|
|
37
|
+
project: { id: params.project.id },
|
|
38
|
+
code: ticket.ticketToken
|
|
39
|
+
});
|
|
40
|
+
authorizedObject = validAuthorization.object;
|
|
41
|
+
if (authorizedObject.typeOf !== 'OwnershipInfo') {
|
|
42
|
+
throw new factory.errors.Argument('ticketToken', 'must be OwnershipInfo');
|
|
43
|
+
}
|
|
44
|
+
const ownershipInfoId = authorizedObject.id;
|
|
45
|
+
const permitOwnershipInfo = (yield repos.ownershipInfo.search({
|
|
46
|
+
limit: 1,
|
|
47
|
+
page: 1,
|
|
48
|
+
project: { id: { $eq: params.project.id } },
|
|
49
|
+
ids: [ownershipInfoId]
|
|
50
|
+
})).shift();
|
|
51
|
+
if (permitOwnershipInfo === undefined) {
|
|
52
|
+
throw new factory.errors.NotFound('OwnershipInfo');
|
|
53
|
+
}
|
|
54
|
+
const { ownedBy, typeOfGood } = permitOwnershipInfo;
|
|
55
|
+
if (typeOfGood.typeOf !== factory.permit.PermitType.Permit) {
|
|
56
|
+
throw new factory.errors.Argument('ticketToken', 'must be Permit');
|
|
57
|
+
}
|
|
58
|
+
if (((_a = typeOfGood.issuedThrough) === null || _a === void 0 ? void 0 : _a.typeOf) !== paymentServiceType) {
|
|
59
|
+
throw new factory.errors.Argument('ticketToken', 'paymentServiceType not matched');
|
|
60
|
+
}
|
|
61
|
+
if (!Array.isArray(ownedBy)) {
|
|
62
|
+
throw new factory.errors.Argument('ticketToken', 'ownershipInfo.ownedBy must be Array');
|
|
63
|
+
}
|
|
64
|
+
if (ownedBy[0].typeOf !== factory.transactionType.PlaceOrder) {
|
|
65
|
+
throw new factory.errors.Argument('ticketToken', 'ownershipInfo.ownedBy.typeOf must be PlaceOrder');
|
|
66
|
+
}
|
|
67
|
+
if (ownedBy[0].id !== params.purpose.id) {
|
|
68
|
+
throw new factory.errors.Argument('ticketToken', 'ownershipInfo.ownedBy.id not matched');
|
|
69
|
+
}
|
|
70
|
+
permit = { identifier: typeOfGood.identifier };
|
|
71
|
+
}
|
|
72
|
+
break;
|
|
73
|
+
default:
|
|
74
|
+
// no op
|
|
75
|
+
}
|
|
76
|
+
return { permit };
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
exports.verifyTicketTokenAsNeeded = verifyTicketTokenAsNeeded;
|
|
@@ -10,6 +10,7 @@ import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
|
10
10
|
import type { AuthorizationRepo } from '../../repo/authorization';
|
|
11
11
|
import type { ConfirmationNumberRepo } from '../../repo/confirmationNumber';
|
|
12
12
|
import type { EventRepo } from '../../repo/event';
|
|
13
|
+
import type { OwnershipInfoRepo } from '../../repo/ownershipInfo';
|
|
13
14
|
import type { PaymentServiceRepo } from '../../repo/paymentService';
|
|
14
15
|
import type { PaymentServiceProviderRepo } from '../../repo/paymentServiceProvider';
|
|
15
16
|
import type { ProductRepo } from '../../repo/product';
|
|
@@ -79,6 +80,7 @@ interface IAuthorizeRepos {
|
|
|
79
80
|
authorization: AuthorizationRepo;
|
|
80
81
|
confirmationNumber: ConfirmationNumberRepo;
|
|
81
82
|
event: EventRepo;
|
|
83
|
+
ownershipInfo: OwnershipInfoRepo;
|
|
82
84
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
83
85
|
paymentService: PaymentServiceRepo;
|
|
84
86
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
@@ -102,6 +104,9 @@ interface IPublishPaymentUrlRepos {
|
|
|
102
104
|
transactionNumber: TransactionNumberRepo;
|
|
103
105
|
}
|
|
104
106
|
type IPublishPaymentUrlOperation<T> = (repos: IPublishPaymentUrlRepos, settings: Settings) => Promise<T>;
|
|
107
|
+
type IObjectWithoutDetail = factory.action.authorize.paymentMethod.any.IObjectWithoutDetail & {
|
|
108
|
+
ticketToken?: string;
|
|
109
|
+
};
|
|
105
110
|
/**
|
|
106
111
|
* 外部決済ロケーションを発行する
|
|
107
112
|
*/
|
|
@@ -123,7 +128,6 @@ declare function publishPaymentUrl(params: {
|
|
|
123
128
|
id: string;
|
|
124
129
|
};
|
|
125
130
|
}): IPublishPaymentUrlOperation<Pick<PayTransactionService.IPublishPaymentUrlResult, 'paymentMethodId' | 'paymentUrl'>>;
|
|
126
|
-
type IObjectWithoutDetail = factory.action.authorize.paymentMethod.any.IObjectWithoutDetail;
|
|
127
131
|
/**
|
|
128
132
|
* 決済承認
|
|
129
133
|
*/
|
|
@@ -16,13 +16,14 @@ exports.publishPaymentUrl = exports.processVoidPayTransaction = exports.person2u
|
|
|
16
16
|
const factory = require("../../factory");
|
|
17
17
|
const PayTransactionService = require("../assetTransaction/pay");
|
|
18
18
|
const code_1 = require("../code");
|
|
19
|
-
const publishConfirmationNumberIfNotExist_1 = require("../transaction/placeOrder/publishConfirmationNumberIfNotExist");
|
|
20
19
|
const factory_1 = require("./any/factory");
|
|
20
|
+
const fixConfirmationNumberAsNeeded_1 = require("./any/fixConfirmationNumberAsNeeded");
|
|
21
21
|
const handlePrePublishedPaymentMethodIdOnAuthorizing_1 = require("./any/handlePrePublishedPaymentMethodIdOnAuthorizing");
|
|
22
22
|
const onPaymentStatusChanged_1 = require("./any/onPaymentStatusChanged");
|
|
23
23
|
Object.defineProperty(exports, "onPaymentStatusChanged", { enumerable: true, get: function () { return onPaymentStatusChanged_1.onPaymentStatusChanged; } });
|
|
24
24
|
const person2username_1 = require("./any/person2username");
|
|
25
25
|
Object.defineProperty(exports, "person2username", { enumerable: true, get: function () { return person2username_1.person2username; } });
|
|
26
|
+
const verifyTicketTokenAsNeeded_1 = require("./any/verifyTicketTokenAsNeeded");
|
|
26
27
|
/**
|
|
27
28
|
* 決済承認中止
|
|
28
29
|
* タスクから決済承認を取り消す
|
|
@@ -304,29 +305,29 @@ function authorize(params) {
|
|
|
304
305
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
305
306
|
return (repos, settings, credentials) => __awaiter(this, void 0, void 0, function* () {
|
|
306
307
|
var _a, _b;
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
// MovieTicketの場合、確認番号を発行(着券に連携するため)(2024-05-27~)
|
|
311
|
-
let confirmationNumber;
|
|
312
|
-
if (params.paymentServiceType === factory.service.paymentService.PaymentServiceType.MovieTicket) {
|
|
313
|
-
confirmationNumber = yield (0, publishConfirmationNumberIfNotExist_1.publishConfirmationNumberIfNotExist)({
|
|
314
|
-
id: params.purpose.id,
|
|
315
|
-
status: { $in: [factory.transactionStatusType.InProgress] },
|
|
316
|
-
object: { orderDate: new Date() }
|
|
317
|
-
})({
|
|
318
|
-
confirmationNumber: repos.confirmationNumber,
|
|
319
|
-
transaction: repos.transaction
|
|
320
|
-
});
|
|
308
|
+
const { paymentServiceType, purpose, project } = params;
|
|
309
|
+
if (purpose.typeOf !== factory.transactionType.PlaceOrder) {
|
|
310
|
+
throw new factory.errors.NotImplemented(`purpose.typeOf '${purpose.typeOf} not implemented'`);
|
|
321
311
|
}
|
|
322
|
-
const
|
|
323
|
-
const
|
|
312
|
+
const confirmationNumber = yield (0, fixConfirmationNumberAsNeeded_1.fixConfirmationNumberAsNeeded)({ purpose, paymentServiceType })(repos);
|
|
313
|
+
const transaction = yield repos.transaction.findInProgressById({ typeOf: purpose.typeOf, id: purpose.id }, ['agent', 'expires', 'typeOf', 'project', 'seller']);
|
|
324
314
|
// 取引番号生成
|
|
325
315
|
let transactionNumber;
|
|
326
316
|
let pendingPaymentAgencyTransaction;
|
|
327
317
|
let creditCard = params.object.creditCard;
|
|
318
|
+
// ticketTokenを解釈(2024-08-13~)
|
|
319
|
+
const { permit } = yield (0, verifyTicketTokenAsNeeded_1.verifyTicketTokenAsNeeded)({ project, object: params.object, paymentServiceType, purpose })(repos);
|
|
320
|
+
const paymentMethodIdByPermit = permit === null || permit === void 0 ? void 0 : permit.identifier;
|
|
321
|
+
if (typeof paymentMethodIdByPermit === 'string') {
|
|
322
|
+
transactionNumber = paymentMethodIdByPermit; // メンバーシップ指定の場合、取引番号に適用(2024-08-13~)
|
|
323
|
+
}
|
|
328
324
|
// リクエストでpaymentMethodIdを指定された場合、取引に保管されたpaymentMethodIdに一致すればそちらを適用(外部サイト決済対応)
|
|
329
325
|
if (typeof params.object.paymentMethodId === 'string' && params.object.paymentMethodId.length > 0) {
|
|
326
|
+
if (typeof paymentMethodIdByPermit === 'string') {
|
|
327
|
+
if (paymentMethodIdByPermit !== params.object.paymentMethodId) {
|
|
328
|
+
throw new factory.errors.Argument('ticketToken', 'not matched with paymentMethodId');
|
|
329
|
+
}
|
|
330
|
+
}
|
|
330
331
|
const { authorizeParams, existingCompletedAuthorizeAction } = yield (0, handlePrePublishedPaymentMethodIdOnAuthorizing_1.handlePrePublishedPaymentMethodIdOnAuthorizing)({
|
|
331
332
|
object: params.object,
|
|
332
333
|
prePublishedPaymentMethodId: params.object.paymentMethodId,
|
|
@@ -420,7 +421,7 @@ function authorize(params) {
|
|
|
420
421
|
throw error;
|
|
421
422
|
}
|
|
422
423
|
}
|
|
423
|
-
const result = (0, factory_1.createAuthorizeResult)({ payTransaction, object: authorizeObjectIncludingPaymentMethodDetails });
|
|
424
|
+
const result = (0, factory_1.createAuthorizeResult)(Object.assign({ payTransaction, object: authorizeObjectIncludingPaymentMethodDetails }, (permit !== undefined) ? { permit } : undefined));
|
|
424
425
|
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: result });
|
|
425
426
|
return { id: action.id };
|
|
426
427
|
});
|
|
@@ -65,7 +65,7 @@ function authorize(params, paymentServiceId) {
|
|
|
65
65
|
exports.authorize = authorize;
|
|
66
66
|
function validatePaymentMethod(params, paymentServiceId) {
|
|
67
67
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
68
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
68
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
69
69
|
const serviceOutputIdentifier = (_a = params.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.accountId;
|
|
70
70
|
const amount = (_b = params.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.amount;
|
|
71
71
|
const paymentMethodType = (_c = params.object.paymentMethod) === null || _c === void 0 ? void 0 : _c.identifier;
|
|
@@ -114,7 +114,10 @@ function validatePaymentMethod(params, paymentServiceId) {
|
|
|
114
114
|
issuedThrough: { typeOf: factory.product.ProductType.PaymentCard }
|
|
115
115
|
});
|
|
116
116
|
// サービスタイプを確認
|
|
117
|
-
if (((
|
|
117
|
+
if (((_j = serviceOutput.issuedThrough) === null || _j === void 0 ? void 0 : _j.typeOf) !== factory.product.ProductType.PaymentCard) {
|
|
118
|
+
throw new factory.errors.Argument('object.paymentMethod.accountId', 'serviceOutput.issuedThrough?.typeOf must be PaymentCard');
|
|
119
|
+
}
|
|
120
|
+
if (((_l = (_k = serviceOutput.issuedThrough) === null || _k === void 0 ? void 0 : _k.serviceType) === null || _l === void 0 ? void 0 : _l.codeValue) !== paymentMethodType) {
|
|
118
121
|
throw new factory.errors.Argument('object.paymentMethod.accountId', 'paymentMethodType not matched');
|
|
119
122
|
}
|
|
120
123
|
// 出金金額設定を確認
|
|
@@ -17,6 +17,7 @@ const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
|
17
17
|
const authorization_1 = require("../../repo/authorization");
|
|
18
18
|
const confirmationNumber_1 = require("../../repo/confirmationNumber");
|
|
19
19
|
const event_1 = require("../../repo/event");
|
|
20
|
+
const ownershipInfo_1 = require("../../repo/ownershipInfo");
|
|
20
21
|
const paymentService_1 = require("../../repo/paymentService");
|
|
21
22
|
const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
22
23
|
const product_1 = require("../../repo/product");
|
|
@@ -54,6 +55,7 @@ function call(params) {
|
|
|
54
55
|
authorization: new authorization_1.AuthorizationRepo(connection),
|
|
55
56
|
confirmationNumber: new confirmationNumber_1.ConfirmationNumberRepo(redisClient),
|
|
56
57
|
event: new event_1.EventRepo(connection),
|
|
58
|
+
ownershipInfo: new ownershipInfo_1.OwnershipInfoRepo(connection),
|
|
57
59
|
paymentAccepted: new sellerPaymentAccepted_1.SellerPaymentAcceptedRepo(connection),
|
|
58
60
|
paymentService: new paymentService_1.PaymentServiceRepo(connection),
|
|
59
61
|
paymentServiceProvider: new paymentServiceProvider_1.PaymentServiceProviderRepo(connection),
|
|
@@ -27,7 +27,8 @@ function validateTransaction(transaction, authorizePaymentActions, authorizeEven
|
|
|
27
27
|
const authorizeMovieTicketActions = authorizePaymentActions.filter((a) => {
|
|
28
28
|
var _a;
|
|
29
29
|
const resultAsInvoice = (Array.isArray(a.result))
|
|
30
|
-
? a.result.find(({ typeOf }) => typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
30
|
+
// ? a.result.find(({ typeOf }) => typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
31
|
+
? a.result[0]
|
|
31
32
|
: undefined;
|
|
32
33
|
return (resultAsInvoice === null || resultAsInvoice === void 0 ? void 0 : resultAsInvoice.issuedThrough.typeOf) === factory.service.paymentService.PaymentServiceType.MovieTicket
|
|
33
34
|
// 決済方法区分は必ず存在するはず(2023-08-15~)
|
|
@@ -65,7 +66,8 @@ function findMovieTicketPaymentMethodTypesFromTransaction(authorizePaymentAction
|
|
|
65
66
|
const paymentMethodTypes = [];
|
|
66
67
|
authorizePaymentActions.forEach(({ result }) => {
|
|
67
68
|
const resultAsInvoice = (Array.isArray(result))
|
|
68
|
-
? result.find(({ typeOf }) => typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
69
|
+
// ? result.find(({ typeOf }) => typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
70
|
+
? result[0]
|
|
69
71
|
: undefined;
|
|
70
72
|
if ((resultAsInvoice === null || resultAsInvoice === void 0 ? void 0 : resultAsInvoice.issuedThrough.typeOf) === factory.service.paymentService.PaymentServiceType.MovieTicket) {
|
|
71
73
|
// 決済方法区分は必ず存在するはず(2023-08-15~)
|
|
@@ -123,7 +125,8 @@ function validatePrice(authorizePaymentActions, authorizeEventServiceOfferAction
|
|
|
123
125
|
authorizePaymentActions.forEach(({ result }) => {
|
|
124
126
|
var _a;
|
|
125
127
|
const resultAsInvoice = (Array.isArray(result))
|
|
126
|
-
? result.find(({ typeOf }) => typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
128
|
+
// ? result.find(({ typeOf }) => typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
129
|
+
? result[0]
|
|
127
130
|
: undefined;
|
|
128
131
|
const jpyAmount = (((_a = resultAsInvoice === null || resultAsInvoice === void 0 ? void 0 : resultAsInvoice.totalPaymentDue) === null || _a === void 0 ? void 0 : _a.currency) === factory.priceCurrency.JPY)
|
|
129
132
|
? resultAsInvoice.totalPaymentDue.value
|
|
@@ -160,7 +163,8 @@ function validatePaymentUrl(transaction, authorizePaymentActions) {
|
|
|
160
163
|
// 発行された決済URLに対する決済承認を確認する
|
|
161
164
|
const authorizePaymentAction4paymentUrlExists = authorizePaymentActions.some(({ result }) => {
|
|
162
165
|
const resultAsInvoice = (Array.isArray(result))
|
|
163
|
-
? result.find(({ typeOf }) => typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
166
|
+
// ? result.find(({ typeOf }) => typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
167
|
+
? result[0]
|
|
164
168
|
: undefined;
|
|
165
169
|
return (resultAsInvoice === null || resultAsInvoice === void 0 ? void 0 : resultAsInvoice.paymentMethodId) === paymentMethodId;
|
|
166
170
|
});
|
|
@@ -176,7 +180,8 @@ function validateMonetaryAmount(authorizePaymentActions, authorizeEventServiceOf
|
|
|
176
180
|
const authorizeMonetaryAmountActions = authorizePaymentActions.filter(({ result }) => {
|
|
177
181
|
var _a;
|
|
178
182
|
const resultAsInvoice = (Array.isArray(result))
|
|
179
|
-
? result.find(({ typeOf }) => typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
183
|
+
// ? result.find(({ typeOf }) => typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
184
|
+
? result[0]
|
|
180
185
|
: undefined;
|
|
181
186
|
// JPY以外の通貨に対して承認可能なのはPaymentServiceType.PaymentCardのみ
|
|
182
187
|
return (resultAsInvoice === null || resultAsInvoice === void 0 ? void 0 : resultAsInvoice.issuedThrough.typeOf) === factory.service.paymentService.PaymentServiceType.PaymentCard
|
|
@@ -198,7 +203,8 @@ function validateMonetaryAmount(authorizePaymentActions, authorizeEventServiceOf
|
|
|
198
203
|
const authorizedCurrencyTypes = [...new Set(authorizeMonetaryAmountActions.map(({ result }) => {
|
|
199
204
|
var _a;
|
|
200
205
|
const resultAsInvoice = (Array.isArray(result))
|
|
201
|
-
? result.find(({ typeOf }) => typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
206
|
+
// ? result.find(({ typeOf }) => typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
207
|
+
? result[0]
|
|
202
208
|
: undefined;
|
|
203
209
|
return (_a = resultAsInvoice === null || resultAsInvoice === void 0 ? void 0 : resultAsInvoice.totalPaymentDue) === null || _a === void 0 ? void 0 : _a.currency;
|
|
204
210
|
}))];
|
|
@@ -213,7 +219,8 @@ function validateMonetaryAmount(authorizePaymentActions, authorizeEventServiceOf
|
|
|
213
219
|
authorizeMonetaryAmountActions.forEach(({ result }) => {
|
|
214
220
|
var _a;
|
|
215
221
|
const resultAsInvoice = (Array.isArray(result))
|
|
216
|
-
? result.find(({ typeOf }) => typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
222
|
+
// ? result.find(({ typeOf }) => typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
223
|
+
? result[0]
|
|
217
224
|
: undefined;
|
|
218
225
|
if (((_a = resultAsInvoice === null || resultAsInvoice === void 0 ? void 0 : resultAsInvoice.totalPaymentDue) === null || _a === void 0 ? void 0 : _a.currency) === currencyType) {
|
|
219
226
|
authorizedMonetaryAmount += resultAsInvoice.totalPaymentDue.value;
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.
|
|
13
|
-
"@cinerino/sdk": "10.
|
|
12
|
+
"@chevre/factory": "4.381.0-alpha.2",
|
|
13
|
+
"@cinerino/sdk": "10.5.0-alpha.0",
|
|
14
14
|
"@motionpicture/coa-service": "9.4.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.3.0",
|
|
16
16
|
"@sendgrid/mail": "6.4.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": "22.
|
|
113
|
+
"version": "22.2.0-alpha.1"
|
|
114
114
|
}
|
|
@@ -1,78 +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
|
-
const MOVIE_TICKET_IDENTIFIER_REGEX = '^[0-9a-zA-Z*]+$';
|
|
10
|
-
// const MOVIE_TICKET_IDENTIFIER_REGEX = '^.+$';
|
|
11
|
-
|
|
12
|
-
// tslint:disable-next-line:max-func-body-length
|
|
13
|
-
async function main() {
|
|
14
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
15
|
-
|
|
16
|
-
const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
|
|
17
|
-
|
|
18
|
-
const cursor = actionRepo.getCursor(
|
|
19
|
-
{
|
|
20
|
-
typeOf: { $eq: chevre.factory.actionType.AuthorizeAction },
|
|
21
|
-
'object.typeOf': { $eq: chevre.factory.action.authorize.paymentMethod.any.ResultType.Payment },
|
|
22
|
-
startDate: {
|
|
23
|
-
$gte: moment()
|
|
24
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
25
|
-
.add(-30, 'days')
|
|
26
|
-
.toDate()
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
project: 1,
|
|
31
|
-
typeOf: 1,
|
|
32
|
-
startDate: 1,
|
|
33
|
-
object: 1,
|
|
34
|
-
result: 1
|
|
35
|
-
}
|
|
36
|
-
);
|
|
37
|
-
console.log('actions found');
|
|
38
|
-
|
|
39
|
-
let i = 0;
|
|
40
|
-
await cursor.eachAsync(async (doc) => {
|
|
41
|
-
i += 1;
|
|
42
|
-
const action: Pick<
|
|
43
|
-
chevre.factory.action.authorize.paymentMethod.any.IAction,
|
|
44
|
-
'project' | 'typeOf' | 'startDate' | 'object' | 'result'
|
|
45
|
-
> = doc.toObject();
|
|
46
|
-
|
|
47
|
-
const accountId = (Array.isArray(action.result)) ? action.result[0].accountId : action.result?.accountId;
|
|
48
|
-
const issuedThroughTypeOf = (Array.isArray(action.result))
|
|
49
|
-
? action.result[0].issuedThrough.typeOf
|
|
50
|
-
: action.result?.issuedThrough.typeOf;
|
|
51
|
-
if (issuedThroughTypeOf === chevre.factory.service.paymentService.PaymentServiceType.MovieTicket) {
|
|
52
|
-
const regExp = new RegExp(MOVIE_TICKET_IDENTIFIER_REGEX);
|
|
53
|
-
console.log(
|
|
54
|
-
'checking...',
|
|
55
|
-
accountId,
|
|
56
|
-
action.project.id, action.startDate, i
|
|
57
|
-
);
|
|
58
|
-
if (typeof accountId !== 'string') {
|
|
59
|
-
throw new Error(`${accountId} must be string`);
|
|
60
|
-
}
|
|
61
|
-
if (!accountId.match(regExp)) {
|
|
62
|
-
throw new Error(`${accountId} invalid`);
|
|
63
|
-
}
|
|
64
|
-
} else {
|
|
65
|
-
// console.log(
|
|
66
|
-
// 'no check',
|
|
67
|
-
// issuedThroughTypeOf,
|
|
68
|
-
// action.project.id, action.startDate, i
|
|
69
|
-
// );
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
console.log(i, 'actions checked');
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
main()
|
|
77
|
-
.then()
|
|
78
|
-
.catch(console.error);
|