@chevre/domain 24.0.0-alpha.37 → 24.0.0-alpha.39

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.
@@ -130,7 +130,8 @@ export declare class ActionProcessRepo<TAction extends IAction<factory.actionTyp
130
130
  };
131
131
  object?: {
132
132
  typeOf?: {
133
- $eq?: factory.action.authorize.offer.eventService.ObjectType.SeatReservation | factory.action.authorize.paymentMethod.any.ResultType.Payment | factory.offerType.AggregateOffer;
133
+ $eq?: factory.action.authorize.offer.eventService.ObjectType.SeatReservation | factory.action.authorize.paymentMethod.any.ResultType.Payment | factory.action.authorize.offer.eventService.ObjectType.AggregateOffer | factory.offerType.AggregateOffer;
134
+ $in?: (factory.action.authorize.offer.eventService.ObjectType.SeatReservation | factory.action.authorize.offer.eventService.ObjectType.AggregateOffer)[];
134
135
  };
135
136
  paymentMethodId?: {
136
137
  $eq?: string;
@@ -723,6 +723,10 @@ class ActionProcessRepo {
723
723
  if (typeof objectTypeOfEq === 'string') {
724
724
  andConditions.push({ 'object.typeOf': { $exists: true, $eq: objectTypeOfEq } });
725
725
  }
726
+ const objectTypeOfIn = params.object?.typeOf?.$in;
727
+ if (Array.isArray(objectTypeOfIn)) {
728
+ andConditions.push({ 'object.typeOf': { $exists: true, $in: objectTypeOfIn } });
729
+ }
726
730
  if (typeof params.typeOf === 'string') {
727
731
  andConditions.push({ typeOf: { $eq: params.typeOf } });
728
732
  }
@@ -20,6 +20,9 @@ export declare class AuthorizeOfferActionRepo extends ActionProcessRepo<IAuthori
20
20
  */
21
21
  ids: string[];
22
22
  }): Promise<IAuthorizeOfferActionWithInstrument[]>;
23
+ /**
24
+ * 注文取引から興行オファー承認アクションを参照する
25
+ */
23
26
  findAuthorizeOfferActionsByPurpose(params: {
24
27
  /**
25
28
  * 注文取引でフィルター
@@ -35,6 +38,24 @@ export declare class AuthorizeOfferActionRepo extends ActionProcessRepo<IAuthori
35
38
  $eq?: factory.actionStatusType.CompletedActionStatus;
36
39
  };
37
40
  }): Promise<IAuthorizeEventServiceOfferAction[]>;
41
+ /**
42
+ * 注文取引から汎用オファー承認アクションを参照する
43
+ */
44
+ findAuthorizeAnyOfferActionsByPurpose(params: {
45
+ /**
46
+ * 注文取引でフィルター
47
+ */
48
+ purpose: {
49
+ typeOf: factory.transactionType;
50
+ id: string;
51
+ };
52
+ /**
53
+ * アクションステータスでフィルター
54
+ */
55
+ actionStatus?: {
56
+ $eq?: factory.actionStatusType.CompletedActionStatus;
57
+ };
58
+ }): Promise<IAuthorizeOfferAction[]>;
38
59
  /**
39
60
  * アクション再開
40
61
  */
@@ -45,13 +45,16 @@ class AuthorizeOfferActionRepo extends actionProcess_1.ActionProcessRepo {
45
45
  typeOf: {
46
46
  $in: [
47
47
  factory.action.authorize.offer.eventService.ObjectType.SeatReservation,
48
- factory.offerType.AggregateOffer
48
+ factory.action.authorize.offer.eventService.ObjectType.AggregateOffer
49
49
  ]
50
50
  }
51
51
  },
52
52
  id: { $in: params.ids }
53
53
  }, ['instrument']);
54
54
  }
55
+ /**
56
+ * 注文取引から興行オファー承認アクションを参照する
57
+ */
55
58
  async findAuthorizeOfferActionsByPurpose(params) {
56
59
  return this.findAnyActionsByPurpose({
57
60
  ...params,
@@ -63,6 +66,27 @@ class AuthorizeOfferActionRepo extends actionProcess_1.ActionProcessRepo {
63
66
  object: { typeOf: { $eq: factory.action.authorize.offer.eventService.ObjectType.SeatReservation } }
64
67
  });
65
68
  }
69
+ /**
70
+ * 注文取引から汎用オファー承認アクションを参照する
71
+ */
72
+ async findAuthorizeAnyOfferActionsByPurpose(params) {
73
+ return this.findAnyActionsByPurpose({
74
+ ...params,
75
+ typeOf: factory.actionType.AuthorizeAction,
76
+ purpose: {
77
+ typeOf: params.purpose.typeOf,
78
+ id: params.purpose.id
79
+ },
80
+ object: {
81
+ typeOf: {
82
+ $in: [
83
+ factory.action.authorize.offer.eventService.ObjectType.SeatReservation,
84
+ factory.action.authorize.offer.eventService.ObjectType.AggregateOffer
85
+ ]
86
+ }
87
+ }
88
+ });
89
+ }
66
90
  /**
67
91
  * アクション再開
68
92
  */
@@ -40,7 +40,7 @@ class AuthorizeProductOfferActionRepo extends actionProcess_1.ActionProcessRepo
40
40
  ...params,
41
41
  typeOf: factory.actionType.AuthorizeAction,
42
42
  object: {
43
- typeOf: { $eq: factory.offerType.AggregateOffer }
43
+ typeOf: { $eq: factory.action.authorize.offer.eventService.ObjectType.AggregateOffer }
44
44
  }
45
45
  });
46
46
  return authorizeActions.filter((a) =>
@@ -48,7 +48,7 @@ class AuthorizeProductOfferActionRepo extends actionProcess_1.ActionProcessRepo
48
48
  // && a.object.length > 0
49
49
  // // && a.object[0].typeOf === factory.offerType.Offer
50
50
  // && availableProductTypes.indexOf(a.object[0].itemOffered.typeOf) >= 0
51
- a.object.typeOf === factory.offerType.AggregateOffer
51
+ a.object.typeOf === factory.action.authorize.offer.product.ObjectType.AggregateOffer
52
52
  && availableProductTypes_1.availableProductTypes.indexOf(a.object.itemOffered.typeOf) >= 0);
53
53
  }
54
54
  }
@@ -37,7 +37,7 @@ export declare class ActionRepo extends ActionProcessRepo<IAction<StartableActio
37
37
  };
38
38
  object?: {
39
39
  typeOf?: {
40
- $eq?: factory.action.authorize.offer.eventService.ObjectType.SeatReservation | factory.action.authorize.paymentMethod.any.ResultType.Payment | factory.offerType.AggregateOffer;
40
+ $eq?: factory.action.authorize.offer.eventService.ObjectType.SeatReservation | factory.action.authorize.paymentMethod.any.ResultType.Payment | factory.action.authorize.offer.product.ObjectType.AggregateOffer;
41
41
  };
42
42
  paymentMethodId?: {
43
43
  $eq?: string;
@@ -8,6 +8,6 @@ type IModel = Model<IDocType, {}, {}, IVirtuals>;
8
8
  type ISchemaDefinition = SchemaDefinition<IDocType>;
9
9
  type ISchema = Schema<IDocType, IModel, {}, {}, IVirtuals, {}, ISchemaDefinition, IDocType>;
10
10
  declare const modelName = "OwnershipInfo";
11
- declare function createSchema(): ISchema;
12
11
  declare const indexes: [d: IndexDefinition, o: IndexOptions][];
12
+ declare function createSchema(): ISchema;
13
13
  export { createSchema, IDocType, IModel, indexes, modelName };
@@ -8,20 +8,14 @@ const settings_1 = require("../../../settings");
8
8
  const modelName = 'OwnershipInfo';
9
9
  exports.modelName = modelName;
10
10
  const schemaDefinition = {
11
- project: mongoose_1.SchemaTypes.Mixed,
11
+ project: { type: mongoose_1.SchemaTypes.Mixed, required: true },
12
12
  _id: String,
13
- typeOf: {
14
- type: String,
15
- required: true
16
- },
17
- identifier: {
18
- type: String,
19
- required: true
20
- },
13
+ typeOf: { type: String, required: true },
14
+ identifier: { type: String, required: true },
21
15
  ownedBy: mongoose_1.SchemaTypes.Mixed,
22
16
  acquiredFrom: mongoose_1.SchemaTypes.Mixed,
23
- ownedFrom: Date,
24
- ownedThrough: Date,
17
+ ownedFrom: { type: Date, required: true },
18
+ ownedThrough: { type: Date, required: true },
25
19
  typeOfGood: mongoose_1.SchemaTypes.Mixed
26
20
  };
27
21
  const schemaOptions = {
@@ -48,16 +42,6 @@ const schemaOptions = {
48
42
  versionKey: false
49
43
  }
50
44
  };
51
- /**
52
- * 所有権スキーマ
53
- */
54
- let schema;
55
- function createSchema() {
56
- if (schema === undefined) {
57
- schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
58
- }
59
- return schema;
60
- }
61
45
  const indexes = [
62
46
  [
63
47
  // 識別子はユニークな前提
@@ -81,14 +65,18 @@ const indexes = [
81
65
  { typeOf: 1, ownedFrom: -1 },
82
66
  { name: 'searchByTypeOf-v2' }
83
67
  ],
68
+ // [
69
+ // { identifier: 1, ownedFrom: -1 },
70
+ // {
71
+ // name: 'searchByIdentifier-v2',
72
+ // partialFilterExpression: {
73
+ // identifier: { $exists: true }
74
+ // }
75
+ // }
76
+ // ],
84
77
  [
85
78
  { identifier: 1, ownedFrom: -1 },
86
- {
87
- name: 'searchByIdentifier-v2',
88
- partialFilterExpression: {
89
- identifier: { $exists: true }
90
- }
91
- }
79
+ { name: 'identifier' }
92
80
  ],
93
81
  [
94
82
  { 'acquiredFrom.id': 1, ownedFrom: -1 },
@@ -117,23 +105,27 @@ const indexes = [
117
105
  }
118
106
  }
119
107
  ],
120
- [
121
- { 'ownedBy.memberOf.membershipNumber': 1, ownedFrom: -1 },
122
- {
123
- name: 'searchByOwnedByMemberOfMembershipNumber',
124
- partialFilterExpression: {
125
- 'ownedBy.memberOf.membershipNumber': { $exists: true }
126
- }
127
- }
128
- ],
129
- [
130
- { ownedThrough: -1, ownedFrom: -1 },
131
- {
132
- name: 'searchByOwnedThrough-v2',
133
- partialFilterExpression: {
134
- ownedThrough: { $exists: true }
135
- }
136
- }
108
+ // [
109
+ // { 'ownedBy.memberOf.membershipNumber': 1, ownedFrom: -1 },
110
+ // {
111
+ // name: 'searchByOwnedByMemberOfMembershipNumber',
112
+ // partialFilterExpression: {
113
+ // 'ownedBy.memberOf.membershipNumber': { $exists: true }
114
+ // }
115
+ // }
116
+ // ],
117
+ // [
118
+ // { ownedThrough: -1, ownedFrom: -1 },
119
+ // {
120
+ // name: 'searchByOwnedThrough-v2',
121
+ // partialFilterExpression: {
122
+ // ownedThrough: { $exists: true }
123
+ // }
124
+ // }
125
+ // ],
126
+ [
127
+ { ownedThrough: 1, ownedFrom: -1 },
128
+ { name: 'ownedThrough' }
137
129
  ],
138
130
  [
139
131
  { 'typeOfGood.typeOf': 1, ownedFrom: -1 },
@@ -144,15 +136,15 @@ const indexes = [
144
136
  }
145
137
  }
146
138
  ],
147
- [
148
- { 'typeOfGood.reservedTicket.ticketToken': 1, ownedFrom: -1 },
149
- {
150
- name: 'searchByTypeOfGoofReservedTicketToken',
151
- partialFilterExpression: {
152
- 'typeOfGood.reservedTicket.ticketToken': { $exists: true }
153
- }
154
- }
155
- ],
139
+ // [
140
+ // { 'typeOfGood.reservedTicket.ticketToken': 1, ownedFrom: -1 },
141
+ // {
142
+ // name: 'searchByTypeOfGoofReservedTicketToken',
143
+ // partialFilterExpression: {
144
+ // 'typeOfGood.reservedTicket.ticketToken': { $exists: true }
145
+ // }
146
+ // }
147
+ // ],
156
148
  [
157
149
  { 'typeOfGood.id': 1, ownedFrom: -1 },
158
150
  {
@@ -171,15 +163,15 @@ const indexes = [
171
163
  }
172
164
  }
173
165
  ],
174
- [
175
- { 'typeOfGood.membershipFor.id': 1, ownedFrom: -1 },
176
- {
177
- name: 'searchByTypeOfGoodMembershipForId',
178
- partialFilterExpression: {
179
- 'typeOfGood.membershipFor.id': { $exists: true }
180
- }
181
- }
182
- ],
166
+ // [
167
+ // { 'typeOfGood.membershipFor.id': 1, ownedFrom: -1 },
168
+ // {
169
+ // name: 'searchByTypeOfGoodMembershipForId',
170
+ // partialFilterExpression: {
171
+ // 'typeOfGood.membershipFor.id': { $exists: true }
172
+ // }
173
+ // }
174
+ // ],
183
175
  [
184
176
  { 'typeOfGood.issuedThrough.id': 1, ownedFrom: -1 },
185
177
  {
@@ -198,15 +190,15 @@ const indexes = [
198
190
  }
199
191
  }
200
192
  ],
201
- [
202
- { 'typeOfGood.accountNumber': 1, ownedFrom: -1 },
203
- {
204
- name: 'searchByTypeOfGoodAccountNumber',
205
- partialFilterExpression: {
206
- 'typeOfGood.accountNumber': { $exists: true }
207
- }
208
- }
209
- ],
193
+ // [
194
+ // { 'typeOfGood.accountNumber': 1, ownedFrom: -1 },
195
+ // {
196
+ // name: 'searchByTypeOfGoodAccountNumber',
197
+ // partialFilterExpression: {
198
+ // 'typeOfGood.accountNumber': { $exists: true }
199
+ // }
200
+ // }
201
+ // ],
210
202
  [
211
203
  { 'typeOfGood.reservationNumber': 1, ownedFrom: -1 },
212
204
  {
@@ -218,3 +210,18 @@ const indexes = [
218
210
  ]
219
211
  ];
220
212
  exports.indexes = indexes;
213
+ /**
214
+ * 所有権スキーマ
215
+ */
216
+ let schema;
217
+ function createSchema() {
218
+ if (schema === undefined) {
219
+ schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
220
+ if (settings_1.MONGO_AUTO_INDEX) {
221
+ indexes.forEach((indexParams) => {
222
+ schema?.index(...indexParams);
223
+ });
224
+ }
225
+ }
226
+ return schema;
227
+ }
@@ -71,9 +71,15 @@ export declare class OwnershipInfoRepo {
71
71
  };
72
72
  identifiers: string[];
73
73
  ownedThrough: {
74
- $lt: Date;
74
+ $lte: Date;
75
75
  };
76
76
  }): Promise<void>;
77
+ /**
78
+ * 所有期限切れの所有権を削除する
79
+ */
80
+ deleteExpiredOwnershipInfos(params: {
81
+ ownedThroughLte: Date;
82
+ }): Promise<void>;
77
83
  getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, {}, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<Omit<factory.ownershipInfo.IOwnershipInfo<factory.ownershipInfo.IGood>, "id"> & {
78
84
  _id: string;
79
85
  } & Required<{
@@ -422,8 +422,18 @@ class OwnershipInfoRepo {
422
422
  await this.ownershipInfoModel.deleteMany({
423
423
  'project.id': { $eq: params.project.id },
424
424
  identifier: { $in: params.identifiers },
425
- // 所有期限切れのもの(ownedThroughの存在しないものは削除してはいけない)
426
- ownedThrough: { $exists: true, $lt: params.ownedThrough.$lt }
425
+ // 所有期限切れのもの(ownedThroughは必ず存在する)
426
+ ownedThrough: { $lte: params.ownedThrough.$lte }
427
+ })
428
+ .exec();
429
+ }
430
+ /**
431
+ * 所有期限切れの所有権を削除する
432
+ */
433
+ async deleteExpiredOwnershipInfos(params) {
434
+ await this.ownershipInfoModel.deleteMany({
435
+ // 所有期限切れのもの(ownedThroughは必ず存在する)
436
+ ownedThrough: { $lte: params.ownedThroughLte }
427
437
  })
428
438
  .exec();
429
439
  }
@@ -440,14 +450,7 @@ class OwnershipInfoRepo {
440
450
  throw new factory.errors.ArgumentNull('ownedBy.id');
441
451
  }
442
452
  let newOwner;
443
- if (params.ownedBy.typeOf === factory.organizationType.Organization) {
444
- newOwner = {
445
- id: params.ownedBy.id,
446
- typeOf: params.ownedBy.typeOf
447
- };
448
- }
449
- else if (params.ownedBy.typeOf === factory.personType.Person
450
- || params.ownedBy.typeOf === factory.creativeWorkType.WebApplication) {
453
+ if (params.ownedBy.typeOf === factory.personType.Person) {
451
454
  newOwner = {
452
455
  id: params.ownedBy.id,
453
456
  typeOf: params.ownedBy.typeOf
@@ -53,15 +53,28 @@ function createOwnershipInfosFromOrder(params) {
53
53
  });
54
54
  const acquiredFrom = createAcquiredFrom(params);
55
55
  const ownedBy = createOwnedby(params);
56
- const itemOfferedType = itemOffered.typeOf;
57
- switch (itemOfferedType) {
58
- case factory.reservationType.EventReservation:
59
- const excludeCOAReservation = acceptedOffer.offeredThrough?.identifier === factory.service.webAPI.Identifier.COA;
60
- if (excludeCOAReservation) {
61
- // bookingService:COAでは作成しない(2024-12-31~)
62
- }
63
- else {
64
- ownershipInfo = (0, factory_2.createReservationOwnershipInfo)({
56
+ // 所有者があれば所有権を作成する
57
+ if (ownedBy.length > 0) {
58
+ const itemOfferedType = itemOffered.typeOf;
59
+ switch (itemOfferedType) {
60
+ case factory.reservationType.EventReservation:
61
+ const excludeCOAReservation = acceptedOffer.offeredThrough?.identifier === factory.service.webAPI.Identifier.COA;
62
+ if (excludeCOAReservation) {
63
+ // bookingService:COAでは作成しない(2024-12-31~)
64
+ }
65
+ else {
66
+ ownershipInfo = (0, factory_2.createReservationOwnershipInfo)({
67
+ project: params.order.project,
68
+ ownedBy: ownedBy,
69
+ acceptedOffer: { ...acceptedOffer, itemOffered },
70
+ ownedFrom: ownedFrom,
71
+ identifier: identifier,
72
+ acquiredFrom: acquiredFrom
73
+ });
74
+ }
75
+ break;
76
+ case factory.permit.PermitType.Permit:
77
+ ownershipInfo = (0, factory_1.createProductOwnershipInfo)({
65
78
  project: params.order.project,
66
79
  ownedBy: ownedBy,
67
80
  acceptedOffer: { ...acceptedOffer, itemOffered },
@@ -69,24 +82,14 @@ function createOwnershipInfosFromOrder(params) {
69
82
  identifier: identifier,
70
83
  acquiredFrom: acquiredFrom
71
84
  });
72
- }
73
- break;
74
- case factory.permit.PermitType.Permit:
75
- ownershipInfo = (0, factory_1.createProductOwnershipInfo)({
76
- project: params.order.project,
77
- ownedBy: ownedBy,
78
- acceptedOffer: { ...acceptedOffer, itemOffered },
79
- ownedFrom: ownedFrom,
80
- identifier: identifier,
81
- acquiredFrom: acquiredFrom
82
- });
83
- break;
84
- // case factory.actionType.MoneyTransfer:
85
- // // no op
86
- // // 所有権は発生しない
87
- // break;
88
- default:
89
- throw new factory.errors.NotImplemented(`Offered item type ${itemOfferedType} not implemented`);
85
+ break;
86
+ // case factory.actionType.MoneyTransfer:
87
+ // // no op
88
+ // // 所有権は発生しない
89
+ // break;
90
+ default:
91
+ throw new factory.errors.NotImplemented(`Offered item type ${itemOfferedType} not implemented`);
92
+ }
90
93
  }
91
94
  if (ownershipInfo !== undefined) {
92
95
  ownershipInfos.push(ownershipInfo);
@@ -111,17 +114,17 @@ function createAcquiredFrom(params) {
111
114
  };
112
115
  }
113
116
  function createOwnedby(params) {
114
- // 最低限の情報に絞る
115
117
  const customer = params.order.customer;
116
118
  let owner;
117
119
  // 顧客組織の場合
118
120
  if (customer.typeOf === factory.organizationType.Organization) {
119
- const ownerAsOrganization = {
120
- // 個人情報排除するように
121
- typeOf: customer.typeOf,
122
- id: customer.id
123
- };
124
- owner = ownerAsOrganization;
121
+ // discontinue(2026-03-15~)
122
+ // const ownerAsOrganization: factory.ownershipInfo.IOwnerAsOrganization = {
123
+ // // 個人情報排除するように
124
+ // typeOf: customer.typeOf,
125
+ // id: customer.id
126
+ // };
127
+ // owner = ownerAsOrganization;
125
128
  }
126
129
  else if (customer.typeOf === factory.personType.Person) {
127
130
  const ownerAsPerson = {
@@ -132,11 +135,12 @@ function createOwnedby(params) {
132
135
  owner = ownerAsPerson;
133
136
  }
134
137
  else {
135
- owner = {
136
- // 個人情報排除するように
137
- typeOf: customer.typeOf,
138
- id: customer.id
139
- };
138
+ // discontinue(2026-03-15~)
139
+ // owner = {
140
+ // // 個人情報排除するように
141
+ // typeOf: customer.typeOf,
142
+ // id: customer.id
143
+ // };
140
144
  }
141
- return [owner];
145
+ return (owner !== undefined) ? [owner] : [];
142
146
  }
@@ -73,7 +73,6 @@ function createProductOwnershipInfo(params) {
73
73
  throw new factory.errors.NotFound('Order.acceptedOffers.priceSpecification.referenceQuantity.value');
74
74
  }
75
75
  const itemOffered = params.acceptedOffer.itemOffered;
76
- // 最適化(2023-02-01~)
77
76
  const issuedThrough = (typeof itemOffered.issuedThrough?.typeOf === 'string')
78
77
  ? {
79
78
  id: itemOffered.issuedThrough.id,
@@ -84,12 +83,11 @@ function createProductOwnershipInfo(params) {
84
83
  }
85
84
  : undefined;
86
85
  const typeOfGood = {
87
- // project: itemOffered.project, // 最適化(2023-02-01~)
88
86
  identifier: itemOffered.identifier,
89
87
  typeOf: itemOffered.typeOf,
90
88
  ...(typeof issuedThrough?.typeOf === 'string') ? { issuedThrough } : undefined,
91
- ...(itemOffered.validFor !== undefined) ? { validFor: itemOffered.validFor } : undefined,
92
- ...(itemOffered.name !== undefined) ? { name: itemOffered.name } : undefined
89
+ // ...(itemOffered.validFor !== undefined) ? { validFor: itemOffered.validFor } : undefined,
90
+ // ...(itemOffered.name !== undefined) ? { name: itemOffered.name } : undefined
93
91
  };
94
92
  const ownershipInfo = {
95
93
  project: params.project,
@@ -42,21 +42,21 @@ function createReservationOwnershipInfo(params) {
42
42
  else {
43
43
  throw new factory.errors.NotImplemented(`itemOffered.typeOf '${itemOffered.typeOf}' not implemented`);
44
44
  }
45
- let bookingService = params.acceptedOffer.offeredThrough;
46
- if (bookingService === undefined) {
47
- // デフォルトブッキングサービスはChevre
48
- bookingService = {
49
- typeOf: 'WebAPI',
50
- identifier: factory.service.webAPI.Identifier.Chevre
51
- };
52
- }
45
+ // let bookingService = params.acceptedOffer.offeredThrough;
46
+ // if (bookingService === undefined) {
47
+ // // デフォルトブッキングサービスはChevre
48
+ // bookingService = {
49
+ // typeOf: 'WebAPI',
50
+ // identifier: factory.service.webAPI.Identifier.Chevre
51
+ // };
52
+ // }
53
53
  let typeOfGood;
54
54
  if (itemOffered.typeOf === factory.reservationType.EventReservation) {
55
55
  typeOfGood = {
56
56
  typeOf: itemOffered.typeOf,
57
57
  id: itemOffered.id,
58
58
  reservationNumber: itemOffered.reservationNumber,
59
- bookingService: bookingService,
59
+ // bookingService: bookingService,
60
60
  ...(typeof itemOffered.issuedThrough?.typeOf === 'string') ? { issuedThrough: itemOffered.issuedThrough } : undefined
61
61
  };
62
62
  // } else if (itemOffered.typeOf === factory.reservationType.BusReservation) {
@@ -80,7 +80,7 @@ function createRegisterServiceStartParams(params) {
80
80
  function createActionAttributes(params) {
81
81
  const transaction = params.transaction;
82
82
  const actionObject = {
83
- typeOf: factory.offerType.AggregateOffer,
83
+ typeOf: factory.action.authorize.offer.product.ObjectType.AggregateOffer,
84
84
  itemOffered: {
85
85
  id: params.acceptedOffer[0].itemOffered.id,
86
86
  typeOf: params.acceptedOffer[0].itemOffered.typeOf
@@ -250,7 +250,7 @@ function voidTransaction(params) {
250
250
  // && a.object.length > 0
251
251
  // && a.object[0].typeOf === factory.offerType.Offer
252
252
  // && availableProductTypes.indexOf(a.object[0].itemOffered.typeOf) >= 0
253
- a.object.typeOf === factory.offerType.AggregateOffer
253
+ a.object.typeOf === factory.action.authorize.offer.product.ObjectType.AggregateOffer
254
254
  && availableProductTypes_1.availableProductTypes.indexOf(a.object.itemOffered.typeOf) >= 0));
255
255
  }
256
256
  await Promise.all(authorizeActions.map(async (action) => {
@@ -147,7 +147,7 @@ function deleteOwnershipInfosByOrder(order) {
147
147
  project: { id: order.project.id },
148
148
  identifiers: ownershipIdentifiers,
149
149
  // 所有期限切れのもの(ownedThroughの存在しないものは削除してはいけない)
150
- ownedThrough: { $lt: now }
150
+ ownedThrough: { $lte: now }
151
151
  });
152
152
  }
153
153
  };
@@ -114,10 +114,13 @@ function sendOrder(params) {
114
114
  // 所有権生成を最小化(2024-03-01~)
115
115
  let createOwnerships = false;
116
116
  switch (order.customer.typeOf) {
117
- case factory.creativeWorkType.WebApplication:
117
+ case factory.personType.Person:
118
+ createOwnerships = true; // Personのみに限定(2026-03-15~)
118
119
  break;
120
+ // case factory.creativeWorkType.WebApplication:
121
+ // break;
119
122
  default:
120
- createOwnerships = true;
123
+ // createOwnerships = true;
121
124
  }
122
125
  try {
123
126
  const offerIndexBase = (limit * (page - 1));
@@ -1,4 +1,6 @@
1
1
  import type { ActionRepo } from '../../../repo/action';
2
+ import type { AuthorizePaymentMethodActionRepo } from '../../../repo/action/authorizePaymentMethod';
3
+ import type { AuthorizeOfferActionRepo } from '../../../repo/action/authorizeOffer';
2
4
  import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
3
5
  import type { AuthorizationRepo } from '../../../repo/authorization';
4
6
  import type { ConfirmationNumberRepo } from '../../../repo/confirmationNumber';
@@ -13,6 +15,8 @@ import * as factory from '../../../factory';
13
15
  import { placeOrder as PlaceOrderFactory } from '../../../factory/transaction';
14
16
  interface IConfirmOperationRepos {
15
17
  action: ActionRepo;
18
+ authorizePaymentMethodAction: AuthorizePaymentMethodActionRepo;
19
+ authorizeOfferAction: AuthorizeOfferActionRepo;
16
20
  assetTransaction: AssetTransactionRepo;
17
21
  authorization: AuthorizationRepo;
18
22
  emailMessage?: EmailMessageRepo;
@@ -57,4 +61,4 @@ interface IConfirmResult {
57
61
  * 注文取引を確定する
58
62
  */
59
63
  declare function confirm(params: IConfirmParams, options: IConfirmOptions): IConfirmOperation<IConfirmResult>;
60
- export { confirm };
64
+ export { IConfirmOperationRepos, confirm };
@@ -263,7 +263,7 @@ function dissolveAuthorizeActions(completedAuthorizeActions) {
263
263
  }
264
264
  serialNumber = assetTransactionNumber;
265
265
  }
266
- else if (a.object.typeOf === factory.offerType.AggregateOffer
266
+ else if (a.object.typeOf === factory.action.authorize.offer.product.ObjectType.AggregateOffer
267
267
  && a.instrument?.typeOf === factory.assetTransactionType.RegisterService) {
268
268
  authorizeProductOfferActions.push(a);
269
269
  serialNumber = a.instrument.transactionNumber;
@@ -420,15 +420,33 @@ function searchAcceptPayActions(params) {
420
420
  function searchAuthorizeActions(params) {
421
421
  return async (repos) => {
422
422
  // 取引に対する全ての承認アクションをマージ
423
- let authorizeActions = await repos.action.searchByPurpose({
424
- typeOf: factory.actionType.AuthorizeAction,
425
- purpose: {
426
- typeOf: factory.transactionType.PlaceOrder,
427
- id: params.id
428
- },
429
- // Completedに絞る(2023-05-16~)
430
- actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
431
- });
423
+ // let authorizeActions = <IAuthorizeOfferOrPaymentAction[]>await repos.action.searchByPurpose({
424
+ // typeOf: factory.actionType.AuthorizeAction,
425
+ // purpose: {
426
+ // typeOf: factory.transactionType.PlaceOrder,
427
+ // id: params.id
428
+ // },
429
+ // // Completedに絞る(2023-05-16~)
430
+ // actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
431
+ // });
432
+ let authorizeActions = [
433
+ ...await repos.authorizePaymentMethodAction.findAuthorizePaymentMethodActionsByPurpose({
434
+ purpose: {
435
+ typeOf: factory.transactionType.PlaceOrder,
436
+ id: params.id
437
+ },
438
+ // Completedに絞る(2023-05-16~)
439
+ actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
440
+ }),
441
+ ...await repos.authorizeOfferAction.findAuthorizeAnyOfferActionsByPurpose({
442
+ purpose: {
443
+ typeOf: factory.transactionType.PlaceOrder,
444
+ id: params.id
445
+ },
446
+ // Completedに絞る(2023-05-16~)
447
+ actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
448
+ }),
449
+ ];
432
450
  // 万が一このプロセス中に他処理が発生してもそれらを無視するように、endDateでフィルタリング
433
451
  authorizeActions = authorizeActions.filter((a) => {
434
452
  return (a.endDate instanceof Date) && (0, moment_1.default)(a.endDate)
@@ -20,7 +20,6 @@ import type * as OrderService from './service/order';
20
20
  import type * as AnyPaymentService from './service/payment/any';
21
21
  import type * as PermitService from './service/permit';
22
22
  import type * as ProjectService from './service/project';
23
- import type * as ReportService from './service/report';
24
23
  import type * as ReserveService from './service/reserve';
25
24
  import type * as TaskService from './service/task';
26
25
  import type * as TransactionService from './service/transaction';
@@ -65,9 +64,6 @@ export declare namespace permit {
65
64
  export declare namespace project {
66
65
  function createService(): Promise<typeof ProjectService>;
67
66
  }
68
- export declare namespace report {
69
- function createService(): Promise<typeof ReportService>;
70
- }
71
67
  export declare namespace reserve {
72
68
  function createService(): Promise<typeof ReserveService>;
73
69
  }
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.factory = exports.transaction = exports.task = exports.reserve = exports.report = exports.project = exports.permit = exports.payment = exports.order = exports.offer = exports.notification = exports.iam = exports.event = exports.delivery = exports.assetTransaction = exports.aggregation = exports.accountTransaction = exports.account = void 0;
26
+ exports.factory = exports.transaction = exports.task = exports.reserve = exports.project = exports.permit = exports.payment = exports.order = exports.offer = exports.notification = exports.iam = exports.event = exports.delivery = exports.assetTransaction = exports.aggregation = exports.accountTransaction = exports.account = void 0;
27
27
  /**
28
28
  * service module
29
29
  */
@@ -189,17 +189,6 @@ var project;
189
189
  }
190
190
  project.createService = createService;
191
191
  })(project || (exports.project = project = {}));
192
- var report;
193
- (function (report) {
194
- let service;
195
- async function createService() {
196
- if (service === undefined) {
197
- service = await Promise.resolve().then(() => __importStar(require('./service/report')));
198
- }
199
- return service;
200
- }
201
- report.createService = createService;
202
- })(report || (exports.report = report = {}));
203
192
  var reserve;
204
193
  (function (reserve) {
205
194
  let service;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "dependencies": {
12
12
  "@aws-sdk/client-cognito-identity-provider": "3.600.0",
13
13
  "@aws-sdk/credential-providers": "3.600.0",
14
- "@chevre/factory": "6.0.0-alpha.1",
14
+ "@chevre/factory": "6.0.0-alpha.3",
15
15
  "@cinerino/sdk": "13.2.0",
16
16
  "@motionpicture/coa-service": "9.6.0",
17
17
  "@motionpicture/gmo-service": "5.4.0-alpha.1",
@@ -99,5 +99,5 @@
99
99
  "postversion": "git push origin --tags",
100
100
  "prepublishOnly": "npm run clean && npm run build"
101
101
  },
102
- "version": "24.0.0-alpha.37"
102
+ "version": "24.0.0-alpha.39"
103
103
  }
@@ -1,27 +0,0 @@
1
- import * as factory from '../../factory';
2
- /**
3
- * 所有権レポートインターフェース
4
- */
5
- export interface IOwnershipInfoReport {
6
- id: string;
7
- identifier: string;
8
- ownedBy: {
9
- typeOf: string;
10
- id: string;
11
- };
12
- typeOfGood: {
13
- typeOf: string;
14
- id?: string;
15
- identifier?: string;
16
- };
17
- ownedFrom: string;
18
- ownedThrough: string;
19
- seller: {
20
- id?: string;
21
- };
22
- }
23
- export declare function ownershipInfo2report(params: {
24
- ownershipInfo: factory.ownershipInfo.IOwnershipInfo<factory.ownershipInfo.IGood> & {
25
- id: string;
26
- };
27
- }): IOwnershipInfoReport;
@@ -1,39 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ownershipInfo2report = ownershipInfo2report;
7
- /**
8
- * 所有権レポートサービス
9
- */
10
- // import * as json2csv from 'json2csv';
11
- const moment_1 = __importDefault(require("moment"));
12
- function ownershipInfo2report(params) {
13
- const ownershipInfo = params.ownershipInfo;
14
- return {
15
- id: ownershipInfo.id,
16
- identifier: String(ownershipInfo.identifier),
17
- ownedBy: (Array.isArray(ownershipInfo.ownedBy))
18
- ? {
19
- typeOf: ownershipInfo.ownedBy[0]?.typeOf,
20
- id: String(ownershipInfo.ownedBy[0]?.id)
21
- }
22
- : {
23
- typeOf: ownershipInfo.ownedBy.typeOf,
24
- id: String(ownershipInfo.ownedBy.id)
25
- },
26
- typeOfGood: {
27
- typeOf: ownershipInfo.typeOfGood.typeOf,
28
- id: ownershipInfo.typeOfGood.id,
29
- identifier: ownershipInfo.typeOfGood.identifier
30
- },
31
- ownedFrom: (0, moment_1.default)(ownershipInfo.ownedFrom)
32
- .toISOString(),
33
- ownedThrough: (0, moment_1.default)(ownershipInfo.ownedThrough)
34
- .toISOString(),
35
- seller: {
36
- id: ownershipInfo.acquiredFrom?.id
37
- }
38
- };
39
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * レポートサービス
3
- */
4
- import * as OwnershipInfoService from './report/ownershipInfo';
5
- export { OwnershipInfoService as ownershipInfo };
@@ -1,31 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.ownershipInfo = void 0;
27
- /**
28
- * レポートサービス
29
- */
30
- const OwnershipInfoService = __importStar(require("./report/ownershipInfo"));
31
- exports.ownershipInfo = OwnershipInfoService;