@chevre/domain 22.7.0-alpha.11 → 22.7.0-alpha.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,36 @@
1
+ // tslint:disable:no-console
2
+ /**
3
+ * イベント集計タスク実行
4
+ */
5
+ import { chevre } from '../../../lib/index';
6
+
7
+ import * as mongoose from 'mongoose';
8
+
9
+ export async function main() {
10
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
11
+
12
+ const offerCatalogRepo = await chevre.repository.OfferCatalog.createInstance(mongoose.connection);
13
+ const offerCatalogItemRepo = await chevre.repository.OfferCatalogItem.createInstance(mongoose.connection);
14
+
15
+ const result = await offerCatalogRepo.aggregateItemList({ itemListElement: { typeOf: { $eq: chevre.factory.offerType.Offer } } });
16
+ // tslint:disable-next-line:no-null-keyword
17
+ console.dir(result, { depth: null });
18
+
19
+ const result2 = await offerCatalogRepo.aggregateItemList({ itemListElement: { typeOf: { $eq: 'OfferCatalog' } } });
20
+ // tslint:disable-next-line:no-null-keyword
21
+ console.dir(result2, { depth: null });
22
+
23
+ const result3 = await offerCatalogItemRepo.aggregateItemList({ itemListElement: { typeOf: { $eq: chevre.factory.offerType.Offer } } });
24
+ // tslint:disable-next-line:no-null-keyword
25
+ console.dir(result3, { depth: null });
26
+
27
+ const result4 = await offerCatalogItemRepo.aggregateItemList({ itemListElement: { typeOf: { $eq: 'OfferCatalog' } } });
28
+ // tslint:disable-next-line:no-null-keyword
29
+ console.dir(result4, { depth: null });
30
+ }
31
+
32
+ main()
33
+ .then(() => {
34
+ console.log('success!');
35
+ })
36
+ .catch(console.error);
@@ -174,5 +174,14 @@ export declare class OfferCatalogRepo {
174
174
  filter: FilterQuery<factory.offerCatalog.IOfferCatalog>;
175
175
  $unset: any;
176
176
  }): Promise<import("mongoose").UpdateWriteOpResult>;
177
+ aggregateItemList(params: {
178
+ itemListElement: {
179
+ typeOf: {
180
+ $eq: factory.offerType.Offer | 'OfferCatalog';
181
+ };
182
+ };
183
+ }): Promise<{
184
+ aggregation: any;
185
+ }>;
177
186
  }
178
187
  export {};
@@ -477,5 +477,41 @@ class OfferCatalogRepo {
477
477
  .exec();
478
478
  });
479
479
  }
480
+ aggregateItemList(params) {
481
+ return __awaiter(this, void 0, void 0, function* () {
482
+ const matchConditions = {
483
+ 'itemListElement.typeOf': { $eq: params.itemListElement.typeOf.$eq }
484
+ };
485
+ const aggregations = yield this.offerCatalogModel.aggregate([
486
+ { $match: matchConditions },
487
+ {
488
+ $project: {
489
+ numItemListElement: { $size: '$itemListElement' }
490
+ }
491
+ },
492
+ {
493
+ $group: {
494
+ _id: '$typeOf',
495
+ maxNumItemListElement: { $max: '$numItemListElement' },
496
+ minNumItemListElement: { $min: '$numItemListElement' }
497
+ }
498
+ },
499
+ {
500
+ $project: {
501
+ _id: 0,
502
+ maxNumItemListElement: '$maxNumItemListElement',
503
+ minNumItemListElement: '$minNumItemListElement'
504
+ }
505
+ }
506
+ ])
507
+ .exec();
508
+ if (aggregations.length === 0) {
509
+ return {
510
+ aggregation: {}
511
+ };
512
+ }
513
+ return { aggregation: aggregations[0] };
514
+ });
515
+ }
480
516
  }
481
517
  exports.OfferCatalogRepo = OfferCatalogRepo;
@@ -122,5 +122,14 @@ export declare class OfferCatalogItemRepo {
122
122
  filter: FilterQuery<factory.offerCatalog.IOfferCatalog>;
123
123
  $unset: any;
124
124
  }): Promise<import("mongoose").UpdateWriteOpResult>;
125
+ aggregateItemList(params: {
126
+ itemListElement: {
127
+ typeOf: {
128
+ $eq: factory.offerType.Offer | 'OfferCatalog';
129
+ };
130
+ };
131
+ }): Promise<{
132
+ aggregation: any;
133
+ }>;
125
134
  }
126
135
  export {};
@@ -398,5 +398,41 @@ class OfferCatalogItemRepo {
398
398
  .exec();
399
399
  });
400
400
  }
401
+ aggregateItemList(params) {
402
+ return __awaiter(this, void 0, void 0, function* () {
403
+ const matchConditions = {
404
+ 'itemListElement.typeOf': { $eq: params.itemListElement.typeOf.$eq }
405
+ };
406
+ const aggregations = yield this.offerCatalogItemModel.aggregate([
407
+ { $match: matchConditions },
408
+ {
409
+ $project: {
410
+ numItemListElement: { $size: '$itemListElement' }
411
+ }
412
+ },
413
+ {
414
+ $group: {
415
+ _id: '$typeOf',
416
+ maxNumItemListElement: { $max: '$numItemListElement' },
417
+ minNumItemListElement: { $min: '$numItemListElement' }
418
+ }
419
+ },
420
+ {
421
+ $project: {
422
+ _id: 0,
423
+ maxNumItemListElement: '$maxNumItemListElement',
424
+ minNumItemListElement: '$minNumItemListElement'
425
+ }
426
+ }
427
+ ])
428
+ .exec();
429
+ if (aggregations.length === 0) {
430
+ return {
431
+ aggregation: {}
432
+ };
433
+ }
434
+ return { aggregation: aggregations[0] };
435
+ });
436
+ }
401
437
  }
402
438
  exports.OfferCatalogItemRepo = OfferCatalogItemRepo;
@@ -17,7 +17,6 @@ function createPrice(params) {
17
17
  name: priceSpec.name,
18
18
  price: priceSpec.price,
19
19
  priceCurrency: priceSpec.priceCurrency,
20
- // project: priceSpec.project,
21
20
  typeOf: priceSpec.typeOf,
22
21
  appliesToCategoryCode: priceSpec.appliesToCategoryCode,
23
22
  valueAddedTaxIncluded: priceSpec.valueAddedTaxIncluded
@@ -30,8 +29,6 @@ function createPrice(params) {
30
29
  ];
31
30
  return {
32
31
  priceCurrency: params.ticketOffer.priceSpecification.priceCurrency,
33
- // 不要な属性を除外(2022-11-02~)
34
- // project: params.ticketOffer.priceSpecification.project,
35
32
  typeOf: params.ticketOffer.priceSpecification.typeOf,
36
33
  valueAddedTaxIncluded: params.ticketOffer.priceSpecification.valueAddedTaxIncluded,
37
34
  priceComponent: priceComponent4reservation
@@ -82,6 +79,8 @@ function createPriceSpecsByEventOffer(params) {
82
79
  else if (typeof ((_a = params.appliesToMovieTicket) === null || _a === void 0 ? void 0 : _a.identifier) === 'string') {
83
80
  appliesToMovieTicketSpecifiedAsArray = [params.appliesToMovieTicket];
84
81
  }
82
+ let categoryCodeChargePriceComponent;
83
+ let movieTicketChargePriceComponent;
85
84
  // 予約のpriceComponentを必要最低限に最適化
86
85
  return params.ticketOffer.priceSpecification.priceComponent.map((priceSpec) => {
87
86
  if (priceSpec.typeOf === factory.priceSpecificationType.UnitPriceSpecification) {
@@ -92,31 +91,30 @@ function createPriceSpecsByEventOffer(params) {
92
91
  });
93
92
  }
94
93
  else if (priceSpec.typeOf === factory.priceSpecificationType.MovieTicketTypeChargeSpecification) {
95
- return {
94
+ movieTicketChargePriceComponent = {
96
95
  name: priceSpec.name,
97
96
  price: priceSpec.price,
98
97
  priceCurrency: priceSpec.priceCurrency,
99
- // project: priceSpec.project,
100
98
  typeOf: priceSpec.typeOf,
101
99
  appliesToVideoFormat: priceSpec.appliesToVideoFormat,
102
100
  valueAddedTaxIncluded: priceSpec.valueAddedTaxIncluded,
103
- // MovieTicketTypeChargeSpecificationの場合、appliesToMovieTicketは必ず存在する(2022-06-02~)
104
101
  appliesToMovieTicket: priceSpec.appliesToMovieTicket
105
102
  };
103
+ return movieTicketChargePriceComponent;
106
104
  }
107
105
  else if (priceSpec.typeOf === factory.priceSpecificationType.CategoryCodeChargeSpecification) {
108
- return {
106
+ categoryCodeChargePriceComponent = {
109
107
  name: priceSpec.name,
110
108
  price: priceSpec.price,
111
109
  priceCurrency: priceSpec.priceCurrency,
112
- // project: priceSpec.project,
113
110
  typeOf: priceSpec.typeOf,
114
111
  appliesToCategoryCode: priceSpec.appliesToCategoryCode,
115
112
  valueAddedTaxIncluded: priceSpec.valueAddedTaxIncluded
116
113
  };
114
+ return categoryCodeChargePriceComponent;
117
115
  }
118
116
  else {
119
- return priceSpec;
117
+ throw new factory.errors.NotImplemented(`priceSpec.typeOf not implemented. ticketOffer: ${params.ticketOffer.id}`);
120
118
  }
121
119
  });
122
120
  }
@@ -126,8 +124,6 @@ function createPriceSpecsByEventOffer(params) {
126
124
  function eventOfferUnitPriceSpec2reservationUnitPriceSpec(params) {
127
125
  var _a;
128
126
  const priceSpec = params.unitPriceSpec;
129
- // 予約単価仕様の適用決済カードをArray化(2022-07-27~)
130
- // let appliesToMovieTicket: factory.priceSpecification.unitPrice.IAppliesToMovieTicket | undefined;
131
127
  let appliesToMovieTicket;
132
128
  // 複数決済カード対応(2022-07-11~)
133
129
  const priceSpecificationAppliesToMovieTicket = priceSpec.appliesToMovieTicket;
@@ -167,10 +163,6 @@ function eventOfferUnitPriceSpec2reservationUnitPriceSpec(params) {
167
163
  }
168
164
  else {
169
165
  // appliesToMovieTicketがArrayでないケースは廃止(2022-09-12~)
170
- // if (typeof priceSpecificationAppliesToMovieTicket?.typeOf === 'string') {
171
- // // Arrayでない場合を廃止(2022-08-01~)
172
- // throw new factory.errors.NotImplemented('appliesToMovieTickets.typeOf as string not implemented');
173
- // }
174
166
  }
175
167
  let accounting4reservation;
176
168
  const accounting = priceSpec.accounting;
@@ -180,14 +172,11 @@ function eventOfferUnitPriceSpec2reservationUnitPriceSpec(params) {
180
172
  : undefined), (typeof ((_a = accounting.operatingRevenue) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
181
173
  ? {
182
174
  operatingRevenue: {
183
- // project: accounting.operatingRevenue.project, // 削除(2023-12-13~)
184
175
  typeOf: accounting.operatingRevenue.typeOf,
185
176
  codeValue: accounting.operatingRevenue.codeValue
186
177
  }
187
178
  }
188
179
  : undefined);
189
180
  }
190
- return Object.assign(Object.assign({ name: priceSpec.name, price: priceSpec.price, priceCurrency: priceSpec.priceCurrency,
191
- // project: priceSpec.project,
192
- referenceQuantity: priceSpec.referenceQuantity, typeOf: priceSpec.typeOf, valueAddedTaxIncluded: priceSpec.valueAddedTaxIncluded }, (Array.isArray(appliesToMovieTicket)) ? { appliesToMovieTicket } : undefined), (typeof (accounting4reservation === null || accounting4reservation === void 0 ? void 0 : accounting4reservation.typeOf) === 'string') ? { accounting: accounting4reservation } : undefined);
181
+ return Object.assign(Object.assign({ name: priceSpec.name, price: priceSpec.price, priceCurrency: priceSpec.priceCurrency, referenceQuantity: priceSpec.referenceQuantity, typeOf: priceSpec.typeOf, valueAddedTaxIncluded: priceSpec.valueAddedTaxIncluded }, (Array.isArray(appliesToMovieTicket)) ? { appliesToMovieTicket } : undefined), (typeof (accounting4reservation === null || accounting4reservation === void 0 ? void 0 : accounting4reservation.typeOf) === 'string') ? { accounting: accounting4reservation } : undefined);
193
182
  }
@@ -217,21 +217,26 @@ function responseBody2acceptedOffers4result(params) {
217
217
  const priceSpecification = itemOffered.price;
218
218
  const priceComponent = priceSpecification.priceComponent.map((c) => {
219
219
  var _a;
220
- const accounting = c.accounting;
221
- return Object.assign(Object.assign({}, c), (typeof (accounting === null || accounting === void 0 ? void 0 : accounting.typeOf) === 'string')
222
- ? {
223
- accounting: Object.assign(Object.assign({ typeOf: accounting.typeOf }, (typeof accounting.accountsReceivable === 'number')
224
- ? { accountsReceivable: accounting.accountsReceivable }
225
- : undefined), (typeof ((_a = accounting.operatingRevenue) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
226
- ? {
227
- operatingRevenue: {
228
- typeOf: accounting.operatingRevenue.typeOf,
229
- codeValue: accounting.operatingRevenue.codeValue
220
+ if (c.typeOf === factory.priceSpecificationType.UnitPriceSpecification) {
221
+ const accounting = c.accounting;
222
+ return Object.assign(Object.assign({}, c), (typeof (accounting === null || accounting === void 0 ? void 0 : accounting.typeOf) === 'string')
223
+ ? {
224
+ accounting: Object.assign(Object.assign({ typeOf: accounting.typeOf }, (typeof accounting.accountsReceivable === 'number')
225
+ ? { accountsReceivable: accounting.accountsReceivable }
226
+ : undefined), (typeof ((_a = accounting.operatingRevenue) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
227
+ ? {
228
+ operatingRevenue: {
229
+ typeOf: accounting.operatingRevenue.typeOf,
230
+ codeValue: accounting.operatingRevenue.codeValue
231
+ }
230
232
  }
231
- }
232
- : undefined)
233
- }
234
- : undefined);
233
+ : undefined)
234
+ }
235
+ : undefined);
236
+ }
237
+ else {
238
+ return c;
239
+ }
235
240
  });
236
241
  // tslint:disable-next-line:no-unnecessary-local-variable
237
242
  const resultAcceptedOffer = {
@@ -10,10 +10,11 @@ interface IAcceptRepos {
10
10
  reserveService: COA.service.Reserve;
11
11
  masterService: COA.service.Master;
12
12
  }
13
- type IAccepteOfferParams = Pick<factory.task.acceptCOAOffer.IData, 'object' | 'potentialActions' | 'purpose'> & {
13
+ type IAccepteOfferParams = Pick<factory.task.acceptCOAOffer.IData, 'object' | 'potentialActions' | 'purpose' | 'agent'> & {
14
14
  sameAs: {
15
15
  id: string;
16
16
  };
17
+ isMember: boolean;
17
18
  };
18
19
  /**
19
20
  * COA興行オファー採用
@@ -58,7 +58,8 @@ function acceptOffer(params) {
58
58
  project: transaction.project,
59
59
  typeOf: factory.actionType.AcceptAction,
60
60
  object: params.object,
61
- agent: { id: transaction.agent.id, typeOf: transaction.agent.typeOf },
61
+ // agent: { id: transaction.agent.id, typeOf: transaction.agent.typeOf },
62
+ agent: { id: params.agent.id, typeOf: params.agent.typeOf },
62
63
  purpose: { id: transaction.id, typeOf: transaction.typeOf },
63
64
  sameAs: { id: params.sameAs.id, typeOf: 'Task' },
64
65
  potentialActions: params.potentialActions,
@@ -76,7 +77,9 @@ function acceptOffer(params) {
76
77
  acceptedOffer = yield (0, authorize_1.validateOffers)(coaInfo, acceptedOffersWithoutDetails, {
77
78
  identifier: params.object.appliesToSurfrock.identifier,
78
79
  serviceOutput: { typeOf: params.object.appliesToSurfrock.serviceOutput.typeOf }
79
- }, params.object.flgMember)({
80
+ },
81
+ // params.object.flgMember
82
+ (params.isMember) ? factory.action.accept.coaOffer.FlgMember.Member : factory.action.accept.coaOffer.FlgMember.NonMember)({
80
83
  reserveService: repos.reserveService,
81
84
  masterService: repos.masterService
82
85
  });
@@ -132,7 +135,8 @@ function reAcceptOffer(params) {
132
135
  project: transaction.project,
133
136
  typeOf: factory.actionType.AcceptAction,
134
137
  object: params.object,
135
- agent: { id: transaction.agent.id, typeOf: transaction.agent.typeOf },
138
+ // agent: { id: transaction.agent.id, typeOf: transaction.agent.typeOf },
139
+ agent: { id: params.agent.id, typeOf: params.agent.typeOf },
136
140
  purpose: { id: transaction.id, typeOf: transaction.typeOf },
137
141
  sameAs: { id: params.sameAs.id, typeOf: 'Task' },
138
142
  potentialActions: params.potentialActions,
@@ -148,7 +152,9 @@ function reAcceptOffer(params) {
148
152
  acceptedOffer = yield (0, authorize_1.validateOffers)(coaInfo, acceptedOffersWithoutDetails, {
149
153
  identifier: params.object.appliesToSurfrock.identifier,
150
154
  serviceOutput: { typeOf: params.object.appliesToSurfrock.serviceOutput.typeOf }
151
- }, params.object.flgMember)({
155
+ },
156
+ // params.object.flgMember
157
+ (params.isMember) ? factory.action.accept.coaOffer.FlgMember.Member : factory.action.accept.coaOffer.FlgMember.NonMember)({
152
158
  reserveService: repos.reserveService,
153
159
  masterService: repos.masterService
154
160
  });
@@ -3,12 +3,29 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createCompoundPriceSpec4event = void 0;
4
4
  const factory = require("../../factory");
5
5
  function categoryCodeChargePriceSpec2component(params) {
6
- var _a;
7
- return Object.assign({ id: params.id, typeOf: params.typeOf, name: params.name, price: params.price, priceCurrency: params.priceCurrency, valueAddedTaxIncluded: params.valueAddedTaxIncluded, appliesToCategoryCode: params.appliesToCategoryCode }, (typeof ((_a = params.accounting) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { accounting: params.accounting } : undefined);
6
+ return {
7
+ id: params.id,
8
+ typeOf: params.typeOf,
9
+ name: params.name,
10
+ price: params.price,
11
+ priceCurrency: params.priceCurrency,
12
+ valueAddedTaxIncluded: params.valueAddedTaxIncluded,
13
+ appliesToCategoryCode: params.appliesToCategoryCode
14
+ // ...(typeof params.accounting?.typeOf === 'string') ? { accounting: params.accounting } : undefined // 不要(2024-12-15~)
15
+ };
8
16
  }
9
17
  function mvtkChargePriceSpec2component(params) {
10
- var _a;
11
- return Object.assign({ id: params.id, typeOf: params.typeOf, name: params.name, price: params.price, priceCurrency: params.priceCurrency, valueAddedTaxIncluded: params.valueAddedTaxIncluded, appliesToVideoFormat: params.appliesToVideoFormat, appliesToMovieTicket: params.appliesToMovieTicket }, (typeof ((_a = params.accounting) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { accounting: params.accounting } : undefined);
18
+ return {
19
+ id: params.id,
20
+ typeOf: params.typeOf,
21
+ name: params.name,
22
+ price: params.price,
23
+ priceCurrency: params.priceCurrency,
24
+ valueAddedTaxIncluded: params.valueAddedTaxIncluded,
25
+ appliesToVideoFormat: params.appliesToVideoFormat,
26
+ appliesToMovieTicket: params.appliesToMovieTicket
27
+ // ...(typeof params.accounting?.typeOf === 'string') ? { accounting: params.accounting } : undefined // 不要(2024-12-15~)
28
+ };
12
29
  }
13
30
  // tslint:disable-next-line:max-func-body-length
14
31
  function createCompoundPriceSpec4event(params) {
@@ -17,7 +34,6 @@ function createCompoundPriceSpec4event(params) {
17
34
  if (params.offer.priceSpecification === undefined) {
18
35
  throw new factory.errors.NotFound(`priceSpecification of the offer: ${params.offer.id}`);
19
36
  }
20
- const unitPriceSpec = Object.assign(Object.assign({}, params.offer.priceSpecification), { name: params.offer.name });
21
37
  let videoFormatChargeSpecComponents = [];
22
38
  let soundFormatChargeSpecComponents = [];
23
39
  // 区分加算料金を適用しないオプションを追加(2023-01-26~)
@@ -26,6 +42,7 @@ function createCompoundPriceSpec4event(params) {
26
42
  videoFormatChargeSpecComponents = params.videoFormatChargeSpecs.map(categoryCodeChargePriceSpec2component);
27
43
  soundFormatChargeSpecComponents = params.soundFormatChargeSpecs.map(categoryCodeChargePriceSpec2component);
28
44
  }
45
+ const unitPriceSpec = Object.assign(Object.assign({}, params.offer.priceSpecification), { name: params.offer.name });
29
46
  const mvtkPriceComponents = [];
30
47
  // 複数決済カード対応(2022-07-11~)
31
48
  if (Array.isArray(unitPriceSpec.appliesToMovieTicket)) {
@@ -22,7 +22,7 @@ function createPayObjectServiceOutput(params) {
22
22
  if (Array.isArray(movieTickets)) {
23
23
  paymentServiceOutput = movieTickets.map((movieTicket) => {
24
24
  var _a;
25
- const { amount, additionalProperty } = checkResult2movieTicket(transaction, movieTicket, params.checkResult);
25
+ const { amount, additionalProperty } = checkResult2movieTicket(movieTicket, params.checkResult);
26
26
  const reservation4invoice = movieTicket2reservation4invoice(movieTicket, order, String(paymentMethodType), transaction.transactionNumber);
27
27
  return Object.assign(Object.assign({ identifier: movieTicket.identifier, additionalProperty }, (typeof (amount === null || amount === void 0 ? void 0 : amount.value) === 'number') ? { amount } : undefined), (typeof ((_a = reservation4invoice.priceSpecification) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
28
28
  ? { serviceOutput: reservation4invoice }
@@ -36,35 +36,37 @@ function createPayObjectServiceOutput(params) {
36
36
  return paymentServiceOutput;
37
37
  }
38
38
  exports.createPayObjectServiceOutput = createPayObjectServiceOutput;
39
- function checkResult2movieTicket(transaction, movieTicket, checkResult) {
40
- var _a, _b, _c;
39
+ function checkResult2movieTicket(
40
+ // transaction: Pick<factory.assetTransaction.ITransaction<factory.assetTransactionType.Pay>, 'object'>,
41
+ movieTicket, checkResult) {
42
+ var _a, _b;
41
43
  const additionalProperty = [];
42
44
  let amount;
43
- // accountsReceivablesByServiceTypeへの依存をactionRecipeへ移行可能か?(2024-12-13~)
45
+ // accountsReceivablesByServiceTypeへの依存をactionRecipeへ移行(2024-12-16~)
44
46
  const purchaseNumberInfo = (_a = checkResult === null || checkResult === void 0 ? void 0 : checkResult.purchaseNumberAuthResult.knyknrNoInfoOut) === null || _a === void 0 ? void 0 : _a.find(({ knyknrNo }) => knyknrNo === movieTicket.identifier);
45
47
  const ykknInfoOfServiceType = (_b = purchaseNumberInfo === null || purchaseNumberInfo === void 0 ? void 0 : purchaseNumberInfo.ykknInfo) === null || _b === void 0 ? void 0 : _b.find((ykknInfo) => ykknInfo.ykknshTyp === movieTicket.serviceType);
46
48
  const kijUnip = ykknInfoOfServiceType === null || ykknInfoOfServiceType === void 0 ? void 0 : ykknInfoOfServiceType.kijUnip;
47
49
  if (typeof kijUnip === 'string') {
48
- // amount = {
49
- // typeOf: 'MonetaryAmount',
50
- // value: Number(accountsReceivableByResponse)
51
- // };
50
+ amount = {
51
+ typeOf: 'MonetaryAmount',
52
+ value: Number(kijUnip)
53
+ };
52
54
  }
53
55
  additionalProperty.push(...(typeof kijUnip === 'string') ? [{ name: 'kijUnip', value: kijUnip }] : [], ...(typeof (purchaseNumberInfo === null || purchaseNumberInfo === void 0 ? void 0 : purchaseNumberInfo.dnshKmTyp) === 'string') ? [{ name: 'dnshKmTyp', value: purchaseNumberInfo.dnshKmTyp }] : []
54
56
  // ...(typeof purchaseNumberInfo?.znkkkytsknGkjknTyp === 'string')
55
57
  // ? [{ name: 'znkkkytsknGkjknTyp', value: purchaseNumberInfo.znkkkytsknGkjknTyp }]
56
58
  // : []
57
59
  );
58
- const accountsReceivables = transaction.object.accountsReceivablesByServiceType;
59
- if (Array.isArray(accountsReceivables)) {
60
- const accountsReceivable = (_c = accountsReceivables.find((a) => a.serviceType === movieTicket.serviceType)) === null || _c === void 0 ? void 0 : _c.accountsReceivable;
61
- if (typeof accountsReceivable === 'number') {
62
- amount = {
63
- typeOf: 'MonetaryAmount',
64
- value: accountsReceivable
65
- };
66
- }
67
- }
60
+ // const accountsReceivables = transaction.object.accountsReceivablesByServiceType;
61
+ // if (Array.isArray(accountsReceivables)) {
62
+ // const accountsReceivable = accountsReceivables.find((a) => a.serviceType === movieTicket.serviceType)?.accountsReceivable;
63
+ // if (typeof accountsReceivable === 'number') {
64
+ // amount = {
65
+ // typeOf: 'MonetaryAmount',
66
+ // value: accountsReceivable
67
+ // };
68
+ // }
69
+ // }
68
70
  return { additionalProperty, amount };
69
71
  }
70
72
  function reservationPriceComponent2invoicePriceComponent(component) {
@@ -26,7 +26,7 @@ let coaAuthClient;
26
26
  function call(params) {
27
27
  // tslint:disable-next-line:max-func-body-length
28
28
  return ({ connection, redisClient, settings }, options) => __awaiter(this, void 0, void 0, function* () {
29
- var _a, _b, _c;
29
+ var _a, _b, _c, _d;
30
30
  if (redisClient === undefined) {
31
31
  throw new factory.errors.Argument('settings', 'redisClient required');
32
32
  }
@@ -34,18 +34,22 @@ function call(params) {
34
34
  if (!options.executeById) {
35
35
  return;
36
36
  }
37
+ const interfaceRepo = new interface_1.InterfaceRepo(connection);
38
+ const coaAPI = yield interfaceRepo.findOne({ project: { id: { $eq: params.project.id } } });
39
+ if (typeof (coaAPI === null || coaAPI === void 0 ? void 0 : coaAPI.id) !== 'string') {
40
+ throw new factory.errors.NotFound('WebAPI');
41
+ }
42
+ const credentials = (_a = coaAPI.availableChannel) === null || _a === void 0 ? void 0 : _a.credentials;
43
+ const memberClients = (_b = coaAPI.availableChannel) === null || _b === void 0 ? void 0 : _b.memberClients;
44
+ if (typeof (credentials === null || credentials === void 0 ? void 0 : credentials.refreshToken) !== 'string') {
45
+ throw new factory.errors.NotFound('WebAPI');
46
+ }
47
+ if (!Array.isArray(memberClients)) {
48
+ throw new factory.errors.NotFound('WebAPI.availableChannel.memberClients');
49
+ }
37
50
  if (coaAuthClient === undefined) {
38
- const interfaceRepo = new interface_1.InterfaceRepo(connection);
39
- const coaAPI = yield interfaceRepo.findOne({ project: { id: { $eq: params.project.id } } });
40
- const credentials = (_a = coaAPI === null || coaAPI === void 0 ? void 0 : coaAPI.availableChannel) === null || _a === void 0 ? void 0 : _a.credentials;
41
- if (typeof (credentials === null || credentials === void 0 ? void 0 : credentials.refreshToken) !== 'string') {
42
- throw new factory.errors.NotFound('WebAPI');
43
- }
44
- if (typeof (coaAPI === null || coaAPI === void 0 ? void 0 : coaAPI.id) !== 'string') {
45
- throw new factory.errors.NotFound('WebAPI');
46
- }
47
51
  let credentialsRepo;
48
- const credentialsExpireInSeconds = (_c = (_b = coaAPI.availableChannel) === null || _b === void 0 ? void 0 : _b.credentials) === null || _c === void 0 ? void 0 : _c.expireInSeconds;
52
+ const credentialsExpireInSeconds = (_d = (_c = coaAPI.availableChannel) === null || _c === void 0 ? void 0 : _c.credentials) === null || _d === void 0 ? void 0 : _d.expireInSeconds;
49
53
  if (typeof credentialsExpireInSeconds === 'number') {
50
54
  // set credentialsRepo(2024-11-20~)
51
55
  credentialsRepo = new credentials_1.CredentialsRepo(redisClient, {
@@ -66,13 +70,17 @@ function call(params) {
66
70
  endpoint: coaAuthClient.options.endpoint,
67
71
  auth: coaAuthClient
68
72
  }, { timeout: settings.coa.timeout });
69
- const { object, potentialActions, purpose } = params.data;
73
+ const { agent, object, potentialActions, purpose } = params.data;
74
+ // agent.idからflgMemberを自動セット(2024-12-16~)
75
+ const isMember = memberClients.includes(agent.id);
70
76
  if (typeof potentialActions.id === 'string') {
71
77
  yield (0, acceptOffer_1.reAcceptOffer)({
78
+ agent,
72
79
  object,
73
80
  purpose,
74
81
  potentialActions: Object.assign(Object.assign({}, potentialActions), { id: potentialActions.id }),
75
- sameAs: { id: params.id }
82
+ sameAs: { id: params.id },
83
+ isMember
76
84
  })({
77
85
  action: actionRepo,
78
86
  event: new event_1.EventRepo(connection),
@@ -83,10 +91,12 @@ function call(params) {
83
91
  }
84
92
  else {
85
93
  yield (0, acceptOffer_1.acceptOffer)({
94
+ agent,
86
95
  object,
87
96
  potentialActions,
88
97
  purpose,
89
- sameAs: { id: params.id }
98
+ sameAs: { id: params.id },
99
+ isMember
90
100
  })({
91
101
  action: actionRepo,
92
102
  event: new event_1.EventRepo(connection),
package/package.json CHANGED
@@ -11,9 +11,9 @@
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": "4.391.0-alpha.0",
15
- "@cinerino/sdk": "10.19.0-alpha.0",
16
- "@motionpicture/coa-service": "9.6.0-alpha.0",
14
+ "@chevre/factory": "4.391.0-alpha.2",
15
+ "@cinerino/sdk": "10.19.0-alpha.1",
16
+ "@motionpicture/coa-service": "9.6.0",
17
17
  "@motionpicture/gmo-service": "5.3.0",
18
18
  "@sendgrid/mail": "6.4.0",
19
19
  "@surfrock/sdk": "1.4.0-alpha.1",
@@ -32,6 +32,7 @@
32
32
  },
33
33
  "description": "Chevre Domain Library for Node.js",
34
34
  "devDependencies": {
35
+ "@eslint/js": "9.16.0",
35
36
  "@types/debug": "0.0.30",
36
37
  "@types/google-libphonenumber": "^7.4.19",
37
38
  "@types/http-status": "^0.2.30",
@@ -49,6 +50,7 @@
49
50
  "@types/uuid": "^3.4.10",
50
51
  "coveralls": "^3.1.0",
51
52
  "csvtojson": "^2.0.10",
53
+ "eslint": "9.16.0",
52
54
  "googleapis": "^85.0.0",
53
55
  "json2csv": "4.5.4",
54
56
  "mocha": "10.6.0",
@@ -62,7 +64,8 @@
62
64
  "ts-node": "^10.9.1",
63
65
  "tslint": "^6.1.3",
64
66
  "tslint-microsoft-contrib": "^6.2.0",
65
- "typescript": "5.0.3"
67
+ "typescript": "5.0.3",
68
+ "typescript-eslint": "8.18.0"
66
69
  },
67
70
  "peerDependencies": {
68
71
  "mongoose": "^7.4.0",
@@ -103,10 +106,11 @@
103
106
  "coverage": "npm run nyc && nyc report --reporter=text-lcov | coveralls",
104
107
  "test": "npm run check && npm run coverage",
105
108
  "tslint": "tslint --project tsconfig.json -c tslint.json --exclude \"**/*.spec.ts\" \"src/**/*.ts\"",
109
+ "eslint": "eslint src/**/*.ts",
106
110
  "preversion": "npm run clean && npm run build && npm test && npm run doc",
107
111
  "version": "git add -A",
108
112
  "postversion": "git push origin --tags",
109
113
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
110
114
  },
111
- "version": "22.7.0-alpha.11"
115
+ "version": "22.7.0-alpha.13"
112
116
  }