@chevre/domain 21.17.0-alpha.8 → 21.17.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 (77) hide show
  1. package/example/src/chevre/adminSellerPaymentAccepted.ts +60 -0
  2. package/example/src/chevre/isPaymentAcceptedBySeller.ts +24 -0
  3. package/example/src/chevre/offerCatalog2offerCatalogItem.ts +38 -15
  4. package/example/src/chevre/saveOfferCatalogItem.ts +40 -0
  5. package/example/src/chevre/searchAggregateOffers.ts +11 -8
  6. package/example/src/chevre/searchOffers.ts +15 -7
  7. package/example/src/chevre/searchOrderAcceptedOffers.ts +38 -0
  8. package/lib/chevre/repo/action.d.ts +4 -4
  9. package/lib/chevre/repo/action.js +1 -1
  10. package/lib/chevre/repo/aggregateOffer.js +39 -17
  11. package/lib/chevre/repo/mongoose/schemas/aggregateOffer.d.ts +1 -1
  12. package/lib/chevre/repo/mongoose/schemas/aggregateOffer.js +25 -11
  13. package/lib/chevre/repo/offer.d.ts +17 -1
  14. package/lib/chevre/repo/offer.js +46 -21
  15. package/lib/chevre/repo/offerCatalogItem.d.ts +8 -2
  16. package/lib/chevre/repo/offerCatalogItem.js +5 -5
  17. package/lib/chevre/repo/order.d.ts +7 -6
  18. package/lib/chevre/repo/order.js +52 -28
  19. package/lib/chevre/repo/seller.d.ts +4 -23
  20. package/lib/chevre/repo/seller.js +3 -38
  21. package/lib/chevre/repo/sellerPaymentAccepted.d.ts +54 -0
  22. package/lib/chevre/repo/sellerPaymentAccepted.js +132 -0
  23. package/lib/chevre/repository.d.ts +5 -0
  24. package/lib/chevre/repository.js +14 -1
  25. package/lib/chevre/service/assetTransaction/pay/account/validation.d.ts +2 -2
  26. package/lib/chevre/service/assetTransaction/pay/account/validation.js +20 -24
  27. package/lib/chevre/service/assetTransaction/pay.d.ts +6 -8
  28. package/lib/chevre/service/assetTransaction/pay.js +26 -14
  29. package/lib/chevre/service/offer/event/authorize.d.ts +5 -1
  30. package/lib/chevre/service/offer/event/authorize.js +50 -115
  31. package/lib/chevre/service/offer/event/defaultOffer.d.ts +5 -0
  32. package/lib/chevre/service/offer/event/defaultOffer.js +50 -0
  33. package/lib/chevre/service/offer/event/factory.d.ts +6 -6
  34. package/lib/chevre/service/offer/event/factory.js +1 -1
  35. package/lib/chevre/service/offer/event/processStartReserve4chevre.d.ts +49 -0
  36. package/lib/chevre/service/offer/event/processStartReserve4chevre.js +96 -0
  37. package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +2 -2
  38. package/lib/chevre/service/offer/event/searchEventTicketOffers.js +10 -6
  39. package/lib/chevre/service/offer/event/voidTransaction.js +7 -5
  40. package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +7 -7
  41. package/lib/chevre/service/offer/eventServiceByCOA/factory.js +1 -1
  42. package/lib/chevre/service/offer/eventServiceByCOA/validateAcceptedOffers.d.ts +1 -1
  43. package/lib/chevre/service/offer/eventServiceByCOA.d.ts +3 -3
  44. package/lib/chevre/service/order/confirmPayTransaction.d.ts +0 -2
  45. package/lib/chevre/service/order/confirmPayTransaction.js +0 -1
  46. package/lib/chevre/service/payment/any.d.ts +5 -6
  47. package/lib/chevre/service/payment/any.js +3 -6
  48. package/lib/chevre/service/payment/creditCard.d.ts +6 -6
  49. package/lib/chevre/service/payment/creditCard.js +22 -14
  50. package/lib/chevre/service/payment/faceToFace.d.ts +0 -4
  51. package/lib/chevre/service/payment/movieTicket/factory.d.ts +0 -1
  52. package/lib/chevre/service/payment/movieTicket/factory.js +4 -8
  53. package/lib/chevre/service/payment/movieTicket/validation.d.ts +2 -2
  54. package/lib/chevre/service/payment/movieTicket/validation.js +21 -13
  55. package/lib/chevre/service/payment/movieTicket.d.ts +4 -6
  56. package/lib/chevre/service/payment/movieTicket.js +37 -34
  57. package/lib/chevre/service/payment.d.ts +4 -4
  58. package/lib/chevre/service/task/confirmPayTransaction.js +1 -2
  59. package/lib/chevre/service/task/pay.js +3 -2
  60. package/lib/chevre/service/task/refund.js +3 -2
  61. package/lib/chevre/service/task/voidPayTransaction.js +3 -2
  62. package/lib/chevre/service/task/voidPayment.js +3 -2
  63. package/lib/chevre/service/transaction/deleteTransaction.js +1 -1
  64. package/lib/chevre/service/transaction/moneyTransfer/potentialActions.js +0 -1
  65. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +0 -1
  66. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +0 -1
  67. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.d.ts +1 -1
  68. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +1 -4
  69. package/lib/chevre/service/transaction/placeOrderInProgress/result.js +1 -2
  70. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +2 -4
  71. package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +3 -3
  72. package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +34 -34
  73. package/lib/chevre/service/transaction/placeOrderInProgress.js +3 -3
  74. package/package.json +3 -3
  75. package/example/src/chevre/aggregateSellerPaymentAccepted.ts +0 -27
  76. package/example/src/handlePhoneNumber.ts +0 -13
  77. package/example/src/retryConnectMongo.ts +0 -82
@@ -0,0 +1,60 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+
4
+ import { chevre } from '../../../lib/index';
5
+
6
+ const project = { id: String(process.env.PROJECT_ID) };
7
+ const SELLER_ID = '59d20831e53ebc2b4e774466';
8
+ const PAYMENT_METHOD_TYPE = 'Cash';
9
+
10
+ async function main() {
11
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
12
+
13
+ const paymentAcceptedRepo = await chevre.repository.SellerPaymentAccepted.createInstance(mongoose.connection);
14
+
15
+ let paymentAccepted = await paymentAcceptedRepo.search({
16
+ project: { id: { $eq: project.id } },
17
+ seller: { id: { $eq: SELLER_ID } },
18
+ codeValue: { $eq: PAYMENT_METHOD_TYPE }
19
+ });
20
+ console.log('paymentAccepted:', paymentAccepted);
21
+ console.log(paymentAccepted.length, 'paymentAccepted found');
22
+
23
+ try {
24
+ await paymentAcceptedRepo.deleteOne({
25
+ codeValue: PAYMENT_METHOD_TYPE,
26
+ project: { id: project.id },
27
+ seller: { id: SELLER_ID }
28
+ });
29
+ console.log('paymentAccepted deleted');
30
+ } catch (error) {
31
+ console.error(error);
32
+ }
33
+
34
+ paymentAccepted = await paymentAcceptedRepo.search({
35
+ project: { id: { $eq: project.id } },
36
+ seller: { id: { $eq: SELLER_ID } },
37
+ codeValue: { $eq: PAYMENT_METHOD_TYPE }
38
+ });
39
+ console.log('paymentAccepted:', paymentAccepted);
40
+ console.log(paymentAccepted.length, 'paymentAccepted found');
41
+
42
+ await paymentAcceptedRepo.create({
43
+ codeValue: PAYMENT_METHOD_TYPE,
44
+ project: { id: project.id },
45
+ seller: { id: SELLER_ID }
46
+ });
47
+ console.log('paymentAccepted created');
48
+
49
+ paymentAccepted = await paymentAcceptedRepo.search({
50
+ project: { id: { $eq: project.id } },
51
+ seller: { id: { $eq: SELLER_ID } },
52
+ codeValue: { $eq: PAYMENT_METHOD_TYPE }
53
+ });
54
+ console.log('paymentAccepted:', paymentAccepted);
55
+ console.log(paymentAccepted.length, 'paymentAccepted found');
56
+ }
57
+
58
+ main()
59
+ .then()
60
+ .catch(console.error);
@@ -0,0 +1,24 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+
4
+ import { chevre } from '../../../lib/index';
5
+
6
+ // const project = { id: String(process.env.PROJECT_ID) };
7
+ const SELLER_ID = '59d20831e53ebc2b4e774466';
8
+ const PAYMENT_METHOD_TYPE = 'Cash';
9
+
10
+ async function main() {
11
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
12
+
13
+ const paymentAcceptedRepo = await chevre.repository.SellerPaymentAccepted.createInstance(mongoose.connection);
14
+
15
+ const paymentAccepted = await paymentAcceptedRepo.isAcceptedBySeller({
16
+ seller: { id: SELLER_ID },
17
+ codeValue: PAYMENT_METHOD_TYPE
18
+ });
19
+ console.log('paymentAccepted:', paymentAccepted);
20
+ }
21
+
22
+ main()
23
+ .then()
24
+ .catch(console.error);
@@ -20,8 +20,11 @@ async function main() {
20
20
 
21
21
  let i = 0;
22
22
  let maxOfferCatalogItemNumItemListElement = 0;
23
+ let maxIdentifierLength = 0;
23
24
  for (const offerCatalog of offerCatalogs) {
24
25
  i += 1;
26
+ maxIdentifierLength = Math.max(maxIdentifierLength, offerCatalog.identifier.length);
27
+
25
28
  const { itemListElement } = await offerCatalogRepo.findItemListElementById({
26
29
  id: String(offerCatalog.id),
27
30
  project: { id: PROJECT_ID }
@@ -33,24 +36,38 @@ async function main() {
33
36
  // console.log(unitPriceOffers);
34
37
  console.log(unitPriceOffers.length, 'unitPriceOffers found', i);
35
38
 
36
- const paymentMethodTypes = [...new Set(unitPriceOffers.reduce<string[]>(
39
+ let paymentMethodTypeSets = unitPriceOffers.reduce<{ identifier: string; codeValues: string[] }[]>(
37
40
  (a, b) => {
38
- const appliesToMovieTicketPaymentMethodTypes = b.priceSpecification.appliesToMovieTicket?.map((appliesToMovieTicket) => {
41
+ let appliesToMovieTicketPaymentMethodTypes = b.priceSpecification.appliesToMovieTicket?.map((appliesToMovieTicket) => {
39
42
  return appliesToMovieTicket.serviceOutput.typeOf;
40
43
  });
41
44
 
42
45
  if (Array.isArray(appliesToMovieTicketPaymentMethodTypes)) {
43
- return [
44
- ...a,
45
- ...appliesToMovieTicketPaymentMethodTypes
46
- ];
46
+ appliesToMovieTicketPaymentMethodTypes = appliesToMovieTicketPaymentMethodTypes.sort(
47
+ (aCodeValue, bCodeValue) => (aCodeValue > bCodeValue) ? 1 : -1 // 順序保証
48
+ );
49
+ const setIdentifier = appliesToMovieTicketPaymentMethodTypes.join(',');
50
+
51
+ if (!a.some((paymentMethodTypeSet) => paymentMethodTypeSet.identifier === setIdentifier)) {
52
+ return [
53
+ ...a,
54
+ {
55
+ identifier: setIdentifier,
56
+ codeValues: appliesToMovieTicketPaymentMethodTypes
57
+ }
58
+ ];
59
+ } else {
60
+ return a;
61
+ }
47
62
  } else {
48
63
  return a;
49
64
  }
50
65
  },
51
66
  []
52
- ))];
53
- console.log(paymentMethodTypes);
67
+ );
68
+ paymentMethodTypeSets = paymentMethodTypeSets.sort((a, b) => (a.identifier > b.identifier) ? 1 : -1); // 順序保証
69
+ console.log(paymentMethodTypeSets);
70
+
54
71
  const offerCatalogItems: chevre.factory.offerCatalog.IOfferCatalog[] = [];
55
72
 
56
73
  // 適用決済カード条件なしのオファーについてサブカタログを作成
@@ -58,7 +75,7 @@ async function main() {
58
75
  project: { id: PROJECT_ID, typeOf: chevre.factory.organizationType.Project },
59
76
  typeOf: 'OfferCatalog',
60
77
  // id?: string;
61
- identifier: `${offerCatalog.identifier}Default`,
78
+ identifier: `${offerCatalog.identifier}IDX${offerCatalogItems.length}`,
62
79
  name: {
63
80
  ja: `${offerCatalog.name.ja}`
64
81
  },
@@ -79,19 +96,24 @@ async function main() {
79
96
  });
80
97
 
81
98
  // 適用決済カード条件ありのオファーについてサブカタログを作成
82
- paymentMethodTypes.forEach((paymentMethodType) => {
99
+ paymentMethodTypeSets.forEach((paymentMethodTypeSet) => {
83
100
  offerCatalogItems.push({
84
101
  project: { id: PROJECT_ID, typeOf: chevre.factory.organizationType.Project },
85
102
  typeOf: 'OfferCatalog',
86
103
  // id?: string;
87
- identifier: `${offerCatalog.identifier}${paymentMethodType}`,
104
+ identifier: `${offerCatalog.identifier}IDX${offerCatalogItems.length}`,
88
105
  name: {
89
- ja: `${offerCatalog.name.ja}[${paymentMethodType}]`
106
+ ja: `${offerCatalog.name.ja}[${paymentMethodTypeSet.identifier}]`,
107
+ en: `${offerCatalog.name.en}[${paymentMethodTypeSet.identifier}]`
90
108
  },
91
109
  itemListElement: unitPriceOffers.filter((offer) => {
92
110
  return Array.isArray(offer.priceSpecification.appliesToMovieTicket)
93
- && offer.priceSpecification.appliesToMovieTicket.some(
94
- (appliesToMovieTicket) => appliesToMovieTicket.serviceOutput.typeOf === paymentMethodType);
111
+ && paymentMethodTypeSet.codeValues.length === offer.priceSpecification.appliesToMovieTicket.length
112
+ && paymentMethodTypeSet.codeValues.every((paymentMethodType) => {
113
+ return Array.isArray(offer.priceSpecification.appliesToMovieTicket)
114
+ && offer.priceSpecification.appliesToMovieTicket.some(
115
+ (appliesToMovieTicket) => appliesToMovieTicket.serviceOutput.typeOf === paymentMethodType);
116
+ });
95
117
  })
96
118
  .map((offer) => {
97
119
  return {
@@ -107,7 +129,7 @@ async function main() {
107
129
  relatedOffer: {
108
130
  typeOf: chevre.factory.offerType.Offer,
109
131
  priceSpecification: {
110
- appliesToMovieTicket: [{ serviceOutput: { typeOf: paymentMethodType } }]
132
+ appliesToMovieTicket: [{ serviceOutput: { typeOf: paymentMethodTypeSet.codeValues[0] } }]
111
133
  }
112
134
  }
113
135
  });
@@ -127,6 +149,7 @@ async function main() {
127
149
 
128
150
  console.log(i, 'offerCatalogs checked');
129
151
  console.log('maxOfferCatalogItemNumItemListElement:', maxOfferCatalogItemNumItemListElement);
152
+ console.log('maxIdentifierLength:', maxIdentifierLength);
130
153
  }
131
154
 
132
155
  main()
@@ -0,0 +1,40 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+
4
+ import { chevre } from '../../../lib/index';
5
+
6
+ const project = { id: String(process.env.PROJECT_ID) };
7
+
8
+ async function main() {
9
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
10
+
11
+ const offerCatalogItemRepo = await chevre.repository.OfferCatalogItem.createInstance(mongoose.connection);
12
+
13
+ let result = await offerCatalogItemRepo.save({
14
+ project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
15
+ typeOf: 'OfferCatalog',
16
+ // id?: string;
17
+ identifier: 'sample',
18
+ name: { ja: 'sample', en: 'sample' },
19
+ description: { ja: 'sample', en: 'sample' },
20
+ itemListElement: [],
21
+ itemOffered: { typeOf: chevre.factory.product.ProductType.EventService }
22
+ });
23
+ console.log(result);
24
+
25
+ result = await offerCatalogItemRepo.save({
26
+ project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
27
+ typeOf: 'OfferCatalog',
28
+ id: result.id,
29
+ identifier: 'sample',
30
+ name: { ja: 'sample', en: 'sample' },
31
+ description: { ja: 'sample', en: 'sample' },
32
+ itemListElement: [],
33
+ itemOffered: { typeOf: chevre.factory.product.ProductType.EventService }
34
+ });
35
+ console.log(result);
36
+ }
37
+
38
+ main()
39
+ .then(console.log)
40
+ .catch(console.error);
@@ -3,8 +3,17 @@ import * as mongoose from 'mongoose';
3
3
 
4
4
  import { chevre } from '../../../lib/index';
5
5
 
6
+ mongoose.Model.on('index', (...args) => {
7
+ console.error('******** index event emitted. ********\n', args);
8
+ });
9
+
6
10
  async function main() {
7
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
11
+ await mongoose.connect(<string>process.env.MONGOLAB_URI);
12
+
13
+ const indexes = await mongoose.connection.db.collection('aggregateOffers')
14
+ .indexes();
15
+ console.log(indexes);
16
+ console.log(indexes.length);
8
17
 
9
18
  const aggregateOfferRepo = await chevre.repository.AggregateOffer.createInstance(mongoose.connection);
10
19
 
@@ -15,6 +24,7 @@ async function main() {
15
24
  project: { id: { $eq: String(process.env.PROJECT_ID) } },
16
25
  availability: { $eq: chevre.factory.itemAvailability.InStock },
17
26
  itemOffered: { typeOf: { $eq: chevre.factory.product.ProductType.EventService } },
27
+ acceptedPaymentMethod: { identifier: { $in: ['xxx'] } },
18
28
  // identifier: { $eq: '901' },
19
29
  sort: {
20
30
  'priceSpecification.price': 1,
@@ -34,13 +44,6 @@ async function main() {
34
44
  return `${offer.project.id} ${(<any>offer).offerCount} ${offer.offers[0].identifier} ${offer.offers[0].name.ja} ${offer.offers[0].priceSpecification.price}`;
35
45
  }));
36
46
  console.log(offers.length);
37
-
38
- const aggregateOfferCount = await aggregateOfferRepo.count({
39
- project: { id: { $eq: String(process.env.PROJECT_ID) } },
40
- availability: { $eq: chevre.factory.itemAvailability.InStock },
41
- itemOffered: { typeOf: { $eq: chevre.factory.product.ProductType.EventService } }
42
- });
43
- console.log('aggregateOfferCount:', aggregateOfferCount);
44
47
  }
45
48
 
46
49
  main()
@@ -14,9 +14,6 @@ async function main() {
14
14
  .indexes();
15
15
  console.log(indexes);
16
16
  console.log(indexes.length);
17
- // await mongoose.connection.db.collection('aggregateOffers')
18
- // .dropIndexes();
19
- // console.log('indexes droped');
20
17
 
21
18
  const offerRepo = await chevre.repository.Offer.createInstance(mongoose.connection);
22
19
 
@@ -25,9 +22,20 @@ async function main() {
25
22
  // page: 1,
26
23
  project: { id: { $eq: String(process.env.PROJECT_ID) } },
27
24
  availability: { $eq: chevre.factory.itemAvailability.InStock },
25
+ acceptedPaymentMethod: { identifier: { $in: ['xxx'] } },
28
26
  parentOffer: {
29
27
  },
30
- includedInDataCatalog: { id: { $in: ['0001'] } }
28
+ priceSpecification: {
29
+ appliesToMovieTicket: {
30
+ serviceOutput: {
31
+ typeOf: {
32
+ // $eq: '',
33
+ // $all: []
34
+ }
35
+ }
36
+ }
37
+ }
38
+ // includedInDataCatalog: { id: { $in: ['0001'] } }
31
39
  // additionalProperty: {
32
40
  // $all: [
33
41
  // {
@@ -45,9 +53,9 @@ async function main() {
45
53
  // ]
46
54
  // }
47
55
  });
48
- // console.log(offers.map((offer) => {
49
- // return `${offer.project.id} ${offer.id} ${offer.identifier} ${offer.name.ja}`;
50
- // }));
56
+ console.log(offers.map((offer) => {
57
+ return `${offer.project.id} ${offer.id} ${offer.identifier} ${offer.name.ja}`;
58
+ }));
51
59
  console.log(offers.length);
52
60
  }
53
61
 
@@ -0,0 +1,38 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+
4
+ import { chevre } from '../../../lib/index';
5
+
6
+ const project = { id: String(process.env.PROJECT_ID) };
7
+
8
+ async function main() {
9
+ await mongoose.connect(<string>process.env.MONGOLAB_URI);
10
+
11
+ const orderRepo = await chevre.repository.Order.createInstance(mongoose.connection);
12
+
13
+ const searchConditions: chevre.factory.order.ISearchConditions = {
14
+ // tslint:disable-next-line:no-magic-numbers
15
+ limit: 10,
16
+ page: 1,
17
+ project: { id: { $eq: project.id } },
18
+ confirmationNumbers: ['36684'],
19
+ orderNumbers: ['CIN1-3743286-2441943'],
20
+ acceptedOffers: { itemOffered: { typeOf: { $in: [chevre.factory.reservationType.EventReservation] } } }
21
+ // ...(typeof req.seller?.id === 'string') ? { seller: { id: { $eq: req.seller.id } } } : undefined // req.seller.idを考慮
22
+ };
23
+ const acceptedOffers = await orderRepo.searchAcceptedOffers(searchConditions, ['itemOffered', 'id']);
24
+ // tslint:disable-next-line:no-null-keyword
25
+ console.dir(acceptedOffers, { depth: 1 });
26
+ const reservationIds = acceptedOffers.map((acceptedOffer) => {
27
+ if (acceptedOffer.itemOffered.typeOf === chevre.factory.reservationType.EventReservation) {
28
+ return acceptedOffer.itemOffered.id;
29
+ } else {
30
+ return '';
31
+ }
32
+ });
33
+ console.log('reservationIds:', reservationIds);
34
+ }
35
+
36
+ main()
37
+ .then()
38
+ .catch(console.error);
@@ -122,7 +122,7 @@ export declare class MongoRepository {
122
122
  };
123
123
  object?: {
124
124
  typeOf?: {
125
- $eq?: factory.action.authorize.offer.seatReservation.ObjectType.SeatReservation | factory.action.authorize.paymentMethod.any.ResultType.Payment;
125
+ $eq?: factory.action.authorize.offer.eventService.ObjectType.SeatReservation | factory.action.authorize.paymentMethod.any.ResultType.Payment;
126
126
  };
127
127
  paymentMethodId?: {
128
128
  $eq?: string;
@@ -147,9 +147,9 @@ export declare class MongoRepository {
147
147
  }): Promise<void>;
148
148
  updateAuthorizeEventOfferAction<T extends factory.service.webAPI.Identifier>(params: {
149
149
  id: string;
150
- object: factory.action.authorize.offer.seatReservation.IObject<T>;
151
- result: factory.action.authorize.offer.seatReservation.IResult<T>;
152
- }): Promise<factory.action.authorize.offer.seatReservation.IAction<T>>;
150
+ object: factory.action.authorize.offer.eventService.IObject<T>;
151
+ result: factory.action.authorize.offer.eventService.IResult<T>;
152
+ }): Promise<factory.action.authorize.offer.eventService.IAction<T>>;
153
153
  updateById(params: {
154
154
  id: string;
155
155
  update: any;
@@ -783,7 +783,7 @@ class MongoRepository {
783
783
  $lte: params.startThrough
784
784
  }, typeOf: { $eq: params.typeOf }, actionStatus: { $eq: actionStatus }, 'object.typeOf': {
785
785
  $exists: true,
786
- $eq: factory.action.authorize.offer.seatReservation.ObjectType.SeatReservation
786
+ $eq: factory.action.authorize.offer.eventService.ObjectType.SeatReservation
787
787
  } }, (typeof ((_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$ne) === 'string')
788
788
  ? { 'project.id': { $ne: params.project.id.$ne } }
789
789
  : undefined);
@@ -22,7 +22,7 @@ class MongoRepository {
22
22
  }
23
23
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
24
24
  static CREATE_AGGREGATE_OFFERS_MATCH_CONDITIONS(params) {
25
- 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, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36;
25
+ 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, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42;
26
26
  const matchStages = [];
27
27
  const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
28
28
  if (typeof projectIdEq === 'string') {
@@ -204,7 +204,18 @@ class MongoRepository {
204
204
  }
205
205
  });
206
206
  }
207
- const appliesToMovieTicketServiceOutputTypeOfNin = (_7 = (_6 = (_5 = (_4 = params.priceSpecification) === null || _4 === void 0 ? void 0 : _4.appliesToMovieTicket) === null || _5 === void 0 ? void 0 : _5.serviceOutput) === null || _6 === void 0 ? void 0 : _6.typeOf) === null || _7 === void 0 ? void 0 : _7.$nin;
207
+ const appliesToMovieTicketServiceOutputTypeOfAll = (_7 = (_6 = (_5 = (_4 = params.priceSpecification) === null || _4 === void 0 ? void 0 : _4.appliesToMovieTicket) === null || _5 === void 0 ? void 0 : _5.serviceOutput) === null || _6 === void 0 ? void 0 : _6.typeOf) === null || _7 === void 0 ? void 0 : _7.$all;
208
+ if (Array.isArray(appliesToMovieTicketServiceOutputTypeOfAll)) {
209
+ matchStages.push({
210
+ $match: {
211
+ 'offers.priceSpecification.appliesToMovieTicket.serviceOutput.typeOf': {
212
+ $exists: true,
213
+ $all: appliesToMovieTicketServiceOutputTypeOfAll
214
+ }
215
+ }
216
+ });
217
+ }
218
+ const appliesToMovieTicketServiceOutputTypeOfNin = (_11 = (_10 = (_9 = (_8 = params.priceSpecification) === null || _8 === void 0 ? void 0 : _8.appliesToMovieTicket) === null || _9 === void 0 ? void 0 : _9.serviceOutput) === null || _10 === void 0 ? void 0 : _10.typeOf) === null || _11 === void 0 ? void 0 : _11.$nin;
208
219
  if (Array.isArray(appliesToMovieTicketServiceOutputTypeOfNin)) {
209
220
  matchStages.push({
210
221
  $match: {
@@ -215,7 +226,7 @@ class MongoRepository {
215
226
  });
216
227
  }
217
228
  if (params.priceSpecification !== undefined && params.priceSpecification !== null) {
218
- const priceSpecificationPriceGte = (_8 = params.priceSpecification.price) === null || _8 === void 0 ? void 0 : _8.$gte;
229
+ const priceSpecificationPriceGte = (_12 = params.priceSpecification.price) === null || _12 === void 0 ? void 0 : _12.$gte;
219
230
  if (typeof priceSpecificationPriceGte === 'number') {
220
231
  matchStages.push({
221
232
  $match: {
@@ -226,7 +237,7 @@ class MongoRepository {
226
237
  }
227
238
  });
228
239
  }
229
- const priceSpecificationPriceLte = (_9 = params.priceSpecification.price) === null || _9 === void 0 ? void 0 : _9.$lte;
240
+ const priceSpecificationPriceLte = (_13 = params.priceSpecification.price) === null || _13 === void 0 ? void 0 : _13.$lte;
230
241
  if (typeof priceSpecificationPriceLte === 'number') {
231
242
  matchStages.push({
232
243
  $match: {
@@ -237,7 +248,7 @@ class MongoRepository {
237
248
  }
238
249
  });
239
250
  }
240
- const accountsReceivableGte = (_11 = (_10 = params.priceSpecification.accounting) === null || _10 === void 0 ? void 0 : _10.accountsReceivable) === null || _11 === void 0 ? void 0 : _11.$gte;
251
+ const accountsReceivableGte = (_15 = (_14 = params.priceSpecification.accounting) === null || _14 === void 0 ? void 0 : _14.accountsReceivable) === null || _15 === void 0 ? void 0 : _15.$gte;
241
252
  if (typeof accountsReceivableGte === 'number') {
242
253
  matchStages.push({
243
254
  $match: {
@@ -248,7 +259,7 @@ class MongoRepository {
248
259
  }
249
260
  });
250
261
  }
251
- const accountsReceivableLte = (_13 = (_12 = params.priceSpecification.accounting) === null || _12 === void 0 ? void 0 : _12.accountsReceivable) === null || _13 === void 0 ? void 0 : _13.$lte;
262
+ const accountsReceivableLte = (_17 = (_16 = params.priceSpecification.accounting) === null || _16 === void 0 ? void 0 : _16.accountsReceivable) === null || _17 === void 0 ? void 0 : _17.$lte;
252
263
  if (typeof accountsReceivableLte === 'number') {
253
264
  matchStages.push({
254
265
  $match: {
@@ -259,7 +270,7 @@ class MongoRepository {
259
270
  }
260
271
  });
261
272
  }
262
- const accountingCodeValueEq = (_16 = (_15 = (_14 = params.priceSpecification.accounting) === null || _14 === void 0 ? void 0 : _14.operatingRevenue) === null || _15 === void 0 ? void 0 : _15.codeValue) === null || _16 === void 0 ? void 0 : _16.$eq;
273
+ const accountingCodeValueEq = (_20 = (_19 = (_18 = params.priceSpecification.accounting) === null || _18 === void 0 ? void 0 : _18.operatingRevenue) === null || _19 === void 0 ? void 0 : _19.codeValue) === null || _20 === void 0 ? void 0 : _20.$eq;
263
274
  if (typeof accountingCodeValueEq === 'string') {
264
275
  matchStages.push({
265
276
  $match: {
@@ -270,7 +281,7 @@ class MongoRepository {
270
281
  }
271
282
  });
272
283
  }
273
- const accountingCodeValueIn = (_19 = (_18 = (_17 = params.priceSpecification.accounting) === null || _17 === void 0 ? void 0 : _17.operatingRevenue) === null || _18 === void 0 ? void 0 : _18.codeValue) === null || _19 === void 0 ? void 0 : _19.$in;
284
+ const accountingCodeValueIn = (_23 = (_22 = (_21 = params.priceSpecification.accounting) === null || _21 === void 0 ? void 0 : _21.operatingRevenue) === null || _22 === void 0 ? void 0 : _22.codeValue) === null || _23 === void 0 ? void 0 : _23.$in;
274
285
  if (Array.isArray(accountingCodeValueIn)) {
275
286
  matchStages.push({
276
287
  $match: {
@@ -281,7 +292,7 @@ class MongoRepository {
281
292
  }
282
293
  });
283
294
  }
284
- const referenceQuantityValueEq = (_21 = (_20 = params.priceSpecification.referenceQuantity) === null || _20 === void 0 ? void 0 : _20.value) === null || _21 === void 0 ? void 0 : _21.$eq;
295
+ const referenceQuantityValueEq = (_25 = (_24 = params.priceSpecification.referenceQuantity) === null || _24 === void 0 ? void 0 : _24.value) === null || _25 === void 0 ? void 0 : _25.$eq;
285
296
  if (typeof referenceQuantityValueEq === 'number') {
286
297
  matchStages.push({
287
298
  $match: {
@@ -293,7 +304,7 @@ class MongoRepository {
293
304
  });
294
305
  }
295
306
  }
296
- const availabilityEq = (_22 = params.availability) === null || _22 === void 0 ? void 0 : _22.$eq;
307
+ const availabilityEq = (_26 = params.availability) === null || _26 === void 0 ? void 0 : _26.$eq;
297
308
  if (typeof availabilityEq === 'string') {
298
309
  matchStages.push({
299
310
  $match: {
@@ -301,7 +312,7 @@ class MongoRepository {
301
312
  }
302
313
  });
303
314
  }
304
- const availableAtOrFromIdEq = (_24 = (_23 = params.availableAtOrFrom) === null || _23 === void 0 ? void 0 : _23.id) === null || _24 === void 0 ? void 0 : _24.$eq;
315
+ const availableAtOrFromIdEq = (_28 = (_27 = params.availableAtOrFrom) === null || _27 === void 0 ? void 0 : _27.id) === null || _28 === void 0 ? void 0 : _28.$eq;
305
316
  if (typeof availableAtOrFromIdEq === 'string') {
306
317
  matchStages.push({
307
318
  $match: {
@@ -312,7 +323,7 @@ class MongoRepository {
312
323
  }
313
324
  });
314
325
  }
315
- const availableAtOrFromIdIn = (_26 = (_25 = params.availableAtOrFrom) === null || _25 === void 0 ? void 0 : _25.id) === null || _26 === void 0 ? void 0 : _26.$in;
326
+ const availableAtOrFromIdIn = (_30 = (_29 = params.availableAtOrFrom) === null || _29 === void 0 ? void 0 : _29.id) === null || _30 === void 0 ? void 0 : _30.$in;
316
327
  if (Array.isArray(availableAtOrFromIdIn)) {
317
328
  matchStages.push({
318
329
  $match: {
@@ -323,7 +334,7 @@ class MongoRepository {
323
334
  }
324
335
  });
325
336
  }
326
- const addOnItemOfferedIdEq = (_29 = (_28 = (_27 = params.addOn) === null || _27 === void 0 ? void 0 : _27.itemOffered) === null || _28 === void 0 ? void 0 : _28.id) === null || _29 === void 0 ? void 0 : _29.$eq;
337
+ const addOnItemOfferedIdEq = (_33 = (_32 = (_31 = params.addOn) === null || _31 === void 0 ? void 0 : _31.itemOffered) === null || _32 === void 0 ? void 0 : _32.id) === null || _33 === void 0 ? void 0 : _33.$eq;
327
338
  if (typeof addOnItemOfferedIdEq === 'string') {
328
339
  matchStages.push({
329
340
  $match: {
@@ -331,7 +342,7 @@ class MongoRepository {
331
342
  }
332
343
  });
333
344
  }
334
- const addOnItemOfferedIdIn = (_32 = (_31 = (_30 = params.addOn) === null || _30 === void 0 ? void 0 : _30.itemOffered) === null || _31 === void 0 ? void 0 : _31.id) === null || _32 === void 0 ? void 0 : _32.$in;
345
+ const addOnItemOfferedIdIn = (_36 = (_35 = (_34 = params.addOn) === null || _34 === void 0 ? void 0 : _34.itemOffered) === null || _35 === void 0 ? void 0 : _35.id) === null || _36 === void 0 ? void 0 : _36.$in;
335
346
  if (Array.isArray(addOnItemOfferedIdIn)) {
336
347
  matchStages.push({
337
348
  $match: {
@@ -339,7 +350,7 @@ class MongoRepository {
339
350
  }
340
351
  });
341
352
  }
342
- const hasMerchantReturnPolicyIdEq = (_34 = (_33 = params.hasMerchantReturnPolicy) === null || _33 === void 0 ? void 0 : _33.id) === null || _34 === void 0 ? void 0 : _34.$eq;
353
+ const hasMerchantReturnPolicyIdEq = (_38 = (_37 = params.hasMerchantReturnPolicy) === null || _37 === void 0 ? void 0 : _37.id) === null || _38 === void 0 ? void 0 : _38.$eq;
343
354
  if (typeof hasMerchantReturnPolicyIdEq === 'string') {
344
355
  matchStages.push({
345
356
  $match: {
@@ -350,7 +361,18 @@ class MongoRepository {
350
361
  }
351
362
  });
352
363
  }
353
- const additionalPropertyAll = (_35 = params.additionalProperty) === null || _35 === void 0 ? void 0 : _35.$all;
364
+ const acceptedPaymentMethodIdentifierIn = (_40 = (_39 = params.acceptedPaymentMethod) === null || _39 === void 0 ? void 0 : _39.identifier) === null || _40 === void 0 ? void 0 : _40.$in;
365
+ if (Array.isArray(acceptedPaymentMethodIdentifierIn)) {
366
+ matchStages.push({
367
+ $match: {
368
+ 'offers.acceptedPaymentMethod.identifier': {
369
+ $exists: true,
370
+ $in: acceptedPaymentMethodIdentifierIn
371
+ }
372
+ }
373
+ });
374
+ }
375
+ const additionalPropertyAll = (_41 = params.additionalProperty) === null || _41 === void 0 ? void 0 : _41.$all;
354
376
  if (Array.isArray(additionalPropertyAll)) {
355
377
  matchStages.push({
356
378
  $match: {
@@ -361,7 +383,7 @@ class MongoRepository {
361
383
  }
362
384
  });
363
385
  }
364
- const additionalPropertyElemMatch = (_36 = params.additionalProperty) === null || _36 === void 0 ? void 0 : _36.$elemMatch;
386
+ const additionalPropertyElemMatch = (_42 = params.additionalProperty) === null || _42 === void 0 ? void 0 : _42.$elemMatch;
365
387
  if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
366
388
  matchStages.push({
367
389
  $match: {
@@ -1,5 +1,5 @@
1
1
  import { IndexDefinition, IndexOptions, Schema } from 'mongoose';
2
2
  declare const modelName = "AggregateOffer";
3
- declare function createSchema(): Schema;
4
3
  declare const indexes: [d: IndexDefinition, o: IndexOptions][];
4
+ declare function createSchema(): Schema;
5
5
  export { modelName, indexes, createSchema };
@@ -39,17 +39,6 @@ const schemaOptions = {
39
39
  versionKey: false
40
40
  }
41
41
  };
42
- /**
43
- * 集計オファースキーマ
44
- */
45
- let schema;
46
- function createSchema() {
47
- if (schema === undefined) {
48
- schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
49
- }
50
- return schema;
51
- }
52
- exports.createSchema = createSchema;
53
42
  const indexes = [
54
43
  [
55
44
  { createdAt: 1 },
@@ -288,6 +277,31 @@ const indexes = [
288
277
  'offers.validThrough': { $exists: true }
289
278
  }
290
279
  }
280
+ ],
281
+ [
282
+ { 'offers.acceptedPaymentMethod.identifier': 1 },
283
+ {
284
+ name: 'searchByOffersAcceptedPaymentMethodIdentifier',
285
+ partialFilterExpression: {
286
+ 'offers.acceptedPaymentMethod.identifier': { $exists: true }
287
+ }
288
+ }
291
289
  ]
292
290
  ];
293
291
  exports.indexes = indexes;
292
+ /**
293
+ * 集計オファースキーマ
294
+ */
295
+ let schema;
296
+ function createSchema() {
297
+ if (schema === undefined) {
298
+ schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
299
+ if (settings_1.MONGO_AUTO_INDEX) {
300
+ indexes.forEach((indexParams) => {
301
+ schema === null || schema === void 0 ? void 0 : schema.index(...indexParams);
302
+ });
303
+ }
304
+ }
305
+ return schema;
306
+ }
307
+ exports.createSchema = createSchema;
@@ -11,6 +11,22 @@ export type IUnitPriceOfferFromAggregateOffer = factory.unitPriceOffer.IUnitPric
11
11
  id: string;
12
12
  };
13
13
  };
14
+ export interface IPriceSpecificationConditionsOnSearchWithSortIndex {
15
+ appliesToMovieTicket?: {
16
+ serviceType?: {
17
+ $exists?: boolean;
18
+ };
19
+ serviceOutput?: {
20
+ /**
21
+ * 適用決済方法タイプ
22
+ */
23
+ typeOf?: {
24
+ $eq?: string;
25
+ $all?: string[];
26
+ };
27
+ };
28
+ };
29
+ }
14
30
  /**
15
31
  * 単価オファーリポジトリ
16
32
  */
@@ -83,7 +99,7 @@ export declare class MongoRepository {
83
99
  /**
84
100
  * 適用決済カード条件
85
101
  */
86
- priceSpecification: Pick<factory.unitPriceOffer.IPriceSpecificationSearchConditions, 'appliesToMovieTicket'>;
102
+ priceSpecification: IPriceSpecificationConditionsOnSearchWithSortIndex;
87
103
  onlyValid?: boolean;
88
104
  useIncludeInDataCatalog: boolean;
89
105
  limit?: number;