@chevre/domain 21.7.0-alpha.1 → 21.7.0-alpha.11

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.
Files changed (40) hide show
  1. package/example/src/chevre/migrateAuthorizePaymentActionResult.ts +83 -0
  2. package/example/src/chevre/unsetUnnecessaryFields.ts +19 -11
  3. package/lib/chevre/emailMessageBuilder.d.ts +1 -1
  4. package/lib/chevre/repo/action.d.ts +4 -0
  5. package/lib/chevre/repo/action.js +6 -0
  6. package/lib/chevre/repo/event.d.ts +12 -0
  7. package/lib/chevre/repo/event.js +11 -0
  8. package/lib/chevre/repo/mongoose/schemas/offer.d.ts +4 -4
  9. package/lib/chevre/repo/mongoose/schemas/offer.js +5 -6
  10. package/lib/chevre/repo/product.d.ts +1 -1
  11. package/lib/chevre/repo/product.js +1 -0
  12. package/lib/chevre/repo/transaction.d.ts +4 -1
  13. package/lib/chevre/repo/transaction.js +7 -1
  14. package/lib/chevre/service/assetTransaction/pay/factory.d.ts +1 -1
  15. package/lib/chevre/service/assetTransaction/pay/factory.js +49 -27
  16. package/lib/chevre/service/assetTransaction/pay/potentialActions.js +39 -18
  17. package/lib/chevre/service/assetTransaction/refund/factory.js +2 -2
  18. package/lib/chevre/service/order/deleteOrder.d.ts +2 -0
  19. package/lib/chevre/service/order/deleteOrder.js +42 -0
  20. package/lib/chevre/service/order/onOrderStatusChanged.d.ts +1 -0
  21. package/lib/chevre/service/order/onOrderStatusChanged.js +118 -1
  22. package/lib/chevre/service/order/placeOrder.d.ts +1 -2
  23. package/lib/chevre/service/order/placeOrder.js +15 -74
  24. package/lib/chevre/service/payment/any/factory.js +18 -7
  25. package/lib/chevre/service/payment/creditCard.js +3 -1
  26. package/lib/chevre/service/payment/paymentCard.js +6 -2
  27. package/lib/chevre/service/task/deleteTransaction.js +2 -0
  28. package/lib/chevre/service/transaction/deleteTransaction.d.ts +2 -0
  29. package/lib/chevre/service/transaction/moneyTransfer/factory.js +1 -5
  30. package/lib/chevre/service/transaction/moneyTransfer.js +0 -1
  31. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +0 -4
  32. package/lib/chevre/service/transaction/placeOrderInProgress/result.js +11 -9
  33. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +6 -4
  34. package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +6 -20
  35. package/lib/chevre/service/transaction/placeOrderInProgress.js +0 -3
  36. package/lib/chevre/service/transaction/returnOrder.js +0 -1
  37. package/lib/chevre/settings.d.ts +2 -0
  38. package/lib/chevre/settings.js +3 -1
  39. package/package.json +3 -3
  40. package/example/src/chevre/migrateReservationProvider.ts +0 -119
@@ -102,7 +102,6 @@ function confirm(params) {
102
102
  }
103
103
  // 取引に対する全ての承認アクションをマージ
104
104
  const authorizeActions = yield searchAuthorizeActions(params)(repos);
105
- // transaction.object.authorizeActions = authorizeActions;
106
105
  // 注文番号を発行
107
106
  const orderNumber = yield publishOrderNumberIfNotExist({
108
107
  project: { id: transaction.project.id },
@@ -134,8 +133,6 @@ function confirm(params) {
134
133
  yield repos.transaction.confirm({
135
134
  typeOf: transaction.typeOf,
136
135
  id: transaction.id,
137
- // 保管有無を設定化(2023-05-16~)
138
- authorizeActions: [],
139
136
  result: result,
140
137
  potentialActions: potentialActions
141
138
  });
@@ -588,7 +588,6 @@ function confirm(params) {
588
588
  yield repos.transaction.confirm({
589
589
  typeOf: transaction.typeOf,
590
590
  id: transaction.id,
591
- authorizeActions: [],
592
591
  result: result,
593
592
  potentialActions: potentialActions
594
593
  });
@@ -40,6 +40,8 @@ export declare const USE_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
40
40
  export declare const USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
41
41
  export declare const USE_NEW_EVENT_AVAILABILITY_KEY_FROM: moment.Moment;
42
42
  export declare const USE_ADVANCE_BOOKING_REQUIREMENT: boolean;
43
+ export declare const USE_OBJECT_AS_PAY_TRANSACTION_AMOUNT: boolean;
44
+ export declare const USE_DELETE_EVENT_BY_ORDER: boolean;
43
45
  export declare const INFORM_RESERVATION_TASK_DELAY_IN_SECONDS: number;
44
46
  export declare const MONGO_MAX_TIME_MS: number;
45
47
  /**
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.settings = exports.MONGO_MAX_TIME_MS = exports.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS = exports.USE_ADVANCE_BOOKING_REQUIREMENT = exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.ABORTED_TASKS_WITHOUT_REPORT = exports.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS = exports.TRIGGER_WEBHOOK_MAX_RETRY_COUNT = void 0;
3
+ exports.settings = exports.MONGO_MAX_TIME_MS = exports.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS = exports.USE_DELETE_EVENT_BY_ORDER = exports.USE_OBJECT_AS_PAY_TRANSACTION_AMOUNT = exports.USE_ADVANCE_BOOKING_REQUIREMENT = exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.ABORTED_TASKS_WITHOUT_REPORT = exports.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS = exports.TRIGGER_WEBHOOK_MAX_RETRY_COUNT = void 0;
4
4
  const moment = require("moment");
5
5
  const factory = require("./factory");
6
6
  const transactionWebhookUrls = (typeof process.env.INFORM_TRANSACTION_URL === 'string')
@@ -72,6 +72,8 @@ exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = (typeof process.env.USE_NEW_EVENT_
72
72
  // ? process.env.USE_NEW_STOCK_HOLDER_REPO_IDS.split(' ')
73
73
  // : [];
74
74
  exports.USE_ADVANCE_BOOKING_REQUIREMENT = process.env.USE_ADVANCE_BOOKING_REQUIREMENT === '1';
75
+ exports.USE_OBJECT_AS_PAY_TRANSACTION_AMOUNT = process.env.USE_OBJECT_AS_PAY_TRANSACTION_AMOUNT === '1';
76
+ exports.USE_DELETE_EVENT_BY_ORDER = process.env.USE_DELETE_EVENT_BY_ORDER === '1';
75
77
  exports.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS = (typeof process.env.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS === 'string')
76
78
  ? Number(process.env.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS)
77
79
  : 0;
package/package.json CHANGED
@@ -9,8 +9,8 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "^4.325.0-alpha.1",
13
- "@cinerino/sdk": "3.163.0",
12
+ "@chevre/factory": "4.325.0-alpha.5",
13
+ "@cinerino/sdk": "3.164.0",
14
14
  "@motionpicture/coa-service": "9.2.0",
15
15
  "@motionpicture/gmo-service": "5.2.0",
16
16
  "@sendgrid/mail": "6.4.0",
@@ -117,5 +117,5 @@
117
117
  "postversion": "git push origin --tags",
118
118
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
119
119
  },
120
- "version": "21.7.0-alpha.1"
120
+ "version": "21.7.0-alpha.11"
121
121
  }
@@ -1,119 +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 reservationRepo = new chevre.repository.Reservation(mongoose.connection);
15
- const placeRepo = new chevre.repository.Place(mongoose.connection);
16
-
17
- const cursor = reservationRepo.getCursor(
18
- {
19
- typeOf: {
20
- $in: [
21
- chevre.factory.reservationType.EventReservation
22
- ]
23
- },
24
- // bookingTime: {
25
- // $gte: moment('2022-07-01T00:00:00Z')
26
- // .toDate(),
27
- // $lte: moment('2022-03-01T00:00:00Z')
28
- // .toDate()
29
- // },
30
- 'provider.id': { $exists: false }
31
- },
32
- {
33
- _id: 1,
34
- project: 1,
35
- provider: 1,
36
- bookingTime: 1,
37
- reservationFor: 1
38
- }
39
- );
40
- console.log('reservations found');
41
-
42
- let i = 0;
43
- let updateCount = 0;
44
- await cursor.eachAsync(async (doc) => {
45
- i += 1;
46
- const reservation: Pick<
47
- chevre.factory.reservation.IReservation<chevre.factory.reservationType.EventReservation>,
48
- 'id' | 'project' | 'provider' | 'bookingTime' | 'reservationFor'
49
- > = doc.toObject();
50
-
51
- const providerId = reservation.provider?.id;
52
- const alreadyMigrated = typeof providerId === 'string';
53
-
54
- if (alreadyMigrated) {
55
- console.log('already exist...', reservation.project.id, reservation.id, reservation.bookingTime, providerId, i);
56
- } else {
57
- const movieTheaterId: string = reservation.reservationFor.superEvent.location.id;
58
- const movieTheaterBranchCode: string = reservation.reservationFor.superEvent.location.branchCode;
59
- const movieTheaters = <Pick<
60
- chevre.factory.place.movieTheater.IPlaceWithoutScreeningRoom,
61
- 'parentOrganization' | 'branchCode'
62
- >[]>
63
- await placeRepo.searchMovieTheaters(
64
- {
65
- limit: 1,
66
- page: 1,
67
- project: { id: { $eq: reservation.project.id } },
68
- id: { $eq: movieTheaterId }
69
- },
70
- ['parentOrganization', 'branchCode'],
71
- []
72
- );
73
- const movieTheater = movieTheaters.shift();
74
- const sellerId = movieTheater?.parentOrganization?.id;
75
- console.log(
76
- 'movieTheater found',
77
- reservation.project.id, reservation.id, reservation.bookingTime, providerId, 'sellerId:', sellerId,
78
- 'movieTheaterId:', movieTheaterId,
79
- 'movieTheaterBranchCode:', movieTheaterBranchCode,
80
- i
81
- );
82
- if (typeof sellerId !== 'string') {
83
- console.error(
84
- 'movieTheater not found',
85
- reservation.project.id, reservation.id, reservation.bookingTime, providerId, 'sellerId:', sellerId,
86
- 'movieTheaterId:', movieTheaterId,
87
- 'movieTheaterBranchCode:', movieTheaterBranchCode,
88
- i
89
- );
90
- throw new Error('movieTheater not found');
91
-
92
- // return;
93
- }
94
- if (typeof sellerId === 'string') {
95
- const newProvider: chevre.factory.reservation.IProvider = {
96
- id: sellerId,
97
- typeOf: chevre.factory.organizationType.Corporation
98
- };
99
- console.log(
100
- 'updating reservation...', reservation.project.id, reservation.id, reservation.bookingTime, providerId, i, updateCount);
101
- await reservationRepo.updatePartiallyById({
102
- id: reservation.id,
103
- update: <any>{
104
- provider: newProvider
105
- }
106
- });
107
- updateCount += 1;
108
- console.log('updated.', reservation.project.id, reservation.id, reservation.bookingTime, providerId, i, updateCount);
109
- }
110
- }
111
- });
112
-
113
- console.log(i, 'reservations checked');
114
- console.log(updateCount, 'reservations updated');
115
- }
116
-
117
- main()
118
- .then()
119
- .catch(console.error);