@chevre/domain 24.1.0-alpha.5 → 24.1.0-alpha.51
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/lib/chevre/emailMessageBuilder.js +4 -12
- package/lib/chevre/index.d.ts +1 -2
- package/lib/chevre/index.js +1 -3
- package/lib/chevre/repo/acceptedOffer.d.ts +20 -26
- package/lib/chevre/repo/acceptedOffer.js +113 -67
- package/lib/chevre/repo/acceptedOfferInReserve.d.ts +30 -0
- package/lib/chevre/repo/acceptedOfferInReserve.js +86 -0
- package/lib/chevre/repo/accountingReport.js +2 -30
- package/lib/chevre/repo/action/actionProcess.d.ts +1 -1
- package/lib/chevre/repo/assetTransaction/reserve.d.ts +1 -2
- package/lib/chevre/repo/assetTransaction/reserve.js +4 -50
- package/lib/chevre/repo/event.js +12 -8
- package/lib/chevre/repo/factory/acceptedOffer/reserveTransaction2itemOffered.d.ts +7 -0
- package/lib/chevre/repo/factory/acceptedOffer/reserveTransaction2itemOffered.js +74 -0
- package/lib/chevre/repo/factory/reservation/createMongoConditions.d.ts +1 -1
- package/lib/chevre/repo/factory/reservation/createMongoConditions.js +171 -362
- package/lib/chevre/repo/mongoose/schemas/accountingReport.js +42 -42
- package/lib/chevre/repo/mongoose/schemas/order.js +108 -108
- package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +3 -1
- package/lib/chevre/repo/mongoose/schemas/reservation.js +128 -146
- package/lib/chevre/repo/mongoose/schemas/setting.d.ts +84 -0
- package/lib/chevre/repo/mongoose/schemas/setting.js +2 -1
- package/lib/chevre/repo/order.d.ts +2 -83
- package/lib/chevre/repo/order.js +10 -373
- package/lib/chevre/repo/orderInTransaction.d.ts +52 -6
- package/lib/chevre/repo/orderInTransaction.js +58 -4
- package/lib/chevre/repo/place/hasPOS.js +2 -1
- package/lib/chevre/repo/reservation.d.ts +20 -7
- package/lib/chevre/repo/reservation.js +16 -12
- package/lib/chevre/repo/role.d.ts +1 -15
- package/lib/chevre/repo/role.js +7 -14
- package/lib/chevre/repo/setting/integration.d.ts +27 -0
- package/lib/chevre/repo/setting/integration.js +102 -0
- package/lib/chevre/repo/transaction.d.ts +6 -6
- package/lib/chevre/repository.d.ts +5 -0
- package/lib/chevre/repository.js +11 -0
- package/lib/chevre/service/aggregation/event/aggregateOffers.js +6 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +0 -1
- package/lib/chevre/service/assetTransaction/cancelReservation/factory.js +14 -11
- package/lib/chevre/service/assetTransaction/cancelReservation/start.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/cancelReservation/start.js +1 -1
- package/lib/chevre/service/assetTransaction/pay/check.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/publishPaymentUrl.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/searchGMOTrade.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorize.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeCreditCard.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeMovieTicket.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/start.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserve/cancel.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserve/confirm.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createReservation.js +0 -12
- package/lib/chevre/service/assetTransaction/reserve/start/factory/price.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserve/start.d.ts +1 -1
- package/lib/chevre/service/delivery/factory.d.ts +6 -1
- package/lib/chevre/service/delivery/factory.js +1 -1
- package/lib/chevre/service/delivery/reservation/factory.d.ts +1 -3
- package/lib/chevre/service/delivery/reservation/factory.js +0 -17
- package/lib/chevre/service/notification/notifyAbortedTasksByEmail.d.ts +2 -4
- package/lib/chevre/service/notification/notifyAbortedTasksByEmail.js +3 -3
- package/lib/chevre/service/notification/notifyByEmail.d.ts +3 -3
- package/lib/chevre/service/notification/notifyByEmail.js +7 -12
- package/lib/chevre/service/notification/sendEmailMessage.d.ts +2 -3
- package/lib/chevre/service/notification/sendEmailMessage.js +5 -4
- package/lib/chevre/service/offer/any.d.ts +7 -2
- package/lib/chevre/service/offer/event/authorize/factory.d.ts +6 -3
- package/lib/chevre/service/offer/event/authorize/factory.js +13 -15
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +1 -1
- package/lib/chevre/service/offer/event/authorize.d.ts +6 -2
- package/lib/chevre/service/offer/event/authorize.js +58 -11
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.d.ts +1 -1
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +1 -1
- package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +1 -3
- package/lib/chevre/service/order/createAccountingReportIfNotExist.d.ts +1 -1
- package/lib/chevre/service/order/createAccountingReportIfNotExist.js +15 -15
- package/lib/chevre/service/order/deleteOrder.js +19 -43
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.d.ts +1 -1
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onReserveTransactionConfirmed.d.ts +1 -1
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.d.ts +1 -1
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.js +9 -11
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/processing2inTransit.d.ts +1 -1
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +0 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +6 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.js +0 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +2 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +0 -1
- package/lib/chevre/service/order/onOrderUpdated.js +0 -1
- package/lib/chevre/service/order/payOrder.d.ts +1 -1
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +4 -1
- package/lib/chevre/service/order/placeOrder/factory/orderedItem.d.ts +1 -1
- package/lib/chevre/service/order/placeOrder/factory/orderedItem.js +0 -5
- package/lib/chevre/service/order/placeOrder/factory.d.ts +1 -1
- package/lib/chevre/service/order/placeOrder.d.ts +1 -1
- package/lib/chevre/service/order/returnOrder.js +0 -1
- package/lib/chevre/service/order/sendOrder.js +0 -4
- package/lib/chevre/service/payment/any/authorize.d.ts +1 -1
- package/lib/chevre/service/payment/any/person2username.js +0 -1
- package/lib/chevre/service/payment/any/publishPaymentUrl.d.ts +1 -1
- package/lib/chevre/service/payment/creditCard/authorize.d.ts +1 -1
- package/lib/chevre/service/payment/creditCard/authorize.js +4 -3
- package/lib/chevre/service/payment/creditCard/payCreditCard.d.ts +1 -1
- package/lib/chevre/service/payment/creditCard/payCreditCard.js +1 -1
- package/lib/chevre/service/payment/creditCard/refundCreditCard.d.ts +1 -1
- package/lib/chevre/service/payment/creditCard/refundCreditCard.js +1 -1
- package/lib/chevre/service/payment/creditCard/searchGMOTrade.d.ts +1 -1
- package/lib/chevre/service/payment/creditCard/searchGMOTrade.js +1 -1
- package/lib/chevre/service/payment/creditCard/voidTransaction.d.ts +1 -1
- package/lib/chevre/service/payment/creditCard/voidTransaction.js +1 -1
- package/lib/chevre/service/payment/factory/createPayObjectServiceOutput.d.ts +8 -1
- package/lib/chevre/service/payment/factory/createPayObjectServiceOutput.js +1 -1
- package/lib/chevre/service/payment/movieTicket/authorize.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket/checkMovieTicket.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket/payMovieTicket.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket/payMovieTicket.js +1 -1
- package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.js +1 -1
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +2 -2
- package/lib/chevre/service/payment/movieTicket/voidTransaction.d.ts +1 -1
- package/lib/chevre/service/reserve/confirmReservation.js +7 -7
- package/lib/chevre/service/reserve/factory.js +2 -1
- package/lib/chevre/service/reserve/findByCode.d.ts +1 -1
- package/lib/chevre/service/reserve/findByCode.js +1 -1
- package/lib/chevre/service/reserve/findReservations.d.ts +14 -6
- package/lib/chevre/service/reserve/findReservations.js +26 -36
- package/lib/chevre/service/reserve/potentialActions/onPendingReservationCanceled.js +0 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +0 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +4 -3
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +1 -10
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +0 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationsCreated.js +0 -1
- package/lib/chevre/service/reserve/searchByOrder.js +7 -3
- package/lib/chevre/service/task/acceptCOAOffer.js +6 -3
- package/lib/chevre/service/task/authorizePayment.js +4 -2
- package/lib/chevre/service/task/cancelPendingReservation.js +4 -2
- package/lib/chevre/service/task/checkMovieTicket.js +4 -2
- package/lib/chevre/service/task/confirmReserveTransaction.d.ts +1 -1
- package/lib/chevre/service/task/confirmReserveTransaction.js +5 -3
- package/lib/chevre/service/task/createAccountingReport.js +4 -8
- package/lib/chevre/service/task/importEventCapacitiesFromCOA.js +4 -2
- package/lib/chevre/service/task/importEventsFromCOA.js +4 -2
- package/lib/chevre/service/task/importOffersFromCOA.js +4 -2
- package/lib/chevre/service/task/invalidatePaymentUrl.js +3 -1
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +3 -1
- package/lib/chevre/service/task/onOrderPaymentCompleted.js +3 -1
- package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.js +0 -1
- package/lib/chevre/service/task/pay.js +4 -2
- package/lib/chevre/service/task/payment/invalidatePaymentUrlByTask.d.ts +1 -1
- package/lib/chevre/service/task/payment/payByTask.d.ts +1 -1
- package/lib/chevre/service/task/payment/payByTask.js +6 -7
- package/lib/chevre/service/task/payment/refundByTask.d.ts +1 -1
- package/lib/chevre/service/task/payment/voidPaymentByTask.d.ts +1 -1
- package/lib/chevre/service/task/placeOrder.js +3 -1
- package/lib/chevre/service/task/publishPaymentUrl.js +3 -1
- package/lib/chevre/service/task/refund.js +4 -2
- package/lib/chevre/service/task/returnReserveTransaction.js +4 -2
- package/lib/chevre/service/task/sendEmailMessage.js +5 -3
- package/lib/chevre/service/task/syncResourcesFromCOA.js +4 -2
- package/lib/chevre/service/task/voidPayment.js +4 -2
- package/lib/chevre/service/task/voidReserveTransaction.js +4 -2
- package/lib/chevre/service/task.d.ts +0 -7
- package/lib/chevre/service/taskHandler.js +1 -0
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.js +0 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.js +0 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateInvoiceReferencesOrder.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateMovieTicket.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +2 -2
- package/lib/chevre/service/transaction/placeOrder/confirm.js +5 -3
- package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +0 -1
- package/lib/chevre/service/transaction/placeOrder/updateAgent.js +0 -1
- package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +0 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +0 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions.js +0 -1
- package/lib/chevre/service/transaction/returnOrder/preStart.js +0 -3
- package/lib/chevre/service/validation/validateOrder.js +3 -78
- package/lib/chevre/settings.d.ts +0 -55
- package/lib/chevre/settings.js +1 -29
- package/lib/chevre/taskSettings.d.ts +0 -22
- package/lib/chevre/taskSettings.js +1 -7
- package/package.json +2 -2
- package/lib/chevre/credentials/customSearch.d.ts +0 -13
- package/lib/chevre/credentials/customSearch.js +0 -16
- package/lib/chevre/credentials/lineNotify.d.ts +0 -17
- package/lib/chevre/credentials/lineNotify.js +0 -20
- package/lib/chevre/credentials/sendGrid.d.ts +0 -24
- package/lib/chevre/credentials/sendGrid.js +0 -18
- package/lib/chevre/credentials.d.ts +0 -20
- package/lib/chevre/credentials.js +0 -42
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createInformHasPOSTasks = createInformHasPOSTasks;
|
|
4
4
|
const factory_1 = require("../../../factory");
|
|
5
|
-
// import { Settings } from '../../../settings';
|
|
6
5
|
function createInformHasPOSTasks(params) {
|
|
7
6
|
return async (repos
|
|
8
7
|
// settings: Settings
|
|
@@ -17,16 +17,18 @@ const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
|
17
17
|
const product_1 = require("../../repo/product");
|
|
18
18
|
const project_1 = require("../../repo/project");
|
|
19
19
|
const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
|
|
20
|
+
const integration_1 = require("../../repo/setting/integration");
|
|
20
21
|
const task_1 = require("../../repo/task");
|
|
21
22
|
const payByTask_1 = require("./payment/payByTask");
|
|
22
23
|
/**
|
|
23
24
|
* タスク実行関数
|
|
24
25
|
*/
|
|
25
26
|
function call(params) {
|
|
26
|
-
return async ({ connection, redisClient
|
|
27
|
+
return async ({ connection, redisClient }) => {
|
|
27
28
|
if (redisClient === undefined) {
|
|
28
29
|
throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
|
|
29
30
|
}
|
|
31
|
+
const settings = new integration_1.IntegrationSettingRepo({ connection });
|
|
30
32
|
const payActionAttributes = await (0, payByTask_1.payTask2payActionAttributes)({
|
|
31
33
|
...params.data,
|
|
32
34
|
sameAs: { id: params.id, typeOf: 'Task' } // タスクIDを関連付け(2024-04-20~)
|
|
@@ -38,7 +40,7 @@ function call(params) {
|
|
|
38
40
|
order: new order_1.OrderRepo(connection)
|
|
39
41
|
});
|
|
40
42
|
const paymentServiceId = payActionAttributes.object.at(0)?.id;
|
|
41
|
-
const credentialsExpireInSeconds = settings.movieticketReserve.credentialsExpireInSeconds;
|
|
43
|
+
const credentialsExpireInSeconds = (await settings.getByKey('movieticketReserve')).credentialsExpireInSeconds;
|
|
42
44
|
const useCredentialsRepo = typeof paymentServiceId === 'string' && paymentServiceId !== ''
|
|
43
45
|
&& typeof credentialsExpireInSeconds === 'number' && credentialsExpireInSeconds > 0;
|
|
44
46
|
await (0, payByTask_1.payByTask)(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { factory } from '../../../factory';
|
|
2
|
-
import { Settings } from '../../../
|
|
2
|
+
import type { IntegrationSettingRepo as Settings } from '../../../repo/setting/integration';
|
|
3
3
|
import type { AccountingReportRepo } from '../../../repo/accountingReport';
|
|
4
4
|
import type { PayActionRepo } from '../../../repo/action/pay';
|
|
5
5
|
import type { RefundActionRepo } from '../../../repo/action/refund';
|
|
@@ -14,7 +14,7 @@ import type { ProjectRepo } from '../../../repo/project';
|
|
|
14
14
|
import type { SellerPaymentAcceptedRepo } from '../../../repo/sellerPaymentAccepted';
|
|
15
15
|
import type { TaskRepo } from '../../../repo/task';
|
|
16
16
|
import { factory } from '../../../factory';
|
|
17
|
-
import { Settings } from '../../../
|
|
17
|
+
import type { IntegrationSettingRepo as Settings } from '../../../repo/setting/integration';
|
|
18
18
|
interface IPayTask2payActionAttributesRepos {
|
|
19
19
|
checkMovieTicketAction: CheckMovieTicketActionRepo;
|
|
20
20
|
acceptedOffer: AcceptedOfferRepo;
|
|
@@ -64,20 +64,19 @@ function fixOrderAsPurpose(params, transaction) {
|
|
|
64
64
|
let acceptedOffersMovieTicketUsed = [];
|
|
65
65
|
const movieTickets = transaction.object.paymentMethod.movieTickets;
|
|
66
66
|
if (Array.isArray(movieTickets) && movieTickets.length > 0) {
|
|
67
|
-
const reservationForId = movieTickets[0].serviceOutput.reservationFor.id; // イベントIDは決済取引ごとにひとつのみ許可なので、これで問題ない
|
|
68
|
-
const seatNumbers = movieTickets.map(({ serviceOutput }) => serviceOutput.reservedTicket.ticketedSeat.seatNumber);
|
|
67
|
+
// const reservationForId = movieTickets[0].serviceOutput.reservationFor.id; // イベントIDは決済取引ごとにひとつのみ許可なので、これで問題ない
|
|
68
|
+
// const seatNumbers = movieTickets.map(({ serviceOutput }) => serviceOutput.reservedTicket.ticketedSeat.seatNumber);
|
|
69
69
|
acceptedOffersMovieTicketUsed = await repos.acceptedOffer.searchAcceptedOffersByOrderNumber({
|
|
70
70
|
orderNumber: { $eq: orderWithoutAcceptedOffers.orderNumber },
|
|
71
71
|
project: { id: { $eq: transaction.project.id } },
|
|
72
72
|
acceptedOffers: {
|
|
73
73
|
itemOffered: {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
reservedTicket: { ticketedSeat: { seatNumber: { $in: seatNumbers } } }
|
|
74
|
+
// movieTicketsに結合されたイベントID,座席コードで絞る
|
|
75
|
+
// reservationFor: { id: { $in: [reservationForId] } }, // reservationForによる絞りは廃止(2026-06-04~)
|
|
76
|
+
// reservedTicket: { ticketedSeat: { seatNumber: { $in: seatNumbers } } } // 座席番号による絞りは廃止(2026-06-01~)
|
|
78
77
|
}
|
|
79
78
|
}
|
|
80
|
-
}
|
|
79
|
+
});
|
|
81
80
|
}
|
|
82
81
|
return {
|
|
83
82
|
...orderWithoutAcceptedOffers,
|
|
@@ -11,7 +11,7 @@ import type { SellerPaymentAcceptedRepo } from '../../../repo/sellerPaymentAccep
|
|
|
11
11
|
import type { TaskRepo } from '../../../repo/task';
|
|
12
12
|
import type { TransactionNumberRepo } from '../../../repo/transactionNumber';
|
|
13
13
|
import { factory } from '../../../factory';
|
|
14
|
-
import { Settings } from '../../../
|
|
14
|
+
import type { IntegrationSettingRepo as Settings } from '../../../repo/setting/integration';
|
|
15
15
|
declare function refundByTask(params: factory.task.refund.IData & {
|
|
16
16
|
sameAs?: {
|
|
17
17
|
id: string;
|
|
@@ -11,7 +11,7 @@ import type { ProjectRepo } from '../../../repo/project';
|
|
|
11
11
|
import type { SellerPaymentAcceptedRepo } from '../../../repo/sellerPaymentAccepted';
|
|
12
12
|
import type { TaskRepo } from '../../../repo/task';
|
|
13
13
|
import { factory } from '../../../factory';
|
|
14
|
-
import { Settings } from '../../../
|
|
14
|
+
import type { IntegrationSettingRepo as Settings } from '../../../repo/setting/integration';
|
|
15
15
|
declare function voidPaymentByTask(params: factory.task.voidPayment.IData): (repos: {
|
|
16
16
|
action: ActionRepo;
|
|
17
17
|
actions: {
|
|
@@ -9,6 +9,7 @@ const authorizePaymentMethod_1 = require("../../repo/action/authorizePaymentMeth
|
|
|
9
9
|
const order_1 = require("../../repo/order");
|
|
10
10
|
const orderInTransaction_1 = require("../../repo/orderInTransaction");
|
|
11
11
|
const setting_1 = require("../../repo/setting");
|
|
12
|
+
const integration_1 = require("../../repo/setting/integration");
|
|
12
13
|
const task_1 = require("../../repo/task");
|
|
13
14
|
// import { TransactionRepo } from '../../repo/transaction';
|
|
14
15
|
const placeOrder_1 = require("../../repo/transaction/placeOrder");
|
|
@@ -17,7 +18,8 @@ const placeOrder_2 = require("../order/placeOrder");
|
|
|
17
18
|
* タスク実行関数
|
|
18
19
|
*/
|
|
19
20
|
function call(data) {
|
|
20
|
-
return async ({ connection
|
|
21
|
+
return async ({ connection }) => {
|
|
22
|
+
const settings = new integration_1.IntegrationSettingRepo({ connection });
|
|
21
23
|
await (0, placeOrder_2.placeOrder)({
|
|
22
24
|
...data,
|
|
23
25
|
useOnOrderStatusChanged: true
|
|
@@ -15,6 +15,7 @@ const paymentService_1 = require("../../repo/paymentService");
|
|
|
15
15
|
const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
16
16
|
const project_1 = require("../../repo/project");
|
|
17
17
|
const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
|
|
18
|
+
const integration_1 = require("../../repo/setting/integration");
|
|
18
19
|
const ticket_1 = require("../../repo/ticket");
|
|
19
20
|
// import { TransactionRepo } from '../../repo/transaction';
|
|
20
21
|
const placeOrder_1 = require("../../repo/transaction/placeOrder");
|
|
@@ -25,7 +26,7 @@ const any_1 = require("../payment/any");
|
|
|
25
26
|
* タスク実行関数
|
|
26
27
|
*/
|
|
27
28
|
function call(params) {
|
|
28
|
-
return async ({ connection, redisClient
|
|
29
|
+
return async ({ connection, redisClient }, options) => {
|
|
29
30
|
if (redisClient === undefined) {
|
|
30
31
|
throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
|
|
31
32
|
}
|
|
@@ -33,6 +34,7 @@ function call(params) {
|
|
|
33
34
|
if (!options.executeById) {
|
|
34
35
|
return;
|
|
35
36
|
}
|
|
37
|
+
const settings = new integration_1.IntegrationSettingRepo({ connection });
|
|
36
38
|
const actionRepo = new acceptPay_1.AcceptPayActionRepo(connection);
|
|
37
39
|
// const transactionProcessRepo = new TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
|
|
38
40
|
try {
|
|
@@ -13,6 +13,7 @@ const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
|
13
13
|
const product_1 = require("../../repo/product");
|
|
14
14
|
const project_1 = require("../../repo/project");
|
|
15
15
|
const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
|
|
16
|
+
const integration_1 = require("../../repo/setting/integration");
|
|
16
17
|
const task_1 = require("../../repo/task");
|
|
17
18
|
const transactionNumber_1 = require("../../repo/transactionNumber");
|
|
18
19
|
const refundByTask_1 = require("./payment/refundByTask");
|
|
@@ -20,10 +21,11 @@ const refundByTask_1 = require("./payment/refundByTask");
|
|
|
20
21
|
* タスク実行関数
|
|
21
22
|
*/
|
|
22
23
|
function call(params) {
|
|
23
|
-
return async ({ connection, redisClient
|
|
24
|
+
return async ({ connection, redisClient }) => {
|
|
24
25
|
if (redisClient === undefined) {
|
|
25
26
|
throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
|
|
26
27
|
}
|
|
28
|
+
const settings = new integration_1.IntegrationSettingRepo({ connection });
|
|
27
29
|
let data;
|
|
28
30
|
if (params.name === factory_1.factory.taskName.Refund) {
|
|
29
31
|
data = {
|
|
@@ -35,7 +37,7 @@ function call(params) {
|
|
|
35
37
|
data = params;
|
|
36
38
|
}
|
|
37
39
|
const paymentServiceId = data.object.at(0)?.id;
|
|
38
|
-
const credentialsExpireInSeconds = settings.movieticketReserve.credentialsExpireInSeconds;
|
|
40
|
+
const credentialsExpireInSeconds = (await settings.getByKey('movieticketReserve')).credentialsExpireInSeconds;
|
|
39
41
|
const useCredentialsRepo = typeof paymentServiceId === 'string' && paymentServiceId !== ''
|
|
40
42
|
&& typeof credentialsExpireInSeconds === 'number' && credentialsExpireInSeconds > 0;
|
|
41
43
|
await (0, refundByTask_1.refundByTask)(data)({
|
|
@@ -48,6 +48,7 @@ const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
|
48
48
|
const project_1 = require("../../repo/project");
|
|
49
49
|
const reservation_1 = require("../../repo/reservation");
|
|
50
50
|
const reserveInterface_1 = require("../../repo/reserveInterface");
|
|
51
|
+
const integration_1 = require("../../repo/setting/integration");
|
|
51
52
|
const transactionNumber_1 = require("../../repo/transactionNumber");
|
|
52
53
|
let coaAuthClientCreated = false;
|
|
53
54
|
let coaAuthClient = new coa_service_1.COA.auth.RefreshToken({
|
|
@@ -59,7 +60,7 @@ let coaAuthClient = new coa_service_1.COA.auth.RefreshToken({
|
|
|
59
60
|
* タスク実行関数
|
|
60
61
|
*/
|
|
61
62
|
function call(params) {
|
|
62
|
-
return async ({ connection, redisClient
|
|
63
|
+
return async ({ connection, redisClient }) => {
|
|
63
64
|
if (redisClient === undefined) {
|
|
64
65
|
throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
|
|
65
66
|
}
|
|
@@ -72,10 +73,11 @@ function call(params) {
|
|
|
72
73
|
coaAuthClientCreated = true;
|
|
73
74
|
}
|
|
74
75
|
}
|
|
76
|
+
const settings = new integration_1.IntegrationSettingRepo({ connection });
|
|
75
77
|
const reserveService = new coa_service_1.COA.service.Reserve({
|
|
76
78
|
endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
|
|
77
79
|
auth: coaAuthClient
|
|
78
|
-
}, { timeout: settings.coa.
|
|
80
|
+
}, { timeout: (await settings.getByKey('coa')).timeoutReserve });
|
|
79
81
|
await returnReserve({
|
|
80
82
|
...params.data,
|
|
81
83
|
sameAs: { id: params.id }
|
|
@@ -4,19 +4,21 @@ exports.call = call;
|
|
|
4
4
|
const action_1 = require("../../repo/action");
|
|
5
5
|
const message_1 = require("../../repo/message");
|
|
6
6
|
const project_1 = require("../../repo/project");
|
|
7
|
+
const integration_1 = require("../../repo/setting/integration");
|
|
7
8
|
const notification_1 = require("../notification");
|
|
8
9
|
/**
|
|
9
10
|
* タスク実行関数
|
|
10
11
|
*/
|
|
11
12
|
function call(params) {
|
|
12
|
-
return async ({ connection
|
|
13
|
+
return async ({ connection }) => {
|
|
13
14
|
await (0, notification_1.sendEmailMessage)({
|
|
14
15
|
...params.data.actionAttributes,
|
|
15
16
|
sameAs: { id: params.id } // タスクIDを関連付け(2024-06-25~)
|
|
16
17
|
})({
|
|
17
18
|
action: new action_1.ActionRepo(connection),
|
|
18
19
|
message: new message_1.MessageRepo(connection),
|
|
19
|
-
project: new project_1.ProjectRepo(connection)
|
|
20
|
-
|
|
20
|
+
project: new project_1.ProjectRepo(connection),
|
|
21
|
+
integrationSetting: new integration_1.IntegrationSettingRepo({ connection })
|
|
22
|
+
});
|
|
21
23
|
};
|
|
22
24
|
}
|
|
@@ -16,6 +16,7 @@ const eventSeries_1 = require("../../repo/eventSeries");
|
|
|
16
16
|
const movieTheater_1 = require("../../repo/place/movieTheater");
|
|
17
17
|
const screeningRoom_1 = require("../../repo/place/screeningRoom");
|
|
18
18
|
const reserveInterface_1 = require("../../repo/reserveInterface");
|
|
19
|
+
const integration_1 = require("../../repo/setting/integration");
|
|
19
20
|
const saveScreeningEvents_1 = require("../event/saveScreeningEvents");
|
|
20
21
|
const saveScreeningEventSeries_1 = require("../event/saveScreeningEventSeries");
|
|
21
22
|
let coaAuthClient;
|
|
@@ -23,7 +24,7 @@ let coaAuthClient;
|
|
|
23
24
|
* タスク実行関数
|
|
24
25
|
*/
|
|
25
26
|
function call(params) {
|
|
26
|
-
return async ({ connection, redisClient
|
|
27
|
+
return async ({ connection, redisClient }, options) => {
|
|
27
28
|
if (redisClient === undefined) {
|
|
28
29
|
throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
|
|
29
30
|
}
|
|
@@ -31,6 +32,7 @@ function call(params) {
|
|
|
31
32
|
if (!options.executeById) {
|
|
32
33
|
return;
|
|
33
34
|
}
|
|
35
|
+
const settings = new integration_1.IntegrationSettingRepo({ connection });
|
|
34
36
|
const reserveInterfaceRepo = new reserveInterface_1.ReserveInterfaceRepo(connection);
|
|
35
37
|
const coaAPI = await reserveInterfaceRepo.findOne({ project: { id: { $eq: params.project.id } } });
|
|
36
38
|
if (typeof coaAPI?.id !== 'string') {
|
|
@@ -60,7 +62,7 @@ function call(params) {
|
|
|
60
62
|
const masterService = new coa_service_1.COA.service.Master({
|
|
61
63
|
endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
|
|
62
64
|
auth: coaAuthClient
|
|
63
|
-
}, { timeout: settings.coa.
|
|
65
|
+
}, { timeout: (await settings.getByKey('coa')).timeoutMaster });
|
|
64
66
|
const { agent, object } = params.data;
|
|
65
67
|
if (object.typeOf === factory_1.factory.eventType.ScreeningEventSeries) {
|
|
66
68
|
await syncEventSeries({
|
|
@@ -13,18 +13,20 @@ const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
|
13
13
|
const product_1 = require("../../repo/product");
|
|
14
14
|
const project_1 = require("../../repo/project");
|
|
15
15
|
const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
|
|
16
|
+
const integration_1 = require("../../repo/setting/integration");
|
|
16
17
|
const task_1 = require("../../repo/task");
|
|
17
18
|
const voidPaymentByTask_1 = require("./payment/voidPaymentByTask");
|
|
18
19
|
/**
|
|
19
20
|
* タスク実行関数
|
|
20
21
|
*/
|
|
21
22
|
function call(data) {
|
|
22
|
-
return async ({ connection, redisClient
|
|
23
|
+
return async ({ connection, redisClient }) => {
|
|
23
24
|
if (redisClient === undefined) {
|
|
24
25
|
throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
|
|
25
26
|
}
|
|
27
|
+
const settings = new integration_1.IntegrationSettingRepo({ connection });
|
|
26
28
|
const paymentServiceId = data.object.object.id;
|
|
27
|
-
const credentialsExpireInSeconds = settings.movieticketReserve.credentialsExpireInSeconds;
|
|
29
|
+
const credentialsExpireInSeconds = (await settings.getByKey('movieticketReserve')).credentialsExpireInSeconds;
|
|
28
30
|
const useCredentialsRepo = typeof paymentServiceId === 'string' && paymentServiceId !== ''
|
|
29
31
|
&& typeof credentialsExpireInSeconds === 'number' && credentialsExpireInSeconds > 0;
|
|
30
32
|
await (0, voidPaymentByTask_1.voidPaymentByTask)(data)({
|
|
@@ -13,6 +13,7 @@ const offer_1 = require("../../repo/rateLimit/offer");
|
|
|
13
13
|
const reservation_1 = require("../../repo/reservation");
|
|
14
14
|
const reserveInterface_1 = require("../../repo/reserveInterface");
|
|
15
15
|
const setting_1 = require("../../repo/setting");
|
|
16
|
+
const integration_1 = require("../../repo/setting/integration");
|
|
16
17
|
const stockHolder_1 = require("../../repo/stockHolder");
|
|
17
18
|
const task_1 = require("../../repo/task");
|
|
18
19
|
// import { TransactionRepo } from '../../repo/transaction';
|
|
@@ -27,7 +28,7 @@ let coaAuthClient = new coa_service_1.COA.auth.RefreshToken({
|
|
|
27
28
|
* タスク実行関数
|
|
28
29
|
*/
|
|
29
30
|
function call(params) {
|
|
30
|
-
return async ({ connection, redisClient
|
|
31
|
+
return async ({ connection, redisClient }, options) => {
|
|
31
32
|
if (redisClient === undefined) {
|
|
32
33
|
throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
|
|
33
34
|
}
|
|
@@ -47,10 +48,11 @@ function call(params) {
|
|
|
47
48
|
coaAuthClientCreated = true;
|
|
48
49
|
}
|
|
49
50
|
}
|
|
51
|
+
const settings = new integration_1.IntegrationSettingRepo({ connection });
|
|
50
52
|
const reserveService = new coa_service_1.COA.service.Reserve({
|
|
51
53
|
endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
|
|
52
54
|
auth: coaAuthClient
|
|
53
|
-
}, { timeout: settings.coa.
|
|
55
|
+
}, { timeout: (await settings.getByKey('coa')).timeoutReserve });
|
|
54
56
|
// const transactionProcessRepo = new TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
|
|
55
57
|
try {
|
|
56
58
|
await (0, voidTransaction_1.voidTransaction)({
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import { SendGridCredentials } from '../credentials/sendGrid';
|
|
2
1
|
import type { IExecuteSettings as IMinimumExecuteSettings, INextFunction, IReadyTask, IRunningTask } from '../eventEmitter/task';
|
|
3
2
|
import { factory } from '../factory';
|
|
4
|
-
import { Settings } from '../settings';
|
|
5
3
|
import type { AggregationSettings } from '../taskSettings';
|
|
6
|
-
interface ICredentialSettings {
|
|
7
|
-
sendGrid: SendGridCredentials;
|
|
8
|
-
}
|
|
9
4
|
interface IExecuteSettings extends IMinimumExecuteSettings {
|
|
10
|
-
credentials: ICredentialSettings;
|
|
11
|
-
settings: Settings;
|
|
12
5
|
aggregationSettings?: AggregationSettings;
|
|
13
6
|
}
|
|
14
7
|
type IOperation<T> = (settings: IExecuteSettings) => Promise<T>;
|
|
@@ -74,6 +74,7 @@ function executeTask(task, next) {
|
|
|
74
74
|
case factory_1.factory.taskName.SendEmailMessage:
|
|
75
75
|
case factory_1.factory.taskName.SyncResourcesFromCOA:
|
|
76
76
|
case factory_1.factory.taskName.TriggerWebhook:
|
|
77
|
+
case factory_1.factory.taskName.UseReservation:
|
|
77
78
|
callResult = await call(task)(settings, options);
|
|
78
79
|
break;
|
|
79
80
|
default:
|
package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.js
CHANGED
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createSendEmailMessageActions = createSendEmailMessageActions;
|
|
4
4
|
const emailMessageBuilder_1 = require("../../../../../emailMessageBuilder");
|
|
5
5
|
const factory_1 = require("../../../../../factory");
|
|
6
|
-
// import { Settings } from '../../../../../settings';
|
|
7
6
|
async function createSendEmailMessageActions(params,
|
|
8
7
|
// settings: Settings
|
|
9
8
|
setting) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createPotentialActions = createPotentialActions;
|
|
4
|
-
// import { Settings } from '../../../../settings';
|
|
5
4
|
const sendEmailMessage_1 = require("./potentialActions/sendEmailMessage");
|
|
6
5
|
/**
|
|
7
6
|
* 取引のポストアクションを作成する
|
|
@@ -4,5 +4,5 @@ declare function validateInvoiceReferencesOrder(authorizePaymentActions: IAuthor
|
|
|
4
4
|
/**
|
|
5
5
|
* 受け入れられた興行オファー
|
|
6
6
|
*/
|
|
7
|
-
eventReservationAcceptedOffers: factory.order.IAcceptedOffer[]): void;
|
|
7
|
+
eventReservationAcceptedOffers: Pick<factory.order.IAcceptedOffer, 'itemOffered'>[]): void;
|
|
8
8
|
export { validateInvoiceReferencesOrder };
|
package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateMovieTicket.d.ts
CHANGED
|
@@ -18,4 +18,4 @@ authorizedMovieTickets: IMovieTicket4validate[],
|
|
|
18
18
|
/**
|
|
19
19
|
* 受け入れられた興行オファー
|
|
20
20
|
*/
|
|
21
|
-
eventReservationAcceptedOffers: factory.order.IAcceptedOffer[]): void;
|
|
21
|
+
eventReservationAcceptedOffers: Pick<factory.order.IAcceptedOffer, 'itemOffered' | 'priceSpecification'>[]): void;
|
|
@@ -5,7 +5,7 @@ export { IAcceptPayAction, IAuthorizeEventServiceOffer, IAuthorizePaymentAction,
|
|
|
5
5
|
/**
|
|
6
6
|
* 取引が確定可能な状態かどうかをチェックする
|
|
7
7
|
*/
|
|
8
|
-
export declare function validateTransaction(transaction: Pick<factory.transaction.placeOrder.ITransaction, 'id' | 'object'>, acceptPayActions: IAcceptPayAction[], authorizePaymentActions: IAuthorizePaymentAction[], authorizeEventServiceOfferActions: Pick<IAuthorizeEventServiceOffer, 'id' | 'result'>[], eventReservationAcceptedOffers: factory.order.IAcceptedOffer[], payTransactions: IPayTransaction[], customer: factory.order.ICustomer): void;
|
|
8
|
+
export declare function validateTransaction(transaction: Pick<factory.transaction.placeOrder.ITransaction, 'id' | 'object'>, acceptPayActions: IAcceptPayAction[], authorizePaymentActions: IAuthorizePaymentAction[], authorizeEventServiceOfferActions: Pick<IAuthorizeEventServiceOffer, 'id' | 'result'>[], eventReservationAcceptedOffers: Pick<factory.order.IAcceptedOffer, 'itemOffered' | 'priceSpecification'>[], payTransactions: IPayTransaction[], customer: factory.order.ICustomer): void;
|
|
9
9
|
export type IOrderURLGenerator = (order: factory.order.IOrder) => string;
|
|
10
10
|
/**
|
|
11
11
|
* 注文オファー数検証
|
|
@@ -14,7 +14,7 @@ export declare function validateAcceptedOffers(params: {
|
|
|
14
14
|
result: {
|
|
15
15
|
order: PlaceOrderFactory.IResultOrderParams;
|
|
16
16
|
};
|
|
17
|
-
acceptedOffers: factory.order.IAcceptedOffer[];
|
|
17
|
+
acceptedOffers: (Pick<factory.order.IAcceptedOffer, 'itemOffered' | 'offeredThrough' | 'serialNumber'>)[];
|
|
18
18
|
}): void;
|
|
19
19
|
export declare function validateOrderedItem(params: {
|
|
20
20
|
order: Pick<factory.order.IOrder, 'orderedItem'>;
|
|
@@ -8,7 +8,6 @@ const debug_1 = __importDefault(require("debug"));
|
|
|
8
8
|
const moment_1 = __importDefault(require("moment"));
|
|
9
9
|
const errorHandler_1 = require("../../../errorHandler");
|
|
10
10
|
const factory_1 = require("../../../factory");
|
|
11
|
-
// import { Settings } from '../../../settings';
|
|
12
11
|
const factory_2 = require("../../order/placeOrder/factory");
|
|
13
12
|
const orderedItem_1 = require("../../order/placeOrder/factory/orderedItem");
|
|
14
13
|
const result_1 = require("./confirm/factory/result");
|
|
@@ -99,7 +98,10 @@ function confirm(params, options) {
|
|
|
99
98
|
// authorizeProductOfferActions,
|
|
100
99
|
serialNumbers } = dissolveAuthorizeActions(completedAuthorizeActions);
|
|
101
100
|
// orderInTransactionから検索する(2024-03-04~)
|
|
102
|
-
const acceptedOffers = (await repos.orderInTransaction.
|
|
101
|
+
const acceptedOffers = (await repos.orderInTransaction.findAcceptedOffersWithPriceByOrderNumber({
|
|
102
|
+
orderNumber,
|
|
103
|
+
project: { id: transaction.project.id }
|
|
104
|
+
}))
|
|
103
105
|
.filter(({ serialNumber }) => typeof serialNumber === 'string' && serialNumbers.includes(serialNumber));
|
|
104
106
|
// authorizePaymentActionsからpayTransactionsを参照(2024-06-20~)
|
|
105
107
|
let payTransactions = [];
|
|
@@ -288,7 +290,7 @@ function createResult(params, options) {
|
|
|
288
290
|
const itemOfferedTypeOf = acceptedOffer.itemOffered.typeOf;
|
|
289
291
|
switch (itemOfferedTypeOf) {
|
|
290
292
|
case factory_1.factory.reservationType.EventReservation:
|
|
291
|
-
eventReservationAcceptedOffers.push(acceptedOffer);
|
|
293
|
+
eventReservationAcceptedOffers.push((acceptedOffer));
|
|
292
294
|
break;
|
|
293
295
|
// case factory.permit.PermitType.Permit:
|
|
294
296
|
// productAcceptedOffers.push((acceptedOffer as factory.order.IAcceptedOffer<factory.order.IPermit>));
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.exportTasksById = exportTasksById;
|
|
7
7
|
const moment_1 = __importDefault(require("moment"));
|
|
8
8
|
const factory_1 = require("../../../factory");
|
|
9
|
-
// import { Settings } from '../../../settings';
|
|
10
9
|
const factory_2 = require("./exportTasks/factory");
|
|
11
10
|
/**
|
|
12
11
|
* 取引のタスクを出力します
|
|
@@ -4,7 +4,6 @@ exports.updateAgent = updateAgent;
|
|
|
4
4
|
const google_libphonenumber_1 = require("google-libphonenumber");
|
|
5
5
|
const factory_1 = require("../../../factory");
|
|
6
6
|
const issueOrderNumberIfNotExist_1 = require("./issueOrderNumberIfNotExist");
|
|
7
|
-
// import { Settings } from '../settings';
|
|
8
7
|
// export type ITransactionOperation<T> = (repos: { transaction: TransactionRepo }) => Promise<T>;
|
|
9
8
|
function fixCustomer(params) {
|
|
10
9
|
return async (repos) => {
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.createTasks = createTasks;
|
|
7
7
|
const moment_1 = __importDefault(require("moment"));
|
|
8
8
|
const factory_1 = require("../../../../factory");
|
|
9
|
-
// import { Settings } from '../../../../settings';
|
|
10
9
|
/**
|
|
11
10
|
* 取引のタスクを作成する
|
|
12
11
|
*/
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createReturnPaymentMethodActions = createReturnPaymentMethodActions;
|
|
4
4
|
const emailMessageBuilder_1 = require("../../../../emailMessageBuilder");
|
|
5
5
|
const factory_1 = require("../../../../factory");
|
|
6
|
-
// import { Settings } from '../../../../settings';
|
|
7
6
|
async function createReturnInvoicePotentialActions(params,
|
|
8
7
|
// settings: Settings
|
|
9
8
|
setting) {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createPotentialActions = createPotentialActions;
|
|
4
4
|
const factory_1 = require("../../../factory");
|
|
5
|
-
// import { Settings } from '../../../settings';
|
|
6
5
|
const returnPaymentMethod_1 = require("./potentialActions/returnPaymentMethod");
|
|
7
6
|
const sendEmailMessage_1 = require("./potentialActions/sendEmailMessage");
|
|
8
7
|
async function createPotentialActions(params,
|
|
@@ -141,9 +141,6 @@ function fixOrders(params) {
|
|
|
141
141
|
const eventIds = await repos.acceptedOffer.distinctValues({
|
|
142
142
|
orderNumber: { $in: [params.object.order[0].orderNumber] }
|
|
143
143
|
}, 'acceptedOffers.itemOffered.reservationFor.id');
|
|
144
|
-
// const acceptedOffers = await repos.acceptedOffer.searchAcceptedOffersByOrderNumbers({
|
|
145
|
-
// orderNumber: { $in: [params.object.order[0].orderNumber] }
|
|
146
|
-
// });
|
|
147
144
|
const acceptedOffers = await repos.acceptedOffer.searchAcceptedOffersByOrderNumber({
|
|
148
145
|
orderNumber: { $eq: params.object.order[0].orderNumber },
|
|
149
146
|
project: { id: { $eq: params.project.id } }
|
|
@@ -10,47 +10,6 @@ const factory_1 = require("../../factory");
|
|
|
10
10
|
const factory_2 = require("../offer/event/authorize/factory");
|
|
11
11
|
// import { acceptedOffers2amount as acceptedOffers2amount4product } from '../offer/product/factory';
|
|
12
12
|
const validateMovieTicket_1 = require("../transaction/placeOrder/confirm/validation/validateMovieTicket");
|
|
13
|
-
// const debug = createDebug('chevre-domain:service:validation');
|
|
14
|
-
// type ICreatingCheckEventTask = Pick<
|
|
15
|
-
// factory.task.checkResource.IAttributes,
|
|
16
|
-
// 'data' | 'executionResults' | 'name' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt' | 'status' | 'description'
|
|
17
|
-
// > & {
|
|
18
|
-
// description: string;
|
|
19
|
-
// };
|
|
20
|
-
// function createCheckEventTasks(params: {
|
|
21
|
-
// order: Pick<factory.order.IOrder, 'orderNumber' | 'typeOf'>;
|
|
22
|
-
// project: { id: string };
|
|
23
|
-
// reservationForIds: string[];
|
|
24
|
-
// }): ICreatingCheckEventTask[] {
|
|
25
|
-
// const { order, project, reservationForIds } = params;
|
|
26
|
-
// const runsAt = new Date();
|
|
27
|
-
// return reservationForIds.map((reservationForId) => {
|
|
28
|
-
// const object: factory.task.checkResource.IResourceAsEvent = { id: reservationForId, typeOf: factory.eventType.ScreeningEvent };
|
|
29
|
-
// const data: factory.task.checkResource.IData = {
|
|
30
|
-
// object,
|
|
31
|
-
// project: { id: project.id, typeOf: factory.organizationType.Project },
|
|
32
|
-
// typeOf: factory.actionType.CheckAction
|
|
33
|
-
// };
|
|
34
|
-
// const description: string = util.format(
|
|
35
|
-
// '%s:%s:%s:%s',
|
|
36
|
-
// order.typeOf,
|
|
37
|
-
// order.orderNumber,
|
|
38
|
-
// factory.eventType.ScreeningEvent,
|
|
39
|
-
// reservationForId
|
|
40
|
-
// );
|
|
41
|
-
// return {
|
|
42
|
-
// description,
|
|
43
|
-
// project: { id: project.id, typeOf: factory.organizationType.Project },
|
|
44
|
-
// name: factory.taskName.CheckResource,
|
|
45
|
-
// status: factory.taskStatus.Ready,
|
|
46
|
-
// runsAt,
|
|
47
|
-
// remainingNumberOfTries: 3,
|
|
48
|
-
// numberOfTried: 0,
|
|
49
|
-
// executionResults: [],
|
|
50
|
-
// data
|
|
51
|
-
// };
|
|
52
|
-
// });
|
|
53
|
-
// }
|
|
54
13
|
function validateOrder(params) {
|
|
55
14
|
return async (repos) => {
|
|
56
15
|
const order = await repos.order.projectFieldsByOrderNumber({
|
|
@@ -101,14 +60,8 @@ function validateOrder(params) {
|
|
|
101
60
|
throw new Error(`invalid acceptedOffer.priceSpecification.priceComponent [${typeof priceSpecification.priceComponent}]`);
|
|
102
61
|
}
|
|
103
62
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
.isAfter((0, moment_1.default)('2023-09-30T15:00:00Z'))
|
|
107
|
-
// || typeOf !== factory.permit.PermitType.Permit
|
|
108
|
-
) {
|
|
109
|
-
if (typeof serialNumber !== 'string' || serialNumber.length === 0) {
|
|
110
|
-
throw new Error(`invalid acceptedOffer.serialNumber [${typeof serialNumber}]`);
|
|
111
|
-
}
|
|
63
|
+
if (typeof serialNumber !== 'string' || serialNumber.length === 0) {
|
|
64
|
+
throw new Error(`invalid acceptedOffer.serialNumber [${typeof serialNumber}]`);
|
|
112
65
|
}
|
|
113
66
|
});
|
|
114
67
|
let reservationForIds = [];
|
|
@@ -176,21 +129,8 @@ function validateOrder(params) {
|
|
|
176
129
|
}
|
|
177
130
|
break;
|
|
178
131
|
}
|
|
179
|
-
// case factory.permit.PermitType.Permit: {
|
|
180
|
-
// numOrderedItemExpected = acceptedOffers.length;
|
|
181
|
-
// const permitAcceptedOffers = acceptedOffers as factory.order.IAcceptedOffer<factory.order.IPermit>[];
|
|
182
|
-
// priceExpected = acceptedOffers2amount4product({
|
|
183
|
-
// acceptedOffers: permitAcceptedOffers
|
|
184
|
-
// });
|
|
185
|
-
// break;
|
|
186
|
-
// }
|
|
187
|
-
// case factory.actionType.MoneyTransfer:
|
|
188
|
-
// break;
|
|
189
132
|
default:
|
|
190
|
-
|
|
191
|
-
.isAfter((0, moment_1.default)('2024-02-01T15:00:00Z'))) {
|
|
192
|
-
throw new Error(`invalid itemOfferedTypeOf [${itemOfferedTypeOf}]`);
|
|
193
|
-
}
|
|
133
|
+
throw new Error(`invalid itemOfferedTypeOf [${itemOfferedTypeOf}]`);
|
|
194
134
|
}
|
|
195
135
|
// orderedItem検証
|
|
196
136
|
if (order.orderedItem.length !== numOrderedItemExpected) {
|
|
@@ -225,20 +165,5 @@ function validateOrder(params) {
|
|
|
225
165
|
throw new Error(`invalid ticketIdentifiers.length:${reservationReservedTicketIdentifiers.length} [expected:${acceptedOffers.length}]`);
|
|
226
166
|
}
|
|
227
167
|
}
|
|
228
|
-
// useMongoAsStockHolderProjectsの場合のイベント検証タスク作成を廃止(もう十分検証したので)(2025-07-11~)
|
|
229
|
-
// add check event task(2025-05-01~)
|
|
230
|
-
// const setting = <Pick<ISetting, 'useMongoAsStockHolderProjects'> | null>
|
|
231
|
-
// await repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['useMongoAsStockHolderProjects']);
|
|
232
|
-
// const useMongoAsStockHolderProjects = setting?.useMongoAsStockHolderProjects;
|
|
233
|
-
// if (Array.isArray(useMongoAsStockHolderProjects) && useMongoAsStockHolderProjects.includes(params.project.id)) {
|
|
234
|
-
// const creatingCheckResourceTask = createCheckEventTasks({
|
|
235
|
-
// order: { orderNumber: order.orderNumber, typeOf: factory.order.OrderType.Order },
|
|
236
|
-
// project: { id: params.project.id },
|
|
237
|
-
// reservationForIds
|
|
238
|
-
// });
|
|
239
|
-
// if (creatingCheckResourceTask.length > 0) {
|
|
240
|
-
// await repos.task.saveMany(creatingCheckResourceTask, { emitImmediately: true });
|
|
241
|
-
// }
|
|
242
|
-
// }
|
|
243
168
|
};
|
|
244
169
|
}
|