@chevre/domain 20.3.0-alpha.1 → 20.3.0-alpha.3
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/example/src/chevre/updateOfferCatalogs.ts +40 -0
- package/lib/chevre/repo/offerCatalog.d.ts +20 -0
- package/lib/chevre/repo/offerCatalog.js +34 -0
- package/lib/chevre/service/offer/event/factory.js +3 -3
- package/lib/chevre/service/payment/movieTicket.js +7 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// tslint:disable:no-console no-magic-numbers
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../lib/index';
|
|
5
|
+
|
|
6
|
+
async function main() {
|
|
7
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
8
|
+
|
|
9
|
+
const offerCatalogRepo = new chevre.repository.OfferCatalog(mongoose.connection);
|
|
10
|
+
|
|
11
|
+
await offerCatalogRepo.updateManyById({
|
|
12
|
+
id: { $in: ['0002'] },
|
|
13
|
+
$pull: {
|
|
14
|
+
itemListElement: {
|
|
15
|
+
$elemMatch: {
|
|
16
|
+
id: {
|
|
17
|
+
$in: [
|
|
18
|
+
// 'al96nqj7z',
|
|
19
|
+
// 'akxecjgeu'
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
$push: {
|
|
26
|
+
itemListElement: {
|
|
27
|
+
$each: [
|
|
28
|
+
{ typeOf: chevre.factory.offerType.Offer, id: 'al96nqj7z' },
|
|
29
|
+
{ typeOf: chevre.factory.offerType.Offer, id: 'akxecjgeu' }
|
|
30
|
+
],
|
|
31
|
+
$slice: 200
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
console.log('updated');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
main()
|
|
39
|
+
.then(console.log)
|
|
40
|
+
.catch(console.error);
|
|
@@ -8,6 +8,26 @@ export declare class MongoRepository {
|
|
|
8
8
|
constructor(connection: Connection);
|
|
9
9
|
static CREATE_MONGO_CONDITIONS(params: factory.offerCatalog.ISearchConditions): any[];
|
|
10
10
|
save(params: factory.offerCatalog.IOfferCatalog): Promise<factory.offerCatalog.IOfferCatalog>;
|
|
11
|
+
updateManyById(params: {
|
|
12
|
+
id: {
|
|
13
|
+
$in: string[];
|
|
14
|
+
};
|
|
15
|
+
$push: {
|
|
16
|
+
itemListElement: {
|
|
17
|
+
$each: factory.offerCatalog.IItemListElement[];
|
|
18
|
+
$slice: number;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
$pull: {
|
|
22
|
+
itemListElement: {
|
|
23
|
+
$elemMatch: {
|
|
24
|
+
id: {
|
|
25
|
+
$in: string[];
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
}): Promise<void>;
|
|
11
31
|
findById(params: {
|
|
12
32
|
id: string;
|
|
13
33
|
}): Promise<factory.offerCatalog.IOfferCatalog>;
|
|
@@ -144,6 +144,40 @@ class MongoRepository {
|
|
|
144
144
|
return doc.toObject();
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
|
+
updateManyById(params) {
|
|
148
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
149
|
+
if (!Array.isArray(params.id.$in) || params.id.$in.length === 0) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const pushItemListElementIds = params.$push.itemListElement.$each.map((element) => element.id);
|
|
153
|
+
yield this.offerCatalogModel.updateMany(Object.assign({ _id: { $in: params.id.$in } }, (pushItemListElementIds.length > 0)
|
|
154
|
+
// itemListElementのユニークネスを保証する
|
|
155
|
+
? {
|
|
156
|
+
'itemListElement.id': {
|
|
157
|
+
$nin: pushItemListElementIds
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
: undefined), Object.assign(Object.assign({}, (pushItemListElementIds.length > 0)
|
|
161
|
+
? {
|
|
162
|
+
$push: {
|
|
163
|
+
itemListElement: {
|
|
164
|
+
$each: params.$push.itemListElement.$each,
|
|
165
|
+
$slice: params.$push.itemListElement.$slice
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
: undefined), (params.$pull.itemListElement.$elemMatch.id.$in.length > 0)
|
|
170
|
+
? {
|
|
171
|
+
$pull: {
|
|
172
|
+
itemListElement: {
|
|
173
|
+
id: { $in: params.$pull.itemListElement.$elemMatch.id.$in }
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
: undefined))
|
|
178
|
+
.exec();
|
|
179
|
+
});
|
|
180
|
+
}
|
|
147
181
|
findById(params) {
|
|
148
182
|
return __awaiter(this, void 0, void 0, function* () {
|
|
149
183
|
const doc = yield this.offerCatalogModel.findOne({
|
|
@@ -9,7 +9,7 @@ function createReserveTransactionStartParams(params) {
|
|
|
9
9
|
var _a, _b;
|
|
10
10
|
const acceptedTicketOffersWithoutDetail = (Array.isArray(params.object.acceptedOffer))
|
|
11
11
|
? params.object.acceptedOffer.map((o) => {
|
|
12
|
-
var _a, _b, _c, _d, _e
|
|
12
|
+
var _a, _b, _c, _d, _e;
|
|
13
13
|
const issuedBy = {
|
|
14
14
|
typeOf: params.transaction.seller.typeOf,
|
|
15
15
|
name: (typeof params.transaction.seller.name === 'string')
|
|
@@ -27,11 +27,11 @@ function createReserveTransactionStartParams(params) {
|
|
|
27
27
|
// } else if (typeof o.movieTicketIdentifire === 'string') {
|
|
28
28
|
// appliesToMovieTicket = { identifier: o.movieTicketIdentifire };
|
|
29
29
|
}
|
|
30
|
-
return Object.assign(Object.assign(
|
|
30
|
+
return Object.assign(Object.assign({
|
|
31
31
|
// 必要な属性のみ指定する
|
|
32
32
|
id: o.id, itemOffered: Object.assign(Object.assign({}, o.itemOffered), { serviceOutput: Object.assign(Object.assign({}, (_c = o.itemOffered) === null || _c === void 0 ? void 0 : _c.serviceOutput), { reservedTicket: Object.assign(Object.assign({}, (_e = (_d = o.itemOffered) === null || _d === void 0 ? void 0 : _d.serviceOutput) === null || _e === void 0 ? void 0 : _e.reservedTicket), {
|
|
33
33
|
// issuedByを明示的に指定する
|
|
34
|
-
issuedBy, typeOf: 'Ticket' }), typeOf: factory.reservationType.EventReservation }) }) }, (Array.isArray(o.addOn)) ? { addOn: o.addOn } : undefined), (
|
|
34
|
+
issuedBy, typeOf: 'Ticket' }), typeOf: factory.reservationType.EventReservation }) }) }, (Array.isArray(o.addOn)) ? { addOn: o.addOn } : undefined), (appliesToMovieTicket !== undefined)
|
|
35
35
|
? { priceSpecification: { appliesToMovieTicket } }
|
|
36
36
|
: undefined);
|
|
37
37
|
})
|
|
@@ -186,6 +186,7 @@ function purchaseNumberAuthResult2movieTickets(params) {
|
|
|
186
186
|
purchaseNumberAuthResult.knyknrNoInfoOut.forEach((knyknrNoInfoOut) => {
|
|
187
187
|
const knyknrNoInfo = knyknrNoInfoIn.find((info) => info.knyknrNo === knyknrNoInfoOut.knyknrNo);
|
|
188
188
|
if (knyknrNoInfo !== undefined) {
|
|
189
|
+
const movieTicketCategoryCode = knyknrNoInfoOut.znkkkytsknGkjknTyp;
|
|
189
190
|
if (Array.isArray(knyknrNoInfoOut.ykknInfo)) {
|
|
190
191
|
knyknrNoInfoOut.ykknInfo.forEach((ykknInfo) => {
|
|
191
192
|
// tslint:disable-next-line:prefer-array-literal
|
|
@@ -195,6 +196,9 @@ function purchaseNumberAuthResult2movieTickets(params) {
|
|
|
195
196
|
typeOf: paymentMethodType,
|
|
196
197
|
identifier: knyknrNoInfo.knyknrNo,
|
|
197
198
|
accessCode: knyknrNoInfo.pinCd,
|
|
199
|
+
category: {
|
|
200
|
+
codeValue: movieTicketCategoryCode // 追加(2023-02-08~)
|
|
201
|
+
},
|
|
198
202
|
serviceType: ykknInfo.ykknshTyp,
|
|
199
203
|
serviceOutput: {
|
|
200
204
|
reservationFor: {
|
|
@@ -219,7 +223,9 @@ function purchaseNumberAuthResult2movieTickets(params) {
|
|
|
219
223
|
knyknrNoInfoOut.mkknInfo.forEach((mkknInfo) => {
|
|
220
224
|
// tslint:disable-next-line:prefer-array-literal
|
|
221
225
|
[...Array(Number(mkknInfo.mkknKnshbtsmiNum))].forEach(() => {
|
|
222
|
-
movieTickets.push(Object.assign({ project: { typeOf: factory.organizationType.Project, id: params.screeningEvent.project.id }, typeOf: paymentMethodType, identifier: knyknrNoInfo.knyknrNo, accessCode: knyknrNoInfo.pinCd,
|
|
226
|
+
movieTickets.push(Object.assign({ project: { typeOf: factory.organizationType.Project, id: params.screeningEvent.project.id }, typeOf: paymentMethodType, identifier: knyknrNoInfo.knyknrNo, accessCode: knyknrNoInfo.pinCd, category: {
|
|
227
|
+
codeValue: movieTicketCategoryCode // 追加(2023-02-08~)
|
|
228
|
+
}, amount: {
|
|
223
229
|
typeOf: 'MonetaryAmount',
|
|
224
230
|
currency: factory.priceCurrency.JPY,
|
|
225
231
|
validThrough: moment(`${mkknInfo.yykDt}+09:00`, 'YYYY/MM/DD HH:mm:ssZ')
|
package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js
CHANGED
|
@@ -155,7 +155,7 @@ function authorizeSeatReservationActions2requiredMovieTickets(params) {
|
|
|
155
155
|
if (Array.isArray(appliesToMovieTickets4paymentMethod) && appliesToMovieTickets4paymentMethod.length > 0) {
|
|
156
156
|
appliesToMovieTickets4paymentMethod.forEach((appliesToMovieTicket) => {
|
|
157
157
|
requiredMovieTickets.push({
|
|
158
|
-
project: action.project,
|
|
158
|
+
// project: action.project,
|
|
159
159
|
typeOf: paymentMethodType,
|
|
160
160
|
identifier: String(appliesToMovieTicket.identifier),
|
|
161
161
|
serviceType: appliesToMovieTicket.serviceType,
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.288.0-alpha.
|
|
12
|
+
"@chevre/factory": "4.288.0-alpha.1",
|
|
13
13
|
"@cinerino/sdk": "3.138.1",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.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.3.0-alpha.
|
|
123
|
+
"version": "20.3.0-alpha.3"
|
|
124
124
|
}
|