@chevre/domain 20.2.0-alpha.12 → 20.2.0-alpha.14

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.
@@ -0,0 +1,37 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+ import * as redis from 'redis';
4
+
5
+ import { chevre } from '../../../lib/index';
6
+
7
+ // const project = { id: <string>process.env.PROJECT_ID };
8
+
9
+ async function main() {
10
+ await mongoose.connect(<string>process.env.MONGOLAB_URI);
11
+ const client = redis.createClient({
12
+ host: process.env.REDIS_HOST,
13
+ port: Number(process.env.REDIS_PORT),
14
+ password: process.env.REDIS_KEY
15
+ });
16
+
17
+ // const now = new Date();
18
+ await chevre.service.aggregation.event.aggregateScreeningEvent({
19
+ id: 'alb35u7m4'
20
+ })({
21
+ event: new chevre.repository.Event(mongoose.connection),
22
+ eventAvailability: new chevre.repository.itemAvailability.ScreeningEvent(client),
23
+ offer: new chevre.repository.Offer(mongoose.connection),
24
+ offerRateLimit: new chevre.repository.rateLimit.Offer(client),
25
+ place: new chevre.repository.Place(mongoose.connection),
26
+ product: new chevre.repository.Product(mongoose.connection),
27
+ project: new chevre.repository.Project(mongoose.connection),
28
+ reservation: new chevre.repository.Reservation(mongoose.connection),
29
+ task: new chevre.repository.Task(mongoose.connection)
30
+ });
31
+ }
32
+
33
+ main()
34
+ .then(() => {
35
+ console.log('success!');
36
+ })
37
+ .catch(console.error);
@@ -14,6 +14,7 @@ async function main() {
14
14
  const categoryCodeRepo = new chevre.repository.CategoryCode(mongoose.connection);
15
15
  const eventRepo = new chevre.repository.Event(mongoose.connection);
16
16
  const placeRepo = new chevre.repository.Place(mongoose.connection);
17
+ const sellerRepo = new chevre.repository.Seller(mongoose.connection);
17
18
 
18
19
  await chevre.service.event.importFromCOA({
19
20
  project: {
@@ -28,7 +29,13 @@ async function main() {
28
29
  .toDate(),
29
30
  saveMovieTheater: false,
30
31
  saveScreeningEventSeries: false
31
- })({ action: actionRepo, categoryCode: categoryCodeRepo, event: eventRepo, place: placeRepo });
32
+ })({
33
+ action: actionRepo,
34
+ categoryCode: categoryCodeRepo,
35
+ event: eventRepo,
36
+ place: placeRepo,
37
+ seller: sellerRepo
38
+ });
32
39
  console.log('imported');
33
40
  }
34
41
 
@@ -0,0 +1,77 @@
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
+ const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
9
+
10
+ // tslint:disable-next-line:max-func-body-length
11
+ async function main() {
12
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
13
+
14
+ const productRepo = new chevre.repository.Product(mongoose.connection);
15
+
16
+ const cursor = productRepo.getCursor(
17
+ {
18
+ // 'project.id': { $eq: project.id },
19
+ 'project.id': { $ne: EXCLUDED_PROJECT_ID },
20
+ typeOf: { $eq: chevre.factory.service.paymentService.PaymentServiceType.CreditCard }
21
+ },
22
+ {
23
+ // _id: 1,
24
+ }
25
+ );
26
+ console.log('products found');
27
+
28
+ let i = 0;
29
+ let updateCount = 0;
30
+ // tslint:disable-next-line:max-func-body-length
31
+ await cursor.eachAsync(async (doc) => {
32
+ i += 1;
33
+ const paymentService: chevre.factory.service.paymentService.IService = doc.toObject();
34
+
35
+ const hasPaymentUrlExpiresInseconds = paymentService.provider?.some((provider) => {
36
+ return typeof (<any>provider).credentials?.paymentUrlExpiresInSeconds === 'number';
37
+ });
38
+
39
+ if (!hasPaymentUrlExpiresInseconds) {
40
+ console.log(
41
+ 'no expiresInSeconds', paymentService.project.id, paymentService.id, paymentService.productID, i);
42
+
43
+ return;
44
+ }
45
+
46
+ const alreadyMigrated = paymentService.provider?.filter((provider) => {
47
+ return typeof (<any>provider).credentials?.paymentUrlExpiresInSeconds === 'number';
48
+ })
49
+ .every((provider) => {
50
+ return typeof provider.credentials?.paymentUrl?.expiresInSeconds === 'number';
51
+ });
52
+
53
+ if (alreadyMigrated) {
54
+ console.log(
55
+ 'already exist...', paymentService.project.id, paymentService.id, paymentService.productID, i);
56
+ } else {
57
+ console.log(
58
+ 'updating product...', paymentService.project.id, paymentService.id, paymentService.productID, i);
59
+ // await eventRepo.updatePartiallyById({
60
+ // id: event.id,
61
+ // attributes: <any>{
62
+ // typeOf: event.typeOf,
63
+ // 'offers.itemOffered.availableChannel': newAvailableChannel
64
+ // }
65
+ // });
66
+ updateCount += 1;
67
+ console.log(
68
+ 'updated...', paymentService.project.id, paymentService.id, paymentService.productID, i);
69
+ }
70
+ });
71
+ console.log(i, 'products checked');
72
+ console.log(updateCount, 'products updated');
73
+ }
74
+
75
+ main()
76
+ .then()
77
+ .catch(console.error);
@@ -52,4 +52,5 @@ export declare class MongoRepository {
52
52
  id: string;
53
53
  };
54
54
  }): Promise<void>;
55
+ getCursor(conditions: any, projection: any): import("mongoose").QueryCursor<any>;
55
56
  }
@@ -251,5 +251,10 @@ class MongoRepository {
251
251
  .exec();
252
252
  });
253
253
  }
254
+ getCursor(conditions, projection) {
255
+ return this.productModel.find(conditions, projection)
256
+ .sort({ productID: factory.sortType.Ascending })
257
+ .cursor();
258
+ }
254
259
  }
255
260
  exports.MongoRepository = MongoRepository;
@@ -70,4 +70,7 @@ export declare function createPotentialActions(params: factory.assetTransaction.
70
70
  transaction: factory.assetTransaction.ITransaction<factory.assetTransactionType.Reserve>;
71
71
  order?: factory.order.IOrder;
72
72
  }): factory.assetTransaction.reserve.IPotentialActions;
73
+ export declare function createPendingReservationAction(params: {
74
+ transaction: factory.assetTransaction.ITransaction<factory.assetTransactionType.Reserve>;
75
+ }): factory.action.cancel.reservation.IAttributes[];
73
76
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createPotentialActions = exports.createReservation = exports.createReservationFor = exports.createAdditionalTicketText = exports.createAdditionalProperty = exports.validateAppliesToMovieTicket = exports.createReservedTicket = exports.createPointAward = exports.createStartParams = void 0;
3
+ exports.createPendingReservationAction = exports.createPotentialActions = exports.createReservation = exports.createReservationFor = exports.createAdditionalTicketText = exports.createAdditionalProperty = exports.validateAppliesToMovieTicket = exports.createReservedTicket = exports.createPointAward = exports.createStartParams = void 0;
4
4
  /**
5
5
  * 予約取引ファクトリー
6
6
  */
@@ -550,3 +550,31 @@ function createMoneyTransferActions(params) {
550
550
  }
551
551
  return moneyTransfer;
552
552
  }
553
+ function createPendingReservationAction(params) {
554
+ const transaction = params.transaction;
555
+ const pendingReservations = (Array.isArray(transaction.object.subReservation)) ? transaction.object.subReservation : [];
556
+ let cancelActionAttributes = [];
557
+ if (pendingReservations.length > 0) {
558
+ const reservationFor = transaction.object.reservationFor;
559
+ if (reservationFor === undefined) {
560
+ throw new factory.errors.NotFound('transaction.object.reservationFor');
561
+ }
562
+ // ReservationPackageに対応(2022-12-23~)
563
+ const reservationPackage = {
564
+ typeOf: factory.reservationType.ReservationPackage,
565
+ reservationNumber: transaction.transactionNumber,
566
+ reservationFor: { typeOf: reservationFor.typeOf, id: String(reservationFor.id) },
567
+ reservationStatus: pendingReservations[0].reservationStatus
568
+ };
569
+ cancelActionAttributes = [{
570
+ project: transaction.project,
571
+ typeOf: factory.actionType.CancelAction,
572
+ purpose: { typeOf: transaction.typeOf, id: transaction.id },
573
+ agent: transaction.project,
574
+ object: reservationPackage,
575
+ potentialActions: {}
576
+ }];
577
+ }
578
+ return cancelActionAttributes;
579
+ }
580
+ exports.createPendingReservationAction = createPendingReservationAction;
@@ -54,10 +54,14 @@ export declare type ITaskAndTransactionOperation<T> = (repos: {
54
54
  task: TaskRepo;
55
55
  assetTransaction: AssetTransactionRepo;
56
56
  }) => Promise<T>;
57
- export declare type IConfirmOperation<T> = (repos: {
57
+ interface IConfirmRepo {
58
+ action: ActionRepo;
58
59
  assetTransaction: AssetTransactionRepo;
59
60
  order: OrderRepo;
60
- }) => Promise<T>;
61
+ reservation: ReservationRepo;
62
+ task: TaskRepo;
63
+ }
64
+ export declare type IConfirmOperation<T> = (repos: IConfirmRepo) => Promise<T>;
61
65
  /**
62
66
  * 取引開始
63
67
  */
@@ -81,3 +85,4 @@ export declare function cancel(params: {
81
85
  export declare function exportTasksById(params: {
82
86
  id: string;
83
87
  }): ITaskAndTransactionOperation<factory.task.ITask<factory.taskName>[]>;
88
+ export {};
@@ -18,6 +18,7 @@ const pecorinoapi = require("../../pecorinoapi");
18
18
  const factory = require("../../factory");
19
19
  const OfferService = require("../offer");
20
20
  const cancelReservation_1 = require("../reserve/cancelReservation");
21
+ const confirmReservation_1 = require("../reserve/confirmReservation");
21
22
  const settings_1 = require("../../settings");
22
23
  const factory_1 = require("./reserve/factory");
23
24
  /**
@@ -571,8 +572,14 @@ function confirm(params) {
571
572
  typeOf: factory.assetTransactionType.Reserve,
572
573
  id: transaction.id,
573
574
  result: result,
574
- potentialActions: potentialActions
575
+ potentialActions: (settings_1.USE_ASSET_TRANSACTION_SYNC_PROCESSING)
576
+ ? { reserve: [] }
577
+ : potentialActions
575
578
  });
579
+ if (settings_1.USE_ASSET_TRANSACTION_SYNC_PROCESSING) {
580
+ // sync対応(2023-01-13~)
581
+ yield (0, confirmReservation_1.confirmReservation)(potentialActions.reserve)(repos);
582
+ }
576
583
  });
577
584
  }
578
585
  exports.confirm = confirm;
@@ -614,34 +621,9 @@ function cancel(params) {
614
621
  });
615
622
  // 本来非同期でタスクが実行されるが、同期的に仮予約取消が実行されていないと、サービス利用側が困る可能性があるので、
616
623
  // 同期的にもcancelPendingReservationを実行しておく
617
- try {
618
- const pendingReservations = (Array.isArray(transaction.object.subReservation)) ? transaction.object.subReservation : [];
619
- let cancelActionAttributes = [];
620
- if (pendingReservations.length > 0) {
621
- const reservationFor = transaction.object.reservationFor;
622
- if (reservationFor === undefined) {
623
- throw new factory.errors.NotFound('transaction.object.reservationFor');
624
- }
625
- // ReservationPackageに対応(2022-12-23~)
626
- const reservationPackage = {
627
- typeOf: factory.reservationType.ReservationPackage,
628
- reservationNumber: transaction.transactionNumber,
629
- reservationFor: { typeOf: reservationFor.typeOf, id: String(reservationFor.id) },
630
- reservationStatus: pendingReservations[0].reservationStatus
631
- };
632
- cancelActionAttributes = [{
633
- project: transaction.project,
634
- typeOf: factory.actionType.CancelAction,
635
- purpose: { typeOf: transaction.typeOf, id: transaction.id },
636
- agent: transaction.project,
637
- object: reservationPackage,
638
- potentialActions: {}
639
- }];
640
- yield (0, cancelReservation_1.cancelPendingReservation)(cancelActionAttributes)(repos);
641
- }
642
- }
643
- catch (error) {
644
- // no op
624
+ const cancelActionAttributes = (0, factory_1.createPendingReservationAction)({ transaction });
625
+ if (cancelActionAttributes.length > 0) {
626
+ yield (0, cancelReservation_1.cancelPendingReservation)(cancelActionAttributes)(repos);
645
627
  }
646
628
  });
647
629
  }
@@ -704,29 +686,29 @@ function exportTasksById(params) {
704
686
  }
705
687
  break;
706
688
  case factory.transactionStatusType.Canceled:
707
- case factory.transactionStatusType.Expired:
708
- const pendingReservations = (Array.isArray(transaction.object.subReservation)) ? transaction.object.subReservation : [];
709
- let cancelActionAttributes = [];
710
- if (pendingReservations.length > 0) {
711
- const reservationFor = transaction.object.reservationFor;
712
- if (reservationFor === undefined) {
713
- throw new factory.errors.NotFound('transaction.object.reservationFor');
714
- }
715
- // ReservationPackageに対応(2022-12-23~)
716
- const reservationPackage = {
717
- typeOf: factory.reservationType.ReservationPackage,
718
- reservationNumber: transaction.transactionNumber,
719
- reservationFor: { typeOf: reservationFor.typeOf, id: String(reservationFor.id) },
720
- reservationStatus: pendingReservations[0].reservationStatus
721
- };
722
- cancelActionAttributes = [{
689
+ // sync対応(2023-01-13~)
690
+ if (!settings_1.USE_ASSET_TRANSACTION_SYNC_PROCESSING) {
691
+ const cancelActionAttributes4canceled = (0, factory_1.createPendingReservationAction)({ transaction });
692
+ if (cancelActionAttributes4canceled.length > 0) {
693
+ const cancelPendingReservationTask = {
723
694
  project: transaction.project,
724
- typeOf: factory.actionType.CancelAction,
725
- purpose: { typeOf: transaction.typeOf, id: transaction.id },
726
- agent: transaction.project,
727
- object: reservationPackage,
728
- potentialActions: {}
729
- }];
695
+ name: factory.taskName.CancelPendingReservation,
696
+ status: factory.taskStatus.Ready,
697
+ runsAt: new Date(),
698
+ remainingNumberOfTries: 10,
699
+ numberOfTried: 0,
700
+ executionResults: [],
701
+ data: {
702
+ actionAttributes: cancelActionAttributes4canceled
703
+ }
704
+ };
705
+ taskAttributes.push(cancelPendingReservationTask);
706
+ }
707
+ }
708
+ break;
709
+ case factory.transactionStatusType.Expired:
710
+ const cancelActionAttributes = (0, factory_1.createPendingReservationAction)({ transaction });
711
+ if (cancelActionAttributes.length > 0) {
730
712
  const cancelPendingReservationTask = {
731
713
  project: transaction.project,
732
714
  name: factory.taskName.CancelPendingReservation,
@@ -3,6 +3,7 @@ import { MongoRepository as CategoryCodeRepo } from '../repo/categoryCode';
3
3
  import { MongoRepository as EventRepo } from '../repo/event';
4
4
  import { MongoRepository as PlaceRepo } from '../repo/place';
5
5
  import { MongoRepository as ProjectRepo } from '../repo/project';
6
+ import { MongoRepository as SellerRepo } from '../repo/seller';
6
7
  import { MongoRepository as TaskRepo } from '../repo/task';
7
8
  import * as factory from '../factory';
8
9
  /**
@@ -32,6 +33,7 @@ export declare function importFromCOA(params: {
32
33
  categoryCode: CategoryCodeRepo;
33
34
  event: EventRepo;
34
35
  place: PlaceRepo;
36
+ seller: SellerRepo;
35
37
  }) => Promise<void>;
36
38
  /**
37
39
  * COA情報からイベントIDを作成する
@@ -89,8 +89,18 @@ function importFromCOA(params) {
89
89
  endpoint: credentials_1.credentials.coa.endpoint,
90
90
  auth: coaAuthClient
91
91
  }, { timeout: credentials_1.credentials.coa.timeout });
92
+ // 同ブランチコードの販売者を検索する
93
+ const sellersWithSameBranchCode = yield repos.seller.search({
94
+ limit: 1,
95
+ page: 1,
96
+ branchCode: { $eq: params.locationBranchCode }
97
+ });
98
+ const seller = sellersWithSameBranchCode.shift();
99
+ if (typeof (seller === null || seller === void 0 ? void 0 : seller.id) !== 'string') {
100
+ throw new factory.errors.NotFound('Seller', `Seller with branchCod '${params.locationBranchCode}' not found`);
101
+ }
92
102
  // 施設取得
93
- let movieTheater = createMovieTheaterFromCOA(project, yield masterService.theater({ theaterCode: params.locationBranchCode }), yield masterService.screen({ theaterCode: params.locationBranchCode }));
103
+ let movieTheater = createMovieTheaterFromCOA(project, { id: seller.id }, yield masterService.theater({ theaterCode: params.locationBranchCode }), yield masterService.screen({ theaterCode: params.locationBranchCode }));
94
104
  // saveMovieTheater:trueの場合のみ、施設保管(2022-10-10~)
95
105
  if (params.saveMovieTheater === true) {
96
106
  movieTheater = yield repos.place.saveMovieTheaterByBranchCode4coa(movieTheater);
@@ -539,11 +549,12 @@ function createScreeningEventSeriesFromCOA(params) {
539
549
  kanaName: params.movieTheater.kanaName,
540
550
  typeOf: params.movieTheater.typeOf
541
551
  },
542
- organizer: {
543
- typeOf: factory.organizationType.Corporation,
544
- identifier: params.movieTheater.id,
545
- name: params.movieTheater.name
546
- },
552
+ // 不要なので廃止(2023-01-12~)
553
+ // organizer: {
554
+ // typeOf: factory.organizationType.Corporation,
555
+ // identifier: params.movieTheater.id,
556
+ // name: params.movieTheater.name
557
+ // },
547
558
  videoFormat: params.eizouKubuns.filter((kubun) => kubun.kubunCode === params.filmFromCOA.kbnEizou)[0],
548
559
  soundFormat: [],
549
560
  workPerformed: {
@@ -617,7 +628,7 @@ function createScreeningEventSeriesId(params) {
617
628
  */
618
629
  // tslint:disable-next-line:no-single-line-block-comment
619
630
  /* istanbul ignore next */
620
- function createMovieTheaterFromCOA(project, theaterFromCOA, screensFromCOA) {
631
+ function createMovieTheaterFromCOA(project, seller, theaterFromCOA, screensFromCOA) {
621
632
  const id = `MovieTheater-${theaterFromCOA.theaterCode}`;
622
633
  return {
623
634
  project: { typeOf: project.typeOf, id: project.id },
@@ -663,7 +674,8 @@ function createMovieTheaterFromCOA(project, theaterFromCOA, screensFromCOA) {
663
674
  value: 2678400,
664
675
  unitCode: factory.unitCode.Sec
665
676
  }
666
- }
677
+ },
678
+ parentOrganization: { id: seller.id, typeOf: factory.organizationType.Corporation }
667
679
  };
668
680
  }
669
681
  /**
@@ -37,7 +37,6 @@ function cancel(params) {
37
37
  const transactionNumber = (_a = action.object.pendingTransaction) === null || _a === void 0 ? void 0 : _a.transactionNumber;
38
38
  if (typeof transactionNumber === 'string') {
39
39
  // すでに取消済であったとしても、すべて取消処理(actionStatusに関係なく)
40
- // await repos.reserveTransaction.cancel({ transactionNumber: action.object.pendingTransaction?.transactionNumber });
41
40
  yield ReserveTransactionService.cancel({ transactionNumber })(repos);
42
41
  }
43
42
  }
@@ -39,10 +39,6 @@ function searchTransportationEventTicketOffers(params) {
39
39
  throw new factory.errors.NotFound('event.offers.itemOffered.id');
40
40
  }
41
41
  const { soundFormatChargeSpecifications, videoFormatChargeSpecifications, movieTicketTypeChargeSpecs } = yield searchPriceSpecs4event({ project: { id: screeningEvent.project.id }, soundFormatTypes, videoFormatTypes })(repos);
42
- const screeningEventOfferSettings = screeningEvent.offers;
43
- if (screeningEventOfferSettings === undefined) {
44
- throw new factory.errors.NotFound('event.offers');
45
- }
46
42
  const unacceptedPaymentMethod = getUnacceptedPaymentMethodByEvent({ event: screeningEvent });
47
43
  // 不許可決済方法があれば、該当オファーを除外
48
44
  if (Array.isArray(unacceptedPaymentMethod) && unacceptedPaymentMethod.length > 0) {
@@ -94,7 +90,7 @@ function searchTransportationEventTicketOffers(params) {
94
90
  });
95
91
  let offers4event = availableOffers.map((availableOffer) => {
96
92
  return (0, factory_1.createCompoundPriceSpec4event)({
97
- eligibleQuantity: screeningEventOfferSettings.eligibleQuantity,
93
+ eligibleQuantity: eventOffers.eligibleQuantity,
98
94
  offer: availableOffer,
99
95
  videoFormatChargeSpecifications,
100
96
  soundFormatChargeSpecifications,
@@ -114,8 +114,6 @@ function processVoidTransaction4chevre(params) {
114
114
  transactionNumber: { $eq: transactionNumber }
115
115
  });
116
116
  if (assetTransactions.length > 0) {
117
- // 予約取引サービスで中止
118
- // await repos.reserveTransaction.cancel({ transactionNumber });
119
117
  yield ReserveTransactionService.cancel({ transactionNumber })(repos);
120
118
  }
121
119
  }
@@ -3,6 +3,8 @@ import * as factory from '../../factory';
3
3
  import { MongoRepository as ActionRepo } from '../../repo/action';
4
4
  import { MongoRepository as AssetTransactionRepo } from '../../repo/assetTransaction';
5
5
  import { MongoRepository as OrderRepo } from '../../repo/order';
6
+ import { MongoRepository as ReservationRepo } from '../../repo/reservation';
7
+ import { MongoRepository as TaskRepo } from '../../repo/task';
6
8
  /**
7
9
  * タスク実行関数
8
10
  */
@@ -14,4 +16,6 @@ export declare function confirmReserveTransaction(params: factory.action.interac
14
16
  action: ActionRepo;
15
17
  assetTransaction: AssetTransactionRepo;
16
18
  order: OrderRepo;
19
+ reservation: ReservationRepo;
20
+ task: TaskRepo;
17
21
  }) => Promise<void>;
@@ -15,6 +15,8 @@ const factory = require("../../factory");
15
15
  const action_1 = require("../../repo/action");
16
16
  const assetTransaction_1 = require("../../repo/assetTransaction");
17
17
  const order_1 = require("../../repo/order");
18
+ const reservation_1 = require("../../repo/reservation");
19
+ const task_1 = require("../../repo/task");
18
20
  const ReserveTransactionService = require("../assetTransaction/reserve");
19
21
  const credentials_1 = require("../../credentials");
20
22
  const coaAuthClient = new COA.auth.RefreshToken({
@@ -29,7 +31,9 @@ function call(data) {
29
31
  yield confirmReserveTransaction(data)({
30
32
  action: new action_1.MongoRepository(settings.connection),
31
33
  assetTransaction: new assetTransaction_1.MongoRepository(settings.connection),
32
- order: new order_1.MongoRepository(settings.connection)
34
+ order: new order_1.MongoRepository(settings.connection),
35
+ reservation: new reservation_1.MongoRepository(settings.connection),
36
+ task: new task_1.MongoRepository(settings.connection)
33
37
  });
34
38
  });
35
39
  }
@@ -44,9 +48,6 @@ function confirmReserveTransaction(params) {
44
48
  const action = yield repos.action.start(confirmActionAttributes);
45
49
  try {
46
50
  let object = confirmActionAttributes.object;
47
- // if (params.instrument === undefined) {
48
- // params.instrument = { typeOf: 'WebAPI', identifier: factory.service.webAPI.Identifier.Chevre };
49
- // }
50
51
  switch (params.instrument.identifier) {
51
52
  case factory.service.webAPI.Identifier.COA:
52
53
  // COA本予約
@@ -72,7 +73,6 @@ function confirmReserveTransaction(params) {
72
73
  object = object;
73
74
  yield ReserveTransactionService.confirm({
74
75
  transactionNumber: object.transactionNumber,
75
- // object: object.object,
76
76
  potentialActions: object.potentialActions
77
77
  })(repos);
78
78
  }
@@ -14,6 +14,7 @@ const action_1 = require("../../repo/action");
14
14
  const categoryCode_1 = require("../../repo/categoryCode");
15
15
  const event_1 = require("../../repo/event");
16
16
  const place_1 = require("../../repo/place");
17
+ const seller_1 = require("../../repo/seller");
17
18
  const EventService = require("../event");
18
19
  /**
19
20
  * タスク実行関数
@@ -24,7 +25,8 @@ function call(data) {
24
25
  action: new action_1.MongoRepository(settings.connection),
25
26
  categoryCode: new categoryCode_1.MongoRepository(settings.connection),
26
27
  event: new event_1.MongoRepository(settings.connection),
27
- place: new place_1.MongoRepository(settings.connection)
28
+ place: new place_1.MongoRepository(settings.connection),
29
+ seller: new seller_1.MongoRepository(settings.connection)
28
30
  });
29
31
  });
30
32
  }
@@ -23,6 +23,7 @@ export declare type ISettings = factory.project.ISettings & {
23
23
  maxNumCreditCardPaymentMethod?: number;
24
24
  };
25
25
  export declare const DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD: string;
26
+ export declare const USE_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
26
27
  /**
27
28
  * グローバル設定
28
29
  */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.settings = 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;
3
+ exports.settings = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = 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 factory = require("./factory");
5
5
  const transactionWebhookUrls = (typeof process.env.INFORM_TRANSACTION_URL === 'string')
6
6
  ? process.env.INFORM_TRANSACTION_URL.split(',')
@@ -46,6 +46,7 @@ exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = 365;
46
46
  exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = 7;
47
47
  exports.DEFAULT_SENDER_EMAIL = process.env.DEFAULT_SENDER_EMAIL;
48
48
  exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = String(process.env.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD);
49
+ exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = process.env.USE_ASSET_TRANSACTION_SYNC_PROCESSING === '1';
49
50
  /**
50
51
  * グローバル設定
51
52
  */
package/package.json CHANGED
@@ -9,8 +9,8 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.281.0-alpha.6",
13
- "@cinerino/sdk": "3.135.0-alpha.7",
12
+ "@chevre/factory": "4.281.0",
13
+ "@cinerino/sdk": "3.135.0",
14
14
  "@motionpicture/coa-service": "9.2.0",
15
15
  "@motionpicture/gmo-service": "5.2.0",
16
16
  "@sendgrid/mail": "6.4.0",
@@ -120,5 +120,5 @@
120
120
  "postversion": "git push origin --tags",
121
121
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
122
122
  },
123
- "version": "20.2.0-alpha.12"
123
+ "version": "20.2.0-alpha.14"
124
124
  }
@@ -1,162 +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
- const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
9
-
10
- // tslint:disable-next-line:max-func-body-length
11
- async function main() {
12
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
13
-
14
- const placeRepo = new chevre.repository.Place(mongoose.connection);
15
-
16
- const cursor = placeRepo.getCursor(
17
- {
18
- // 'project.id': { $eq: project.id },
19
- 'project.id': { $ne: EXCLUDED_PROJECT_ID }
20
- // typeOf: { $eq: chevre.factory.eventType.ScreeningEventSeries },
21
- // starDate: { $gte: new Date() }
22
- // _id: { $eq: 'al6aff83w' }
23
- },
24
- {
25
- // _id: 1,
26
- }
27
- );
28
- console.log('creativeWorks found');
29
-
30
- const additionalPropertyNames: string[] = [];
31
- const additionalPropertyNamesOnSections: string[] = [];
32
- const additionalPropertyNamesOnSeats: string[] = [];
33
- const projectIds: string[] = [];
34
- const unexpextedprojectIds: string[] = [];
35
- const projectIdsOnSections: string[] = [];
36
- const unexpextedprojectIdsOnSections: string[] = [];
37
- const projectIdsOnSeats: string[] = [];
38
- const unexpextedprojectIdsOnSeats: string[] = [];
39
-
40
- let i = 0;
41
- let updateCount = 0;
42
- // tslint:disable-next-line:max-func-body-length
43
- await cursor.eachAsync(async (doc) => {
44
- i += 1;
45
- const movieTheater: chevre.factory.place.movieTheater.IPlace = doc.toObject();
46
-
47
- if (Array.isArray(movieTheater.containsPlace)) {
48
- movieTheater.containsPlace.forEach((screeningRoom) => {
49
- const additionalPropertyNamesOnResource = screeningRoom.additionalProperty?.map((p) => p.name);
50
- console.log(
51
- (Array.isArray(additionalPropertyNamesOnResource)) ? additionalPropertyNamesOnResource.length : 0,
52
- 'additionalPropertyNamesOnResource found',
53
- movieTheater.project.id,
54
- movieTheater.id
55
- );
56
- if (Array.isArray(additionalPropertyNamesOnResource) && additionalPropertyNamesOnResource.length > 0) {
57
- console.log(
58
- additionalPropertyNamesOnResource.length,
59
- 'additionalPropertyNamesOnResource found',
60
- movieTheater.project.id,
61
- movieTheater.id
62
- );
63
- additionalPropertyNames.push(...additionalPropertyNamesOnResource);
64
- projectIds.push(movieTheater.project.id);
65
- additionalPropertyNamesOnResource.forEach((name) => {
66
- if (!name.match(/^[a-zA-Z]*$/)) {
67
- // throw new Error(`not matched ${creativeWork.project.id} ${creativeWork.id}`);
68
- unexpextedprojectIds.push(movieTheater.project.id);
69
- }
70
- // tslint:disable-next-line:no-magic-numbers
71
- if (name.length < 5) {
72
- // throw new Error(`length matched ${creativeWork.project.id} ${creativeWork.id} ${name}`);
73
- unexpextedprojectIds.push(movieTheater.project.id);
74
- }
75
- });
76
- }
77
-
78
- if (Array.isArray(screeningRoom.containsPlace)) {
79
- screeningRoom.containsPlace.forEach((section) => {
80
- const additionalPropertyNamesOnSection = section.additionalProperty?.map((p) => p.name);
81
- console.log(
82
- (Array.isArray(additionalPropertyNamesOnSection)) ? additionalPropertyNamesOnSection.length : 0,
83
- 'additionalPropertyNamesOnSection found',
84
- movieTheater.project.id,
85
- movieTheater.id
86
- );
87
- if (Array.isArray(additionalPropertyNamesOnSection) && additionalPropertyNamesOnSection.length > 0) {
88
- console.log(
89
- additionalPropertyNamesOnSection.length,
90
- 'additionalPropertyNamesOnSection found',
91
- movieTheater.project.id,
92
- movieTheater.id
93
- );
94
- additionalPropertyNamesOnSections.push(...additionalPropertyNamesOnSection);
95
- projectIdsOnSections.push(movieTheater.project.id);
96
- additionalPropertyNamesOnSection.forEach((name) => {
97
- if (!name.match(/^[a-zA-Z]*$/)) {
98
- // throw new Error(`not matched ${creativeWork.project.id} ${creativeWork.id}`);
99
- unexpextedprojectIdsOnSections.push(movieTheater.project.id);
100
- }
101
- // tslint:disable-next-line:no-magic-numbers
102
- if (name.length < 5) {
103
- // throw new Error(`length matched ${creativeWork.project.id} ${creativeWork.id} ${name}`);
104
- unexpextedprojectIdsOnSections.push(movieTheater.project.id);
105
- }
106
- });
107
- }
108
-
109
- if (Array.isArray(section.containsPlace)) {
110
- section.containsPlace.forEach((seat) => {
111
- const additionalPropertyNamesOnSeat = seat.additionalProperty?.map((p) => p.name);
112
- console.log(
113
- (Array.isArray(additionalPropertyNamesOnSeat)) ? additionalPropertyNamesOnSeat.length : 0,
114
- 'additionalPropertyNamesOnSeat found',
115
- movieTheater.project.id,
116
- movieTheater.id
117
- );
118
- if (Array.isArray(additionalPropertyNamesOnSeat) && additionalPropertyNamesOnSeat.length > 0) {
119
- console.log(
120
- additionalPropertyNamesOnSeat.length,
121
- 'additionalPropertyNamesOnSeat found',
122
- movieTheater.project.id,
123
- movieTheater.id
124
- );
125
- additionalPropertyNamesOnSeats.push(...additionalPropertyNamesOnSeat);
126
- projectIdsOnSeats.push(movieTheater.project.id);
127
- additionalPropertyNamesOnSeat.forEach((name) => {
128
- if (!name.match(/^[a-zA-Z]*$/)) {
129
- // throw new Error(`not matched ${creativeWork.project.id} ${creativeWork.id}`);
130
- unexpextedprojectIdsOnSeats.push(movieTheater.project.id);
131
- }
132
- // tslint:disable-next-line:no-magic-numbers
133
- if (name.length < 5) {
134
- // throw new Error(`length matched ${creativeWork.project.id} ${creativeWork.id} ${name}`);
135
- unexpextedprojectIdsOnSeats.push(movieTheater.project.id);
136
- }
137
- });
138
- }
139
-
140
- });
141
- }
142
- });
143
- }
144
- });
145
- }
146
- });
147
- console.log(i, 'places checked');
148
- console.log(updateCount, 'places updated');
149
- console.log([...new Set(additionalPropertyNames)], 'screeningRooms');
150
- console.log([...new Set(projectIds)], 'screeningRooms');
151
- console.log([...new Set(unexpextedprojectIds)], 'screeningRooms');
152
- console.log([...new Set(additionalPropertyNamesOnSections)], 'sections');
153
- console.log([...new Set(projectIdsOnSections)], 'sections');
154
- console.log([...new Set(unexpextedprojectIdsOnSections)], 'sections');
155
- console.log([...new Set(additionalPropertyNamesOnSeats)], 'seats');
156
- console.log([...new Set(projectIdsOnSeats)], 'seats');
157
- console.log([...new Set(unexpextedprojectIdsOnSeats)], 'seats');
158
- }
159
-
160
- main()
161
- .then()
162
- .catch(console.error);