@chevre/domain 21.18.0-alpha.4 → 21.18.0-alpha.41
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/offerCatalog2offerCatalogItem.ts +4 -0
- package/example/src/chevre/searchAcceptedOfferIds.ts +57 -0
- package/example/src/chevre/searchOffers.ts +41 -37
- package/example/src/chevre/searchOrderAcceptedOffers.ts +12 -12
- package/example/src/chevre/searchOrders.ts +36 -19
- package/example/src/chevre/searchReservationsByOrder.ts +30 -0
- package/example/src/chevre/searchTransactions.ts +41 -0
- package/example/src/chevre/transaction/processReturnOrder.ts +1 -0
- 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 +60 -0
- package/lib/chevre/repo/acceptedOffer.js +158 -0
- 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/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 -54
- package/lib/chevre/repo/order.js +46 -180
- package/lib/chevre/repo/paymentService.d.ts +30 -0
- package/lib/chevre/repo/paymentService.js +75 -0
- package/lib/chevre/repo/place.js +14 -10
- package/lib/chevre/repo/product.d.ts +41 -10
- package/lib/chevre/repo/product.js +94 -47
- package/lib/chevre/repo/transaction.d.ts +5 -4
- package/lib/chevre/repository.d.ts +10 -7
- package/lib/chevre/repository.js +28 -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 +3 -1
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +3 -3
- package/lib/chevre/service/assetTransaction/pay.d.ts +2 -0
- package/lib/chevre/service/assetTransaction/pay.js +47 -34
- 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.js +15 -3
- 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.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/factory.d.ts +1 -1
- package/lib/chevre/service/offer/event/factory.js +4 -2
- 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 +0 -14
- package/lib/chevre/service/offer/product.js +61 -44
- package/lib/chevre/service/order/confirmPayTransaction.d.ts +2 -0
- package/lib/chevre/service/order/confirmPayTransaction.js +1 -0
- 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 -3
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +15 -9
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +11 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.js +54 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled.d.ts +10 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled.js +38 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.d.ts +12 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.js +111 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.d.ts +12 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +64 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.d.ts +10 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +103 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.d.ts +23 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +180 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +14 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +214 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +10 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +110 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.d.ts +14 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +164 -0
- package/lib/chevre/service/order/onOrderStatusChanged.d.ts +9 -15
- package/lib/chevre/service/order/onOrderStatusChanged.js +11 -446
- package/lib/chevre/service/order/onOrderUpdated/factory.d.ts +6 -0
- package/lib/chevre/service/order/onOrderUpdated/factory.js +45 -0
- package/lib/chevre/service/order/onOrderUpdated.js +1 -1
- package/lib/chevre/service/order/payOrder.d.ts +2 -2
- package/lib/chevre/service/order/placeOrder.d.ts +2 -3
- package/lib/chevre/service/order/placeOrder.js +65 -22
- package/lib/chevre/service/order/returnOrder.d.ts +2 -2
- package/lib/chevre/service/order/returnOrder.js +34 -13
- package/lib/chevre/service/order/sendOrder.d.ts +2 -2
- package/lib/chevre/service/order/sendOrder.js +19 -6
- package/lib/chevre/service/order.d.ts +2 -2
- package/lib/chevre/service/order.js +2 -2
- package/lib/chevre/service/payment/any.js +1 -1
- package/lib/chevre/service/payment/movieTicket/getCredentials.js +1 -2
- package/lib/chevre/service/payment/paymentCard.js +9 -2
- 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 +2 -1
- package/lib/chevre/service/task/deleteTransaction.js +2 -0
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +5 -6
- package/lib/chevre/service/task/onAuthorizationCreated.js +9 -18
- package/lib/chevre/service/task/onOrderPaymentCompleted.js +5 -6
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated.js +1 -1
- package/lib/chevre/service/task/placeOrder.js +10 -17
- package/lib/chevre/service/task/returnOrder.js +10 -17
- package/lib/chevre/service/task/sendOrder.js +10 -17
- package/lib/chevre/service/task/voidRegisterServiceTransaction.js +3 -7
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +2 -0
- package/lib/chevre/service/transaction/moneyTransfer.js +3 -4
- 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 +3 -0
- package/lib/chevre/service/transaction/returnOrder.js +73 -55
- 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/order/onOrderStatusChanged/factory.d.ts +0 -42
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +0 -467
- package/lib/chevre/service/transaction/orderProgramMembership/findPaymentCardPermit.d.ts +0 -26
- package/lib/chevre/service/transaction/orderProgramMembership/findPaymentCardPermit.js +0 -65
|
@@ -172,25 +172,34 @@ function fixOrders(params) {
|
|
|
172
172
|
project: { id: { $eq: params.project.id } },
|
|
173
173
|
confirmationNumbers: [params.object.order[0].confirmationNumber],
|
|
174
174
|
orderNumbers: [params.object.order[0].orderNumber]
|
|
175
|
-
},
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}
|
|
175
|
+
},
|
|
176
|
+
// positive projectionで検索(2023-12-08~)
|
|
177
|
+
{
|
|
178
|
+
confirmationNumber: 1, dateReturned: 1, orderDate: 1, orderNumber: 1, orderStatus: 1,
|
|
179
|
+
paymentMethods: 1, price: 1, project: 1, seller: 1, typeOf: 1
|
|
180
|
+
}
|
|
181
|
+
// {
|
|
182
|
+
// // acceptedOffers: 0, // カスタム返品ポリシーに必要
|
|
183
|
+
// customer: 0,
|
|
184
|
+
// orderedItem: 0
|
|
185
|
+
// // paymentMethods: 0 // 適用決済方法検証に必要
|
|
186
|
+
// }
|
|
187
|
+
);
|
|
181
188
|
if (orders.length !== params.object.order.length) {
|
|
182
189
|
throw new factory.errors.NotFound('Order');
|
|
183
190
|
}
|
|
184
|
-
const offerIds = yield repos.
|
|
185
|
-
project: { id: { $eq: params.project.id } },
|
|
186
|
-
confirmationNumbers: [params.object.order[0].confirmationNumber],
|
|
187
|
-
orderNumbers: [params.object.order[0].orderNumber]
|
|
188
|
-
});
|
|
189
|
-
const eventIds = yield repos.order.searchReservationForIdsByOrderNumbers({
|
|
191
|
+
const offerIds = yield repos.acceptedOffer.distinctValues({
|
|
190
192
|
orderNumber: { $in: [params.object.order[0].orderNumber] }
|
|
191
|
-
});
|
|
192
|
-
const
|
|
193
|
+
}, 'acceptedOffers.id');
|
|
194
|
+
const eventIds = yield repos.acceptedOffer.distinctValues({
|
|
193
195
|
orderNumber: { $in: [params.object.order[0].orderNumber] }
|
|
196
|
+
}, 'acceptedOffers.itemOffered.reservationFor.id');
|
|
197
|
+
// const acceptedOffers = await repos.acceptedOffer.searchAcceptedOffersByOrderNumbers({
|
|
198
|
+
// orderNumber: { $in: [params.object.order[0].orderNumber] }
|
|
199
|
+
// });
|
|
200
|
+
const acceptedOffers = yield repos.acceptedOffer.searchAcceptedOffersByOrderNumber({
|
|
201
|
+
orderNumber: { $eq: params.object.order[0].orderNumber },
|
|
202
|
+
project: { id: { $eq: params.project.id } }
|
|
194
203
|
});
|
|
195
204
|
return { acceptedOffers, eventIds, offerIds, orders };
|
|
196
205
|
});
|
|
@@ -208,9 +217,12 @@ function checkUsedReservationExists(params) {
|
|
|
208
217
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
209
218
|
let usedReservationExists = false;
|
|
210
219
|
// 注文に含まれる予約の状態検証
|
|
211
|
-
const reservationNumbers =
|
|
220
|
+
// const reservationNumbers = await repos.acceptedOffer.searchReservationNumbersByOrderNumbers({
|
|
221
|
+
// orderNumber: { $in: params.orders.map((order) => order.orderNumber) }
|
|
222
|
+
// });
|
|
223
|
+
const reservationNumbers = yield repos.acceptedOffer.distinctValues({
|
|
212
224
|
orderNumber: { $in: params.orders.map((order) => order.orderNumber) }
|
|
213
|
-
});
|
|
225
|
+
}, 'acceptedOffers.itemOffered.reservationNumber');
|
|
214
226
|
if (reservationNumbers.length > 0) {
|
|
215
227
|
// 使用済の予約がひとつでもあれば不可
|
|
216
228
|
const existingUsedReservations = yield repos.reservation.search({
|
|
@@ -279,42 +291,40 @@ function createOrder4returnPolicy(params) {
|
|
|
279
291
|
orderDate: params.order.orderDate,
|
|
280
292
|
orderNumber: params.order.orderNumber,
|
|
281
293
|
price: params.order.price,
|
|
282
|
-
acceptedOffers:
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
// superEvent: reservation.reservationFor.superEvent
|
|
296
|
-
},
|
|
297
|
-
reservedTicket: {
|
|
298
|
-
ticketedSeat: reservation.reservedTicket.ticketedSeat
|
|
299
|
-
}
|
|
294
|
+
acceptedOffers: params.order.acceptedOffers.map((o) => {
|
|
295
|
+
var _a;
|
|
296
|
+
if (o.itemOffered.typeOf === factory.reservationType.EventReservation) {
|
|
297
|
+
const reservation = o.itemOffered;
|
|
298
|
+
const priceComponent = (_a = o.priceSpecification) === null || _a === void 0 ? void 0 : _a.priceComponent;
|
|
299
|
+
return {
|
|
300
|
+
itemOffered: {
|
|
301
|
+
additionalProperty: reservation.additionalProperty,
|
|
302
|
+
reservationFor: {
|
|
303
|
+
doorTime: reservation.reservationFor.doorTime,
|
|
304
|
+
endDate: reservation.reservationFor.endDate,
|
|
305
|
+
startDate: reservation.reservationFor.startDate
|
|
306
|
+
// superEvent: reservation.reservationFor.superEvent
|
|
300
307
|
},
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
? priceComponent.map((component) => {
|
|
304
|
-
const { accounting, name, priceCurrency, valueAddedTaxIncluded } = component, postingComponent = __rest(component, ["accounting", "name", "priceCurrency", "valueAddedTaxIncluded"]);
|
|
305
|
-
return postingComponent;
|
|
306
|
-
})
|
|
307
|
-
: []
|
|
308
|
+
reservedTicket: {
|
|
309
|
+
ticketedSeat: reservation.reservedTicket.ticketedSeat
|
|
308
310
|
}
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
311
|
+
},
|
|
312
|
+
priceSpecification: {
|
|
313
|
+
priceComponent: (Array.isArray(priceComponent))
|
|
314
|
+
? priceComponent.map((component) => {
|
|
315
|
+
const { accounting, name, priceCurrency, valueAddedTaxIncluded } = component, postingComponent = __rest(component, ["accounting", "name", "priceCurrency", "valueAddedTaxIncluded"]);
|
|
316
|
+
return postingComponent;
|
|
317
|
+
})
|
|
318
|
+
: []
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
return {
|
|
324
|
+
priceSpecification: o.priceSpecification
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
})
|
|
318
328
|
};
|
|
319
329
|
}
|
|
320
330
|
const TIMEOUT = 5000;
|
|
@@ -389,7 +399,7 @@ function findApplicableReturnPolicy(params) {
|
|
|
389
399
|
if (typeof returnPolicySameAsByPoject === 'string' && returnPolicySameAsByPoject.length > 0) {
|
|
390
400
|
const returnPolicyByProject = yield getReturnPolicyByProject({
|
|
391
401
|
sameAs: returnPolicySameAsByPoject,
|
|
392
|
-
order: params.orders[0]
|
|
402
|
+
order: Object.assign(Object.assign({}, params.orders[0]), { acceptedOffers: params.acceptedOffers })
|
|
393
403
|
});
|
|
394
404
|
applicalbleReturnPolicies.push(returnPolicyByProject);
|
|
395
405
|
}
|
|
@@ -601,6 +611,7 @@ function validateOffersReturnPolicy(params) {
|
|
|
601
611
|
// 決済カード取消ポリシーを確定(2023-05-23~)
|
|
602
612
|
const returnFeesMovieTicket = [];
|
|
603
613
|
params.acceptedOffers.forEach((acceptedOffer) => {
|
|
614
|
+
var _a, _b;
|
|
604
615
|
const unitPriceOffer = params.offers.find((offer) => offer.id === acceptedOffer.id);
|
|
605
616
|
if (unitPriceOffer === undefined) {
|
|
606
617
|
throw new factory.errors.NotFound(`UnitPriceOffer ${acceptedOffer.id}`);
|
|
@@ -613,11 +624,11 @@ function validateOffersReturnPolicy(params) {
|
|
|
613
624
|
if (policyByOffer === undefined) {
|
|
614
625
|
throw new factory.errors.NotFound(`MerchantReturnPolicy acceptedOffer:${acceptedOffer.id}`);
|
|
615
626
|
}
|
|
616
|
-
const movieTicketTypeChargeSpecExists = acceptedOffer.priceSpecification.priceComponent.some((component) => {
|
|
627
|
+
const movieTicketTypeChargeSpecExists = (_a = acceptedOffer.priceSpecification) === null || _a === void 0 ? void 0 : _a.priceComponent.some((component) => {
|
|
617
628
|
return component.typeOf === factory.priceSpecificationType.MovieTicketTypeChargeSpecification;
|
|
618
629
|
});
|
|
619
|
-
if (movieTicketTypeChargeSpecExists) {
|
|
620
|
-
acceptedOffer.priceSpecification.priceComponent.forEach((component) => {
|
|
630
|
+
if (movieTicketTypeChargeSpecExists === true) {
|
|
631
|
+
(_b = acceptedOffer.priceSpecification) === null || _b === void 0 ? void 0 : _b.priceComponent.forEach((component) => {
|
|
621
632
|
if (component.typeOf === factory.priceSpecificationType.UnitPriceSpecification) {
|
|
622
633
|
if (Array.isArray(component.appliesToMovieTicket)) {
|
|
623
634
|
component.appliesToMovieTicket.forEach((appliesToMovieTicket) => {
|
|
@@ -706,12 +717,19 @@ function confirm(params) {
|
|
|
706
717
|
emailMessageOnOrderReturned = searchEmailMessagesResult.shift();
|
|
707
718
|
}
|
|
708
719
|
const result = {};
|
|
720
|
+
const moneyTransferAcceptedOffers = yield repos.acceptedOffer.searchAcceptedOffersByOrderNumber({
|
|
721
|
+
orderNumber: { $eq: transaction.object.order[0].orderNumber },
|
|
722
|
+
project: { id: { $eq: transaction.project.id } },
|
|
723
|
+
acceptedOffers: { itemOffered: { typeOf: { $in: [factory.actionType.MoneyTransfer] } } }
|
|
724
|
+
}, ['itemOffered']);
|
|
725
|
+
debug(moneyTransferAcceptedOffers.length, 'moneyTransferAcceptedOffers found.', moneyTransferAcceptedOffers);
|
|
709
726
|
const potentialActions = yield (0, potentialActions_1.createPotentialActions)({
|
|
710
727
|
dateReturned: params.object.order.dateReturned,
|
|
711
728
|
orders: orders,
|
|
712
729
|
potentialActions: params.potentialActions,
|
|
713
730
|
transaction: transaction,
|
|
714
|
-
emailMessageOnOrderReturned: emailMessageOnOrderReturned
|
|
731
|
+
emailMessageOnOrderReturned: emailMessageOnOrderReturned,
|
|
732
|
+
moneyTransferAcceptedOffers
|
|
715
733
|
});
|
|
716
734
|
// ステータス変更
|
|
717
735
|
yield repos.transaction.confirm({
|
package/package.json
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/credential-providers": "3.433.0",
|
|
13
|
-
"@chevre/factory": "4.
|
|
14
|
-
"@cinerino/sdk": "5.
|
|
13
|
+
"@chevre/factory": "4.347.0-alpha.12",
|
|
14
|
+
"@cinerino/sdk": "5.4.0-alpha.7",
|
|
15
15
|
"@motionpicture/coa-service": "9.2.0",
|
|
16
16
|
"@motionpicture/gmo-service": "5.2.0",
|
|
17
17
|
"@sendgrid/mail": "6.4.0",
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"postversion": "git push origin --tags",
|
|
116
116
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
117
117
|
},
|
|
118
|
-
"version": "21.18.0-alpha.
|
|
118
|
+
"version": "21.18.0-alpha.41"
|
|
119
119
|
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../../lib/index';
|
|
5
|
-
|
|
6
|
-
import { findPaymentCardPermit } from '../../../../lib/chevre/service/transaction/orderProgramMembership/findPaymentCardPermit';
|
|
7
|
-
|
|
8
|
-
const project = { id: String(process.env.PROJECT_ID) };
|
|
9
|
-
async function main() {
|
|
10
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
11
|
-
|
|
12
|
-
const ownershipInfoRepo = await chevre.repository.OwnershipInfo.createInstance(mongoose.connection);
|
|
13
|
-
const productRepo = await chevre.repository.Product.createInstance(mongoose.connection);
|
|
14
|
-
|
|
15
|
-
const result = await findPaymentCardPermit({
|
|
16
|
-
project: { id: project.id },
|
|
17
|
-
customer: { id: 'a7909268-a584-425e-8212-d7d10f344093' },
|
|
18
|
-
now: new Date(),
|
|
19
|
-
accountType: 'Point'
|
|
20
|
-
})({
|
|
21
|
-
product: productRepo,
|
|
22
|
-
ownershipInfo: ownershipInfoRepo
|
|
23
|
-
});
|
|
24
|
-
console.log(result);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
main()
|
|
28
|
-
.then(console.log)
|
|
29
|
-
.catch(console.error);
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { RedisClientType } from 'redis';
|
|
2
|
-
/**
|
|
3
|
-
* 進行アクションキーインターフェース
|
|
4
|
-
*/
|
|
5
|
-
export interface IProgressKey {
|
|
6
|
-
agent: {
|
|
7
|
-
id: string;
|
|
8
|
-
};
|
|
9
|
-
product: {
|
|
10
|
-
id: string;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* 進行中サービス登録アクションリポジトリ
|
|
15
|
-
*/
|
|
16
|
-
export declare class RedisRepository {
|
|
17
|
-
private static readonly KEY_PREFIX;
|
|
18
|
-
private readonly redisClient;
|
|
19
|
-
constructor(redisClient: RedisClientType);
|
|
20
|
-
/**
|
|
21
|
-
* ロックする
|
|
22
|
-
*/
|
|
23
|
-
lock(progressKey: IProgressKey, holder: string): Promise<boolean>;
|
|
24
|
-
/**
|
|
25
|
-
* メンバーシップ登録進行ロックを解除する
|
|
26
|
-
*/
|
|
27
|
-
unlock(progressKey: IProgressKey): Promise<void>;
|
|
28
|
-
getHolder(progressKey: IProgressKey): Promise<string | null>;
|
|
29
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.RedisRepository = void 0;
|
|
13
|
-
/**
|
|
14
|
-
* 進行中サービス登録アクションリポジトリ
|
|
15
|
-
*/
|
|
16
|
-
class RedisRepository {
|
|
17
|
-
constructor(redisClient) {
|
|
18
|
-
this.redisClient = redisClient;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* ロックする
|
|
22
|
-
*/
|
|
23
|
-
lock(progressKey, holder) {
|
|
24
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
const key = `${RedisRepository.KEY_PREFIX}:${progressKey.agent.id}:${progressKey.product.id}`;
|
|
26
|
-
const ttl = 7200;
|
|
27
|
-
const [setNXReply] = yield this.redisClient.multi()
|
|
28
|
-
.setNX(key, holder)
|
|
29
|
-
.expire(key, ttl)
|
|
30
|
-
.exec();
|
|
31
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
32
|
-
/* istanbul ignore else: please write tests */
|
|
33
|
-
if (setNXReply === 1 || setNXReply === true) {
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
throw new Error('Already in progress.');
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* メンバーシップ登録進行ロックを解除する
|
|
43
|
-
*/
|
|
44
|
-
unlock(progressKey) {
|
|
45
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
-
const key = `${RedisRepository.KEY_PREFIX}:${progressKey.agent.id}:${progressKey.product.id}`;
|
|
47
|
-
yield this.redisClient.del([key]);
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
getHolder(progressKey) {
|
|
51
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
const key = `${RedisRepository.KEY_PREFIX}:${progressKey.agent.id}:${progressKey.product.id}`;
|
|
53
|
-
return this.redisClient.get(key);
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
RedisRepository.KEY_PREFIX = 'cinerino:registerProgramMembershipActionInProgress';
|
|
58
|
-
exports.RedisRepository = RedisRepository;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import * as factory from '../../../factory';
|
|
2
|
-
type IOrderWithToken = factory.order.IOrder & {
|
|
3
|
-
token: string;
|
|
4
|
-
};
|
|
5
|
-
export declare function getOrderWithToken(params: {
|
|
6
|
-
order: factory.order.IOrder;
|
|
7
|
-
expiresIn: number;
|
|
8
|
-
}): Promise<factory.order.IOrder | IOrderWithToken>;
|
|
9
|
-
export type IUpdatedOrder4inform = Pick<factory.order.IOrder, 'typeOf' | 'orderNumber' | 'name' | 'additionalProperty' | 'project'> & {
|
|
10
|
-
orderStatus?: undefined;
|
|
11
|
-
updatedAt: Date;
|
|
12
|
-
};
|
|
13
|
-
export declare function createInformTasks(order: factory.order.IOrder | IOrderWithToken | IUpdatedOrder4inform): factory.task.IAttributes<factory.taskName.TriggerWebhook>[];
|
|
14
|
-
export declare function createConfirmReservationActionObject4ChevreByOrder(params: {
|
|
15
|
-
order: factory.order.IOrder;
|
|
16
|
-
}): factory.action.interact.confirm.reservation.IObject<factory.service.webAPI.Identifier.Chevre>[];
|
|
17
|
-
export declare function createConfirmReservationActionObject4COAByOrder(params: {
|
|
18
|
-
order: factory.order.IOrder;
|
|
19
|
-
}): factory.action.interact.confirm.reservation.IObject<factory.service.webAPI.Identifier.COA>[];
|
|
20
|
-
export declare function createConfirmRegisterServiceActionObjectByOrder(params: {
|
|
21
|
-
order: factory.order.IOrder;
|
|
22
|
-
}): factory.action.interact.confirm.registerService.IObject[];
|
|
23
|
-
export type IExternalOrder = Pick<factory.order.IOrder, 'project' | 'typeOf' | 'seller' | 'customer' | 'confirmationNumber' | 'orderNumber' | 'price' | 'priceCurrency' | 'orderDate' | 'name' | 'orderStatus' | 'orderedItem' | 'paymentMethods'>;
|
|
24
|
-
/**
|
|
25
|
-
* 注文配送後のアクション
|
|
26
|
-
*/
|
|
27
|
-
export declare function createOnOrderSentTasksByTransaction(params: {
|
|
28
|
-
potentialActions?: factory.action.transfer.send.order.IPotentialActions;
|
|
29
|
-
}): (import("@chevre/factory/lib/task").IAttributes | import("@chevre/factory/lib/task/confirmMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/confirmRegisterService").IAttributes | import("@chevre/factory/lib/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/task/createEvent").IAttributes | import("@chevre/factory/lib/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/task/givePointAward").IAttributes | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/task/onEventChanged").IAttributes | import("@chevre/factory/lib/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/task/placeOrder").IAttributes | import("@chevre/factory/lib/task/returnOrder").IAttributes | import("@chevre/factory/lib/task/returnMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/task/returnPointAward").IAttributes | import("@chevre/factory/lib/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/task/sendOrder").IAttributes | import("@chevre/factory/lib/task/syncScreeningRooms").IAttributes | import("@chevre/factory/lib/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/task/useReservation").IAttributes | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").IAttributes | import("@chevre/factory/lib/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/voidReserveTransaction").IAttributes)[];
|
|
30
|
-
/**
|
|
31
|
-
* 注文返品後のアクション
|
|
32
|
-
*/
|
|
33
|
-
export declare function createOnOrderReturnedTasksByTransaction(params: {
|
|
34
|
-
potentialActions?: factory.action.transfer.returnAction.order.IPotentialActions;
|
|
35
|
-
}): (import("@chevre/factory/lib/task").IAttributes | import("@chevre/factory/lib/task/confirmMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/confirmRegisterService").IAttributes | import("@chevre/factory/lib/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/task/createEvent").IAttributes | import("@chevre/factory/lib/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/task/givePointAward").IAttributes | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/task/onEventChanged").IAttributes | import("@chevre/factory/lib/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/task/placeOrder").IAttributes | import("@chevre/factory/lib/task/returnOrder").IAttributes | import("@chevre/factory/lib/task/returnMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/task/returnPointAward").IAttributes | import("@chevre/factory/lib/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/task/sendOrder").IAttributes | import("@chevre/factory/lib/task/syncScreeningRooms").IAttributes | import("@chevre/factory/lib/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/task/useReservation").IAttributes | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").IAttributes | import("@chevre/factory/lib/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/voidReserveTransaction").IAttributes)[];
|
|
36
|
-
/**
|
|
37
|
-
* 注文中止時のアクション
|
|
38
|
-
*/
|
|
39
|
-
export declare function createOnOrderCancelledTasksByTransaction(params: {
|
|
40
|
-
transaction?: factory.transaction.placeOrder.ITransaction;
|
|
41
|
-
}): (import("@chevre/factory/lib/task").IAttributes | import("@chevre/factory/lib/task/confirmMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/confirmRegisterService").IAttributes | import("@chevre/factory/lib/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/task/createEvent").IAttributes | import("@chevre/factory/lib/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/task/givePointAward").IAttributes | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/task/onEventChanged").IAttributes | import("@chevre/factory/lib/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/task/placeOrder").IAttributes | import("@chevre/factory/lib/task/returnOrder").IAttributes | import("@chevre/factory/lib/task/returnMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/task/returnPointAward").IAttributes | import("@chevre/factory/lib/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/task/sendOrder").IAttributes | import("@chevre/factory/lib/task/syncScreeningRooms").IAttributes | import("@chevre/factory/lib/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/task/useReservation").IAttributes | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").IAttributes | import("@chevre/factory/lib/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/voidReserveTransaction").IAttributes)[];
|
|
42
|
-
export {};
|