@chevre/domain 24.0.0-alpha.77 → 24.0.0-alpha.79
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/repo/action/actionProcess.d.ts +4 -4
- package/lib/chevre/repo/action/authorizeOffer.d.ts +2 -3
- package/lib/chevre/repo/action/authorizeOffer.js +2 -2
- package/lib/chevre/repo/action.d.ts +2 -2
- package/lib/chevre/repo/assetTransaction.d.ts +3 -51
- package/lib/chevre/repo/assetTransaction.js +51 -51
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +1 -1
- package/lib/chevre/repo/product.d.ts +0 -10
- package/lib/chevre/repo/product.js +28 -22
- package/lib/chevre/repo/task.d.ts +1 -1
- package/lib/chevre/repository.d.ts +0 -5
- package/lib/chevre/repository.js +0 -11
- package/lib/chevre/service/assetTransaction/pay/publishPaymentUrl.js +1 -1
- package/lib/chevre/service/assetTransaction/pay/start/factory.js +7 -7
- package/lib/chevre/service/assetTransaction/pay/start/preStart/fixPaymentService.js +18 -16
- package/lib/chevre/service/assetTransaction/refund.js +19 -17
- package/lib/chevre/service/assetTransaction/reserve/start.js +8 -8
- package/lib/chevre/service/assetTransaction.d.ts +0 -2
- package/lib/chevre/service/assetTransaction.js +8 -10
- package/lib/chevre/service/delivery/factory.js +13 -13
- package/lib/chevre/service/offer/any.d.ts +1 -1
- package/lib/chevre/service/offer/event/authorize.js +7 -32
- package/lib/chevre/service/offer/product.d.ts +0 -62
- package/lib/chevre/service/offer/product.js +0 -409
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/isDeliverable.d.ts +1 -1
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/isDeliverable.js +48 -43
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +38 -37
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/processOrder.js +2 -96
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +18 -15
- package/lib/chevre/service/order/placeOrder/factory/orderedItem.d.ts +0 -1
- package/lib/chevre/service/order/placeOrder/factory/orderedItem.js +3 -28
- package/lib/chevre/service/order/placeOrder/factory.js +5 -5
- package/lib/chevre/service/payment/factory/createPayObjectServiceOutput.js +1 -1
- package/lib/chevre/service/payment/factory.js +23 -23
- package/lib/chevre/service/product.js +16 -16
- package/lib/chevre/service/reserve/confirmReservation.js +19 -17
- package/lib/chevre/service/reserve/factory.d.ts +0 -6
- package/lib/chevre/service/reserve/factory.js +0 -59
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +16 -15
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/factory.d.ts +0 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/validatePrice.d.ts +2 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/validatePrice.js +2 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +3 -3
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +16 -12
- package/lib/chevre/service/transaction/placeOrder/confirm.js +21 -23
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +0 -21
- package/lib/chevre/service/transaction/returnOrder/potentialActions.js +4 -4
- package/lib/chevre/service/validation/validateOrder.js +11 -10
- package/package.json +2 -2
- package/lib/chevre/repo/action/authorizeProductOffer.d.ts +0 -26
- package/lib/chevre/repo/action/authorizeProductOffer.js +0 -32
- package/lib/chevre/service/assetTransaction/registerService/factory.d.ts +0 -21
- package/lib/chevre/service/assetTransaction/registerService/factory.js +0 -171
- package/lib/chevre/service/assetTransaction/registerService/potentialActions.d.ts +0 -8
- package/lib/chevre/service/assetTransaction/registerService/potentialActions.js +0 -148
- package/lib/chevre/service/assetTransaction/registerService.d.ts +0 -54
- package/lib/chevre/service/assetTransaction/registerService.js +0 -273
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createPointAward.d.ts +0 -15
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createPointAward.js +0 -44
- package/lib/chevre/service/delivery/product/factory.d.ts +0 -13
- package/lib/chevre/service/delivery/product/factory.js +0 -81
- package/lib/chevre/service/offer/product/factory.d.ts +0 -37
- package/lib/chevre/service/offer/product/factory.js +0 -208
- package/lib/chevre/service/task/confirmRegisterService.d.ts +0 -6
- package/lib/chevre/service/task/confirmRegisterService.js +0 -19
- package/lib/chevre/service/task/confirmRegisterServiceTransaction.d.ts +0 -17
- package/lib/chevre/service/task/confirmRegisterServiceTransaction.js +0 -116
- package/lib/chevre/service/task/voidRegisterServiceTransaction.d.ts +0 -6
- package/lib/chevre/service/task/voidRegisterServiceTransaction.js +0 -23
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.d.ts +0 -8
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.js +0 -89
|
@@ -7,5 +7,5 @@ import { factory } from '../../../../factory';
|
|
|
7
7
|
*/
|
|
8
8
|
declare function createOnOrderCancelledTasksByTransaction(params: {
|
|
9
9
|
transaction: Pick<factory.transaction.placeOrder.ITransaction, 'id' | 'project' | 'typeOf'>;
|
|
10
|
-
}): (import("@chevre/factory/lib/chevre/task").ITaskAttributes | import("@chevre/factory/lib/chevre/task/
|
|
10
|
+
}): (import("@chevre/factory/lib/chevre/task").ITaskAttributes | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/createAccountingReport").IAttributes | import("@chevre/factory/lib/chevre/task/deletePerson").IAttributes | import("@chevre/factory/lib/chevre/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/chevre/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/chevre/task/onEventChanged").IAttributes | import("@chevre/factory/lib/chevre/task/onResourceDeleted").IAttributes | import("@chevre/factory/lib/chevre/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/chevre/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/chevre/task/placeOrder").IAttributes | import("@chevre/factory/lib/chevre/task/returnOrder").IAttributes | import("@chevre/factory/lib/chevre/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/chevre/task/sendOrder").IAttributes | import("@chevre/factory/lib/chevre/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/chevre/task/useReservation").IAttributes | import("@chevre/factory/lib/chevre/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/voidReserveTransaction").IAttributes)[];
|
|
11
11
|
export { createOnOrderCancelledTasksByTransaction };
|
package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts
CHANGED
|
@@ -13,5 +13,5 @@ declare function createInformTasks(params: {
|
|
|
13
13
|
}, setting: Pick<ISetting, 'onOrderStatusChanged'> | null): factory.task.IAttributes<factory.taskName.TriggerWebhook>[];
|
|
14
14
|
declare function createNextSendOrderTasks(params: {
|
|
15
15
|
order: IInTransitOrder;
|
|
16
|
-
}): (import("@chevre/factory/lib/chevre/task").ITaskAttributes | import("@chevre/factory/lib/chevre/task/
|
|
16
|
+
}): (import("@chevre/factory/lib/chevre/task").ITaskAttributes | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/createAccountingReport").IAttributes | import("@chevre/factory/lib/chevre/task/deletePerson").IAttributes | import("@chevre/factory/lib/chevre/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/chevre/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/chevre/task/onEventChanged").IAttributes | import("@chevre/factory/lib/chevre/task/onResourceDeleted").IAttributes | import("@chevre/factory/lib/chevre/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/chevre/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/chevre/task/placeOrder").IAttributes | import("@chevre/factory/lib/chevre/task/returnOrder").IAttributes | import("@chevre/factory/lib/chevre/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/chevre/task/sendOrder").IAttributes | import("@chevre/factory/lib/chevre/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/chevre/task/useReservation").IAttributes | import("@chevre/factory/lib/chevre/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/voidReserveTransaction").IAttributes)[];
|
|
17
17
|
export { createInformTasks, createNextSendOrderTasks, IInTransitOrder };
|
|
@@ -16,26 +16,14 @@ function processOrder(params) {
|
|
|
16
16
|
return async (repos) => {
|
|
17
17
|
const simpleOrder = {
|
|
18
18
|
typeOf: params.order.typeOf,
|
|
19
|
-
// seller: {
|
|
20
|
-
// id: params.order.seller.id,
|
|
21
|
-
// typeOf: params.order.seller.typeOf,
|
|
22
|
-
// name: params.order.seller.name
|
|
23
|
-
// }, // 廃止(2024-03-06~)
|
|
24
|
-
// customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id }, // 廃止(2024-03-06~)
|
|
25
19
|
orderNumber: params.order.orderNumber,
|
|
26
|
-
// price: params.order.price,
|
|
27
|
-
// priceCurrency: params.order.priceCurrency,
|
|
28
20
|
orderDate: params.order.orderDate
|
|
29
21
|
};
|
|
30
|
-
// if (params.order.itemOfferedTypeOf === factory.actionType.MoneyTransfer) {
|
|
31
|
-
// await createConfirmMoneyTransferTasksIfNotExist(params.order, simpleOrder)(repos);
|
|
32
|
-
// } else
|
|
33
22
|
if (params.order.itemOfferedTypeOf === factory_1.factory.reservationType.EventReservation) {
|
|
34
23
|
// 冗長なconfirmReserveTransactionタスク作成を回避(2023-08-25~)
|
|
35
24
|
await createConfirmReserveTransactionTasksIfNotExist(params.order, simpleOrder, params.options)(repos);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
await createConfirmRegisterServiceTasksIfNotExist(params.order, simpleOrder)(repos);
|
|
25
|
+
// } else if (params.order.itemOfferedTypeOf === factory.permit.PermitType.Permit) {
|
|
26
|
+
// await createConfirmRegisterServiceTasksIfNotExist(params.order, simpleOrder)(repos);
|
|
39
27
|
}
|
|
40
28
|
};
|
|
41
29
|
}
|
|
@@ -91,85 +79,3 @@ function createConfirmReserveTransactionTasksIfNotExist(order, simpleOrder, opti
|
|
|
91
79
|
}));
|
|
92
80
|
};
|
|
93
81
|
}
|
|
94
|
-
// function createConfirmMoneyTransferTasksIfNotExist(
|
|
95
|
-
// order: Pick<IProcessingOrder, 'orderNumber' | 'project'> & {
|
|
96
|
-
// serialNumbers: string[];
|
|
97
|
-
// },
|
|
98
|
-
// simpleOrder: factory.order.ISimpleOrder
|
|
99
|
-
// ) {
|
|
100
|
-
// return async (repos: {
|
|
101
|
-
// task: TaskRepo;
|
|
102
|
-
// }): Promise<void> => {
|
|
103
|
-
// const taskRunsAt = new Date();
|
|
104
|
-
// await Promise.all(order.serialNumbers.map(async (moneyTransferTransactionNumber) => {
|
|
105
|
-
// const data: factory.task.IData<factory.taskName.ConfirmMoneyTransfer> = {
|
|
106
|
-
// project: order.project,
|
|
107
|
-
// typeOf: factory.actionType.ConfirmAction,
|
|
108
|
-
// object: {
|
|
109
|
-
// // pendingTransaction: { id: '' }, // 空文字であれば、transactionNumberで処理される
|
|
110
|
-
// transactionNumber: moneyTransferTransactionNumber,
|
|
111
|
-
// typeOf: factory.assetTransactionType.MoneyTransfer
|
|
112
|
-
// },
|
|
113
|
-
// agent: order.project,
|
|
114
|
-
// purpose: simpleOrder
|
|
115
|
-
// };
|
|
116
|
-
// const taskIdentifier: string = util.format(
|
|
117
|
-
// '%s:%s:%s:%s:%s:%s',
|
|
118
|
-
// data.project.id,
|
|
119
|
-
// factory.taskName.ConfirmMoneyTransfer,
|
|
120
|
-
// data.purpose.typeOf,
|
|
121
|
-
// simpleOrder.orderNumber,
|
|
122
|
-
// data.object.typeOf,
|
|
123
|
-
// data.object.transactionNumber
|
|
124
|
-
// );
|
|
125
|
-
// const confirmMoneyTransferTransactionTask: factory.task.IAttributes<factory.taskName.ConfirmMoneyTransfer> & {
|
|
126
|
-
// alternateName: string;
|
|
127
|
-
// identifier: string;
|
|
128
|
-
// } = {
|
|
129
|
-
// alternateName: taskIdentifier,
|
|
130
|
-
// identifier: taskIdentifier,
|
|
131
|
-
// project: order.project,
|
|
132
|
-
// name: factory.taskName.ConfirmMoneyTransfer,
|
|
133
|
-
// status: factory.taskStatus.Ready,
|
|
134
|
-
// runsAt: taskRunsAt,
|
|
135
|
-
// remainingNumberOfTries: 10,
|
|
136
|
-
// numberOfTried: 0,
|
|
137
|
-
// executionResults: [],
|
|
138
|
-
// data
|
|
139
|
-
// };
|
|
140
|
-
// await repos.task.createIfNotExistByAlternateName(confirmMoneyTransferTransactionTask, { emitImmediately: true });
|
|
141
|
-
// }));
|
|
142
|
-
// };
|
|
143
|
-
// }
|
|
144
|
-
function createConfirmRegisterServiceTasksIfNotExist(order, simpleOrder) {
|
|
145
|
-
return async (repos) => {
|
|
146
|
-
const taskRunsAt = new Date();
|
|
147
|
-
await Promise.all(order.serialNumbers.map(async (registerServiceTransactionNumber) => {
|
|
148
|
-
const data = {
|
|
149
|
-
project: order.project,
|
|
150
|
-
typeOf: factory_1.factory.actionType.ConfirmAction,
|
|
151
|
-
object: {
|
|
152
|
-
endDate: order.orderDate,
|
|
153
|
-
transactionNumber: registerServiceTransactionNumber,
|
|
154
|
-
typeOf: factory_1.factory.assetTransactionType.RegisterService
|
|
155
|
-
},
|
|
156
|
-
agent: order.project,
|
|
157
|
-
purpose: simpleOrder
|
|
158
|
-
};
|
|
159
|
-
const taskIdentifier = (0, util_1.format)('%s:%s:%s:%s:%s:%s', data.project.id, factory_1.factory.taskName.ConfirmRegisterService, data.purpose.typeOf, simpleOrder.orderNumber, data.object.typeOf, data.object.transactionNumber);
|
|
160
|
-
const confirmRegisterServiceTask = {
|
|
161
|
-
alternateName: taskIdentifier,
|
|
162
|
-
identifier: taskIdentifier,
|
|
163
|
-
project: order.project,
|
|
164
|
-
name: factory_1.factory.taskName.ConfirmRegisterService,
|
|
165
|
-
status: factory_1.factory.taskStatus.Ready,
|
|
166
|
-
runsAt: taskRunsAt,
|
|
167
|
-
remainingNumberOfTries: 10,
|
|
168
|
-
numberOfTried: 0,
|
|
169
|
-
executionResults: [],
|
|
170
|
-
data
|
|
171
|
-
};
|
|
172
|
-
await repos.task.createIfNotExistByAlternateName(confirmRegisterServiceTask, { emitImmediately: true });
|
|
173
|
-
}));
|
|
174
|
-
};
|
|
175
|
-
}
|
|
@@ -11,5 +11,5 @@ declare function createInformTasks(order: IReturnedOrder, returnOrderAction: IRe
|
|
|
11
11
|
declare function createOnOrderReturnedTasksByTransaction(params: {
|
|
12
12
|
order: Pick<factory.order.IOrder, 'project' | 'typeOf' | 'orderNumber' | 'customer' | 'price' | 'priceCurrency' | 'orderDate'>;
|
|
13
13
|
potentialActions?: factory.action.transfer.returnAction.order.IPotentialActions;
|
|
14
|
-
}): (import("@chevre/factory/lib/chevre/task").ITaskAttributes | import("@chevre/factory/lib/chevre/task/
|
|
14
|
+
}): (import("@chevre/factory/lib/chevre/task").ITaskAttributes | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/createAccountingReport").IAttributes | import("@chevre/factory/lib/chevre/task/deletePerson").IAttributes | import("@chevre/factory/lib/chevre/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/chevre/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/chevre/task/onEventChanged").IAttributes | import("@chevre/factory/lib/chevre/task/onResourceDeleted").IAttributes | import("@chevre/factory/lib/chevre/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/chevre/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/chevre/task/placeOrder").IAttributes | import("@chevre/factory/lib/chevre/task/returnOrder").IAttributes | import("@chevre/factory/lib/chevre/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/chevre/task/sendOrder").IAttributes | import("@chevre/factory/lib/chevre/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/chevre/task/useReservation").IAttributes | import("@chevre/factory/lib/chevre/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/voidReserveTransaction").IAttributes)[];
|
|
15
15
|
export { createInformTasks, createOnOrderReturnedTasksByTransaction, IReturnAction };
|
|
@@ -101,22 +101,25 @@ function createOnOrderReturnedTasksByTransaction(params) {
|
|
|
101
101
|
// }
|
|
102
102
|
// ));
|
|
103
103
|
// }
|
|
104
|
+
// discontinue(2026-04-18~)
|
|
104
105
|
// ポイント特典返却タスク
|
|
105
|
-
const returnPointAwardAttributes = potentialActions?.returnPointAward;
|
|
106
|
-
if (Array.isArray(returnPointAwardAttributes)) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
106
|
+
// const returnPointAwardAttributes = potentialActions?.returnPointAward;
|
|
107
|
+
// if (Array.isArray(returnPointAwardAttributes)) {
|
|
108
|
+
// taskAttributes.push(...returnPointAwardAttributes.map(
|
|
109
|
+
// (a): factory.task.IAttributes<factory.taskName.ReturnPointAward> => {
|
|
110
|
+
// return {
|
|
111
|
+
// project: a.project,
|
|
112
|
+
// name: factory.taskName.ReturnPointAward,
|
|
113
|
+
// status: factory.taskStatus.Ready,
|
|
114
|
+
// runsAt: now, // なるはやで実行
|
|
115
|
+
// remainingNumberOfTries: 10,
|
|
116
|
+
// numberOfTried: 0,
|
|
117
|
+
// executionResults: [],
|
|
118
|
+
// data: a
|
|
119
|
+
// };
|
|
120
|
+
// }
|
|
121
|
+
// ));
|
|
122
|
+
// }
|
|
120
123
|
const sendEmailMessageAttributes = potentialActions?.sendEmailMessage;
|
|
121
124
|
if (Array.isArray(sendEmailMessageAttributes)) {
|
|
122
125
|
const simpleOrder = {
|
|
@@ -4,6 +4,5 @@ import { factory } from '../../../../factory';
|
|
|
4
4
|
*/
|
|
5
5
|
declare function acceptedOffers2orderedItem(params: {
|
|
6
6
|
eventReservationAcceptedOffers: factory.order.IAcceptedOffer<factory.order.IReservation>[];
|
|
7
|
-
productAcceptedOffers: factory.order.IAcceptedOffer<factory.order.IPermit>[];
|
|
8
7
|
}): factory.order.IOrderedItem[];
|
|
9
8
|
export { acceptedOffers2orderedItem };
|
|
@@ -11,9 +11,10 @@ function acceptedOffers2orderedItem(params) {
|
|
|
11
11
|
// 通貨転送がある場合
|
|
12
12
|
// const { moneyTransferOrderItems } = createMoneyTransferAcceptedOffers(params);
|
|
13
13
|
// プロダクトがある場合
|
|
14
|
-
const { productOrderItems } = createProductItems(params);
|
|
14
|
+
// const { productOrderItems } = createProductItems(params);
|
|
15
15
|
// return [...reservationOrderItems, ...moneyTransferOrderItems, ...productOrderItems];
|
|
16
|
-
return [...reservationOrderItems, ...productOrderItems];
|
|
16
|
+
// return [...reservationOrderItems, ...productOrderItems];
|
|
17
|
+
return reservationOrderItems;
|
|
17
18
|
}
|
|
18
19
|
function createReservationAcceptedOffers(params) {
|
|
19
20
|
const orderedItems = [];
|
|
@@ -70,29 +71,3 @@ function reservationOffers2orderedItem(params) {
|
|
|
70
71
|
throw new factory_1.factory.errors.Internal('unexpected params on reservationOffers2orderedItem');
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
|
-
function createProductItems(params) {
|
|
74
|
-
const orderedItems = [];
|
|
75
|
-
const productIds = [];
|
|
76
|
-
if (Array.isArray(params.productAcceptedOffers) && params.productAcceptedOffers.length > 0) {
|
|
77
|
-
// プロダクトIDで最適化する
|
|
78
|
-
const issuedThrough = params.productAcceptedOffers[0].itemOffered.issuedThrough;
|
|
79
|
-
if (typeof issuedThrough?.id === 'string') {
|
|
80
|
-
if (!productIds.includes(issuedThrough.id)) {
|
|
81
|
-
productIds.push(issuedThrough.id);
|
|
82
|
-
orderedItems.push({
|
|
83
|
-
typeOf: 'OrderItem',
|
|
84
|
-
orderedItem: {
|
|
85
|
-
id: String(issuedThrough.id),
|
|
86
|
-
typeOf: issuedThrough.typeOf,
|
|
87
|
-
...(typeof issuedThrough.serviceType?.typeOf === 'string')
|
|
88
|
-
? { serviceType: issuedThrough.serviceType }
|
|
89
|
-
: undefined
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return {
|
|
96
|
-
productOrderItems: orderedItems
|
|
97
|
-
};
|
|
98
|
-
}
|
|
@@ -82,7 +82,7 @@ function createPlacingOrder(params) {
|
|
|
82
82
|
const broker = (typeof transaction.object.broker?.typeOf === 'string') ? transaction.object.broker : undefined;
|
|
83
83
|
const { paymentMethods, price } = createPaymentMethods({ authorizePaymentActions });
|
|
84
84
|
const eventReservationAcceptedOffers = [];
|
|
85
|
-
const productAcceptedOffers = [];
|
|
85
|
+
// const productAcceptedOffers: factory.order.IAcceptedOffer<factory.order.IPermit>[] = [];
|
|
86
86
|
// const moneyTransferAcceptedOffers: factory.order.IAcceptedOffer<factory.order.IMoneyTransfer>[] = [];
|
|
87
87
|
params.acceptedOffers.forEach((acceptedOffer) => {
|
|
88
88
|
const itemOfferedTypeOf = acceptedOffer.itemOffered.typeOf;
|
|
@@ -90,9 +90,9 @@ function createPlacingOrder(params) {
|
|
|
90
90
|
case factory_1.factory.reservationType.EventReservation:
|
|
91
91
|
eventReservationAcceptedOffers.push(acceptedOffer);
|
|
92
92
|
break;
|
|
93
|
-
case
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
// case factory.permit.PermitType.Permit:
|
|
94
|
+
// productAcceptedOffers.push((acceptedOffer as factory.order.IAcceptedOffer<factory.order.IPermit>));
|
|
95
|
+
// break;
|
|
96
96
|
// case factory.actionType.MoneyTransfer:
|
|
97
97
|
// moneyTransferAcceptedOffers.push(<factory.order.IAcceptedOffer<factory.order.IMoneyTransfer>>acceptedOffer);
|
|
98
98
|
// break;
|
|
@@ -102,7 +102,7 @@ function createPlacingOrder(params) {
|
|
|
102
102
|
});
|
|
103
103
|
const orderedItem = (0, orderedItem_1.acceptedOffers2orderedItem)({
|
|
104
104
|
eventReservationAcceptedOffers,
|
|
105
|
-
productAcceptedOffers,
|
|
105
|
+
// productAcceptedOffers,
|
|
106
106
|
// moneyTransferAcceptedOffers
|
|
107
107
|
});
|
|
108
108
|
return {
|
|
@@ -12,8 +12,8 @@ function createPayObjectServiceOutput(params) {
|
|
|
12
12
|
const order = params.order;
|
|
13
13
|
let paymentServiceOutput;
|
|
14
14
|
switch (transaction.object.typeOf) {
|
|
15
|
+
// case factory.service.paymentService.PaymentServiceType.PaymentCard: // discontinue(2026-04-18~)
|
|
15
16
|
case factory_1.factory.service.paymentService.PaymentServiceType.FaceToFace:
|
|
16
|
-
case factory_1.factory.service.paymentService.PaymentServiceType.PaymentCard:
|
|
17
17
|
case factory_1.factory.service.paymentService.PaymentServiceType.CreditCard:
|
|
18
18
|
break;
|
|
19
19
|
case factory_1.factory.service.paymentService.PaymentServiceType.MovieTicket: {
|
|
@@ -80,29 +80,29 @@ function createPayObject(params) {
|
|
|
80
80
|
};
|
|
81
81
|
break;
|
|
82
82
|
}
|
|
83
|
-
case
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
83
|
+
// case factory.service.paymentService.PaymentServiceType.PaymentCard: {
|
|
84
|
+
// const totalPaymentDue: factory.order.ITotalPaymentDue = (typeof paymentMethod?.totalPaymentDue?.typeOf === 'string')
|
|
85
|
+
// ? paymentMethod.totalPaymentDue
|
|
86
|
+
// : {
|
|
87
|
+
// typeOf: 'MonetaryAmount',
|
|
88
|
+
// currency: factory.priceCurrency.JPY,
|
|
89
|
+
// value: paymentMethodAmountValue
|
|
90
|
+
// };
|
|
91
|
+
// payObject = {
|
|
92
|
+
// typeOf: transaction.object.typeOf,
|
|
93
|
+
// id: (typeof transaction.object.id === 'string') ? transaction.object.id : '',
|
|
94
|
+
// paymentMethod: {
|
|
95
|
+
// accountId: paymentMethod?.accountId,
|
|
96
|
+
// additionalProperty: (Array.isArray(additionalProperty)) ? additionalProperty : [],
|
|
97
|
+
// name: paymentMethodName,
|
|
98
|
+
// paymentMethodId: paymentMethodId,
|
|
99
|
+
// totalPaymentDue: totalPaymentDue,
|
|
100
|
+
// typeOf: paymentMethodType
|
|
101
|
+
// },
|
|
102
|
+
// pendingTransaction: transaction.object.pendingTransaction
|
|
103
|
+
// };
|
|
104
|
+
// break;
|
|
105
|
+
// }
|
|
106
106
|
case factory_1.factory.service.paymentService.PaymentServiceType.CreditCard:
|
|
107
107
|
payObject = {
|
|
108
108
|
typeOf: transaction.object.typeOf,
|
|
@@ -8,7 +8,6 @@ exports.registerService = registerService;
|
|
|
8
8
|
* プロダクトサービス
|
|
9
9
|
*/
|
|
10
10
|
const moment_1 = __importDefault(require("moment"));
|
|
11
|
-
const factory_1 = require("../factory");
|
|
12
11
|
const permit_1 = require("./permit");
|
|
13
12
|
function registerService(params) {
|
|
14
13
|
return async (repos) => {
|
|
@@ -52,24 +51,25 @@ function registerService(params) {
|
|
|
52
51
|
function onRegistered(actionAttributes, __) {
|
|
53
52
|
return async (repos) => {
|
|
54
53
|
const potentialActions = actionAttributes.potentialActions;
|
|
55
|
-
const now = new Date();
|
|
54
|
+
// const now = new Date();
|
|
56
55
|
const taskAttributes = [];
|
|
57
56
|
/* istanbul ignore else */
|
|
58
57
|
if (potentialActions !== undefined) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
58
|
+
// discontinue(2026-04-18~)
|
|
59
|
+
// if (Array.isArray(potentialActions.moneyTransfer)) {
|
|
60
|
+
// taskAttributes.push(...potentialActions.moneyTransfer.map((a) => {
|
|
61
|
+
// return {
|
|
62
|
+
// project: a.project,
|
|
63
|
+
// name: factory.taskName.MoneyTransfer as factory.taskName.MoneyTransfer,
|
|
64
|
+
// status: factory.taskStatus.Ready,
|
|
65
|
+
// runsAt: now,
|
|
66
|
+
// remainingNumberOfTries: 10,
|
|
67
|
+
// numberOfTried: 0,
|
|
68
|
+
// executionResults: [],
|
|
69
|
+
// data: a
|
|
70
|
+
// };
|
|
71
|
+
// }));
|
|
72
|
+
// }
|
|
73
73
|
}
|
|
74
74
|
// タスク保管
|
|
75
75
|
await repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.confirmReservation = confirmReservation;
|
|
7
7
|
const debug_1 = __importDefault(require("debug"));
|
|
8
8
|
const factory_1 = require("../../factory");
|
|
9
|
-
const factory_2 = require("./factory");
|
|
10
9
|
const onReservationConfirmed_1 = require("./potentialActions/onReservationConfirmed");
|
|
11
10
|
const debug = (0, debug_1.default)('chevre-domain:service:reserve:confirmReservation');
|
|
12
11
|
/**
|
|
@@ -81,21 +80,23 @@ function reserveTransaction2action(params) {
|
|
|
81
80
|
if (reservationFor === undefined) {
|
|
82
81
|
throw new factory_1.factory.errors.NotFound('transaction.object.reservationFor');
|
|
83
82
|
}
|
|
84
|
-
let underName;
|
|
85
|
-
if (typeof transaction.object.underName?.typeOf === 'string') {
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
const moneyTransferActions = [];
|
|
89
|
-
const pendingReservations = (Array.isArray(transaction.object.subReservation)) ? transaction.object.subReservation : [];
|
|
90
|
-
pendingReservations.forEach((reservation) => {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
83
|
+
// let underName: factory.assetTransaction.reserve.IUnderName | undefined;
|
|
84
|
+
// if (typeof transaction.object.underName?.typeOf === 'string') {
|
|
85
|
+
// underName = transaction.object.underName;
|
|
86
|
+
// }
|
|
87
|
+
// const moneyTransferActions: factory.action.transfer.moneyTransfer.IAttributes[] = [];
|
|
88
|
+
// const pendingReservations = (Array.isArray(transaction.object.subReservation)) ? transaction.object.subReservation : [];
|
|
89
|
+
// pendingReservations.forEach((reservation) => {
|
|
90
|
+
// const acceptedOffer4reservation = transaction.object.acceptedOffer?.find(
|
|
91
|
+
// (o) => o.itemOffered?.serviceOutput?.id === reservation.id
|
|
92
|
+
// );
|
|
93
|
+
// moneyTransferActions.push(...createMoneyTransferActions({
|
|
94
|
+
// acceptedOffer: acceptedOffer4reservation,
|
|
95
|
+
// reservation,
|
|
96
|
+
// transaction: params.transaction,
|
|
97
|
+
// underName
|
|
98
|
+
// }));
|
|
99
|
+
// });
|
|
99
100
|
const reservationPackage = {
|
|
100
101
|
reservationFor: {
|
|
101
102
|
id: String(reservationFor.id),
|
|
@@ -114,7 +115,8 @@ function reserveTransaction2action(params) {
|
|
|
114
115
|
object: reservationPackage,
|
|
115
116
|
agent: transaction.project,
|
|
116
117
|
potentialActions: {
|
|
117
|
-
|
|
118
|
+
// discontinue(2026-04-18~)
|
|
119
|
+
// moneyTransfer: moneyTransferActions
|
|
118
120
|
},
|
|
119
121
|
purpose: { typeOf: transaction.typeOf, id: transaction.id },
|
|
120
122
|
...(Array.isArray(transaction.instrument)) ? { instrument: transaction.instrument } : undefined // add(2025-02-17~)
|
|
@@ -4,12 +4,6 @@ export declare function optimizeUnderName4inform(params: {
|
|
|
4
4
|
}): factory.notification.reservation.IMaskedUnderName;
|
|
5
5
|
export type IPotentialInformReservationAction = factory.task.triggerWebhook.IPotentialInformReservationAction;
|
|
6
6
|
export declare const NUM_TRY_INFORM_RESERVATION = 10;
|
|
7
|
-
export declare function createMoneyTransferActions(params: {
|
|
8
|
-
acceptedOffer?: factory.assetTransaction.reserve.IAcceptedOffer4object;
|
|
9
|
-
reservation: Pick<factory.assetTransaction.reserve.IObjectSubReservation, 'reservedTicket'>;
|
|
10
|
-
transaction: factory.assetTransaction.ITransaction<factory.assetTransactionType.Reserve>;
|
|
11
|
-
underName?: Pick<factory.reservation.IUnderName, 'id' | 'typeOf' | 'name'>;
|
|
12
|
-
}): import("@chevre/factory/lib/chevre/action/transfer/moneyTransfer").IAttributes[];
|
|
13
7
|
export interface IPotentialCancelAction extends factory.action.cancel.reservation.IAttributes {
|
|
14
8
|
purpose: {
|
|
15
9
|
id: string;
|
|
@@ -2,71 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NUM_TRY_INFORM_RESERVATION = void 0;
|
|
4
4
|
exports.optimizeUnderName4inform = optimizeUnderName4inform;
|
|
5
|
-
exports.createMoneyTransferActions = createMoneyTransferActions;
|
|
6
5
|
exports.createCancelPendingReservationAction = createCancelPendingReservationAction;
|
|
7
6
|
const factory_1 = require("../../factory");
|
|
8
7
|
function optimizeUnderName4inform(params) {
|
|
9
8
|
return { id: params.underName.id, typeOf: params.underName.typeOf };
|
|
10
9
|
}
|
|
11
10
|
exports.NUM_TRY_INFORM_RESERVATION = 10;
|
|
12
|
-
function createMoneyTransferActions(params) {
|
|
13
|
-
const pointAward = params.acceptedOffer?.itemOffered?.pointAward;
|
|
14
|
-
const moneyTransfer = [];
|
|
15
|
-
// ポイント特典があれば適用
|
|
16
|
-
const pointAwardToLocationIdentifier = pointAward?.toLocation?.identifier;
|
|
17
|
-
const pointAwardToLocationTypeOf = pointAward?.toLocation?.typeOf;
|
|
18
|
-
if (typeof pointAward?.amount?.value === 'number'
|
|
19
|
-
&& typeof pointAwardToLocationIdentifier === 'string'
|
|
20
|
-
&& typeof pointAwardToLocationTypeOf === 'string') {
|
|
21
|
-
const fromLocation = {
|
|
22
|
-
typeOf: (typeof params.reservation.reservedTicket.issuedBy?.typeOf === 'string')
|
|
23
|
-
? params.reservation.reservedTicket.issuedBy.typeOf
|
|
24
|
-
: params.transaction.typeOf,
|
|
25
|
-
name: (typeof params.reservation.reservedTicket.issuedBy?.name === 'string')
|
|
26
|
-
? params.reservation.reservedTicket.issuedBy.name
|
|
27
|
-
: params.transaction.id
|
|
28
|
-
};
|
|
29
|
-
const toLocation = {
|
|
30
|
-
identifier: pointAwardToLocationIdentifier,
|
|
31
|
-
typeOf: factory_1.factory.permit.PermitType.Permit,
|
|
32
|
-
issuedThrough: { id: String(pointAward.toLocation?.issuedThrough?.id) }
|
|
33
|
-
};
|
|
34
|
-
const recipient = {
|
|
35
|
-
typeOf: (typeof params.underName?.typeOf === 'string')
|
|
36
|
-
? params.underName?.typeOf
|
|
37
|
-
: factory_1.factory.personType.Person,
|
|
38
|
-
id: (typeof params.underName?.id === 'string')
|
|
39
|
-
? params.underName?.id
|
|
40
|
-
: '',
|
|
41
|
-
name: String(params.underName?.name)
|
|
42
|
-
};
|
|
43
|
-
moneyTransfer.push({
|
|
44
|
-
project: params.transaction.project,
|
|
45
|
-
typeOf: factory_1.factory.actionType.MoneyTransfer,
|
|
46
|
-
agent: params.transaction.project,
|
|
47
|
-
recipient,
|
|
48
|
-
object: {
|
|
49
|
-
typeOf: factory_1.factory.account.transactionType.Deposit
|
|
50
|
-
},
|
|
51
|
-
purpose: {
|
|
52
|
-
typeOf: params.transaction.typeOf,
|
|
53
|
-
id: params.transaction.id,
|
|
54
|
-
// 入金取引に識別子を指定する
|
|
55
|
-
...(typeof pointAward.purpose?.identifier === 'string') ? { identifier: pointAward.purpose.identifier } : undefined
|
|
56
|
-
},
|
|
57
|
-
amount: {
|
|
58
|
-
typeOf: 'MonetaryAmount',
|
|
59
|
-
value: pointAward.amount?.value,
|
|
60
|
-
currency: pointAward.amount?.currency
|
|
61
|
-
},
|
|
62
|
-
fromLocation: fromLocation,
|
|
63
|
-
toLocation: toLocation,
|
|
64
|
-
...(typeof pointAward.description === 'string') ? { description: pointAward.description } : undefined,
|
|
65
|
-
...(pointAward.recipient !== undefined) ? { recipient: pointAward.recipient } : undefined
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
return moneyTransfer;
|
|
69
|
-
}
|
|
70
11
|
function createCancelPendingReservationAction(params) {
|
|
71
12
|
const transaction = params.transaction;
|
|
72
13
|
const pendingReservations = (Array.isArray(transaction.object.subReservation)) ? transaction.object.subReservation : [];
|
|
@@ -14,24 +14,25 @@ const factory_2 = require("../factory");
|
|
|
14
14
|
function onReservationConfirmedByAction(actionAttributes) {
|
|
15
15
|
return async (repos) => {
|
|
16
16
|
const potentialActions = actionAttributes.potentialActions;
|
|
17
|
-
const now = new Date();
|
|
17
|
+
// const now = new Date();
|
|
18
18
|
const taskAttributes = [];
|
|
19
19
|
/* istanbul ignore else */
|
|
20
20
|
if (potentialActions !== undefined) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
21
|
+
// discontinue(2026-04-18~)
|
|
22
|
+
// if (Array.isArray(potentialActions.moneyTransfer)) {
|
|
23
|
+
// taskAttributes.push(...potentialActions.moneyTransfer.map((a) => {
|
|
24
|
+
// return {
|
|
25
|
+
// project: a.project,
|
|
26
|
+
// name: factory.taskName.MoneyTransfer as factory.taskName.MoneyTransfer,
|
|
27
|
+
// status: factory.taskStatus.Ready,
|
|
28
|
+
// runsAt: now,
|
|
29
|
+
// remainingNumberOfTries: 10,
|
|
30
|
+
// numberOfTried: 0,
|
|
31
|
+
// executionResults: [],
|
|
32
|
+
// data: a
|
|
33
|
+
// };
|
|
34
|
+
// }));
|
|
35
|
+
// }
|
|
35
36
|
}
|
|
36
37
|
// タスク保管
|
|
37
38
|
if (taskAttributes.length > 0) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { factory } from '../../../../../factory';
|
|
2
2
|
export type IAcceptPayAction = Pick<factory.action.accept.pay.IAction, 'object' | 'result' | 'endDate'>;
|
|
3
3
|
export type IAuthorizeEventServiceOffer = factory.action.authorize.offer.eventService.IAction;
|
|
4
|
-
export type IAuthorizeProductOffer = factory.action.authorize.offer.product.IAction;
|
|
5
4
|
export type IAuthorizePaymentAction = Pick<factory.action.authorize.paymentMethod.any.IAction, 'id' | 'result' | 'endDate'> & {
|
|
6
5
|
object: Pick<factory.action.authorize.paymentMethod.any.IObject, 'typeOf' | 'paymentMethodId'>;
|
|
7
6
|
instrument?: never;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { IAuthorizeEventServiceOffer, IAuthorizePaymentAction
|
|
2
|
-
declare function validatePrice(authorizePaymentActions: IAuthorizePaymentAction[], authorizeEventServiceOfferActions: Pick<IAuthorizeEventServiceOffer, 'id' | 'result'>[]
|
|
1
|
+
import { IAuthorizeEventServiceOffer, IAuthorizePaymentAction } from './factory';
|
|
2
|
+
declare function validatePrice(authorizePaymentActions: IAuthorizePaymentAction[], authorizeEventServiceOfferActions: Pick<IAuthorizeEventServiceOffer, 'id' | 'result'>[]): void;
|
|
3
3
|
export { validatePrice };
|