@chevre/domain 21.7.0-alpha.9 → 21.8.0-alpha.0

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 (55) hide show
  1. package/example/src/chevre/countDelayedTasks.ts +1 -1
  2. package/example/src/chevre/createDeleteTransactionTasks.ts +108 -0
  3. package/example/src/chevre/createDeleteTransactionTasksIfNotExist.ts +98 -0
  4. package/example/src/chevre/deleteRunsAtPassedCertainPeriod.ts +28 -0
  5. package/example/src/chevre/deleteTasksByName.ts +1 -1
  6. package/example/src/chevre/migrateAuthorizePaymentActionResult.ts +1 -1
  7. package/example/src/chevre/migrateOwnershipInfos2newUserPool.ts +4 -1
  8. package/example/src/chevre/unsetUnnecessaryFields.ts +1 -1
  9. package/lib/chevre/emailMessageBuilder.js +2 -1
  10. package/lib/chevre/repo/assetTransaction.js +22 -23
  11. package/lib/chevre/repo/mongoose/schemas/offer.d.ts +4 -4
  12. package/lib/chevre/repo/mongoose/schemas/offer.js +5 -6
  13. package/lib/chevre/repo/project.d.ts +1 -0
  14. package/lib/chevre/repo/project.js +10 -4
  15. package/lib/chevre/repo/task.d.ts +6 -2
  16. package/lib/chevre/repo/task.js +25 -1
  17. package/lib/chevre/repo/transaction.d.ts +25 -1
  18. package/lib/chevre/repo/transaction.js +6 -1
  19. package/lib/chevre/service/notification.js +13 -6
  20. package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +20 -0
  21. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +242 -1
  22. package/lib/chevre/service/order/onOrderStatusChanged.d.ts +2 -1
  23. package/lib/chevre/service/order/onOrderStatusChanged.js +139 -110
  24. package/lib/chevre/service/order/payOrder.d.ts +23 -0
  25. package/lib/chevre/service/order/payOrder.js +74 -0
  26. package/lib/chevre/service/order/placeOrder.d.ts +1 -3
  27. package/lib/chevre/service/order/placeOrder.js +33 -76
  28. package/lib/chevre/service/order/returnOrder.d.ts +1 -2
  29. package/lib/chevre/service/order/returnOrder.js +15 -97
  30. package/lib/chevre/service/order/sendOrder.d.ts +0 -1
  31. package/lib/chevre/service/order/sendOrder.js +6 -68
  32. package/lib/chevre/service/payment/any/factory.js +3 -2
  33. package/lib/chevre/service/task/confirmPayTransaction.js +56 -0
  34. package/lib/chevre/service/task/confirmRegisterServiceTransaction.d.ts +1 -1
  35. package/lib/chevre/service/task/confirmRegisterServiceTransaction.js +6 -6
  36. package/lib/chevre/service/transaction/moneyTransfer/factory.js +1 -5
  37. package/lib/chevre/service/transaction/moneyTransfer.js +0 -1
  38. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +12 -6
  39. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.d.ts +4 -0
  40. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +92 -88
  41. package/lib/chevre/service/transaction/placeOrderInProgress/result.js +1 -1
  42. package/lib/chevre/service/transaction/placeOrderInProgress.js +0 -2
  43. package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +8 -1
  44. package/lib/chevre/service/transaction/returnOrder/potentialActions.js +7 -4
  45. package/lib/chevre/service/transaction/returnOrder.js +0 -1
  46. package/lib/chevre/settings.d.ts +1 -1
  47. package/lib/chevre/settings.js +2 -2
  48. package/package.json +3 -3
  49. package/example/src/chevre/checkOrderMembershipTasks.ts +0 -127
  50. package/example/src/chevre/transaction/callOrderMembershipServiceTask.ts +0 -65
  51. package/example/src/chevre/transaction/orderMembershipService.ts +0 -105
  52. package/lib/chevre/service/task/orderProgramMembership.d.ts +0 -6
  53. package/lib/chevre/service/task/orderProgramMembership.js +0 -98
  54. package/lib/chevre/service/transaction/orderProgramMembership.d.ts +0 -50
  55. package/lib/chevre/service/transaction/orderProgramMembership.js +0 -349
@@ -11,7 +11,7 @@ export async function main() {
11
11
  const count = await taskRepo.countDelayedTasks({
12
12
  delayInSeconds: 60,
13
13
  name: {
14
- $nin: [chevre.factory.taskName.OrderProgramMembership]
14
+ $nin: [<any>'orderProgramMembership']
15
15
  }
16
16
  });
17
17
  console.log('count:', count);
@@ -0,0 +1,108 @@
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 ONE_YEAR_IN_DAYS = 365;
8
+
9
+ // tslint:disable-next-line:max-func-body-length
10
+ async function main() {
11
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
12
+
13
+ const now = new Date();
14
+ const endDateLt: Date = moment(now)
15
+ // tslint:disable-next-line:no-magic-numbers
16
+ .add(-ONE_YEAR_IN_DAYS, 'days')
17
+ .toDate();
18
+ const startDateLt: Date = moment('2022-01-01T00:00:00Z')
19
+ .toDate();
20
+
21
+ const taskRepo = new chevre.repository.Task(mongoose.connection);
22
+ const transactionRepo = new chevre.repository.Transaction(mongoose.connection);
23
+
24
+ const cursor = transactionRepo.getCursor(
25
+ {
26
+ typeOf: { $eq: chevre.factory.transactionType.PlaceOrder },
27
+ startDate: {
28
+ $lt: startDateLt
29
+ }
30
+ // endDate: {
31
+ // $exists: true,
32
+ // $lt: moment(now)
33
+ // // tslint:disable-next-line:no-magic-numbers
34
+ // .add(-365, 'days')
35
+ // .toDate()
36
+ // }
37
+ },
38
+ {
39
+ _id: 1,
40
+ typeOf: 1,
41
+ project: 1,
42
+ startDate: 1,
43
+ endDate: 1,
44
+ object: 1
45
+ }
46
+ );
47
+ console.log('transactions found');
48
+
49
+ let i = 0;
50
+ let updateCount = 0;
51
+ await cursor.eachAsync(async (doc) => {
52
+ i += 1;
53
+ const transaction: Pick<
54
+ chevre.factory.transaction.placeOrder.ITransaction,
55
+ 'id' | 'project' | 'typeOf' | 'startDate' | 'endDate' | 'object'
56
+ > = doc.toObject();
57
+ console.log('checking...', transaction.project.id, transaction.id, transaction.startDate, transaction.endDate, i);
58
+
59
+ const isEndDateBefore = transaction.endDate !== undefined && moment(transaction.endDate)
60
+ .isBefore(endDateLt);
61
+ if (isEndDateBefore) {
62
+ const runsAt: Date = moment(transaction.endDate)
63
+ .add(ONE_YEAR_IN_DAYS, 'days')
64
+ .toDate();
65
+
66
+ updateCount += 1;
67
+ const deleteTransactionTask: chevre.factory.task.deleteTransaction.IAttributes = {
68
+ project: transaction.project,
69
+ name: chevre.factory.taskName.DeleteTransaction,
70
+ status: chevre.factory.taskStatus.Ready,
71
+ runsAt,
72
+ remainingNumberOfTries: 3,
73
+ numberOfTried: 0,
74
+ executionResults: [],
75
+ data: {
76
+ object: {
77
+ specifyingMethod: chevre.factory.task.deleteTransaction.SpecifyingMethod.Id,
78
+ endDate: transaction.endDate,
79
+ id: transaction.id,
80
+ object: {
81
+ ...(typeof transaction.object.confirmationNumber === 'string')
82
+ ? { confirmationNumber: transaction.object.confirmationNumber }
83
+ : undefined,
84
+ ...(typeof transaction.object.orderNumber === 'string')
85
+ ? { orderNumber: transaction.object.orderNumber }
86
+ : undefined
87
+ },
88
+ project: transaction.project,
89
+ startDate: transaction.startDate,
90
+ typeOf: transaction.typeOf
91
+ }
92
+ }
93
+ };
94
+ console.log(
95
+ 'saving task...',
96
+ deleteTransactionTask, transaction.project.id, transaction.id, transaction.startDate, transaction.endDate, i);
97
+ await taskRepo.saveMany([deleteTransactionTask], { emitImmediately: false });
98
+ console.log('task saved', transaction.project.id, transaction.id, transaction.startDate, transaction.endDate, i);
99
+ }
100
+ });
101
+
102
+ console.log(i, 'transactions checked');
103
+ console.log(updateCount, 'transactions updated');
104
+ }
105
+
106
+ main()
107
+ .then()
108
+ .catch(console.error);
@@ -0,0 +1,98 @@
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 ONE_YEAR_IN_DAYS = 365;
8
+ type IDeletingTransaction = Pick<
9
+ chevre.factory.transaction.placeOrder.ITransaction,
10
+ 'id' | 'project' | 'typeOf' | 'startDate' | 'endDate' | 'object'
11
+ >;
12
+
13
+ async function main() {
14
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
15
+
16
+ const now = new Date();
17
+ const endDateLt: Date = moment(now)
18
+ // tslint:disable-next-line:no-magic-numbers
19
+ .add(-ONE_YEAR_IN_DAYS, 'days')
20
+ .toDate();
21
+
22
+ const taskRepo = new chevre.repository.Task(mongoose.connection);
23
+ const transactionRepo = new chevre.repository.Transaction(mongoose.connection);
24
+
25
+ const deletingTransactions = <IDeletingTransaction[]>await transactionRepo.search<chevre.factory.transactionType.PlaceOrder>(
26
+ {
27
+ limit: 100,
28
+ page: 1,
29
+ sort: { startDate: chevre.factory.sortType.Ascending },
30
+ typeOf: chevre.factory.transactionType.PlaceOrder,
31
+ statuses: [
32
+ chevre.factory.transactionStatusType.Canceled,
33
+ chevre.factory.transactionStatusType.Confirmed,
34
+ chevre.factory.transactionStatusType.Expired
35
+ ],
36
+ endThrough: endDateLt,
37
+ inclusion: ['_id', 'project', 'typeOf', 'startDate', 'endDate', 'object'],
38
+ exclusion: []
39
+ }
40
+ );
41
+
42
+ let i = 0;
43
+ let updateCount = 0;
44
+ for (const deletingTransaction of deletingTransactions) {
45
+ i += 1;
46
+ const transaction: IDeletingTransaction = deletingTransaction;
47
+ console.log('checking...', transaction.project.id, transaction.id, transaction.startDate, transaction.endDate, i);
48
+
49
+ const isEndDateBefore = transaction.endDate !== undefined && moment(transaction.endDate)
50
+ .isBefore(endDateLt);
51
+ if (isEndDateBefore) {
52
+ const runsAt: Date = moment(transaction.endDate)
53
+ .add(ONE_YEAR_IN_DAYS, 'days')
54
+ .toDate();
55
+
56
+ updateCount += 1;
57
+ const deleteTransactionTask: chevre.factory.task.deleteTransaction.IAttributes = {
58
+ project: transaction.project,
59
+ name: chevre.factory.taskName.DeleteTransaction,
60
+ status: chevre.factory.taskStatus.Ready,
61
+ runsAt,
62
+ remainingNumberOfTries: 3,
63
+ numberOfTried: 0,
64
+ executionResults: [],
65
+ data: {
66
+ object: {
67
+ specifyingMethod: chevre.factory.task.deleteTransaction.SpecifyingMethod.Id,
68
+ endDate: transaction.endDate,
69
+ id: transaction.id,
70
+ object: {
71
+ ...(typeof transaction.object.confirmationNumber === 'string')
72
+ ? { confirmationNumber: transaction.object.confirmationNumber }
73
+ : undefined,
74
+ ...(typeof transaction.object.orderNumber === 'string')
75
+ ? { orderNumber: transaction.object.orderNumber }
76
+ : undefined
77
+ },
78
+ project: transaction.project,
79
+ startDate: transaction.startDate,
80
+ typeOf: transaction.typeOf
81
+ }
82
+ }
83
+ };
84
+ console.log(
85
+ 'saving task...',
86
+ deleteTransactionTask.runsAt, transaction.project.id, transaction.id, transaction.startDate, transaction.endDate, i);
87
+ await taskRepo.createDeleteTransactionTaskIfNotExist(deleteTransactionTask, { emitImmediately: false });
88
+ console.log('task saved', transaction.project.id, transaction.id, transaction.startDate, transaction.endDate, i);
89
+ }
90
+ }
91
+
92
+ console.log(i, 'transactions checked');
93
+ console.log(updateCount, 'transactions updated');
94
+ }
95
+
96
+ main()
97
+ .then()
98
+ .catch(console.error);
@@ -0,0 +1,28 @@
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 TASK_STORAGE_PERIOD_IN_DAYS = 365;
8
+
9
+ async function main() {
10
+ const now = new Date();
11
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
12
+
13
+ const taskRepo = new chevre.repository.Task(mongoose.connection);
14
+
15
+ const result = await taskRepo.deleteRunsAtPassedCertainPeriod({
16
+ runsAt: {
17
+ $lt: moment(now)
18
+ .add(-TASK_STORAGE_PERIOD_IN_DAYS, 'days')
19
+ .toDate()
20
+ }
21
+ });
22
+
23
+ console.log('deleted', result);
24
+ }
25
+
26
+ main()
27
+ .then()
28
+ .catch(console.error);
@@ -12,7 +12,7 @@ async function main() {
12
12
  const taskRepo = new chevre.repository.Task(mongoose.connection);
13
13
 
14
14
  const result = await taskRepo.deleteByName({
15
- name: chevre.factory.taskName.OrderProgramMembership,
15
+ name: <any>'orderProgramMembership',
16
16
  status: { $eq: chevre.factory.taskStatus.Ready }
17
17
  // runsAt: {
18
18
  // $gte: moment('2023-05-20T00:00:00Z')
@@ -46,7 +46,7 @@ async function main() {
46
46
  'id' | 'project' | 'result' | 'typeOf' | 'startDate' | 'actionStatus'
47
47
  > = doc.toObject();
48
48
 
49
- const oldPaymentMethodType = action.result?.paymentMethod;
49
+ const oldPaymentMethodType = (<any>action).result?.paymentMethod;
50
50
  const paymentMethodType = action.result?.paymentMethodAsObject?.typeOf;
51
51
  const alreadyMigrated = typeof paymentMethodType === 'string' && oldPaymentMethodType === paymentMethodType;
52
52
 
@@ -3,9 +3,12 @@
3
3
  import * as mongoose from 'mongoose';
4
4
 
5
5
  import { chevre } from '../../../lib/index';
6
- import { ISS_PREFIX, USERPOOL_ID_NEW } from './checkOrderMembershipTasks';
7
6
  import { migrateUser } from './migrateCognitoUser';
8
7
 
8
+ // export const USERPOOL_ID_OLD = String(process.env.USERPOOL_ID_OLD);
9
+ export const USERPOOL_ID_NEW = String(process.env.USERPOOL_ID_NEW);
10
+ export const ISS_PREFIX = 'https://cognito-idp.ap-northeast-1.amazonaws.com/';
11
+
9
12
  const project = { id: String(process.env.PROJECT_ID) };
10
13
  const PRODUCT_TYPE = chevre.factory.product.ProductType.EventService;
11
14
 
@@ -14,7 +14,7 @@ async function main() {
14
14
  let updateResult: any;
15
15
  updateResult = await transactionRepo.unsetUnnecessaryFields({
16
16
  filter: {
17
- 'project.id': { $eq: PROJECT_ID },
17
+ // 'project.id': { $eq: PROJECT_ID },
18
18
  typeOf: { $eq: chevre.factory.transactionType.PlaceOrder },
19
19
  status: { $eq: chevre.factory.transactionStatusType.Confirmed },
20
20
  startDate: {
@@ -115,7 +115,8 @@ function createEmailMessageSender(params) {
115
115
  : (typeof params.order.seller.name === 'string')
116
116
  ? params.order.seller.name
117
117
  : String(params.order.seller.id),
118
- email: (typeof ((_d = (_c = params.email) === null || _c === void 0 ? void 0 : _c.sender) === null || _d === void 0 ? void 0 : _d.email) === 'string')
118
+ // sender.email指定を非推奨化(2023-08-23~)
119
+ email: (settings_1.USE_CUSTOM_SENDER_EMAIL && typeof ((_d = (_c = params.email) === null || _c === void 0 ? void 0 : _c.sender) === null || _d === void 0 ? void 0 : _d.email) === 'string')
119
120
  ? params.email.sender.email
120
121
  : settings_1.DEFAULT_SENDER_EMAIL
121
122
  };
@@ -24,7 +24,7 @@ class MongoRepository {
24
24
  }
25
25
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
26
26
  static CREATE_MONGO_CONDITIONS(params) {
27
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24;
27
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25;
28
28
  const andConditions = [
29
29
  {
30
30
  typeOf: params.typeOf
@@ -97,12 +97,11 @@ class MongoRepository {
97
97
  }
98
98
  const transactionNumberEq = (_c = params.transactionNumber) === null || _c === void 0 ? void 0 : _c.$eq;
99
99
  if (typeof transactionNumberEq === 'string') {
100
- andConditions.push({
101
- transactionNumber: {
102
- $exists: true,
103
- $eq: transactionNumberEq
104
- }
105
- });
100
+ andConditions.push({ transactionNumber: { $exists: true, $eq: transactionNumberEq } });
101
+ }
102
+ const transactionNumberIn = (_d = params.transactionNumber) === null || _d === void 0 ? void 0 : _d.$in;
103
+ if (Array.isArray(transactionNumberIn)) {
104
+ andConditions.push({ transactionNumber: { $exists: true, $in: transactionNumberIn } });
106
105
  }
107
106
  if (Array.isArray(params.tasksExportationStatuses)) {
108
107
  andConditions.push({
@@ -111,7 +110,7 @@ class MongoRepository {
111
110
  }
112
111
  switch (params.typeOf) {
113
112
  case factory.assetTransactionType.Pay:
114
- const objectAccountIdEq = (_e = (_d = params.object) === null || _d === void 0 ? void 0 : _d.accountId) === null || _e === void 0 ? void 0 : _e.$eq;
113
+ const objectAccountIdEq = (_f = (_e = params.object) === null || _e === void 0 ? void 0 : _e.accountId) === null || _f === void 0 ? void 0 : _f.$eq;
115
114
  if (typeof objectAccountIdEq === 'string') {
116
115
  andConditions.push({
117
116
  'object.accountId': {
@@ -122,7 +121,7 @@ class MongoRepository {
122
121
  }
123
122
  break;
124
123
  case factory.assetTransactionType.Refund:
125
- const objectAccountIdEq4refund = (_g = (_f = params.object) === null || _f === void 0 ? void 0 : _f.accountId) === null || _g === void 0 ? void 0 : _g.$eq;
124
+ const objectAccountIdEq4refund = (_h = (_g = params.object) === null || _g === void 0 ? void 0 : _g.accountId) === null || _h === void 0 ? void 0 : _h.$eq;
126
125
  if (typeof objectAccountIdEq4refund === 'string') {
127
126
  andConditions.push({
128
127
  'object.accountId': {
@@ -131,13 +130,13 @@ class MongoRepository {
131
130
  }
132
131
  });
133
132
  }
134
- const objectPaymentMethodIdEq4refund = (_j = (_h = params.object) === null || _h === void 0 ? void 0 : _h.paymentMethodId) === null || _j === void 0 ? void 0 : _j.$eq;
133
+ const objectPaymentMethodIdEq4refund = (_k = (_j = params.object) === null || _j === void 0 ? void 0 : _j.paymentMethodId) === null || _k === void 0 ? void 0 : _k.$eq;
135
134
  if (typeof objectPaymentMethodIdEq4refund === 'string') {
136
135
  andConditions.push({
137
136
  'object.paymentMethodId': { $exists: true, $eq: objectPaymentMethodIdEq4refund }
138
137
  });
139
138
  }
140
- const objectPaymentMethodIdIn4refund = (_l = (_k = params.object) === null || _k === void 0 ? void 0 : _k.paymentMethodId) === null || _l === void 0 ? void 0 : _l.$in;
139
+ const objectPaymentMethodIdIn4refund = (_m = (_l = params.object) === null || _l === void 0 ? void 0 : _l.paymentMethodId) === null || _m === void 0 ? void 0 : _m.$in;
141
140
  if (Array.isArray(objectPaymentMethodIdIn4refund)) {
142
141
  andConditions.push({
143
142
  'object.paymentMethodId': { $exists: true, $in: objectPaymentMethodIdIn4refund }
@@ -145,7 +144,7 @@ class MongoRepository {
145
144
  }
146
145
  break;
147
146
  case factory.assetTransactionType.MoneyTransfer:
148
- const fromLocationIdentifierEq = (_p = (_o = (_m = params.object) === null || _m === void 0 ? void 0 : _m.fromLocation) === null || _o === void 0 ? void 0 : _o.identifier) === null || _p === void 0 ? void 0 : _p.$eq;
147
+ const fromLocationIdentifierEq = (_q = (_p = (_o = params.object) === null || _o === void 0 ? void 0 : _o.fromLocation) === null || _p === void 0 ? void 0 : _p.identifier) === null || _q === void 0 ? void 0 : _q.$eq;
149
148
  if (typeof fromLocationIdentifierEq === 'string') {
150
149
  andConditions.push({
151
150
  'object.fromLocation.identifier': {
@@ -154,7 +153,7 @@ class MongoRepository {
154
153
  }
155
154
  });
156
155
  }
157
- const toLocationIdentifierEq = (_s = (_r = (_q = params.object) === null || _q === void 0 ? void 0 : _q.toLocation) === null || _r === void 0 ? void 0 : _r.identifier) === null || _s === void 0 ? void 0 : _s.$eq;
156
+ const toLocationIdentifierEq = (_t = (_s = (_r = params.object) === null || _r === void 0 ? void 0 : _r.toLocation) === null || _s === void 0 ? void 0 : _s.identifier) === null || _t === void 0 ? void 0 : _t.$eq;
158
157
  if (typeof toLocationIdentifierEq === 'string') {
159
158
  andConditions.push({
160
159
  'object.toLocation.identifier': {
@@ -163,7 +162,7 @@ class MongoRepository {
163
162
  }
164
163
  });
165
164
  }
166
- const pendingTransactionIdentifierEq = (_v = (_u = (_t = params.object) === null || _t === void 0 ? void 0 : _t.pendingTransaction) === null || _u === void 0 ? void 0 : _u.identifier) === null || _v === void 0 ? void 0 : _v.$eq;
165
+ const pendingTransactionIdentifierEq = (_w = (_v = (_u = params.object) === null || _u === void 0 ? void 0 : _u.pendingTransaction) === null || _v === void 0 ? void 0 : _v.identifier) === null || _w === void 0 ? void 0 : _w.$eq;
167
166
  if (typeof pendingTransactionIdentifierEq === 'string') {
168
167
  andConditions.push({
169
168
  'object.pendingTransaction.identifier': {
@@ -176,11 +175,11 @@ class MongoRepository {
176
175
  case factory.assetTransactionType.CancelReservation:
177
176
  break;
178
177
  case factory.assetTransactionType.Reserve:
179
- const objectProviderIdEq = (_y = (_x = (_w = params.object) === null || _w === void 0 ? void 0 : _w.provider) === null || _x === void 0 ? void 0 : _x.id) === null || _y === void 0 ? void 0 : _y.$eq;
178
+ const objectProviderIdEq = (_z = (_y = (_x = params.object) === null || _x === void 0 ? void 0 : _x.provider) === null || _y === void 0 ? void 0 : _y.id) === null || _z === void 0 ? void 0 : _z.$eq;
180
179
  if (typeof objectProviderIdEq === 'string') {
181
180
  andConditions.push({ 'object.provider.id': { $exists: true, $eq: objectProviderIdEq } });
182
181
  }
183
- const objectReservationForIdEq = (_1 = (_0 = (_z = params.object) === null || _z === void 0 ? void 0 : _z.reservationFor) === null || _0 === void 0 ? void 0 : _0.id) === null || _1 === void 0 ? void 0 : _1.$eq;
182
+ const objectReservationForIdEq = (_2 = (_1 = (_0 = params.object) === null || _0 === void 0 ? void 0 : _0.reservationFor) === null || _1 === void 0 ? void 0 : _1.id) === null || _2 === void 0 ? void 0 : _2.$eq;
184
183
  if (typeof objectReservationForIdEq === 'string') {
185
184
  andConditions.push({
186
185
  'object.reservationFor.id': {
@@ -189,7 +188,7 @@ class MongoRepository {
189
188
  }
190
189
  });
191
190
  }
192
- const objectReservationNumberIn = (_3 = (_2 = params.object) === null || _2 === void 0 ? void 0 : _2.reservationNumber) === null || _3 === void 0 ? void 0 : _3.$in;
191
+ const objectReservationNumberIn = (_4 = (_3 = params.object) === null || _3 === void 0 ? void 0 : _3.reservationNumber) === null || _4 === void 0 ? void 0 : _4.$in;
193
192
  if (Array.isArray(objectReservationNumberIn)) {
194
193
  andConditions.push({
195
194
  'object.reservationNumber': {
@@ -198,7 +197,7 @@ class MongoRepository {
198
197
  }
199
198
  });
200
199
  }
201
- const objectReservationNumberEq = (_5 = (_4 = params.object) === null || _4 === void 0 ? void 0 : _4.reservationNumber) === null || _5 === void 0 ? void 0 : _5.$eq;
200
+ const objectReservationNumberEq = (_6 = (_5 = params.object) === null || _5 === void 0 ? void 0 : _5.reservationNumber) === null || _6 === void 0 ? void 0 : _6.$eq;
202
201
  if (typeof objectReservationNumberEq === 'string') {
203
202
  andConditions.push({
204
203
  'object.reservationNumber': {
@@ -207,7 +206,7 @@ class MongoRepository {
207
206
  }
208
207
  });
209
208
  }
210
- const objectSubReservationIdIn = (_8 = (_7 = (_6 = params.object) === null || _6 === void 0 ? void 0 : _6.reservations) === null || _7 === void 0 ? void 0 : _7.id) === null || _8 === void 0 ? void 0 : _8.$in;
209
+ const objectSubReservationIdIn = (_9 = (_8 = (_7 = params.object) === null || _7 === void 0 ? void 0 : _7.reservations) === null || _8 === void 0 ? void 0 : _8.id) === null || _9 === void 0 ? void 0 : _9.$in;
211
210
  if (Array.isArray(objectSubReservationIdIn)) {
212
211
  andConditions.push({
213
212
  'object.subReservation.id': {
@@ -242,7 +241,7 @@ class MongoRepository {
242
241
  }
243
242
  }
244
243
  }
245
- const objectUnderNameIdEq = (_11 = (_10 = (_9 = params.object) === null || _9 === void 0 ? void 0 : _9.underName) === null || _10 === void 0 ? void 0 : _10.id) === null || _11 === void 0 ? void 0 : _11.$eq;
244
+ const objectUnderNameIdEq = (_12 = (_11 = (_10 = params.object) === null || _10 === void 0 ? void 0 : _10.underName) === null || _11 === void 0 ? void 0 : _11.id) === null || _12 === void 0 ? void 0 : _12.$eq;
246
245
  if (typeof objectUnderNameIdEq === 'string') {
247
246
  andConditions.push({
248
247
  'object.underName.id': {
@@ -251,7 +250,7 @@ class MongoRepository {
251
250
  }
252
251
  });
253
252
  }
254
- const objectSubReservationSeatNumberEq = (_16 = (_15 = (_14 = (_13 = (_12 = params.object) === null || _12 === void 0 ? void 0 : _12.reservations) === null || _13 === void 0 ? void 0 : _13.reservedTicket) === null || _14 === void 0 ? void 0 : _14.ticketedSeat) === null || _15 === void 0 ? void 0 : _15.seatNumber) === null || _16 === void 0 ? void 0 : _16.$eq;
253
+ const objectSubReservationSeatNumberEq = (_17 = (_16 = (_15 = (_14 = (_13 = params.object) === null || _13 === void 0 ? void 0 : _13.reservations) === null || _14 === void 0 ? void 0 : _14.reservedTicket) === null || _15 === void 0 ? void 0 : _15.ticketedSeat) === null || _16 === void 0 ? void 0 : _16.seatNumber) === null || _17 === void 0 ? void 0 : _17.$eq;
255
254
  if (typeof objectSubReservationSeatNumberEq === 'string') {
256
255
  andConditions.push({
257
256
  'object.subReservation.reservedTicket.ticketedSeat.seatNumber': {
@@ -262,7 +261,7 @@ class MongoRepository {
262
261
  }
263
262
  break;
264
263
  case factory.assetTransactionType.RegisterService:
265
- const objectItemOfferedServiceOutputIdentifierEq = (_20 = (_19 = (_18 = (_17 = params.object) === null || _17 === void 0 ? void 0 : _17.itemOffered) === null || _18 === void 0 ? void 0 : _18.serviceOutput) === null || _19 === void 0 ? void 0 : _19.identifier) === null || _20 === void 0 ? void 0 : _20.$eq;
264
+ const objectItemOfferedServiceOutputIdentifierEq = (_21 = (_20 = (_19 = (_18 = params.object) === null || _18 === void 0 ? void 0 : _18.itemOffered) === null || _19 === void 0 ? void 0 : _19.serviceOutput) === null || _20 === void 0 ? void 0 : _20.identifier) === null || _21 === void 0 ? void 0 : _21.$eq;
266
265
  if (typeof objectItemOfferedServiceOutputIdentifierEq === 'string') {
267
266
  andConditions.push({
268
267
  'object.itemOffered.serviceOutput.identifier': {
@@ -271,7 +270,7 @@ class MongoRepository {
271
270
  }
272
271
  });
273
272
  }
274
- const objectItemOfferedServiceOutputIdentifierIn = (_24 = (_23 = (_22 = (_21 = params.object) === null || _21 === void 0 ? void 0 : _21.itemOffered) === null || _22 === void 0 ? void 0 : _22.serviceOutput) === null || _23 === void 0 ? void 0 : _23.identifier) === null || _24 === void 0 ? void 0 : _24.$in;
273
+ const objectItemOfferedServiceOutputIdentifierIn = (_25 = (_24 = (_23 = (_22 = params.object) === null || _22 === void 0 ? void 0 : _22.itemOffered) === null || _23 === void 0 ? void 0 : _23.serviceOutput) === null || _24 === void 0 ? void 0 : _24.identifier) === null || _25 === void 0 ? void 0 : _25.$in;
275
274
  if (Array.isArray(objectItemOfferedServiceOutputIdentifierIn)) {
276
275
  andConditions.push({
277
276
  'object.itemOffered.serviceOutput.identifier': {
@@ -25,7 +25,7 @@
25
25
  import { Schema } from 'mongoose';
26
26
  declare const modelName = "Offer";
27
27
  /**
28
- * オファースキーマ
28
+ * 単価オファースキーマ
29
29
  */
30
30
  declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
31
31
  collection: string;
@@ -53,6 +53,7 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
53
53
  }, {
54
54
  additionalProperty: any[];
55
55
  addOn: any[];
56
+ availability: string;
56
57
  availableAtOrFrom: any[];
57
58
  _id?: string | undefined;
58
59
  name?: any;
@@ -68,7 +69,6 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
68
69
  validFrom?: Date | undefined;
69
70
  category?: any;
70
71
  advanceBookingRequirement?: any;
71
- availability?: string | undefined;
72
72
  hasMerchantReturnPolicy?: any;
73
73
  priceSpecification?: any;
74
74
  eligibleCustomerType?: any;
@@ -84,6 +84,7 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
84
84
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
85
85
  additionalProperty: any[];
86
86
  addOn: any[];
87
+ availability: string;
87
88
  availableAtOrFrom: any[];
88
89
  _id?: string | undefined;
89
90
  name?: any;
@@ -99,7 +100,6 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
99
100
  validFrom?: Date | undefined;
100
101
  category?: any;
101
102
  advanceBookingRequirement?: any;
102
- availability?: string | undefined;
103
103
  hasMerchantReturnPolicy?: any;
104
104
  priceSpecification?: any;
105
105
  eligibleCustomerType?: any;
@@ -115,6 +115,7 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
115
115
  }>> & Omit<import("mongoose").FlatRecord<{
116
116
  additionalProperty: any[];
117
117
  addOn: any[];
118
+ availability: string;
118
119
  availableAtOrFrom: any[];
119
120
  _id?: string | undefined;
120
121
  name?: any;
@@ -130,7 +131,6 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
130
131
  validFrom?: Date | undefined;
131
132
  category?: any;
132
133
  advanceBookingRequirement?: any;
133
- availability?: string | undefined;
134
134
  hasMerchantReturnPolicy?: any;
135
135
  priceSpecification?: any;
136
136
  eligibleCustomerType?: any;
@@ -6,7 +6,7 @@ const writeConcern_1 = require("../writeConcern");
6
6
  const modelName = 'Offer';
7
7
  exports.modelName = modelName;
8
8
  /**
9
- * オファースキーマ
9
+ * 単価オファースキーマ
10
10
  */
11
11
  const schema = new mongoose_1.Schema({
12
12
  project: mongoose_1.SchemaTypes.Mixed,
@@ -22,14 +22,13 @@ const schema = new mongoose_1.Schema({
22
22
  alternateName: mongoose_1.SchemaTypes.Mixed,
23
23
  // acceptedPaymentMethod: SchemaTypes.Mixed, // 削除(2023-02-27~)
24
24
  addOn: [mongoose_1.SchemaTypes.Mixed],
25
- // availableAddOn: SchemaTypes.Mixed, // 削除(2023-02-27~)
26
- availability: String,
27
- // availabilityEnds: Date, // 削除(2023-02-27~)
28
- // availabilityStarts: Date, // 削除(2023-02-27~)
25
+ availability: {
26
+ type: String,
27
+ required: true
28
+ },
29
29
  availableAtOrFrom: [mongoose_1.SchemaTypes.Mixed],
30
30
  hasMerchantReturnPolicy: mongoose_1.SchemaTypes.Mixed,
31
31
  itemOffered: mongoose_1.SchemaTypes.Mixed,
32
- // price: Number, // 削除(2023-02-27~)
33
32
  priceCurrency: String,
34
33
  priceSpecification: mongoose_1.SchemaTypes.Mixed,
35
34
  eligibleCustomerType: mongoose_1.SchemaTypes.Mixed,
@@ -50,6 +50,7 @@ export declare class MongoRepository {
50
50
  logo?: string;
51
51
  name?: string;
52
52
  settings?: {
53
+ sendEmailMessage?: factory.project.ISendEmailMessageSettings;
53
54
  sendgridApiKey?: string;
54
55
  };
55
56
  subscription?: {
@@ -142,13 +142,19 @@ class MongoRepository {
142
142
  });
143
143
  }
144
144
  findByIdAndIUpdate(params) {
145
- var _a, _b;
145
+ var _a, _b, _c, _d, _e;
146
146
  return __awaiter(this, void 0, void 0, function* () {
147
- yield this.projectModel.findOneAndUpdate({ _id: params.id }, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ updatedAt: new Date() }, (typeof params.alternateName === 'string' && params.alternateName.length > 0)
147
+ yield this.projectModel.findOneAndUpdate({ _id: params.id }, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ updatedAt: new Date() }, (typeof params.alternateName === 'string' && params.alternateName.length > 0)
148
148
  ? { alternateName: params.alternateName }
149
- : undefined), (typeof params.name === 'string' && params.name.length > 0) ? { name: params.name } : undefined), (typeof params.logo === 'string' && params.logo.length > 0) ? { logo: params.logo } : undefined), (typeof ((_a = params.settings) === null || _a === void 0 ? void 0 : _a.sendgridApiKey) === 'string')
149
+ : undefined), (typeof params.name === 'string' && params.name.length > 0) ? { name: params.name } : undefined), (typeof params.logo === 'string' && params.logo.length > 0) ? { logo: params.logo } : undefined), (typeof ((_c = (_b = (_a = params.settings) === null || _a === void 0 ? void 0 : _a.sendEmailMessage) === null || _b === void 0 ? void 0 : _b.sender) === null || _c === void 0 ? void 0 : _c.email) === 'string')
150
+ ? {
151
+ 'settings.sendEmailMessage': {
152
+ sender: { email: params.settings.sendEmailMessage.sender.email }
153
+ }
154
+ }
155
+ : undefined), (typeof ((_d = params.settings) === null || _d === void 0 ? void 0 : _d.sendgridApiKey) === 'string')
150
156
  ? { 'settings.sendgridApiKey': params.settings.sendgridApiKey }
151
- : undefined), (typeof ((_b = params.subscription) === null || _b === void 0 ? void 0 : _b.useEventServiceAsProduct) === 'boolean')
157
+ : undefined), (typeof ((_e = params.subscription) === null || _e === void 0 ? void 0 : _e.useEventServiceAsProduct) === 'boolean')
152
158
  ? { 'subscription.useEventServiceAsProduct': params.subscription.useEventServiceAsProduct }
153
159
  : undefined), {
154
160
  // ↓customerUserPoolは廃止
@@ -31,6 +31,10 @@ export declare class MongoRepository {
31
31
  id: string;
32
32
  }[]>;
33
33
  createInformTaskIfNotExist(params: factory.task.IAttributes<factory.taskName.TriggerWebhook>, options: IOptionOnCreate): Promise<void>;
34
+ /**
35
+ * 取引削除タスク冪等作成
36
+ */
37
+ createDeleteTransactionTaskIfNotExist(params: factory.task.IAttributes<factory.taskName.DeleteTransaction>, options: IOptionOnCreate): Promise<void>;
34
38
  executeById(params: {
35
39
  id: string;
36
40
  executor: {
@@ -63,7 +67,7 @@ export declare class MongoRepository {
63
67
  */
64
68
  $nin?: factory.taskName[];
65
69
  };
66
- }): Promise<Pick<import("@chevre/factory/lib/task").ITask | import("@chevre/factory/lib/task/confirmMoneyTransfer").ITask | import("@chevre/factory/lib/task/confirmRegisterService").ITask | import("@chevre/factory/lib/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/task/createEvent").ITask | import("@chevre/factory/lib/task/deleteTransaction").ITask | import("@chevre/factory/lib/task/givePointAward").ITask | import("@chevre/factory/lib/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/task/onEventChanged").ITask | import("@chevre/factory/lib/task/onResourceUpdated").ITask | import("@chevre/factory/lib/task/orderProgramMembership").ITask | import("@chevre/factory/lib/task/placeOrder").ITask | import("@chevre/factory/lib/task/returnOrder").ITask | import("@chevre/factory/lib/task/returnMoneyTransfer").ITask | import("@chevre/factory/lib/task/returnPayTransaction").ITask | import("@chevre/factory/lib/task/returnPointAward").ITask | import("@chevre/factory/lib/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/task/sendEmailMessage").ITask | import("@chevre/factory/lib/task/sendOrder").ITask | import("@chevre/factory/lib/task/syncScreeningRooms").ITask | import("@chevre/factory/lib/task/triggerWebhook").ITask | import("@chevre/factory/lib/task/useReservation").ITask | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").ITask | import("@chevre/factory/lib/task/voidPayTransaction").ITask | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/voidReserveTransaction").ITask, "id" | "name" | "status">[]>;
70
+ }): Promise<Pick<import("@chevre/factory/lib/task").ITask | import("@chevre/factory/lib/task/confirmMoneyTransfer").ITask | import("@chevre/factory/lib/task/confirmRegisterService").ITask | import("@chevre/factory/lib/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/task/createEvent").ITask | import("@chevre/factory/lib/task/deleteTransaction").ITask | import("@chevre/factory/lib/task/givePointAward").ITask | import("@chevre/factory/lib/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/task/onEventChanged").ITask | import("@chevre/factory/lib/task/onResourceUpdated").ITask | import("@chevre/factory/lib/task/placeOrder").ITask | import("@chevre/factory/lib/task/returnOrder").ITask | import("@chevre/factory/lib/task/returnMoneyTransfer").ITask | import("@chevre/factory/lib/task/returnPayTransaction").ITask | import("@chevre/factory/lib/task/returnPointAward").ITask | import("@chevre/factory/lib/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/task/sendEmailMessage").ITask | import("@chevre/factory/lib/task/sendOrder").ITask | import("@chevre/factory/lib/task/syncScreeningRooms").ITask | import("@chevre/factory/lib/task/triggerWebhook").ITask | import("@chevre/factory/lib/task/useReservation").ITask | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").ITask | import("@chevre/factory/lib/task/voidPayTransaction").ITask | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/voidReserveTransaction").ITask, "id" | "name" | "status">[]>;
67
71
  retry(params: {
68
72
  intervalInMinutes: number;
69
73
  }): Promise<void>;
@@ -108,7 +112,7 @@ export declare class MongoRepository {
108
112
  runsAt: {
109
113
  $lt: Date;
110
114
  };
111
- }): Promise<void>;
115
+ }): Promise<import("mongodb").DeleteResult>;
112
116
  countDelayedTasks(params: {
113
117
  delayInSeconds: number;
114
118
  name: {