@chevre/domain 20.0.0-alpha.0 → 20.0.0-alpha.2

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.
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # Chevre Domain Library for Node.js
2
2
 
3
- [![npm (scoped)](https://img.shields.io/npm/v/@cinerino/domain.svg)](https://www.npmjs.com/package/@cinerino/domain)
4
- [![CircleCI](https://circleci.com/gh/cinerino/domain.svg?style=svg)](https://circleci.com/gh/cinerino/domain)
5
- [![Coverage Status](https://coveralls.io/repos/github/cinerino/domain/badge.svg?branch=master)](https://coveralls.io/github/cinerino/domain?branch=master)
6
- [![Known Vulnerabilities](https://snyk.io/test/github/cinerino/domain/badge.svg)](https://snyk.io/test/github/cinerino/domain)
7
- [![npm](https://img.shields.io/npm/dm/@cinerino/domain.svg)](https://nodei.co/npm/@cinerino/domain/)
3
+ [![npm (scoped)](https://img.shields.io/npm/v/@chevre/domain.svg)](https://www.npmjs.com/package/@chevre/domain)
4
+ [![CircleCI](https://circleci.com/gh/chevre-jp/domain.svg?style=svg)](https://circleci.com/gh/chevre-jp/domain)
5
+ [![Coverage Status](https://coveralls.io/repos/github/chevre-jp/domain/badge.svg?branch=master)](https://coveralls.io/github/chevre-jp/domain?branch=master)
6
+ [![Known Vulnerabilities](https://snyk.io/test/github/chevre-jp/domain/badge.svg)](https://snyk.io/test/github/chevre-jp/domain)
7
+ [![npm](https://img.shields.io/npm/dm/@chevre/domain.svg)](https://nodei.co/npm/@chevre/domain/)
8
8
 
9
9
  Node.js client library for using Chevre backend programming.
10
10
 
@@ -17,38 +17,38 @@ Node.js client library for using Chevre backend programming.
17
17
  ## Usage
18
18
 
19
19
  ```shell
20
- npm install @cinerino/domain
20
+ npm install @chevre/domain
21
21
  ```
22
22
 
23
23
  ### Environment variables
24
24
 
25
- | Name | Required | Value | Purpose |
26
- | -------------------------------- | -------- | ----------------- | ------------------------------ |
27
- | `AWS_ACCESS_KEY_ID` | true | | AWS access key |
28
- | `AWS_SECRET_ACCESS_KEY` | true | | AWS secret access key |
29
- | `CHEVRE_AUTHORIZE_SERVER_DOMAIN` | true | | Chevre credentials |
30
- | `CHEVRE_CLIENT_ID` | true | | Chevre credentials |
31
- | `CHEVRE_CLIENT_SECRET` | true | | Chevre credentials |
32
- | `CHEVRE_ENDPOINT` | true | | Chevre credentials |
33
- | `CUSTOM_SEARCH_ENGINE_ID` | true | | Google Custom Search Engine ID |
34
- | `COA_ENDPOINT` | true | | COA credentilas |
35
- | `COA_REFRESH_TOKEN` | true | | credentilas |
36
- | `DEBUG` | false | cinerino-domain:* | Debug |
37
- | `GOOGLE_API_KEY` | true | | Google API Key |
38
- | `INFORM_ORDER_URL` | false | | Inform Order URLs |
39
- | `INFORM_TRANSACTION_URL` | false | | Inform Transaction URLs |
40
- | `LINE_NOTIFY_URL` | true | | LINE Notify URL |
41
- | `LINE_NOTIFY_ACCESS_TOKEN` | true | | LINE Notify access token |
42
- | `SENDGRID_API_KEY` | true | | SendGrid API key |
43
- | `COA_TIMEOUT` | false | | Timeout settings |
44
- | `GMO_TIMEOUT` | false | | Timeout settings |
45
- | `MVTK_TIMEOUT` | false | | Timeout settings |
46
- | `TRIGGER_WEBHOOK_TIMEOUT` | false | | Timeout settings |
25
+ | Name | Required | Value | Purpose |
26
+ | -------------------------------- | -------- | --------------- | ------------------------------ |
27
+ | `AWS_ACCESS_KEY_ID` | true | | AWS access key |
28
+ | `AWS_SECRET_ACCESS_KEY` | true | | AWS secret access key |
29
+ | `CHEVRE_AUTHORIZE_SERVER_DOMAIN` | true | | Chevre credentials |
30
+ | `CHEVRE_CLIENT_ID` | true | | Chevre credentials |
31
+ | `CHEVRE_CLIENT_SECRET` | true | | Chevre credentials |
32
+ | `CHEVRE_ENDPOINT` | true | | Chevre credentials |
33
+ | `CUSTOM_SEARCH_ENGINE_ID` | true | | Google Custom Search Engine ID |
34
+ | `COA_ENDPOINT` | true | | COA credentilas |
35
+ | `COA_REFRESH_TOKEN` | true | | credentilas |
36
+ | `DEBUG` | false | chevre-domain:* | Debug |
37
+ | `GOOGLE_API_KEY` | true | | Google API Key |
38
+ | `INFORM_ORDER_URL` | false | | Inform Order URLs |
39
+ | `INFORM_TRANSACTION_URL` | false | | Inform Transaction URLs |
40
+ | `LINE_NOTIFY_URL` | true | | LINE Notify URL |
41
+ | `LINE_NOTIFY_ACCESS_TOKEN` | true | | LINE Notify access token |
42
+ | `SENDGRID_API_KEY` | true | | SendGrid API key |
43
+ | `COA_TIMEOUT` | false | | Timeout settings |
44
+ | `GMO_TIMEOUT` | false | | Timeout settings |
45
+ | `MVTK_TIMEOUT` | false | | Timeout settings |
46
+ | `TRIGGER_WEBHOOK_TIMEOUT` | false | | Timeout settings |
47
47
 
48
48
 
49
49
  ## Code Samples
50
50
 
51
- Code sample are [here](https://github.com/cinerino/domain/tree/master/example).
51
+ Code sample are [here](https://github.com/chevre-jp/domain/tree/master/example).
52
52
 
53
53
  ## License
54
54
 
@@ -33,7 +33,7 @@ async function main() {
33
33
  let updateCount = 0;
34
34
  await cursor.eachAsync(async (doc) => {
35
35
  i += 1;
36
- const offer = <chevre.factory.offer.IUnitPriceOffer>doc.toObject();
36
+ const offer = <chevre.factory.unitPriceOffer.IUnitPriceOffer>doc.toObject();
37
37
  const applieToMovieTicket = offer.priceSpecification?.appliesToMovieTicket;
38
38
  if (Array.isArray(applieToMovieTicket)) {
39
39
  console.log('is Array', offer.project.id, offer.id, i);
@@ -35,24 +35,6 @@ async function main() {
35
35
  const product = products[0];
36
36
  console.log(product);
37
37
 
38
- // オファーカタログ検索
39
- // const offerCatalog = await offerRepo.findOfferCatalogById({ id: product.hasOfferCatalog.id });
40
- // console.log(offerCatalog);
41
-
42
- // オファー検索
43
- // const offers = await offerRepo.offerModel.find(
44
- // { _id: { $in: (offerCatalog.itemListElement).map((e) => e.id) } },
45
- // {
46
- // __v: 0,
47
- // createdAt: 0,
48
- // updatedAt: 0
49
- // }
50
- // )
51
- // .exec()
52
- // .then((docs) => docs.map((doc) => doc.toObject()));
53
- // console.log(offers);
54
- // console.log(offers.length, 'offers found');
55
-
56
38
  const identifier = `CIN${(new Date()).valueOf()}`;
57
39
  const transaction = await chevre.service.assetTransaction.registerService.start({
58
40
  project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
@@ -35,24 +35,6 @@ async function main() {
35
35
  const product = products[0];
36
36
  console.log(product);
37
37
 
38
- // オファーカタログ検索
39
- // const offerCatalog = await offerRepo.findOfferCatalogById({ id: product.hasOfferCatalog.id });
40
- // console.log(offerCatalog);
41
-
42
- // オファー検索
43
- // const offers = await offerRepo.offerModel.find(
44
- // { _id: { $in: (offerCatalog.itemListElement).map((e) => e.id) } },
45
- // {
46
- // __v: 0,
47
- // createdAt: 0,
48
- // updatedAt: 0
49
- // }
50
- // )
51
- // .exec()
52
- // .then((docs) => docs.map((doc) => doc.toObject()));
53
- // console.log(offers);
54
- // console.log(offers.length, 'offers found');
55
-
56
38
  const transactionNumber = `CIN${(new Date()).valueOf()}`;
57
39
  const identifier = transactionNumber;
58
40
  const accessCode = '123';
@@ -310,17 +310,6 @@ class MongoRepository {
310
310
  : [];
311
311
  let offers = [];
312
312
  if (sortedOfferIds.length > 0) {
313
- // offers = await this.offerModel.find(
314
- // { _id: { $in: sortedOfferIds } },
315
- // {
316
- // __v: 0,
317
- // createdAt: 0,
318
- // updatedAt: 0
319
- // }
320
- // )
321
- // .setOptions({ maxTimeMS: 10000 })
322
- // .exec()
323
- // .then((docs) => docs.map((doc) => doc.toObject()));
324
313
  offers = yield this.search({ id: { $in: sortedOfferIds } });
325
314
  // sorting
326
315
  offers = offers.sort((a, b) => sortedOfferIds.indexOf(String(a.id)) - sortedOfferIds.indexOf(String(b.id)));
@@ -150,7 +150,6 @@ function movieTicket2reservation4invoice(movieTicket, order, paymentMethodType)
150
150
  // Orderから対象予約を取得
151
151
  const reservationOffer = (_a = order === null || order === void 0 ? void 0 : order.acceptedOffers) === null || _a === void 0 ? void 0 : _a.find((o) => {
152
152
  var _a, _b, _c, _d;
153
- // let appliesToMovieTicketIdentifier: string | undefined;
154
153
  let mvtkUnitPriceSpec;
155
154
  // MovieTicket適用単価オファーからidentifierを取り出す
156
155
  if (((_a = o.priceSpecification) === null || _a === void 0 ? void 0 : _a.typeOf) === factory.priceSpecificationType.CompoundPriceSpecification) {
@@ -183,16 +182,20 @@ function movieTicket2reservation4invoice(movieTicket, order, paymentMethodType)
183
182
  if (Array.isArray(priceComponent)) {
184
183
  reservationPrice = priceComponent.reduce((a, b) => a + Number(b.price), 0);
185
184
  priceComponents4invoice = priceComponent.map((component) => {
186
- var _a, _b;
185
+ var _a;
186
+ const accounting = (typeof ((_a = component.accounting) === null || _a === void 0 ? void 0 : _a.accountsReceivable) === 'number')
187
+ ? { accountsReceivable: component.accounting.accountsReceivable }
188
+ : undefined;
187
189
  if (component.typeOf === factory.priceSpecificationType.UnitPriceSpecification) {
188
- return Object.assign(Object.assign({ typeOf: component.typeOf, price: component.price, referenceQuantity: component.referenceQuantity }, (Array.isArray(component.appliesToAddOn) ? { appliesToAddOn: component.appliesToAddOn } : undefined)), (typeof ((_a = component.accounting) === null || _a === void 0 ? void 0 : _a.accountsReceivable) === 'number')
189
- ? { accounting: { accountsReceivable: component.accounting.accountsReceivable } }
190
- : undefined);
190
+ const appliesToAddOn = (Array.isArray(component.appliesToAddOn))
191
+ ? component.appliesToAddOn.map((addOn) => {
192
+ return { typeOf: addOn.typeOf };
193
+ })
194
+ : undefined;
195
+ return Object.assign(Object.assign({ typeOf: component.typeOf, price: component.price, referenceQuantity: component.referenceQuantity }, (Array.isArray(appliesToAddOn)) ? { appliesToAddOn } : undefined), (typeof (accounting === null || accounting === void 0 ? void 0 : accounting.accountsReceivable) === 'number') ? { accounting } : undefined);
191
196
  }
192
197
  else {
193
- return Object.assign({ typeOf: component.typeOf, price: component.price }, (typeof ((_b = component.accounting) === null || _b === void 0 ? void 0 : _b.accountsReceivable) === 'number')
194
- ? { accounting: { accountsReceivable: component.accounting.accountsReceivable } }
195
- : undefined);
198
+ return Object.assign({ typeOf: component.typeOf, price: component.price }, (typeof (accounting === null || accounting === void 0 ? void 0 : accounting.accountsReceivable) === 'number') ? { accounting } : undefined);
196
199
  }
197
200
  });
198
201
  }
@@ -30,7 +30,8 @@ function createPrice(params) {
30
30
  ];
31
31
  return {
32
32
  priceCurrency: params.ticketOffer.priceSpecification.priceCurrency,
33
- project: params.ticketOffer.priceSpecification.project,
33
+ // 不要な属性を除外(2022-11-02~)
34
+ // project: params.ticketOffer.priceSpecification.project,
34
35
  typeOf: params.ticketOffer.priceSpecification.typeOf,
35
36
  valueAddedTaxIncluded: params.ticketOffer.priceSpecification.valueAddedTaxIncluded,
36
37
  priceComponent: priceComponent4reservation
@@ -51,7 +52,7 @@ function createUnitPriceSpecsAppliedToAddOn(params) {
51
52
  id: acceptedAddOn.itemOffered.id,
52
53
  name: acceptedAddOn.itemOffered.name,
53
54
  productID: acceptedAddOn.itemOffered.productID,
54
- project: acceptedAddOn.itemOffered.project,
55
+ // project: acceptedAddOn.itemOffered.project,
55
56
  typeOf: acceptedAddOn.itemOffered.typeOf
56
57
  };
57
58
  const appliesToAddOn = {
@@ -82,12 +83,10 @@ function createPriceSpecsByEventOffer(params) {
82
83
  let isAppliesToMovieTicketSpecifiedAsArray = false;
83
84
  let appliesToMovieTicketSpecifiedAsArray;
84
85
  if (Array.isArray(params.appliesToMovieTicket)) {
85
- // throw new factory.errors.NotImplemented('multiple appliesToMovieTicket not implemented');
86
86
  isAppliesToMovieTicketSpecifiedAsArray = true;
87
87
  appliesToMovieTicketSpecifiedAsArray = params.appliesToMovieTicket;
88
88
  }
89
89
  else if (typeof ((_a = params.appliesToMovieTicket) === null || _a === void 0 ? void 0 : _a.identifier) === 'string') {
90
- // const appliesToMovieTicketIdentifier = params.appliesToMovieTicket?.identifier;
91
90
  appliesToMovieTicketSpecifiedAsArray = [params.appliesToMovieTicket];
92
91
  }
93
92
  // 予約のpriceComponentを必要最低限に最適化
@@ -104,7 +103,7 @@ function createPriceSpecsByEventOffer(params) {
104
103
  name: priceSpec.name,
105
104
  price: priceSpec.price,
106
105
  priceCurrency: priceSpec.priceCurrency,
107
- project: priceSpec.project,
106
+ // project: priceSpec.project,
108
107
  typeOf: priceSpec.typeOf,
109
108
  appliesToVideoFormat: priceSpec.appliesToVideoFormat,
110
109
  valueAddedTaxIncluded: priceSpec.valueAddedTaxIncluded,
@@ -117,7 +116,7 @@ function createPriceSpecsByEventOffer(params) {
117
116
  name: priceSpec.name,
118
117
  price: priceSpec.price,
119
118
  priceCurrency: priceSpec.priceCurrency,
120
- project: priceSpec.project,
119
+ // project: priceSpec.project,
121
120
  typeOf: priceSpec.typeOf,
122
121
  appliesToCategoryCode: priceSpec.appliesToCategoryCode,
123
122
  valueAddedTaxIncluded: priceSpec.valueAddedTaxIncluded
@@ -195,5 +194,7 @@ function eventOfferUnitPriceSpec2reservationUnitPriceSpec(params) {
195
194
  }
196
195
  : undefined);
197
196
  }
198
- return Object.assign(Object.assign({ name: priceSpec.name, price: priceSpec.price, priceCurrency: priceSpec.priceCurrency, project: priceSpec.project, 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);
197
+ return Object.assign(Object.assign({ name: priceSpec.name, price: priceSpec.price, priceCurrency: priceSpec.priceCurrency,
198
+ // project: priceSpec.project,
199
+ 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);
199
200
  }
@@ -316,15 +316,6 @@ function validateAppliesToMovieTicket(params) {
316
316
  }
317
317
  }
318
318
  // Arrayでないケースは廃止(2022-09-10~)
319
- // } else {
320
- // const appliesToMovieTicketTypeOf = priceSpecificationAppliesToMovieTicket?.typeOf;
321
- // if (typeof appliesToMovieTicketTypeOf === 'string') {
322
- // // Arrayでない場合を廃止(2022-08-01~)
323
- // throw new factory.errors.NotImplemented('appliesToMovieTickets.typeOf as string not implemented');
324
- // // if (typeof appliesToMovieTicketIdentifier !== 'string' || appliesToMovieTicketIdentifier.length === 0) {
325
- // // throw new factory.errors.Argument('appliesToMovieTicket.identifier');
326
- // // }
327
- // }
328
319
  }
329
320
  }
330
321
  exports.validateAppliesToMovieTicket = validateAppliesToMovieTicket;
@@ -303,26 +303,30 @@ function acceptedOfferWithoutDetail2acceptedOffer(params) {
303
303
  offerWithoutDetail,
304
304
  transaction: params.transaction
305
305
  });
306
- let movieTicketIdentifire;
307
306
  const acceptedAppliesToMovieTicket = (_a = offerWithoutDetail.priceSpecification) === null || _a === void 0 ? void 0 : _a.appliesToMovieTicket;
308
- if (Array.isArray(acceptedAppliesToMovieTicket)) {
309
- // throw new factory.errors.NotImplemented('multiple appliesToMovieTicket not implemented');
310
- // no op
311
- }
312
- else if (typeof (acceptedAppliesToMovieTicket === null || acceptedAppliesToMovieTicket === void 0 ? void 0 : acceptedAppliesToMovieTicket.identifier) === 'string') {
313
- movieTicketIdentifire = acceptedAppliesToMovieTicket.identifier;
314
- }
307
+ // let movieTicketIdentifire: string | undefined;
308
+ // if (Array.isArray(acceptedAppliesToMovieTicket)) {
309
+ // // throw new factory.errors.NotImplemented('multiple appliesToMovieTicket not implemented');
310
+ // // no op
311
+ // } else if (typeof acceptedAppliesToMovieTicket?.identifier === 'string') {
312
+ // movieTicketIdentifire = acceptedAppliesToMovieTicket.identifier;
313
+ // }
315
314
  // 承認アクションオブジェクトのacceptedOfferにappliesToMovieTicketを連携する(2022-08-02~)
316
315
  const priceSpecification = Object.assign(Object.assign({}, offer.priceSpecification), (Array.isArray(acceptedAppliesToMovieTicket) || typeof (acceptedAppliesToMovieTicket === null || acceptedAppliesToMovieTicket === void 0 ? void 0 : acceptedAppliesToMovieTicket.identifier) === 'string')
317
316
  ? { appliesToMovieTicket: acceptedAppliesToMovieTicket }
318
317
  : undefined);
319
- const acceptedOffer = Object.assign({
318
+ const acceptedOffer = {
320
319
  // オファーの中身を最適化する(必要最低限の情報のみに)
321
- id: String(offer.id), identifier: offer.identifier, priceSpecification,
320
+ id: String(offer.id),
321
+ identifier: offer.identifier,
322
+ priceSpecification,
322
323
  // project: offer.project,
323
- typeOf: offer.typeOf, priceCurrency: offer.priceCurrency, itemOffered: Object.assign({ typeOf: factory.product.ProductType.EventService, serviceOutput: (offerWithoutDetail.itemOffered !== undefined && offerWithoutDetail.itemOffered !== null)
324
+ typeOf: offer.typeOf,
325
+ priceCurrency: offer.priceCurrency,
326
+ itemOffered: Object.assign({ typeOf: factory.product.ProductType.EventService, serviceOutput: (offerWithoutDetail.itemOffered !== undefined && offerWithoutDetail.itemOffered !== null)
324
327
  ? offerWithoutDetail.itemOffered.serviceOutput
325
- : undefined }, (pointAward !== undefined) ? { pointAward } : undefined), addOn: (Array.isArray(offerWithoutDetail.addOn))
328
+ : undefined }, (pointAward !== undefined) ? { pointAward } : undefined),
329
+ addOn: (Array.isArray(offerWithoutDetail.addOn))
326
330
  ? offerWithoutDetail.addOn.map((a) => {
327
331
  return {
328
332
  project: offer.project,
@@ -331,12 +335,15 @@ function acceptedOfferWithoutDetail2acceptedOffer(params) {
331
335
  priceCurrency: offer.priceCurrency
332
336
  };
333
337
  })
334
- : [],
338
+ : [],
335
339
  // 追加属性をマージ
336
340
  additionalProperty: [
337
341
  ...(Array.isArray(offerWithoutDetail.additionalProperty)) ? offerWithoutDetail.additionalProperty : [],
338
342
  ...(Array.isArray(offer.additionalProperty)) ? offer.additionalProperty : []
339
- ] }, (typeof movieTicketIdentifire === 'string') ? { movieTicketIdentifire } : undefined);
343
+ ]
344
+ // movieTicketIdentifireの不要を確認後に廃止(2022-09-09以降)(2022-11-02+)
345
+ // ...(typeof movieTicketIdentifire === 'string') ? { movieTicketIdentifire } : undefined
346
+ };
340
347
  let offeredThrough = (_b = params.event.offers) === null || _b === void 0 ? void 0 : _b.offeredThrough;
341
348
  if (typeof (offeredThrough === null || offeredThrough === void 0 ? void 0 : offeredThrough.typeOf) !== 'string') {
342
349
  offeredThrough = { typeOf: 'WebAPI', identifier: factory.service.webAPI.Identifier.Chevre };
@@ -23,9 +23,8 @@ function createReserveTransactionStartParams(params) {
23
23
  }
24
24
  else if (typeof ((_b = o.priceSpecification.appliesToMovieTicket) === null || _b === void 0 ? void 0 : _b.identifier) === 'string') {
25
25
  appliesToMovieTicket = { identifier: o.priceSpecification.appliesToMovieTicket.identifier };
26
- }
27
- else if (typeof o.movieTicketIdentifire === 'string') {
28
26
  // movieTicketIdentifire参照は廃止(2022-09-09~)
27
+ // } else if (typeof o.movieTicketIdentifire === 'string') {
29
28
  // appliesToMovieTicket = { identifier: o.movieTicketIdentifire };
30
29
  }
31
30
  return Object.assign(Object.assign(Object.assign({
@@ -192,7 +191,8 @@ function responseBody2acceptedOffers4result(params) {
192
191
  priceSpecification: {
193
192
  priceComponent: priceComponent,
194
193
  priceCurrency: priceSpecification.priceCurrency,
195
- project: priceSpecification.project,
194
+ // 不要な属性を除外(2022-11-02~)
195
+ // project: priceSpecification.project,
196
196
  typeOf: priceSpecification.typeOf,
197
197
  valueAddedTaxIncluded: priceSpecification.valueAddedTaxIncluded
198
198
  },
@@ -72,6 +72,10 @@ function searchScreeningEventTicketOffers(params) {
72
72
  if (priceSpecificationAppliesToMovieTicket.length === 0) {
73
73
  return false;
74
74
  }
75
+ // 上映方式がなければ除外(2022-11-03~)
76
+ if (videoFormatTypes.length === 0) {
77
+ return false;
78
+ }
75
79
  return priceSpecificationAppliesToMovieTicket.every((appliesToMovieTicket) => {
76
80
  // すべての上映方式について検証する(2022-10-29~)
77
81
  return videoFormatTypes.every((videoFormat) => {
@@ -46,7 +46,8 @@ function createCompoundPriceSpec4event(params) {
46
46
  // Arrayでないケースは廃止(2022-09-12~)
47
47
  }
48
48
  const compoundPriceSpecification = {
49
- project: params.offer.project,
49
+ // 不要な属性を除外(2022-11-02~)
50
+ // project: params.offer.project,
50
51
  typeOf: factory.priceSpecificationType.CompoundPriceSpecification,
51
52
  priceCurrency: factory.priceCurrency.JPY,
52
53
  valueAddedTaxIncluded: true,
@@ -82,8 +82,7 @@ function responseBody2resultAcceptedOffer(params) {
82
82
  let acceptedOffers = [];
83
83
  if (Array.isArray(params.responseBody.object)) {
84
84
  acceptedOffers = params.responseBody.object.map((responseBodyObject) => {
85
- var _a, _b, _c;
86
- // const productTypeOf = responseBodyObject.itemOffered?.serviceOutput?.issuedThrough?.typeOf;
85
+ var _a, _b, _c, _d;
87
86
  const serviceOutputIdentifier = (_b = (_a = responseBodyObject.itemOffered) === null || _a === void 0 ? void 0 : _a.serviceOutput) === null || _b === void 0 ? void 0 : _b.identifier;
88
87
  if (serviceOutputIdentifier !== undefined && typeof serviceOutputIdentifier !== 'string') {
89
88
  // 基本的にありえないフロー↓
@@ -96,13 +95,50 @@ function responseBody2resultAcceptedOffer(params) {
96
95
  if (offer === undefined) {
97
96
  throw new factory.errors.ServiceUnavailable(`Offer ${responseBodyObject.id} from registerService not found`);
98
97
  }
98
+ if (typeof ((_d = offer.priceSpecification) === null || _d === void 0 ? void 0 : _d.typeOf) !== 'string') {
99
+ throw new factory.errors.NotFound('acceptedOffer.priceSpecification');
100
+ }
101
+ const priceSpecification = {
102
+ typeOf: offer.priceSpecification.typeOf,
103
+ valueAddedTaxIncluded: offer.priceSpecification.valueAddedTaxIncluded,
104
+ priceCurrency: offer.priceSpecification.priceCurrency,
105
+ priceComponent: offer.priceSpecification.priceComponent.map((component) => {
106
+ var _a, _b;
107
+ if (component.typeOf === factory.priceSpecificationType.UnitPriceSpecification) {
108
+ // tslint:disable-next-line:no-unnecessary-local-variable
109
+ const unitPriceComponent = Object.assign(Object.assign(Object.assign({ accounting: component.accounting, name: component.name, price: component.price, priceCurrency: component.priceCurrency, referenceQuantity: component.referenceQuantity, typeOf: component.typeOf, valueAddedTaxIncluded: component.valueAddedTaxIncluded }, (Array.isArray(component.appliesToAddOn))
110
+ ? { appliesToAddOn: component.appliesToAddOn }
111
+ : undefined), (Array.isArray(component.appliesToMovieTicket))
112
+ ? { appliesToMovieTicket: component.appliesToMovieTicket }
113
+ : undefined), (typeof ((_a = component.accounting) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
114
+ ? {
115
+ accounting: Object.assign(Object.assign({ typeOf: component.accounting.typeOf }, (typeof component.accounting.accountsReceivable === 'number')
116
+ ? { accountsReceivable: component.accounting.accountsReceivable }
117
+ : undefined), (typeof ((_b = component.accounting.operatingRevenue) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string')
118
+ ? {
119
+ operatingRevenue: {
120
+ project: component.accounting.operatingRevenue.project,
121
+ typeOf: component.accounting.operatingRevenue.typeOf,
122
+ codeValue: component.accounting.operatingRevenue.codeValue
123
+ }
124
+ }
125
+ : undefined)
126
+ }
127
+ : undefined);
128
+ return unitPriceComponent;
129
+ }
130
+ else {
131
+ return component;
132
+ }
133
+ })
134
+ };
99
135
  return {
100
136
  project: { typeOf: params.project.typeOf, id: params.project.id },
101
137
  typeOf: responseBodyObject.typeOf,
102
138
  id: offer.id,
103
139
  name: offer.name,
104
140
  itemOffered,
105
- priceSpecification: offer.priceSpecification,
141
+ priceSpecification,
106
142
  priceCurrency: offer.priceCurrency,
107
143
  seller: offer.seller
108
144
  };
@@ -30,7 +30,8 @@ function searchProductOffers(params) {
30
30
  .map((o) => {
31
31
  const unitSpec = o.priceSpecification;
32
32
  const compoundPriceSpecification = {
33
- project: productWithOffers.project,
33
+ // 不要な属性を除外(2022-11-02~)
34
+ // project: productWithOffers.project,
34
35
  typeOf: factory.priceSpecificationType.CompoundPriceSpecification,
35
36
  priceCurrency: factory.priceCurrency.JPY,
36
37
  valueAddedTaxIncluded: true,
@@ -41,7 +41,8 @@ function addOffers2Seat(params) {
41
41
  });
42
42
  }));
43
43
  const priceSpecification = {
44
- project: params.project,
44
+ // 不要な属性を除外(2022-11-02~)
45
+ // project: params.project,
45
46
  typeOf: factory.priceSpecificationType.CompoundPriceSpecification,
46
47
  priceCurrency: factory.priceCurrency.JPY,
47
48
  valueAddedTaxIncluded: true,
@@ -90,9 +90,6 @@ function validateMovieTicket(paymentMethodType, transaction) {
90
90
  }
91
91
  exports.validateMovieTicket = validateMovieTicket;
92
92
  function validateAppliesToMovieTicketIdentifiers(params) {
93
- // const offeredThroughChevre: boolean =
94
- // params.requiredMovieTicketsByEvent[0]?.serviceOutput.reservationFor.offers?.offeredThrough?.identifier
95
- // === factory.service.webAPI.Identifier.Chevre;
96
93
  // 予約の適用identifierと、決済accountIdは番号ごとに枚数が完全一致するはず
97
94
  const movieTicketIdentifiers = params.requiredMovieTicketsByEvent.map((t) => t.identifier);
98
95
  movieTicketIdentifiers.forEach((movieTicketIdentifier) => {
@@ -154,9 +151,6 @@ function authorizeSeatReservationActions2requiredMovieTickets(params) {
154
151
  else if (typeof (appliesToMovieTickets4reservation === null || appliesToMovieTickets4reservation === void 0 ? void 0 : appliesToMovieTickets4reservation.identifier) === 'string') {
155
152
  // Arrayでない場合を廃止(2022-08-01~)
156
153
  throw new factory.errors.NotImplemented('appliesToMovieTickets.typeOf as string not implemented');
157
- // if (appliesToMovieTickets4reservation.serviceOutput.typeOf === paymentMethodType) {
158
- // appliesToMovieTickets4paymentMethod = [appliesToMovieTickets4reservation];
159
- // }
160
154
  }
161
155
  if (Array.isArray(appliesToMovieTickets4paymentMethod) && appliesToMovieTickets4paymentMethod.length > 0) {
162
156
  appliesToMovieTickets4paymentMethod.forEach((appliesToMovieTicket) => {
@@ -182,27 +176,3 @@ function authorizeSeatReservationActions2requiredMovieTickets(params) {
182
176
  });
183
177
  return requiredMovieTickets;
184
178
  }
185
- // function acceptedOffer2appliesToMovieTicketIdentifier(
186
- // acceptedOffer: factory.action.authorize.offer.seatReservation.IResultAcceptedOffer
187
- // ): string {
188
- // let appliesToMovieTicketIdentifier = '';
189
- // const unitPriceSpec = <IUnitPriceSpecification | undefined>acceptedOffer.priceSpecification?.priceComponent.find((component) => {
190
- // return component.typeOf === factory.priceSpecificationType.UnitPriceSpecification
191
- // && (!Array.isArray(component.appliesToAddOn));
192
- // });
193
- // if (unitPriceSpec === undefined) {
194
- // throw new factory.errors.NotFound('UnitPriceSpecification of acceptedOffer');
195
- // }
196
- // // Chevreの場合は必ず指定されている想定
197
- // // 複数決済カード対応(2022-07-11~)
198
- // if (Array.isArray(unitPriceSpec.appliesToMovieTicket)) {
199
- // if (typeof unitPriceSpec.appliesToMovieTicket[0]?.identifier === 'string') {
200
- // appliesToMovieTicketIdentifier = unitPriceSpec.appliesToMovieTicket[0].identifier;
201
- // }
202
- // } else {
203
- // if (typeof unitPriceSpec.appliesToMovieTicket?.identifier === 'string') {
204
- // appliesToMovieTicketIdentifier = unitPriceSpec.appliesToMovieTicket.identifier;
205
- // }
206
- // }
207
- // return appliesToMovieTicketIdentifier;
208
- // }
package/package.json CHANGED
@@ -9,8 +9,8 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.272.0",
13
- "@cinerino/sdk": "3.130.0-alpha.0",
12
+ "@chevre/factory": "4.274.0-alpha.0",
13
+ "@cinerino/sdk": "3.130.0-alpha.1",
14
14
  "@motionpicture/coa-service": "9.2.0",
15
15
  "@motionpicture/gmo-service": "5.2.0",
16
16
  "@sendgrid/mail": "6.4.0",
@@ -120,5 +120,5 @@
120
120
  "postversion": "git push origin --tags",
121
121
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
122
122
  },
123
- "version": "20.0.0-alpha.0"
123
+ "version": "20.0.0-alpha.2"
124
124
  }