@chevre/domain 24.0.0-alpha.78 → 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 +3 -3
- 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 -27
- package/lib/chevre/repo/assetTransaction.js +21 -21
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +1 -1
- 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.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/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 +22 -18
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +20 -20
- 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/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/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 +4 -2
- 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/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 -14
- package/lib/chevre/service/assetTransaction/registerService/factory.js +0 -140
- package/lib/chevre/service/assetTransaction/registerService/potentialActions.d.ts +0 -8
- package/lib/chevre/service/assetTransaction/registerService/potentialActions.js +0 -120
- package/lib/chevre/service/assetTransaction/registerService.d.ts +0 -54
- package/lib/chevre/service/assetTransaction/registerService.js +0 -274
- 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
|
@@ -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 };
|
|
@@ -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 {
|
|
@@ -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 };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validatePrice = validatePrice;
|
|
4
4
|
const factory_1 = require("../../../../../factory");
|
|
5
|
-
function validatePrice(authorizePaymentActions, authorizeEventServiceOfferActions
|
|
5
|
+
function validatePrice(authorizePaymentActions, authorizeEventServiceOfferActions) {
|
|
6
6
|
let priceByAgent = 0;
|
|
7
7
|
let priceBySeller = 0;
|
|
8
8
|
// 決済承認を確認
|
|
@@ -19,7 +19,7 @@ function validatePrice(authorizePaymentActions, authorizeEventServiceOfferAction
|
|
|
19
19
|
// 販売者が提供するアイテムの発生金額
|
|
20
20
|
[
|
|
21
21
|
...authorizeEventServiceOfferActions,
|
|
22
|
-
...authorizeProductOfferActions
|
|
22
|
+
// ...authorizeProductOfferActions
|
|
23
23
|
].forEach(({ id, result }) => {
|
|
24
24
|
const priceByAction = result?.price;
|
|
25
25
|
if (typeof priceByAction === 'number' && priceByAction >= 0) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { factory } from '../../../../factory';
|
|
2
2
|
import { placeOrder as PlaceOrderFactory } from '../../../../factory/transaction';
|
|
3
|
-
import { IAcceptPayAction, IAuthorizeEventServiceOffer, IAuthorizePaymentAction,
|
|
4
|
-
export { IAcceptPayAction, IAuthorizeEventServiceOffer, IAuthorizePaymentAction,
|
|
3
|
+
import { IAcceptPayAction, IAuthorizeEventServiceOffer, IAuthorizePaymentAction, IPayTransaction } from './validation/factory';
|
|
4
|
+
export { IAcceptPayAction, IAuthorizeEventServiceOffer, IAuthorizePaymentAction, IPayTransaction };
|
|
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'>[],
|
|
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<factory.order.IReservation>[], payTransactions: IPayTransaction[], customer: factory.order.ICustomer): void;
|
|
9
9
|
export type IOrderURLGenerator = (order: factory.order.IOrder) => string;
|
|
10
10
|
/**
|
|
11
11
|
* 注文オファー数検証
|
|
@@ -21,10 +21,12 @@ const debug = (0, debug_1.default)('chevre-domain:service:transaction');
|
|
|
21
21
|
/**
|
|
22
22
|
* 取引が確定可能な状態かどうかをチェックする
|
|
23
23
|
*/
|
|
24
|
-
function validateTransaction(transaction, acceptPayActions, authorizePaymentActions, authorizeEventServiceOfferActions,
|
|
24
|
+
function validateTransaction(transaction, acceptPayActions, authorizePaymentActions, authorizeEventServiceOfferActions,
|
|
25
|
+
// authorizeProductOfferActions: Pick<IAuthorizeProductOffer, 'id' | 'result'>[],
|
|
26
|
+
eventReservationAcceptedOffers, payTransactions, customer) {
|
|
25
27
|
// validateProfile(transaction);
|
|
26
28
|
validateProfile({ customer });
|
|
27
|
-
(0, validatePrice_1.validatePrice)(authorizePaymentActions, authorizeEventServiceOfferActions
|
|
29
|
+
(0, validatePrice_1.validatePrice)(authorizePaymentActions, authorizeEventServiceOfferActions);
|
|
28
30
|
// 請求のreferencesOrder検証(2025-11-23~)
|
|
29
31
|
(0, validateInvoiceReferencesOrder_1.validateInvoiceReferencesOrder)(authorizePaymentActions, eventReservationAcceptedOffers);
|
|
30
32
|
// 利用可能な通貨単位に対して取引検証
|
|
@@ -95,7 +95,9 @@ function confirm(params, options) {
|
|
|
95
95
|
}
|
|
96
96
|
const {
|
|
97
97
|
// acceptedOffersFromAuthorizeAction, // discontinue(2024-06-17~)
|
|
98
|
-
authorizePaymentActions, authorizeEventServiceOfferActions,
|
|
98
|
+
authorizePaymentActions, authorizeEventServiceOfferActions,
|
|
99
|
+
// authorizeProductOfferActions,
|
|
100
|
+
serialNumbers } = dissolveAuthorizeActions(completedAuthorizeActions);
|
|
99
101
|
// orderInTransactionから検索する(2024-03-04~)
|
|
100
102
|
const acceptedOffers = (await repos.orderInTransaction.findAcceptedOffersByOrderNumber({ orderNumber: { $eq: orderNumber } }))
|
|
101
103
|
.filter(({ serialNumber }) => typeof serialNumber === 'string' && serialNumbers.includes(serialNumber));
|
|
@@ -118,7 +120,8 @@ function confirm(params, options) {
|
|
|
118
120
|
...params,
|
|
119
121
|
orderNumber, transaction,
|
|
120
122
|
acceptPayActions,
|
|
121
|
-
authorizePaymentActions, authorizeEventServiceOfferActions,
|
|
123
|
+
authorizePaymentActions, authorizeEventServiceOfferActions,
|
|
124
|
+
// authorizeProductOfferActions,
|
|
122
125
|
acceptedOffers, payTransactions, customer,
|
|
123
126
|
...(typeof code === 'string') ? { code } : undefined
|
|
124
127
|
}, options);
|
|
@@ -217,20 +220,12 @@ function dissolveAuthorizeActions(completedAuthorizeActions) {
|
|
|
217
220
|
// const acceptedOffersFromAuthorizeAction: IOrderAcceptedOffer[] = []; // discontinue(2024-06-17~)
|
|
218
221
|
const authorizePaymentActions = [];
|
|
219
222
|
const authorizeEventServiceOfferActions = [];
|
|
220
|
-
const authorizeProductOfferActions = [];
|
|
223
|
+
// const authorizeProductOfferActions: IAuthorizeProductOffer[] = [];
|
|
221
224
|
const serialNumbers = [];
|
|
222
225
|
completedAuthorizeActions.forEach((a) => {
|
|
223
226
|
let serialNumber;
|
|
224
227
|
if (Array.isArray(a.object)) {
|
|
225
228
|
throw new factory_1.factory.errors.NotImplemented('authorizeAction object as an array discontinued.'); // discontinue(2026-03-13~)
|
|
226
|
-
// if (
|
|
227
|
-
// a.object.length > 0
|
|
228
|
-
// && a.object.every(({ typeOf }) => typeOf === factory.offerType.Offer)
|
|
229
|
-
// && a.object.every(({ itemOffered }) => availableProductTypes.indexOf(itemOffered.typeOf) >= 0)
|
|
230
|
-
// ) {
|
|
231
|
-
// authorizeProductOfferActions.push(<IAuthorizeProductOffer>a);
|
|
232
|
-
// serialNumber = (<IAuthorizeProductOffer>a).instrument.transactionNumber;
|
|
233
|
-
// }
|
|
234
229
|
}
|
|
235
230
|
else {
|
|
236
231
|
if (a.object.typeOf === factory_1.factory.action.authorize.offer.eventService.ObjectType.SeatReservation) {
|
|
@@ -241,10 +236,11 @@ function dissolveAuthorizeActions(completedAuthorizeActions) {
|
|
|
241
236
|
}
|
|
242
237
|
serialNumber = assetTransactionNumber;
|
|
243
238
|
}
|
|
244
|
-
else if (a.object.typeOf ===
|
|
245
|
-
&& a.instrument?.typeOf ===
|
|
246
|
-
|
|
247
|
-
|
|
239
|
+
else if (a.object.typeOf === 'AggregateOffer'
|
|
240
|
+
&& a.instrument?.typeOf === 'RegisterService') {
|
|
241
|
+
throw new factory_1.factory.errors.NotImplemented('authorizeAction instrument as RegisterService discontinued.'); // discontinue(2026-03-13~)
|
|
242
|
+
// authorizeProductOfferActions.push((a as IAuthorizeProductOffer));
|
|
243
|
+
// serialNumber = a.instrument.transactionNumber;
|
|
248
244
|
}
|
|
249
245
|
else if (a.object.typeOf === factory_1.factory.action.authorize.paymentMethod.any.ResultType.Payment) {
|
|
250
246
|
authorizePaymentActions.push(a);
|
|
@@ -258,7 +254,7 @@ function dissolveAuthorizeActions(completedAuthorizeActions) {
|
|
|
258
254
|
return {
|
|
259
255
|
authorizePaymentActions,
|
|
260
256
|
authorizeEventServiceOfferActions,
|
|
261
|
-
authorizeProductOfferActions,
|
|
257
|
+
// authorizeProductOfferActions,
|
|
262
258
|
serialNumbers
|
|
263
259
|
};
|
|
264
260
|
}
|
|
@@ -288,7 +284,7 @@ function createReservationIdsResult(order, acceptedOffers) {
|
|
|
288
284
|
function createResult(params, options) {
|
|
289
285
|
const transaction = params.transaction;
|
|
290
286
|
const eventReservationAcceptedOffers = [];
|
|
291
|
-
const productAcceptedOffers = [];
|
|
287
|
+
// const productAcceptedOffers: factory.order.IAcceptedOffer<factory.order.IPermit>[] = [];
|
|
292
288
|
// const moneyTransferAcceptedOffers: factory.order.IAcceptedOffer<factory.order.IMoneyTransfer>[] = [];
|
|
293
289
|
params.acceptedOffers.forEach((acceptedOffer) => {
|
|
294
290
|
const itemOfferedTypeOf = acceptedOffer.itemOffered.typeOf;
|
|
@@ -296,19 +292,21 @@ function createResult(params, options) {
|
|
|
296
292
|
case factory_1.factory.reservationType.EventReservation:
|
|
297
293
|
eventReservationAcceptedOffers.push(acceptedOffer);
|
|
298
294
|
break;
|
|
299
|
-
case
|
|
300
|
-
|
|
301
|
-
|
|
295
|
+
// case factory.permit.PermitType.Permit:
|
|
296
|
+
// productAcceptedOffers.push((acceptedOffer as factory.order.IAcceptedOffer<factory.order.IPermit>));
|
|
297
|
+
// break;
|
|
302
298
|
default:
|
|
303
299
|
throw new factory_1.factory.errors.NotImplemented(`${itemOfferedTypeOf} not implemented`);
|
|
304
300
|
}
|
|
305
301
|
});
|
|
306
302
|
// 取引の確定条件が全て整っているかどうか確認
|
|
307
|
-
(0, validation_1.validateTransaction)(transaction, params.acceptPayActions, params.authorizePaymentActions, params.authorizeEventServiceOfferActions,
|
|
303
|
+
(0, validation_1.validateTransaction)(transaction, params.acceptPayActions, params.authorizePaymentActions, params.authorizeEventServiceOfferActions,
|
|
304
|
+
// params.authorizeProductOfferActions,
|
|
305
|
+
eventReservationAcceptedOffers, params.payTransactions, params.customer);
|
|
308
306
|
const { paymentMethods, price } = (0, factory_2.createPaymentMethods)({ authorizePaymentActions: params.authorizePaymentActions });
|
|
309
307
|
const orderedItem = (0, orderedItem_1.acceptedOffers2orderedItem)({
|
|
310
308
|
eventReservationAcceptedOffers,
|
|
311
|
-
productAcceptedOffers,
|
|
309
|
+
// productAcceptedOffers,
|
|
312
310
|
// moneyTransferAcceptedOffers
|
|
313
311
|
});
|
|
314
312
|
// 注文作成
|
|
@@ -348,7 +346,7 @@ function createResult(params, options) {
|
|
|
348
346
|
const authorizeActions = [
|
|
349
347
|
...params.authorizePaymentActions.map(({ id }) => ({ id })),
|
|
350
348
|
...params.authorizeEventServiceOfferActions.map(({ id }) => ({ id })),
|
|
351
|
-
...params.authorizeProductOfferActions.map(({ id }) => ({ id }))
|
|
349
|
+
// ...params.authorizeProductOfferActions.map(({ id }) => ({ id }))
|
|
352
350
|
];
|
|
353
351
|
let eventId;
|
|
354
352
|
let reservationIds;
|
|
@@ -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
|
-
// | factory.task.IAttributes<factory.taskName.VoidRegisterServiceTransaction>;
|
|
10
9
|
/**
|
|
11
10
|
* 取引のタスクを作成する
|
|
12
11
|
*/
|
|
@@ -192,26 +191,6 @@ function createTasks(params, setting
|
|
|
192
191
|
else {
|
|
193
192
|
taskAttributes.push(voidReserveTaskAttributes, voidPaymentTaskAttributes);
|
|
194
193
|
}
|
|
195
|
-
// eslint-disable-next-line no-warning-comments
|
|
196
|
-
// TODO reimplement
|
|
197
|
-
// temporarily discontinue VoidRegisterServiceTransaction VoidMoneyTransferTransaction(2025-02-25~)
|
|
198
|
-
// const voidRegisterServiceTaskAttributes: factory.task.IAttributes<factory.taskName.VoidRegisterServiceTransaction> = {
|
|
199
|
-
// project: transaction.project,
|
|
200
|
-
// name: factory.taskName.VoidRegisterServiceTransaction,
|
|
201
|
-
// status: factory.taskStatus.Ready,
|
|
202
|
-
// runsAt: taskRunsAt,
|
|
203
|
-
// remainingNumberOfTries: 10,
|
|
204
|
-
// numberOfTried: 0,
|
|
205
|
-
// executionResults: [],
|
|
206
|
-
// data: {
|
|
207
|
-
// project: transaction.project,
|
|
208
|
-
// purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
209
|
-
// }
|
|
210
|
-
// };
|
|
211
|
-
// taskAttributes.push(
|
|
212
|
-
// voidRegisterServiceTaskAttributes,
|
|
213
|
-
// voidMoneyTransferTaskAttributes
|
|
214
|
-
// );
|
|
215
194
|
break;
|
|
216
195
|
default:
|
|
217
196
|
throw new factory_1.factory.errors.NotImplemented(`Transaction status "${transaction.status}" not implemented.`);
|
|
@@ -8,7 +8,7 @@ exports.validateOrder = validateOrder;
|
|
|
8
8
|
const moment_1 = __importDefault(require("moment"));
|
|
9
9
|
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
13
|
// const debug = createDebug('chevre-domain:service:validation');
|
|
14
14
|
// type ICreatingCheckEventTask = Pick<
|
|
@@ -104,7 +104,8 @@ function validateOrder(params) {
|
|
|
104
104
|
// 旧メンバーシップ&ペイメントカードを例外として除外(互換性維持対応をしていないため)
|
|
105
105
|
if ((0, moment_1.default)(order.orderDate)
|
|
106
106
|
.isAfter((0, moment_1.default)('2023-09-30T15:00:00Z'))
|
|
107
|
-
|
|
107
|
+
// || typeOf !== factory.permit.PermitType.Permit
|
|
108
|
+
) {
|
|
108
109
|
if (typeof serialNumber !== 'string' || serialNumber.length === 0) {
|
|
109
110
|
throw new Error(`invalid acceptedOffer.serialNumber [${typeof serialNumber}]`);
|
|
110
111
|
}
|
|
@@ -175,14 +176,14 @@ function validateOrder(params) {
|
|
|
175
176
|
}
|
|
176
177
|
break;
|
|
177
178
|
}
|
|
178
|
-
case
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
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
|
+
// }
|
|
186
187
|
// case factory.actionType.MoneyTransfer:
|
|
187
188
|
// break;
|
|
188
189
|
default:
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.600.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.600.0",
|
|
14
|
-
"@chevre/factory": "8.0.0-alpha.
|
|
14
|
+
"@chevre/factory": "8.0.0-alpha.1",
|
|
15
15
|
"@motionpicture/coa-service": "10.0.0",
|
|
16
16
|
"@motionpicture/gmo-service": "6.0.0",
|
|
17
17
|
"@sendgrid/client": "8.1.4",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"postversion": "git push origin --tags",
|
|
92
92
|
"prepublishOnly": "npm run clean && npm run build"
|
|
93
93
|
},
|
|
94
|
-
"version": "24.0.0-alpha.
|
|
94
|
+
"version": "24.0.0-alpha.79"
|
|
95
95
|
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { factory } from '../../factory';
|
|
2
|
-
import { ActionProcessRepo } from './actionProcess';
|
|
3
|
-
export type IAuthorizeProductOfferAction = factory.action.authorize.offer.product.IAction;
|
|
4
|
-
/**
|
|
5
|
-
* プロダクトオファー承認リポジトリ
|
|
6
|
-
*/
|
|
7
|
-
export declare class AuthorizeProductOfferActionRepo extends ActionProcessRepo<IAuthorizeProductOfferAction, never> {
|
|
8
|
-
/**
|
|
9
|
-
* 取引に対するプロダクトオファー承認アクションを検索する
|
|
10
|
-
*/
|
|
11
|
-
findAuthorizeProductOfferActionsByPurpose(params: {
|
|
12
|
-
/**
|
|
13
|
-
* 注文取引でフィルター
|
|
14
|
-
*/
|
|
15
|
-
purpose: {
|
|
16
|
-
typeOf: factory.transactionType;
|
|
17
|
-
id: string;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* アクションステータスでフィルター
|
|
21
|
-
*/
|
|
22
|
-
actionStatus?: {
|
|
23
|
-
$eq?: factory.actionStatusType.CompletedActionStatus;
|
|
24
|
-
};
|
|
25
|
-
}): Promise<IAuthorizeProductOfferAction[]>;
|
|
26
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AuthorizeProductOfferActionRepo = void 0;
|
|
4
|
-
const factory_1 = require("../../factory");
|
|
5
|
-
// import { MONGO_MAX_TIME_MS } from '../settings';
|
|
6
|
-
const availableProductTypes_1 = require("../../factory/availableProductTypes");
|
|
7
|
-
const actionProcess_1 = require("./actionProcess");
|
|
8
|
-
/**
|
|
9
|
-
* プロダクトオファー承認リポジトリ
|
|
10
|
-
*/
|
|
11
|
-
class AuthorizeProductOfferActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
12
|
-
/**
|
|
13
|
-
* 取引に対するプロダクトオファー承認アクションを検索する
|
|
14
|
-
*/
|
|
15
|
-
async findAuthorizeProductOfferActionsByPurpose(params) {
|
|
16
|
-
const authorizeActions = await this.findAnyActionsByPurpose({
|
|
17
|
-
...params,
|
|
18
|
-
typeOf: factory_1.factory.actionType.AuthorizeAction,
|
|
19
|
-
object: {
|
|
20
|
-
typeOf: { $eq: factory_1.factory.action.authorize.offer.eventService.ObjectType.AggregateOffer }
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
return authorizeActions.filter((a) =>
|
|
24
|
-
// Array.isArray(a.object)
|
|
25
|
-
// && a.object.length > 0
|
|
26
|
-
// // && a.object[0].typeOf === factory.offerType.Offer
|
|
27
|
-
// && availableProductTypes.indexOf(a.object[0].itemOffered.typeOf) >= 0
|
|
28
|
-
a.object.typeOf === factory_1.factory.action.authorize.offer.product.ObjectType.AggregateOffer
|
|
29
|
-
&& availableProductTypes_1.availableProductTypes.indexOf(a.object.itemOffered.typeOf) >= 0);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.AuthorizeProductOfferActionRepo = AuthorizeProductOfferActionRepo;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { factory } from '../../../factory';
|
|
2
|
-
export type IUnitPriceSpecification = factory.priceSpecification.IPriceSpecification<factory.priceSpecificationType.UnitPriceSpecification>;
|
|
3
|
-
/**
|
|
4
|
-
* サービスアウトプットを作成する
|
|
5
|
-
*/
|
|
6
|
-
export declare function createServiceOutput(params: {
|
|
7
|
-
dateIssued: Date;
|
|
8
|
-
product: Pick<factory.product.IProduct, 'id' | 'typeOf' | 'project' | 'serviceOutput' | 'serviceType'> & {
|
|
9
|
-
id: string;
|
|
10
|
-
};
|
|
11
|
-
acceptedOffer: factory.assetTransaction.registerService.IAcceptedOfferWithoutDetail;
|
|
12
|
-
offer: factory.product.ITicketOffer;
|
|
13
|
-
transactionNumber: string;
|
|
14
|
-
}): factory.assetTransaction.registerService.IServiceOutput;
|