@chevre/domain 21.18.0-alpha.9 → 21.18.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.
- package/example/src/chevre/aggreateOwnershipInfosByOrder.ts +24 -0
- package/example/src/chevre/migratePaymentServicesToNewCollection.ts +21 -0
- package/example/src/chevre/offerCatalog2offerCatalogItem.ts +4 -0
- package/example/src/chevre/searchOffers.ts +41 -37
- package/example/src/chevre/searchOrderAcceptedOffers.ts +11 -11
- package/example/src/chevre/searchOrders.ts +11 -0
- package/example/src/chevre/searchProducts.ts +28 -0
- package/example/src/chevre/searchReservationsByOrder.ts +30 -0
- package/example/src/chevre/searchTransactions.ts +41 -0
- package/example/src/chevre/unsetUnnecessaryFields.ts +12 -6
- package/example/src/chevre/upsertMoviesByIdentifier.ts +5 -4
- package/example/src/chevre/upsertOfferCatalogsByIdentifier.ts +46 -0
- package/example/src/chevre/upsertOffersByIdentifier.ts +94 -0
- package/example/src/chevre/upsertScreeningEventSeriesByVersion.ts +104 -0
- package/lib/chevre/credentials.d.ts +0 -3
- package/lib/chevre/credentials.js +4 -3
- package/lib/chevre/repo/acceptedOffer.d.ts +31 -14
- package/lib/chevre/repo/acceptedOffer.js +56 -102
- package/lib/chevre/repo/creativeWork.d.ts +12 -2
- package/lib/chevre/repo/creativeWork.js +39 -25
- package/lib/chevre/repo/event.d.ts +15 -0
- package/lib/chevre/repo/event.js +66 -0
- package/lib/chevre/repo/mongoose/schemas/paymentService.d.ts +5 -0
- package/lib/chevre/repo/mongoose/schemas/paymentService.js +146 -0
- package/lib/chevre/repo/offer.d.ts +14 -5
- package/lib/chevre/repo/offer.js +94 -19
- package/lib/chevre/repo/offerCatalog.d.ts +18 -1
- package/lib/chevre/repo/offerCatalog.js +51 -39
- package/lib/chevre/repo/order.d.ts +14 -10
- package/lib/chevre/repo/order.js +20 -14
- package/lib/chevre/repo/paymentService.d.ts +62 -0
- package/lib/chevre/repo/paymentService.js +339 -0
- package/lib/chevre/repo/paymentServiceProvider.d.ts +27 -4
- package/lib/chevre/repo/paymentServiceProvider.js +85 -12
- package/lib/chevre/repo/place.js +14 -10
- package/lib/chevre/repo/product.d.ts +37 -24
- package/lib/chevre/repo/product.js +60 -150
- package/lib/chevre/repo/transaction.d.ts +5 -4
- package/lib/chevre/repository.d.ts +5 -7
- package/lib/chevre/repository.js +14 -17
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +10 -1
- package/lib/chevre/service/aggregation/event/findEventOffers.js +10 -1
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +1 -1
- package/lib/chevre/service/assetTransaction/pay/potentialActions.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +3 -3
- package/lib/chevre/service/assetTransaction/pay.d.ts +7 -6
- package/lib/chevre/service/assetTransaction/pay.js +44 -36
- package/lib/chevre/service/assetTransaction/refund/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/refund/factory.js +0 -5
- package/lib/chevre/service/assetTransaction/refund.d.ts +2 -0
- package/lib/chevre/service/assetTransaction/refund.js +16 -4
- package/lib/chevre/service/assetTransaction/registerService.js +18 -2
- package/lib/chevre/service/assetTransaction/reserve/factory/price.js +1 -1
- package/lib/chevre/service/assetTransaction/reserve.d.ts +6 -0
- package/lib/chevre/service/assetTransaction/reserve.js +32 -2
- package/lib/chevre/service/delivery/factory.d.ts +3 -1
- package/lib/chevre/service/delivery/factory.js +4 -2
- package/lib/chevre/service/delivery.d.ts +1 -2
- package/lib/chevre/service/delivery.js +1 -3
- package/lib/chevre/service/event.js +1 -1
- package/lib/chevre/service/moneyTransfer.js +11 -1
- package/lib/chevre/service/offer/event/authorize.d.ts +4 -0
- package/lib/chevre/service/offer/event/factory.d.ts +1 -1
- package/lib/chevre/service/offer/event/factory.js +4 -2
- package/lib/chevre/service/offer/event/processStartReserve4chevre.d.ts +4 -0
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +40 -5
- package/lib/chevre/service/offer/product/factory.js +1 -1
- package/lib/chevre/service/offer/product/searchProductOffers.js +10 -1
- package/lib/chevre/service/offer/product.d.ts +4 -15
- package/lib/chevre/service/offer/product.js +85 -57
- package/lib/chevre/service/order/confirmPayTransaction.d.ts +0 -2
- package/lib/chevre/service/order/confirmPayTransaction.js +0 -1
- package/lib/chevre/service/order/createAccountingReportIfNotExist.d.ts +3 -1
- package/lib/chevre/service/order/createAccountingReportIfNotExist.js +4 -1
- package/lib/chevre/service/order/deleteOrder.d.ts +2 -0
- package/lib/chevre/service/order/deleteOrder.js +15 -4
- package/lib/chevre/service/order/findPlaceOrderTransaction.d.ts +3 -1
- package/lib/chevre/service/order/findPlaceOrderTransaction.js +1 -2
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +3 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +13 -5
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.d.ts +2 -4
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +13 -32
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.d.ts +12 -12
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +17 -76
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +2 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +1 -3
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +3 -3
- package/lib/chevre/service/order/payOrder.d.ts +2 -0
- package/lib/chevre/service/order/placeOrder.d.ts +2 -0
- package/lib/chevre/service/order/placeOrder.js +62 -14
- package/lib/chevre/service/order/returnOrder.js +28 -10
- package/lib/chevre/service/order/sendOrder.d.ts +2 -2
- package/lib/chevre/service/order/sendOrder.js +16 -4
- package/lib/chevre/service/payment/any.d.ts +5 -4
- package/lib/chevre/service/payment/any.js +1 -1
- package/lib/chevre/service/payment/creditCard.d.ts +5 -5
- package/lib/chevre/service/payment/creditCard.js +4 -4
- package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +5 -3
- package/lib/chevre/service/payment/movieTicket/checkByIdentifier.js +3 -3
- package/lib/chevre/service/payment/movieTicket/getCredentials.d.ts +14 -5
- package/lib/chevre/service/payment/movieTicket/getCredentials.js +26 -9
- package/lib/chevre/service/payment/movieTicket/validation.d.ts +4 -2
- package/lib/chevre/service/payment/movieTicket.d.ts +11 -7
- package/lib/chevre/service/payment/movieTicket.js +4 -5
- package/lib/chevre/service/payment/paymentCard.js +9 -2
- package/lib/chevre/service/payment.d.ts +4 -0
- package/lib/chevre/service/reserve/searchByOrder.d.ts +21 -0
- package/lib/chevre/service/reserve/searchByOrder.js +113 -0
- package/lib/chevre/service/reserve/verifyToken4reservation.js +0 -11
- package/lib/chevre/service/reserve.d.ts +2 -1
- package/lib/chevre/service/reserve.js +3 -1
- package/lib/chevre/service/task/confirmPayTransaction.js +0 -2
- package/lib/chevre/service/task/deleteTransaction.js +2 -0
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +2 -0
- package/lib/chevre/service/task/onAuthorizationCreated.js +0 -19
- package/lib/chevre/service/task/onOrderPaymentCompleted.js +2 -0
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +3 -6
- package/lib/chevre/service/task/onResourceUpdated.js +1 -1
- package/lib/chevre/service/task/pay.js +2 -1
- package/lib/chevre/service/task/placeOrder.js +2 -0
- package/lib/chevre/service/task/refund.js +2 -1
- package/lib/chevre/service/task/returnPayTransaction.js +3 -2
- package/lib/chevre/service/task/sendOrder.js +10 -17
- package/lib/chevre/service/task/voidPayTransaction.js +2 -3
- package/lib/chevre/service/task/voidPayment.js +2 -0
- package/lib/chevre/service/task/voidRegisterServiceTransaction.js +3 -7
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +2 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.d.ts +0 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +0 -86
- package/lib/chevre/service/transaction/placeOrderInProgress/result.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +1 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.d.ts +1 -0
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.js +3 -3
- package/lib/chevre/service/transaction/returnOrder/potentialActions.d.ts +1 -0
- package/lib/chevre/service/transaction/returnOrder/potentialActions.js +1 -1
- package/lib/chevre/service/transaction/returnOrder.d.ts +1 -0
- package/lib/chevre/service/transaction/returnOrder.js +64 -58
- package/lib/chevre/settings.d.ts +2 -0
- package/lib/chevre/settings.js +3 -1
- package/package.json +3 -3
- package/example/src/chevre/transaction/findPaymentCardPermit.ts +0 -29
- package/lib/chevre/repo/action/registerServiceInProgress.d.ts +0 -29
- package/lib/chevre/repo/action/registerServiceInProgress.js +0 -58
- package/lib/chevre/service/transaction/orderProgramMembership/findPaymentCardPermit.d.ts +0 -26
- package/lib/chevre/service/transaction/orderProgramMembership/findPaymentCardPermit.js +0 -65
|
@@ -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
|
+
|
|
8
|
+
async function main() {
|
|
9
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
10
|
+
|
|
11
|
+
const acceptedOfferRepo = await chevre.repository.AcceptedOffer.createInstance(mongoose.connection);
|
|
12
|
+
|
|
13
|
+
const ownershipInfos = await acceptedOfferRepo.aggreateOwnershipInfosByOrder(
|
|
14
|
+
{
|
|
15
|
+
orderNumber: { $eq: 'CIN4-3943271-4221863' }
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
// tslint:disable-next-line:no-null-keyword
|
|
19
|
+
console.dir(ownershipInfos, { depth: 1 });
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
main()
|
|
23
|
+
.then()
|
|
24
|
+
.catch(console.error);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../lib/index';
|
|
5
|
+
|
|
6
|
+
mongoose.Model.on('index', (...args) => {
|
|
7
|
+
console.error('******** index event emitted. ********\n', args);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
// tslint:disable-next-line:max-func-body-length
|
|
11
|
+
async function main() {
|
|
12
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: process.env.MONGO_AUTO_INDEX === '1' });
|
|
13
|
+
|
|
14
|
+
const paymentServiceRepo = await chevre.repository.PaymentService.createInstance(mongoose.connection);
|
|
15
|
+
|
|
16
|
+
await paymentServiceRepo.migratePaymentServicesToNewCollection();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
main()
|
|
20
|
+
.then()
|
|
21
|
+
.catch(console.error);
|
|
@@ -21,6 +21,7 @@ async function main() {
|
|
|
21
21
|
let i = 0;
|
|
22
22
|
let maxOfferCatalogItemNumItemListElement = 0;
|
|
23
23
|
let maxIdentifierLength = 0;
|
|
24
|
+
let maxOfferCatalogItemLength = 0;
|
|
24
25
|
for (const offerCatalog of offerCatalogs) {
|
|
25
26
|
i += 1;
|
|
26
27
|
maxIdentifierLength = Math.max(maxIdentifierLength, offerCatalog.identifier.length);
|
|
@@ -145,11 +146,14 @@ async function main() {
|
|
|
145
146
|
maxOfferCatalogItemNumItemListElement =
|
|
146
147
|
Math.max(maxOfferCatalogItemNumItemListElement, offerCatalogItem.itemListElement.length);
|
|
147
148
|
});
|
|
149
|
+
|
|
150
|
+
maxOfferCatalogItemLength = Math.max(maxOfferCatalogItemLength, offerCatalogItems.length);
|
|
148
151
|
}
|
|
149
152
|
|
|
150
153
|
console.log(i, 'offerCatalogs checked');
|
|
151
154
|
console.log('maxOfferCatalogItemNumItemListElement:', maxOfferCatalogItemNumItemListElement);
|
|
152
155
|
console.log('maxIdentifierLength:', maxIdentifierLength);
|
|
156
|
+
console.log('maxOfferCatalogItemLength:', maxOfferCatalogItemLength);
|
|
153
157
|
}
|
|
154
158
|
|
|
155
159
|
main()
|
|
@@ -10,52 +10,56 @@ mongoose.Model.on('index', (...args) => {
|
|
|
10
10
|
async function main() {
|
|
11
11
|
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
12
12
|
|
|
13
|
-
const indexes = await mongoose.connection.db.collection('aggregateOffers')
|
|
14
|
-
|
|
15
|
-
console.log(indexes);
|
|
16
|
-
console.log(indexes.length);
|
|
13
|
+
// const indexes = await mongoose.connection.db.collection('aggregateOffers')
|
|
14
|
+
// .indexes();
|
|
15
|
+
// console.log(indexes);
|
|
16
|
+
// console.log(indexes.length);
|
|
17
17
|
|
|
18
18
|
const offerRepo = await chevre.repository.Offer.createInstance(mongoose.connection);
|
|
19
19
|
|
|
20
|
-
const offers = await offerRepo.search(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
const offers = await offerRepo.search(
|
|
21
|
+
{
|
|
22
|
+
limit: 100,
|
|
23
|
+
// page: 1,
|
|
24
|
+
project: { id: { $eq: String(process.env.PROJECT_ID) } },
|
|
25
|
+
availability: { $eq: chevre.factory.itemAvailability.InStock },
|
|
26
|
+
// acceptedPaymentMethod: { identifier: { $in: ['xxx'] } },
|
|
27
|
+
parentOffer: {
|
|
28
|
+
},
|
|
29
|
+
priceSpecification: {
|
|
30
|
+
appliesToMovieTicket: {
|
|
31
|
+
serviceOutput: {
|
|
32
|
+
typeOf: {
|
|
33
|
+
// $eq: '',
|
|
34
|
+
// $all: []
|
|
35
|
+
}
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
38
|
}
|
|
39
|
+
// includedInDataCatalog: { id: { $in: ['0001'] } }
|
|
40
|
+
// additionalProperty: {
|
|
41
|
+
// $all: [
|
|
42
|
+
// {
|
|
43
|
+
// $elemMatch: {
|
|
44
|
+
// name: { $eq: 'theaterCode' },
|
|
45
|
+
// value: { $in: ['120'] }
|
|
46
|
+
// }
|
|
47
|
+
// },
|
|
48
|
+
// {
|
|
49
|
+
// $elemMatch: {
|
|
50
|
+
// name: { $eq: 'ticketCode' },
|
|
51
|
+
// value: { $in: ['10', '1001'] }
|
|
52
|
+
// }
|
|
53
|
+
// }
|
|
54
|
+
// ]
|
|
55
|
+
// }
|
|
37
56
|
}
|
|
38
|
-
//
|
|
39
|
-
|
|
40
|
-
// $all: [
|
|
41
|
-
// {
|
|
42
|
-
// $elemMatch: {
|
|
43
|
-
// name: { $eq: 'theaterCode' },
|
|
44
|
-
// value: { $in: ['120'] }
|
|
45
|
-
// }
|
|
46
|
-
// },
|
|
47
|
-
// {
|
|
48
|
-
// $elemMatch: {
|
|
49
|
-
// name: { $eq: 'ticketCode' },
|
|
50
|
-
// value: { $in: ['10', '1001'] }
|
|
51
|
-
// }
|
|
52
|
-
// }
|
|
53
|
-
// ]
|
|
54
|
-
// }
|
|
55
|
-
});
|
|
57
|
+
// { identifier: 1 }
|
|
58
|
+
);
|
|
56
59
|
console.log(offers.map((offer) => {
|
|
57
|
-
return `${offer.project.id} ${offer.id} ${offer.identifier} ${offer.name
|
|
60
|
+
return `${offer.project?.id} ${offer.id} ${offer.parentOffer?.id} ${offer.identifier} ${offer.name?.ja}`;
|
|
58
61
|
}));
|
|
62
|
+
// console.log(offers);
|
|
59
63
|
console.log(offers.length);
|
|
60
64
|
}
|
|
61
65
|
|
|
@@ -10,17 +10,17 @@ async function main() {
|
|
|
10
10
|
|
|
11
11
|
const acceptedOfferRepo = await chevre.repository.AcceptedOffer.createInstance(mongoose.connection);
|
|
12
12
|
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
const acceptedOffers = await acceptedOfferRepo.searchAcceptedOffersByOrderNumber(
|
|
14
|
+
{
|
|
15
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
16
|
+
limit: 10,
|
|
17
|
+
page: 1,
|
|
18
|
+
project: { id: { $eq: project.id } },
|
|
19
|
+
orderNumber: { $eq: 'CIN3-0760465-8981560' },
|
|
20
|
+
acceptedOffers: { itemOffered: { typeOf: { $in: [chevre.factory.reservationType.EventReservation] } } }
|
|
21
|
+
},
|
|
22
|
+
['itemOffered', 'id']
|
|
23
|
+
);
|
|
24
24
|
// tslint:disable-next-line:no-null-keyword
|
|
25
25
|
console.dir(acceptedOffers, { depth: 1 });
|
|
26
26
|
const reservationIds = acceptedOffers.map((acceptedOffer) => {
|
|
@@ -10,6 +10,17 @@ async function main() {
|
|
|
10
10
|
|
|
11
11
|
const orderRepo = await chevre.repository.Order.createInstance(mongoose.connection);
|
|
12
12
|
|
|
13
|
+
const order = await orderRepo.findByOrderNumber({
|
|
14
|
+
orderNumber: 'CIN4-3943271-4221863',
|
|
15
|
+
project: { id: project.id },
|
|
16
|
+
inclusion: [
|
|
17
|
+
// 'project', 'typeOf', 'orderNumber', 'dateReturned', 'id',
|
|
18
|
+
// 'customer', 'returner', 'seller', 'price', 'priceCurrency', 'orderDate'
|
|
19
|
+
],
|
|
20
|
+
exclusion: ['acceptedOffers']
|
|
21
|
+
});
|
|
22
|
+
console.log(order);
|
|
23
|
+
|
|
13
24
|
const orders = await orderRepo.search(
|
|
14
25
|
{
|
|
15
26
|
limit: 10,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// tslint:disable:no-implicit-dependencies no-console
|
|
2
|
+
import { chevre } from '../../../lib/index';
|
|
3
|
+
|
|
4
|
+
import * as mongoose from 'mongoose';
|
|
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 productRepo = await chevre.repository.Product.createInstance(mongoose.connection);
|
|
12
|
+
const products = await productRepo.searchProducts(
|
|
13
|
+
{
|
|
14
|
+
project: { id: { $eq: project.id } }
|
|
15
|
+
},
|
|
16
|
+
// ['_id', 'typeOf'],
|
|
17
|
+
[],
|
|
18
|
+
[]
|
|
19
|
+
);
|
|
20
|
+
console.log('products:', products);
|
|
21
|
+
console.log(products.length, 'products found');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
main()
|
|
25
|
+
.then(() => {
|
|
26
|
+
console.log('success!');
|
|
27
|
+
})
|
|
28
|
+
.catch(console.error);
|
|
@@ -0,0 +1,30 @@
|
|
|
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 { reservations } = await (await chevre.service.reserve.createService()).searchByOrder({
|
|
12
|
+
limit: 10,
|
|
13
|
+
page: 1,
|
|
14
|
+
project: { id: project.id },
|
|
15
|
+
orderNumber: 'CIN3-0760465-8981560',
|
|
16
|
+
// orderNumber: 'SSK1-3743647-5975553',
|
|
17
|
+
// orderNumber: 'SSK9-4864565-8689164',
|
|
18
|
+
typeOf: chevre.factory.reservationType.EventReservation
|
|
19
|
+
})({
|
|
20
|
+
acceptedOffer: await chevre.repository.AcceptedOffer.createInstance(mongoose.connection),
|
|
21
|
+
order: await chevre.repository.Order.createInstance(mongoose.connection),
|
|
22
|
+
reservation: await chevre.repository.Reservation.createInstance(mongoose.connection)
|
|
23
|
+
});
|
|
24
|
+
console.log(reservations);
|
|
25
|
+
console.log(reservations.length, 'reservations found');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
main()
|
|
29
|
+
.then(console.log)
|
|
30
|
+
.catch(console.error);
|
|
@@ -0,0 +1,41 @@
|
|
|
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 transactionRepo = await chevre.repository.Transaction.createInstance(mongoose.connection);
|
|
12
|
+
|
|
13
|
+
const transactions = await transactionRepo.search<chevre.factory.transactionType.PlaceOrder>({
|
|
14
|
+
limit: 1,
|
|
15
|
+
page: 1,
|
|
16
|
+
project: { id: { $eq: project.id } },
|
|
17
|
+
typeOf: chevre.factory.transactionType.PlaceOrder,
|
|
18
|
+
statuses: [chevre.factory.transactionStatusType.Confirmed],
|
|
19
|
+
result: {
|
|
20
|
+
order: {
|
|
21
|
+
confirmationNumber: { $eq: '14438' },
|
|
22
|
+
orderNumbers: ['CIN3-0760465-8981560']
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
inclusion: ['id'],
|
|
26
|
+
exclusion: []
|
|
27
|
+
});
|
|
28
|
+
console.log('transactions found', transactions);
|
|
29
|
+
console.log(transactions.length, 'transactions found');
|
|
30
|
+
|
|
31
|
+
const transaction = await transactionRepo.findById({
|
|
32
|
+
typeOf: chevre.factory.transactionType.PlaceOrder,
|
|
33
|
+
id: '6570f9d7834f9638ceec86ad',
|
|
34
|
+
inclusion: ['_id', 'typeOf', 'status']
|
|
35
|
+
});
|
|
36
|
+
console.log('transaction found', transaction);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
main()
|
|
40
|
+
.then()
|
|
41
|
+
.catch(console.error);
|
|
@@ -3,19 +3,25 @@ import * as mongoose from 'mongoose';
|
|
|
3
3
|
|
|
4
4
|
import { chevre } from '../../../lib/index';
|
|
5
5
|
|
|
6
|
-
// const PROJECT_ID = String(process.env.PROJECT_ID);
|
|
7
|
-
|
|
8
6
|
async function main() {
|
|
9
7
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
8
|
|
|
11
9
|
let updateResult: any;
|
|
12
10
|
|
|
13
|
-
const
|
|
14
|
-
updateResult = await
|
|
11
|
+
const paymentServiceProviderRepo = await chevre.repository.PaymentServiceProvider.createInstance(mongoose.connection);
|
|
12
|
+
updateResult = await paymentServiceProviderRepo.unsetUnnecessaryFields({
|
|
15
13
|
filter: {
|
|
16
|
-
|
|
14
|
+
typeOf: {
|
|
15
|
+
$in: [
|
|
16
|
+
chevre.factory.service.paymentService.PaymentServiceType.CreditCard,
|
|
17
|
+
chevre.factory.service.paymentService.PaymentServiceType.MovieTicket
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
'provider.name': { $exists: true }
|
|
17
21
|
},
|
|
18
|
-
$unset: {
|
|
22
|
+
$unset: {
|
|
23
|
+
'provider.$[].name': 1
|
|
24
|
+
}
|
|
19
25
|
});
|
|
20
26
|
console.log('unset processed.', updateResult);
|
|
21
27
|
}
|
|
@@ -14,9 +14,9 @@ async function main() {
|
|
|
14
14
|
const result = await creativeWorkRepo.upsertMoviesByIdentifier(
|
|
15
15
|
[
|
|
16
16
|
{
|
|
17
|
-
|
|
17
|
+
$set: {
|
|
18
18
|
id: '',
|
|
19
|
-
identifier: '
|
|
19
|
+
identifier: '20231215',
|
|
20
20
|
typeOf: chevre.factory.creativeWorkType.Movie,
|
|
21
21
|
duration: 'PT2H',
|
|
22
22
|
name: { ja: '名探偵コナン ゼロの執行人', en: 'Detective Conan Zero Enforcer' },
|
|
@@ -34,7 +34,7 @@ async function main() {
|
|
|
34
34
|
value: 'https://iwiz-movies.c.yimg.jp/c/movies/pict/p/p/90/cb/174755_02.jpg'
|
|
35
35
|
}
|
|
36
36
|
],
|
|
37
|
-
headline: '
|
|
37
|
+
// headline: 'サブタイトルサブタイトル',
|
|
38
38
|
datePublished: moment('2018-11-04T15:00:00.000Z')
|
|
39
39
|
.toDate(),
|
|
40
40
|
distributor: {
|
|
@@ -44,7 +44,8 @@ async function main() {
|
|
|
44
44
|
distributorType: '001'
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
}
|
|
47
|
+
},
|
|
48
|
+
$unset: { headline: 1 }
|
|
48
49
|
}
|
|
49
50
|
],
|
|
50
51
|
{ replace: true }
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
// tslint:disable-next-line:max-func-body-length
|
|
9
|
+
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
|
+
|
|
14
|
+
const result = await offerCatalogRepo.upsertManyByIdentifier(
|
|
15
|
+
[
|
|
16
|
+
{
|
|
17
|
+
$set: {
|
|
18
|
+
project: { typeOf: chevre.factory.organizationType.Project, id: PROJECT_ID },
|
|
19
|
+
typeOf: 'OfferCatalog',
|
|
20
|
+
id: '',
|
|
21
|
+
identifier: '2023121501',
|
|
22
|
+
itemListElement: [
|
|
23
|
+
{ id: '1001', typeOf: chevre.factory.offerType.Offer }
|
|
24
|
+
],
|
|
25
|
+
itemOffered: { typeOf: chevre.factory.product.ProductType.EventService },
|
|
26
|
+
name: {
|
|
27
|
+
en: '2023121501',
|
|
28
|
+
ja: '2023121501'
|
|
29
|
+
},
|
|
30
|
+
description: {
|
|
31
|
+
en: '2023121501',
|
|
32
|
+
ja: '2023121501'
|
|
33
|
+
},
|
|
34
|
+
additionalProperty: []
|
|
35
|
+
},
|
|
36
|
+
$unset: {}
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
// { replace: true }
|
|
40
|
+
);
|
|
41
|
+
console.log('result:', result);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
main()
|
|
45
|
+
.then(console.log)
|
|
46
|
+
.catch(console.error);
|
|
@@ -0,0 +1,94 @@
|
|
|
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
|
+
// tslint:disable-next-line:max-func-body-length
|
|
9
|
+
async function main() {
|
|
10
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
11
|
+
|
|
12
|
+
const offerRepo = await chevre.repository.Offer.createInstance(mongoose.connection);
|
|
13
|
+
|
|
14
|
+
const result = await offerRepo.upsertByIdentifier(
|
|
15
|
+
[
|
|
16
|
+
{
|
|
17
|
+
additionalProperty: [],
|
|
18
|
+
addOn: [],
|
|
19
|
+
alternateName: { en: '', ja: '20231213' },
|
|
20
|
+
availability: chevre.factory.itemAvailability.InStock,
|
|
21
|
+
availableAtOrFrom: [],
|
|
22
|
+
itemOffered: {
|
|
23
|
+
typeOf: chevre.factory.product.ProductType.EventService,
|
|
24
|
+
serviceOutput: {}
|
|
25
|
+
},
|
|
26
|
+
name: { ja: '20231213', en: '20231213' },
|
|
27
|
+
priceCurrency: chevre.factory.priceCurrency.JPY,
|
|
28
|
+
priceSpecification: {
|
|
29
|
+
name: { en: '20231213', ja: '20231213' },
|
|
30
|
+
price: 20231213,
|
|
31
|
+
priceCurrency: chevre.factory.priceCurrency.JPY,
|
|
32
|
+
referenceQuantity: {
|
|
33
|
+
typeOf: 'QuantitativeValue',
|
|
34
|
+
value: 1,
|
|
35
|
+
unitCode: chevre.factory.unitCode.C62
|
|
36
|
+
},
|
|
37
|
+
typeOf: chevre.factory.priceSpecificationType.UnitPriceSpecification,
|
|
38
|
+
valueAddedTaxIncluded: true,
|
|
39
|
+
accounting: {
|
|
40
|
+
typeOf: 'Accounting',
|
|
41
|
+
accountsReceivable: 20231213
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
settings: { ignoreCategoryCodeChargeSpec: false },
|
|
45
|
+
description: { en: '', ja: '' },
|
|
46
|
+
hasMerchantReturnPolicy: [],
|
|
47
|
+
identifier: '20231213',
|
|
48
|
+
project: { typeOf: chevre.factory.organizationType.Project, id: PROJECT_ID },
|
|
49
|
+
typeOf: chevre.factory.offerType.Offer
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
additionalProperty: [],
|
|
53
|
+
addOn: [],
|
|
54
|
+
alternateName: { en: '', ja: '2023121302' },
|
|
55
|
+
availability: chevre.factory.itemAvailability.InStock,
|
|
56
|
+
availableAtOrFrom: [],
|
|
57
|
+
itemOffered: {
|
|
58
|
+
typeOf: chevre.factory.product.ProductType.EventService,
|
|
59
|
+
serviceOutput: {}
|
|
60
|
+
},
|
|
61
|
+
name: { ja: '2023121302', en: '2023121302' },
|
|
62
|
+
priceCurrency: chevre.factory.priceCurrency.JPY,
|
|
63
|
+
priceSpecification: {
|
|
64
|
+
name: { en: '2023121302', ja: '2023121302' },
|
|
65
|
+
price: 20231213,
|
|
66
|
+
priceCurrency: chevre.factory.priceCurrency.JPY,
|
|
67
|
+
referenceQuantity: {
|
|
68
|
+
typeOf: 'QuantitativeValue',
|
|
69
|
+
value: 1,
|
|
70
|
+
unitCode: chevre.factory.unitCode.C62
|
|
71
|
+
},
|
|
72
|
+
typeOf: chevre.factory.priceSpecificationType.UnitPriceSpecification,
|
|
73
|
+
valueAddedTaxIncluded: true,
|
|
74
|
+
accounting: {
|
|
75
|
+
typeOf: 'Accounting',
|
|
76
|
+
accountsReceivable: 20231213
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
settings: { ignoreCategoryCodeChargeSpec: false },
|
|
80
|
+
description: { en: '', ja: '' },
|
|
81
|
+
hasMerchantReturnPolicy: [],
|
|
82
|
+
identifier: '2023121302',
|
|
83
|
+
project: { typeOf: chevre.factory.organizationType.Project, id: PROJECT_ID },
|
|
84
|
+
typeOf: chevre.factory.offerType.Offer
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
// { replace: true }
|
|
88
|
+
);
|
|
89
|
+
console.log('result:', result);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
main()
|
|
93
|
+
.then(console.log)
|
|
94
|
+
.catch(console.error);
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as moment from 'moment';
|
|
3
|
+
import * as mongoose from 'mongoose';
|
|
4
|
+
|
|
5
|
+
import { chevre } from '../../../lib/index';
|
|
6
|
+
|
|
7
|
+
const PROJECT_ID = String(process.env.PROJECT_ID);
|
|
8
|
+
|
|
9
|
+
// tslint:disable-next-line:max-func-body-length
|
|
10
|
+
async function main() {
|
|
11
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
12
|
+
|
|
13
|
+
const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
14
|
+
|
|
15
|
+
const result = await eventRepo.upsertScreeningEventSeriesByVersion(
|
|
16
|
+
[
|
|
17
|
+
{
|
|
18
|
+
$set: {
|
|
19
|
+
eventStatus: chevre.factory.eventStatusType.EventScheduled,
|
|
20
|
+
videoFormat: [],
|
|
21
|
+
soundFormat: [],
|
|
22
|
+
kanaName: '',
|
|
23
|
+
startDate: moment('2023-12-08T15:00:00Z')
|
|
24
|
+
.toDate(),
|
|
25
|
+
endDate: moment('2123-12-08T15:00:00Z')
|
|
26
|
+
.toDate(),
|
|
27
|
+
typeOf: chevre.factory.eventType.ScreeningEventSeries,
|
|
28
|
+
duration: 'PT2H',
|
|
29
|
+
name: { ja: '名探偵コナン ゼロの執行人', en: 'Detective Conan Zero Enforcer' },
|
|
30
|
+
offers: {
|
|
31
|
+
typeOf: chevre.factory.offerType.Offer
|
|
32
|
+
},
|
|
33
|
+
project: { typeOf: chevre.factory.organizationType.Project, id: PROJECT_ID },
|
|
34
|
+
additionalProperty: [
|
|
35
|
+
],
|
|
36
|
+
location: {
|
|
37
|
+
branchCode: '118',
|
|
38
|
+
id: '5bfb841d5a78d7948369979a',
|
|
39
|
+
kanaName: 'シネモーションアカサカ',
|
|
40
|
+
name: { ja: 'シネモーション赤坂 ', en: 'CineMotion Akasaka' },
|
|
41
|
+
typeOf: chevre.factory.placeType.MovieTheater
|
|
42
|
+
},
|
|
43
|
+
workPerformed: {
|
|
44
|
+
typeOf: chevre.factory.creativeWorkType.Movie,
|
|
45
|
+
id: '5bfb841d5a78d79483699801',
|
|
46
|
+
identifier: '071953',
|
|
47
|
+
name: {
|
|
48
|
+
ja: '男はつらいよ 純情篇'
|
|
49
|
+
},
|
|
50
|
+
duration: 'PT1H29M',
|
|
51
|
+
version: '2'
|
|
52
|
+
},
|
|
53
|
+
organizer: { id: '59d20831e53ebc2b4e774466' },
|
|
54
|
+
headline: { ja: 'xxx', en: '' }
|
|
55
|
+
},
|
|
56
|
+
$unset: {}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
$set: {
|
|
60
|
+
eventStatus: chevre.factory.eventStatusType.EventScheduled,
|
|
61
|
+
videoFormat: [],
|
|
62
|
+
soundFormat: [],
|
|
63
|
+
kanaName: '',
|
|
64
|
+
startDate: moment('2023-12-08T15:00:00Z')
|
|
65
|
+
.toDate(),
|
|
66
|
+
endDate: moment('2123-12-08T15:00:00Z')
|
|
67
|
+
.toDate(),
|
|
68
|
+
typeOf: chevre.factory.eventType.ScreeningEventSeries,
|
|
69
|
+
duration: 'PT2H',
|
|
70
|
+
name: { ja: '名探偵コナン ゼロの執行人', en: 'Detective Conan Zero Enforcer' },
|
|
71
|
+
offers: {
|
|
72
|
+
typeOf: chevre.factory.offerType.Offer
|
|
73
|
+
},
|
|
74
|
+
project: { typeOf: chevre.factory.organizationType.Project, id: PROJECT_ID },
|
|
75
|
+
additionalProperty: [
|
|
76
|
+
],
|
|
77
|
+
location: {
|
|
78
|
+
branchCode: '118',
|
|
79
|
+
id: '5bfb841d5a78d7948369979a',
|
|
80
|
+
kanaName: 'シネモーションアカサカ',
|
|
81
|
+
name: { ja: 'シネモーション赤坂 ', en: 'CineMotion Akasaka' },
|
|
82
|
+
typeOf: chevre.factory.placeType.MovieTheater
|
|
83
|
+
},
|
|
84
|
+
workPerformed: {
|
|
85
|
+
typeOf: chevre.factory.creativeWorkType.Movie,
|
|
86
|
+
id: '5bfb841d5a78d79483699801',
|
|
87
|
+
identifier: '071953',
|
|
88
|
+
name: {
|
|
89
|
+
ja: '男はつらいよ 純情篇'
|
|
90
|
+
},
|
|
91
|
+
duration: 'PT1H29M',
|
|
92
|
+
version: '6'
|
|
93
|
+
},
|
|
94
|
+
organizer: { id: '59d20831e53ebc2b4e774466' }
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
);
|
|
99
|
+
console.log('result:', result);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
main()
|
|
103
|
+
.then(console.log)
|
|
104
|
+
.catch(console.error);
|
|
@@ -41,9 +41,10 @@ exports.credentials = {
|
|
|
41
41
|
sendGrid: {
|
|
42
42
|
apiKey: process.env.SENDGRID_API_KEY
|
|
43
43
|
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
// discontinue(2023-12-12~)
|
|
45
|
+
// hub: {
|
|
46
|
+
// clientId: <string>process.env.HUB_CLIENT_ID
|
|
47
|
+
// },
|
|
47
48
|
jwt: {
|
|
48
49
|
secret: process.env.TOKEN_SECRET,
|
|
49
50
|
issuer: process.env.RESOURCE_SERVER_IDENTIFIER
|