@chevre/domain 20.0.0-alpha.0 → 20.0.0-alpha.1
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 +29 -29
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +0 -1
- package/lib/chevre/service/assetTransaction/reserve/factory/price.js +2 -3
- package/lib/chevre/service/assetTransaction/reserve/factory.js +0 -9
- package/lib/chevre/service/offer/event/authorize.js +21 -14
- package/lib/chevre/service/offer/event/factory.js +3 -3
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +4 -0
- package/lib/chevre/service/offer/factory.js +2 -1
- package/lib/chevre/service/offer/product/searchProductOffers.js +2 -1
- package/lib/chevre/service/offer.js +2 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +0 -30
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Chevre Domain Library for Node.js
|
|
2
2
|
|
|
3
|
-
[](https://img.shields.io/npm/v/@chevre/domain.svg)](https://www.npmjs.com/package/@chevre/domain)
|
|
4
|
+
[](https://circleci.com/gh/chevre-jp/domain)
|
|
5
|
+
[](https://coveralls.io/github/chevre-jp/domain?branch=master)
|
|
6
|
+
[](https://snyk.io/test/github/chevre-jp/domain)
|
|
7
|
+
[](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 @
|
|
20
|
+
npm install @chevre/domain
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
### Environment variables
|
|
24
24
|
|
|
25
|
-
| Name | Required | Value
|
|
26
|
-
| -------------------------------- | -------- |
|
|
27
|
-
| `AWS_ACCESS_KEY_ID` | true |
|
|
28
|
-
| `AWS_SECRET_ACCESS_KEY` | true |
|
|
29
|
-
| `CHEVRE_AUTHORIZE_SERVER_DOMAIN` | true |
|
|
30
|
-
| `CHEVRE_CLIENT_ID` | true |
|
|
31
|
-
| `CHEVRE_CLIENT_SECRET` | true |
|
|
32
|
-
| `CHEVRE_ENDPOINT` | true |
|
|
33
|
-
| `CUSTOM_SEARCH_ENGINE_ID` | true |
|
|
34
|
-
| `COA_ENDPOINT` | true |
|
|
35
|
-
| `COA_REFRESH_TOKEN` | true |
|
|
36
|
-
| `DEBUG` | false |
|
|
37
|
-
| `GOOGLE_API_KEY` | true |
|
|
38
|
-
| `INFORM_ORDER_URL` | false |
|
|
39
|
-
| `INFORM_TRANSACTION_URL` | false |
|
|
40
|
-
| `LINE_NOTIFY_URL` | true |
|
|
41
|
-
| `LINE_NOTIFY_ACCESS_TOKEN` | true |
|
|
42
|
-
| `SENDGRID_API_KEY` | true |
|
|
43
|
-
| `COA_TIMEOUT` | false |
|
|
44
|
-
| `GMO_TIMEOUT` | false |
|
|
45
|
-
| `MVTK_TIMEOUT` | false |
|
|
46
|
-
| `TRIGGER_WEBHOOK_TIMEOUT` | false |
|
|
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/
|
|
51
|
+
Code sample are [here](https://github.com/chevre-jp/domain/tree/master/example).
|
|
52
52
|
|
|
53
53
|
## License
|
|
54
54
|
|
|
@@ -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) {
|
|
@@ -30,7 +30,8 @@ function createPrice(params) {
|
|
|
30
30
|
];
|
|
31
31
|
return {
|
|
32
32
|
priceCurrency: params.ticketOffer.priceSpecification.priceCurrency,
|
|
33
|
-
|
|
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
|
|
@@ -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を必要最低限に最適化
|
|
@@ -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
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
else if (typeof
|
|
313
|
-
|
|
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 =
|
|
318
|
+
const acceptedOffer = {
|
|
320
319
|
// オファーの中身を最適化する(必要最低限の情報のみに)
|
|
321
|
-
id: String(offer.id),
|
|
320
|
+
id: String(offer.id),
|
|
321
|
+
identifier: offer.identifier,
|
|
322
|
+
priceSpecification,
|
|
322
323
|
// project: offer.project,
|
|
323
|
-
typeOf: offer.typeOf,
|
|
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),
|
|
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
|
-
]
|
|
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
|
-
|
|
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
|
-
|
|
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,
|
|
@@ -30,7 +30,8 @@ function searchProductOffers(params) {
|
|
|
30
30
|
.map((o) => {
|
|
31
31
|
const unitSpec = o.priceSpecification;
|
|
32
32
|
const compoundPriceSpecification = {
|
|
33
|
-
|
|
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
|
-
|
|
44
|
+
// 不要な属性を除外(2022-11-02~)
|
|
45
|
+
// project: params.project,
|
|
45
46
|
typeOf: factory.priceSpecificationType.CompoundPriceSpecification,
|
|
46
47
|
priceCurrency: factory.priceCurrency.JPY,
|
|
47
48
|
valueAddedTaxIncluded: true,
|
package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js
CHANGED
|
@@ -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.
|
|
13
|
-
"@cinerino/sdk": "3.130.0-alpha.
|
|
12
|
+
"@chevre/factory": "4.273.1",
|
|
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.
|
|
123
|
+
"version": "20.0.0-alpha.1"
|
|
124
124
|
}
|