@chevre/domain 24.0.0-alpha.32 → 24.0.0-alpha.34
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/factory/transaction.d.ts +0 -3
- package/lib/chevre/repo/action/actionProcess.d.ts +1 -1
- package/lib/chevre/repo/action/authorizeOffer.d.ts +16 -1
- package/lib/chevre/repo/action/authorizeOffer.js +21 -2
- package/lib/chevre/repo/action/authorizePaymentMethod.d.ts +12 -0
- package/lib/chevre/repo/action/authorizePaymentMethod.js +14 -0
- package/lib/chevre/repo/action/authorizeTicketedObject.d.ts +8 -0
- package/lib/chevre/repo/action/authorizeTicketedObject.js +11 -0
- package/lib/chevre/repo/action.d.ts +2 -2
- package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +1 -2
- package/lib/chevre/repo/passport.d.ts +1 -1
- package/lib/chevre/repo/task.d.ts +1 -1
- package/lib/chevre/repo/transaction.d.ts +1 -39
- package/lib/chevre/repository.d.ts +5 -10
- package/lib/chevre/repository.js +11 -22
- package/lib/chevre/service/delivery/factory.js +4 -4
- package/lib/chevre/service/offer/any.d.ts +1 -1
- package/lib/chevre/service/offer/event/issueEventOfferTicket.d.ts +16 -14
- package/lib/chevre/service/offer/event/issueEventOfferTicket.js +3 -3
- package/lib/chevre/service/offer.d.ts +1 -2
- package/lib/chevre/service/offer.js +1 -3
- 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 +54 -36
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +78 -64
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.d.ts +5 -2
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +40 -25
- package/lib/chevre/service/order/placeOrder/factory/orderedItem.d.ts +0 -1
- package/lib/chevre/service/order/placeOrder/factory/orderedItem.js +3 -8
- package/lib/chevre/service/order/placeOrder/factory.js +5 -5
- package/lib/chevre/service/order/placeOrder.d.ts +4 -0
- package/lib/chevre/service/order/placeOrder.js +6 -1
- package/lib/chevre/service/task/deletePerson.js +0 -1
- package/lib/chevre/service/task/deleteTransaction.js +0 -2
- package/lib/chevre/service/task/placeOrder.js +4 -0
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +0 -2
- package/lib/chevre/service/transaction/deleteTransaction.js +2 -47
- 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 -3
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +3 -3
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +2 -2
- package/lib/chevre/service/transaction/placeOrder/confirm.js +12 -17
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +1 -15
- package/lib/chevre/service/transaction.d.ts +0 -4
- package/lib/chevre/service/transaction.js +1 -11
- package/lib/chevre/service/validation/validateOrder.js +2 -2
- package/package.json +3 -3
- package/lib/chevre/repo/action/authorizeMoneyTransferOffer.d.ts +0 -40
- package/lib/chevre/repo/action/authorizeMoneyTransferOffer.js +0 -61
- package/lib/chevre/repo/transaction/moneyTransfer.d.ts +0 -61
- package/lib/chevre/repo/transaction/moneyTransfer.js +0 -379
- package/lib/chevre/service/offer/moneyTransfer/authorize.d.ts +0 -38
- package/lib/chevre/service/offer/moneyTransfer/authorize.js +0 -250
- package/lib/chevre/service/offer/moneyTransfer/returnMoneyTransfer.d.ts +0 -16
- package/lib/chevre/service/offer/moneyTransfer/returnMoneyTransfer.js +0 -96
- package/lib/chevre/service/offer/moneyTransfer/settleTransaction.d.ts +0 -9
- package/lib/chevre/service/offer/moneyTransfer/settleTransaction.js +0 -91
- package/lib/chevre/service/offer/moneyTransfer/voidTransaction.d.ts +0 -10
- package/lib/chevre/service/offer/moneyTransfer/voidTransaction.js +0 -81
- package/lib/chevre/service/offer/moneyTransfer.d.ts +0 -5
- package/lib/chevre/service/offer/moneyTransfer.js +0 -11
- package/lib/chevre/service/task/confirmMoneyTransfer.d.ts +0 -6
- package/lib/chevre/service/task/confirmMoneyTransfer.js +0 -19
- package/lib/chevre/service/task/returnMoneyTransfer.d.ts +0 -6
- package/lib/chevre/service/task/returnMoneyTransfer.js +0 -55
- package/lib/chevre/service/task/voidMoneyTransferTransaction.d.ts +0 -6
- package/lib/chevre/service/task/voidMoneyTransferTransaction.js +0 -27
- package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.d.ts +0 -9
- package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.js +0 -138
- package/lib/chevre/service/transaction/moneyTransfer/factory.d.ts +0 -2
- package/lib/chevre/service/transaction/moneyTransfer/factory.js +0 -55
- package/lib/chevre/service/transaction/moneyTransfer/potentialActions.d.ts +0 -9
- package/lib/chevre/service/transaction/moneyTransfer/potentialActions.js +0 -65
- package/lib/chevre/service/transaction/moneyTransfer.d.ts +0 -72
- package/lib/chevre/service/transaction/moneyTransfer.js +0 -649
|
@@ -50,10 +50,10 @@ function processOrder(params) {
|
|
|
50
50
|
// priceCurrency: params.order.priceCurrency,
|
|
51
51
|
orderDate: params.order.orderDate
|
|
52
52
|
};
|
|
53
|
-
if (params.order.itemOfferedTypeOf === factory.actionType.MoneyTransfer) {
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
53
|
+
// if (params.order.itemOfferedTypeOf === factory.actionType.MoneyTransfer) {
|
|
54
|
+
// await createConfirmMoneyTransferTasksIfNotExist(params.order, simpleOrder)(repos);
|
|
55
|
+
// } else
|
|
56
|
+
if (params.order.itemOfferedTypeOf === factory.reservationType.EventReservation) {
|
|
57
57
|
// 冗長なconfirmReserveTransactionタスク作成を回避(2023-08-25~)
|
|
58
58
|
await createConfirmReserveTransactionTasksIfNotExist(params.order, simpleOrder, params.options)(repos);
|
|
59
59
|
}
|
|
@@ -114,38 +114,56 @@ function createConfirmReserveTransactionTasksIfNotExist(order, simpleOrder, opti
|
|
|
114
114
|
}));
|
|
115
115
|
};
|
|
116
116
|
}
|
|
117
|
-
function createConfirmMoneyTransferTasksIfNotExist(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
117
|
+
// function createConfirmMoneyTransferTasksIfNotExist(
|
|
118
|
+
// order: Pick<IProcessingOrder, 'orderNumber' | 'project'> & {
|
|
119
|
+
// serialNumbers: string[];
|
|
120
|
+
// },
|
|
121
|
+
// simpleOrder: factory.order.ISimpleOrder
|
|
122
|
+
// ) {
|
|
123
|
+
// return async (repos: {
|
|
124
|
+
// task: TaskRepo;
|
|
125
|
+
// }): Promise<void> => {
|
|
126
|
+
// const taskRunsAt = new Date();
|
|
127
|
+
// await Promise.all(order.serialNumbers.map(async (moneyTransferTransactionNumber) => {
|
|
128
|
+
// const data: factory.task.IData<factory.taskName.ConfirmMoneyTransfer> = {
|
|
129
|
+
// project: order.project,
|
|
130
|
+
// typeOf: factory.actionType.ConfirmAction,
|
|
131
|
+
// object: {
|
|
132
|
+
// // pendingTransaction: { id: '' }, // 空文字であれば、transactionNumberで処理される
|
|
133
|
+
// transactionNumber: moneyTransferTransactionNumber,
|
|
134
|
+
// typeOf: factory.assetTransactionType.MoneyTransfer
|
|
135
|
+
// },
|
|
136
|
+
// agent: order.project,
|
|
137
|
+
// purpose: simpleOrder
|
|
138
|
+
// };
|
|
139
|
+
// const taskIdentifier: string = util.format(
|
|
140
|
+
// '%s:%s:%s:%s:%s:%s',
|
|
141
|
+
// data.project.id,
|
|
142
|
+
// factory.taskName.ConfirmMoneyTransfer,
|
|
143
|
+
// data.purpose.typeOf,
|
|
144
|
+
// simpleOrder.orderNumber,
|
|
145
|
+
// data.object.typeOf,
|
|
146
|
+
// data.object.transactionNumber
|
|
147
|
+
// );
|
|
148
|
+
// const confirmMoneyTransferTransactionTask: factory.task.IAttributes<factory.taskName.ConfirmMoneyTransfer> & {
|
|
149
|
+
// alternateName: string;
|
|
150
|
+
// identifier: string;
|
|
151
|
+
// } = {
|
|
152
|
+
// alternateName: taskIdentifier,
|
|
153
|
+
// identifier: taskIdentifier,
|
|
154
|
+
// project: order.project,
|
|
155
|
+
// name: factory.taskName.ConfirmMoneyTransfer,
|
|
156
|
+
// status: factory.taskStatus.Ready,
|
|
157
|
+
// runsAt: taskRunsAt,
|
|
158
|
+
// remainingNumberOfTries: 10,
|
|
159
|
+
// numberOfTried: 0,
|
|
160
|
+
// executionResults: [],
|
|
161
|
+
// data
|
|
162
|
+
// };
|
|
163
|
+
// await repos.task.createIfNotExistByAlternateName(confirmMoneyTransferTransactionTask, { emitImmediately: true });
|
|
164
|
+
// }));
|
|
165
|
+
// };
|
|
166
|
+
// }
|
|
149
167
|
function createConfirmRegisterServiceTasksIfNotExist(order, simpleOrder) {
|
|
150
168
|
return async (repos) => {
|
|
151
169
|
const taskRunsAt = new Date();
|
|
@@ -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/task").IAttributes | import("@chevre/factory/lib/task/
|
|
14
|
+
}): (import("@chevre/factory/lib/task").IAttributes | import("@chevre/factory/lib/task/confirmRegisterService").IAttributes | import("@chevre/factory/lib/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/task/createAccountingReport").IAttributes | import("@chevre/factory/lib/task/deletePerson").IAttributes | import("@chevre/factory/lib/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/task/givePointAward").IAttributes | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/task/onEventChanged").IAttributes | import("@chevre/factory/lib/task/onResourceDeleted").IAttributes | import("@chevre/factory/lib/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/task/placeOrder").IAttributes | import("@chevre/factory/lib/task/returnOrder").IAttributes | import("@chevre/factory/lib/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/task/returnPointAward").IAttributes | import("@chevre/factory/lib/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/task/sendOrder").IAttributes | import("@chevre/factory/lib/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/task/useReservation").IAttributes | import("@chevre/factory/lib/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/voidReserveTransaction").IAttributes)[];
|
|
15
15
|
export { createInformTasks, createOnOrderReturnedTasksByTransaction, IReturnAction };
|
|
@@ -63,8 +63,14 @@ function onOrderReturned(params) {
|
|
|
63
63
|
const potentialActionsByTransaction = params.returnOrderTransaction?.potentialActions?.returnOrder?.find((returnOrderActionByTransaction) => {
|
|
64
64
|
return returnOrderActionByTransaction.object.orderNumber === params.order.orderNumber;
|
|
65
65
|
})?.potentialActions;
|
|
66
|
-
const itemOfferedTypeOfs = await repos.acceptedOffer.distinctValues(
|
|
67
|
-
|
|
66
|
+
// const itemOfferedTypeOfs = <factory.order.IItemOffered['typeOf'][]>await repos.acceptedOffer.distinctValues(
|
|
67
|
+
// { orderNumber: { $in: [params.order.orderNumber] } },
|
|
68
|
+
// 'acceptedOffers.itemOffered.typeOf'
|
|
69
|
+
// );
|
|
70
|
+
// const serialNumbers = await repos.acceptedOffer.distinctValues(
|
|
71
|
+
// { orderNumber: { $in: [params.order.orderNumber] } },
|
|
72
|
+
// 'acceptedOffers.serialNumber'
|
|
73
|
+
// );
|
|
68
74
|
const reservationNumbers = await repos.acceptedOffer.distinctValues({ orderNumber: { $in: [params.order.orderNumber] } }, 'acceptedOffers.itemOffered.reservationNumber');
|
|
69
75
|
const offeredThroughIdentifier = (await repos.acceptedOffer.distinctValues({ orderNumber: { $in: [params.order.orderNumber] } }, 'acceptedOffers.offeredThrough.identifier'))[0];
|
|
70
76
|
const reservationForSuperEventLocationBranchCodes = await repos.acceptedOffer.distinctValues({ orderNumber: { $in: [params.order.orderNumber] } }, 'acceptedOffers.itemOffered.reservationFor.superEvent.location.branchCode');
|
|
@@ -80,12 +86,15 @@ function onOrderReturned(params) {
|
|
|
80
86
|
...createReturnPayTransactionTasks({ orderNumber: params.order.orderNumber, project: params.order.project }, params.returnOrderTransaction),
|
|
81
87
|
// 取引のpotentialActionsを適用(2023-08-19~)
|
|
82
88
|
...(0, factory_1.createOnOrderReturnedTasksByTransaction)({ order: params.order, potentialActions: potentialActionsByTransaction }),
|
|
83
|
-
...(itemOfferedTypeOfs[0] === factory.actionType.MoneyTransfer)
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
+
// ...(itemOfferedTypeOfs[0] === factory.actionType.MoneyTransfer)
|
|
90
|
+
// ? createReturnMoneyTransferTasks(
|
|
91
|
+
// {
|
|
92
|
+
// ...params.order,
|
|
93
|
+
// serialNumbers
|
|
94
|
+
// },
|
|
95
|
+
// simpleOrder
|
|
96
|
+
// )
|
|
97
|
+
// : []
|
|
89
98
|
];
|
|
90
99
|
break;
|
|
91
100
|
default:
|
|
@@ -169,62 +178,67 @@ function createReturnReserveTransactionTasks(order, simpleOrder) {
|
|
|
169
178
|
}
|
|
170
179
|
return tasks;
|
|
171
180
|
}
|
|
172
|
-
function createReturnMoneyTransferTasks(
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
181
|
+
// function createReturnMoneyTransferTasks(
|
|
182
|
+
// order: Pick<factory.order.IOrder, 'seller' | 'customer' | 'project' | 'orderDate'> & {
|
|
183
|
+
// serialNumbers: string[];
|
|
184
|
+
// },
|
|
185
|
+
// simpleOrder: factory.order.ISimpleOrder
|
|
186
|
+
// ): factory.task.IAttributes<factory.taskName.ReturnMoneyTransfer>[] {
|
|
187
|
+
// const taskRunsAt = new Date();
|
|
188
|
+
// const tasks: factory.task.IAttributes<factory.taskName.ReturnMoneyTransfer>[] = [];
|
|
189
|
+
// for (const transactionNumber of order.serialNumbers) {
|
|
190
|
+
// const returnMoneyTransferActionObject: factory.action.transfer.returnAction.moneyTransfer.IObject = {
|
|
191
|
+
// // project: order.project,
|
|
192
|
+
// typeOf: factory.actionType.MoneyTransfer,
|
|
193
|
+
// // actionStatus: factory.actionStatusType.CompletedActionStatus,
|
|
194
|
+
// // startDate: order.orderDate,
|
|
195
|
+
// // id: '',
|
|
196
|
+
// // amount: {
|
|
197
|
+
// // typeOf: 'MonetaryAmount',
|
|
198
|
+
// // currency: '' // この時点で不明でも動作する
|
|
199
|
+
// // },
|
|
200
|
+
// object: {
|
|
201
|
+
// typeOf: factory.account.transactionType.Deposit,
|
|
202
|
+
// // いったんtransactionNumberさえあれば返却可能
|
|
203
|
+
// transactionNumber
|
|
204
|
+
// }
|
|
205
|
+
// // agent: order.project,
|
|
206
|
+
// // recipient: {
|
|
207
|
+
// // typeOf: order.customer.typeOf,
|
|
208
|
+
// // id: order.customer.id,
|
|
209
|
+
// // name: String(order.customer.name)
|
|
210
|
+
// // },
|
|
211
|
+
// // fromLocation: <any>{},
|
|
212
|
+
// // toLocation: <any>{},
|
|
213
|
+
// // purpose: <any>{}
|
|
214
|
+
// };
|
|
215
|
+
// const returnMoneyTransferAction: factory.task.IData<factory.taskName.ReturnMoneyTransfer> = {
|
|
216
|
+
// project: order.project,
|
|
217
|
+
// typeOf: factory.actionType.ReturnAction,
|
|
218
|
+
// object: returnMoneyTransferActionObject,
|
|
219
|
+
// agent: order.project,
|
|
220
|
+
// recipient: {
|
|
221
|
+
// typeOf: order.seller.typeOf,
|
|
222
|
+
// id: order.seller.id,
|
|
223
|
+
// name: order.seller.name
|
|
224
|
+
// },
|
|
225
|
+
// potentialActions: {},
|
|
226
|
+
// purpose: simpleOrder,
|
|
227
|
+
// instrument: { typeOf: 'WebAPI', identifier: factory.service.webAPI.Identifier.Chevre }
|
|
228
|
+
// };
|
|
229
|
+
// tasks.push({
|
|
230
|
+
// project: order.project,
|
|
231
|
+
// name: factory.taskName.ReturnMoneyTransfer,
|
|
232
|
+
// status: factory.taskStatus.Ready,
|
|
233
|
+
// runsAt: taskRunsAt, // なるはやで実行
|
|
234
|
+
// remainingNumberOfTries: 10,
|
|
235
|
+
// numberOfTried: 0,
|
|
236
|
+
// executionResults: [],
|
|
237
|
+
// data: returnMoneyTransferAction
|
|
238
|
+
// });
|
|
239
|
+
// }
|
|
240
|
+
// return tasks;
|
|
241
|
+
// }
|
|
228
242
|
function createReturnPayTransactionTasks(order, returnOrderTransaction) {
|
|
229
243
|
const taskRunsAt = new Date();
|
|
230
244
|
// const taskRunsAt = moment(order.dateReturned)
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AuthorizeOfferActionRepo } from '../../../repo/action/authorizeOffer';
|
|
2
|
+
import type { AuthorizePaymentMethodActionRepo } from '../../../repo/action/authorizePaymentMethod';
|
|
2
3
|
import type { IPlacingOrder, OrderInTransactionRepo } from '../../../repo/orderInTransaction';
|
|
3
4
|
import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
4
5
|
import * as factory from '../../../factory';
|
|
5
6
|
type IPlaceOrderTransaction = Pick<factory.transaction.placeOrder.ITransaction, 'id' | 'project' | 'typeOf' | 'result' | 'object' | 'seller'>;
|
|
6
7
|
interface ICreatePlacingOrderFromExistingTransactionRepos {
|
|
7
|
-
action
|
|
8
|
+
action?: never;
|
|
9
|
+
authorizeOfferAction: AuthorizeOfferActionRepo;
|
|
10
|
+
authorizePaymentMethodAction: AuthorizePaymentMethodActionRepo;
|
|
8
11
|
orderInTransaction: OrderInTransactionRepo;
|
|
9
12
|
placeOrder: PlaceOrderRepo;
|
|
10
13
|
}
|
|
@@ -54,31 +54,46 @@ function createPlacingOrderFromExistingTransaction(params) {
|
|
|
54
54
|
if (Array.isArray(authorizeActionsAsResult) && authorizeActionsAsResult.length > 0) {
|
|
55
55
|
const completedAuthorizeActionIds = authorizeActionsAsResult.map(({ id }) => id);
|
|
56
56
|
if (completedAuthorizeActionIds.length > 0) {
|
|
57
|
-
authorizePaymentActions =
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
57
|
+
// authorizePaymentActions = <Pick<factory.action.authorize.paymentMethod.any.IAction, 'result'>[]>
|
|
58
|
+
// await repos.action.search<factory.actionType.AuthorizeAction>(
|
|
59
|
+
// {
|
|
60
|
+
// typeOf: factory.actionType.AuthorizeAction,
|
|
61
|
+
// purpose: {
|
|
62
|
+
// typeOf: { $in: [factory.transactionType.PlaceOrder] },
|
|
63
|
+
// id: { $in: [placeOrderTransactionWithResult.id] }
|
|
64
|
+
// },
|
|
65
|
+
// object: { typeOf: { $eq: factory.action.authorize.paymentMethod.any.ResultType.Payment } },
|
|
66
|
+
// id: { $in: completedAuthorizeActionIds }
|
|
67
|
+
// },
|
|
68
|
+
// ['result']
|
|
69
|
+
// );
|
|
70
|
+
authorizePaymentActions = await repos.authorizePaymentMethodAction.findAuthorizePaymentMethodResultsById({
|
|
71
|
+
purpose: { id: placeOrderTransactionWithResult.id },
|
|
72
|
+
ids: completedAuthorizeActionIds
|
|
73
|
+
});
|
|
74
|
+
// authorizeOfferActionsWithInstrument = <IAuthorizeActionWithInstrument[]>await repos.action.search<factory.actionType.AuthorizeAction>(
|
|
75
|
+
// {
|
|
76
|
+
// typeOf: factory.actionType.AuthorizeAction,
|
|
77
|
+
// purpose: {
|
|
78
|
+
// typeOf: { $in: [factory.transactionType.PlaceOrder] },
|
|
79
|
+
// id: { $in: [placeOrderTransactionWithResult.id] }
|
|
80
|
+
// },
|
|
81
|
+
// object: {
|
|
82
|
+
// typeOf: {
|
|
83
|
+
// $in: [
|
|
84
|
+
// factory.action.authorize.offer.eventService.ObjectType.SeatReservation,
|
|
85
|
+
// factory.offerType.Offer
|
|
86
|
+
// ]
|
|
87
|
+
// }
|
|
88
|
+
// },
|
|
89
|
+
// id: { $in: completedAuthorizeActionIds }
|
|
90
|
+
// },
|
|
91
|
+
// ['instrument']
|
|
92
|
+
// );
|
|
93
|
+
authorizeOfferActionsWithInstrument = await repos.authorizeOfferAction.findAuthorizeOfferInstrumentsByIds({
|
|
94
|
+
purpose: { id: placeOrderTransactionWithResult.id },
|
|
95
|
+
ids: completedAuthorizeActionIds
|
|
96
|
+
});
|
|
82
97
|
}
|
|
83
98
|
}
|
|
84
99
|
// orderedItem生成のためにacceptedOffersを取得
|
|
@@ -5,6 +5,5 @@ import * as factory from '../../../../factory';
|
|
|
5
5
|
declare function acceptedOffers2orderedItem(params: {
|
|
6
6
|
eventReservationAcceptedOffers: factory.order.IAcceptedOffer<factory.order.IReservation>[];
|
|
7
7
|
productAcceptedOffers: factory.order.IAcceptedOffer<factory.order.IPermit>[];
|
|
8
|
-
moneyTransferAcceptedOffers: factory.order.IAcceptedOffer<factory.order.IMoneyTransfer>[];
|
|
9
8
|
}): factory.order.IOrderedItem[];
|
|
10
9
|
export { acceptedOffers2orderedItem };
|
|
@@ -32,10 +32,11 @@ function acceptedOffers2orderedItem(params) {
|
|
|
32
32
|
// 予約がある場合
|
|
33
33
|
const { reservationOrderItems } = createReservationAcceptedOffers(params);
|
|
34
34
|
// 通貨転送がある場合
|
|
35
|
-
const { moneyTransferOrderItems } = createMoneyTransferAcceptedOffers(params);
|
|
35
|
+
// const { moneyTransferOrderItems } = createMoneyTransferAcceptedOffers(params);
|
|
36
36
|
// プロダクトがある場合
|
|
37
37
|
const { productOrderItems } = createProductItems(params);
|
|
38
|
-
return [...reservationOrderItems, ...moneyTransferOrderItems, ...productOrderItems];
|
|
38
|
+
// return [...reservationOrderItems, ...moneyTransferOrderItems, ...productOrderItems];
|
|
39
|
+
return [...reservationOrderItems, ...productOrderItems];
|
|
39
40
|
}
|
|
40
41
|
function createReservationAcceptedOffers(params) {
|
|
41
42
|
const orderedItems = [];
|
|
@@ -118,9 +119,3 @@ function createProductItems(params) {
|
|
|
118
119
|
productOrderItems: orderedItems
|
|
119
120
|
};
|
|
120
121
|
}
|
|
121
|
-
function createMoneyTransferAcceptedOffers(__) {
|
|
122
|
-
const orderedItems = [];
|
|
123
|
-
return {
|
|
124
|
-
moneyTransferOrderItems: orderedItems
|
|
125
|
-
};
|
|
126
|
-
}
|
|
@@ -106,7 +106,7 @@ function createPlacingOrder(params) {
|
|
|
106
106
|
const { paymentMethods, price } = createPaymentMethods({ authorizePaymentActions });
|
|
107
107
|
const eventReservationAcceptedOffers = [];
|
|
108
108
|
const productAcceptedOffers = [];
|
|
109
|
-
const moneyTransferAcceptedOffers = [];
|
|
109
|
+
// const moneyTransferAcceptedOffers: factory.order.IAcceptedOffer<factory.order.IMoneyTransfer>[] = [];
|
|
110
110
|
params.acceptedOffers.forEach((acceptedOffer) => {
|
|
111
111
|
const itemOfferedTypeOf = acceptedOffer.itemOffered.typeOf;
|
|
112
112
|
switch (itemOfferedTypeOf) {
|
|
@@ -116,9 +116,9 @@ function createPlacingOrder(params) {
|
|
|
116
116
|
case factory.permit.PermitType.Permit:
|
|
117
117
|
productAcceptedOffers.push(acceptedOffer);
|
|
118
118
|
break;
|
|
119
|
-
case factory.actionType.MoneyTransfer:
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
// case factory.actionType.MoneyTransfer:
|
|
120
|
+
// moneyTransferAcceptedOffers.push(<factory.order.IAcceptedOffer<factory.order.IMoneyTransfer>>acceptedOffer);
|
|
121
|
+
// break;
|
|
122
122
|
default:
|
|
123
123
|
throw new factory.errors.NotImplemented(`${itemOfferedTypeOf} not implemented`);
|
|
124
124
|
}
|
|
@@ -126,7 +126,7 @@ function createPlacingOrder(params) {
|
|
|
126
126
|
const orderedItem = (0, orderedItem_1.acceptedOffers2orderedItem)({
|
|
127
127
|
eventReservationAcceptedOffers,
|
|
128
128
|
productAcceptedOffers,
|
|
129
|
-
moneyTransferAcceptedOffers
|
|
129
|
+
// moneyTransferAcceptedOffers
|
|
130
130
|
});
|
|
131
131
|
return {
|
|
132
132
|
...orderByTransaction,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { AcceptedOfferRepo } from '../../repo/acceptedOffer';
|
|
2
2
|
import type { AccountingReportRepo } from '../../repo/accountingReport';
|
|
3
3
|
import type { ActionRepo } from '../../repo/action';
|
|
4
|
+
import type { AuthorizeOfferActionRepo } from '../../repo/action/authorizeOffer';
|
|
5
|
+
import type { AuthorizePaymentMethodActionRepo } from '../../repo/action/authorizePaymentMethod';
|
|
4
6
|
import type { OrderRepo } from '../../repo/order';
|
|
5
7
|
import type { OrderInTransactionRepo } from '../../repo/orderInTransaction';
|
|
6
8
|
import type { SettingRepo } from '../../repo/setting';
|
|
@@ -12,6 +14,8 @@ interface IPlaceOrderRepos {
|
|
|
12
14
|
acceptedOffer: AcceptedOfferRepo;
|
|
13
15
|
accountingReport: AccountingReportRepo;
|
|
14
16
|
action: ActionRepo;
|
|
17
|
+
authorizeOfferAction: AuthorizeOfferActionRepo;
|
|
18
|
+
authorizePaymentMethodAction: AuthorizePaymentMethodActionRepo;
|
|
15
19
|
order: OrderRepo;
|
|
16
20
|
orderInTransaction: OrderInTransactionRepo;
|
|
17
21
|
setting: SettingRepo;
|
|
@@ -42,7 +42,12 @@ function placeOrder(params) {
|
|
|
42
42
|
project: { id: params.project.id },
|
|
43
43
|
confirmationNumber: params.object.confirmationNumber,
|
|
44
44
|
orderNumber: params.object.orderNumber
|
|
45
|
-
})(
|
|
45
|
+
})({
|
|
46
|
+
authorizeOfferAction: repos.authorizeOfferAction,
|
|
47
|
+
authorizePaymentMethodAction: repos.authorizePaymentMethodAction,
|
|
48
|
+
orderInTransaction: repos.orderInTransaction,
|
|
49
|
+
placeOrder: repos.placeOrder,
|
|
50
|
+
});
|
|
46
51
|
// USE_ORDER_PAYMENT_DUE_ON_PLACED設定を廃止したので、必ずOrderPaymentDueのはず(2024-01-10~)
|
|
47
52
|
if (order.orderStatus !== factory.orderStatus.OrderPaymentDue) {
|
|
48
53
|
throw new factory.errors.Internal(`orderStatus must be ${factory.orderStatus.OrderPaymentDue}`);
|
|
@@ -389,7 +389,6 @@ function getCreditCardPaymentServiceChannel(params) {
|
|
|
389
389
|
function createDeleteTransactionTask(params) {
|
|
390
390
|
return async (repos) => {
|
|
391
391
|
const deleteTransactionTasks = [
|
|
392
|
-
factory.transactionType.MoneyTransfer,
|
|
393
392
|
factory.transactionType.PlaceOrder,
|
|
394
393
|
factory.transactionType.ReturnOrder
|
|
395
394
|
].map((transactionType) => {
|
|
@@ -39,7 +39,6 @@ const task_1 = require("../../repo/task");
|
|
|
39
39
|
const transaction_1 = require("../../repo/transaction");
|
|
40
40
|
const placeOrder_1 = require("../../repo/transaction/placeOrder");
|
|
41
41
|
const returnOrder_1 = require("../../repo/transaction/returnOrder");
|
|
42
|
-
const moneyTransfer_1 = require("../../repo/transaction/moneyTransfer");
|
|
43
42
|
const TransactionService = __importStar(require("../transaction"));
|
|
44
43
|
/**
|
|
45
44
|
* タスク実行関数
|
|
@@ -62,7 +61,6 @@ function call(data) {
|
|
|
62
61
|
transaction: new transaction_1.TransactionRepo(connection),
|
|
63
62
|
placeOrder: new placeOrder_1.PlaceOrderRepo(connection),
|
|
64
63
|
returnOrder: new returnOrder_1.ReturnOrderRepo(connection),
|
|
65
|
-
moneyTransfer: new moneyTransfer_1.MoneyTransferRepo(connection),
|
|
66
64
|
});
|
|
67
65
|
};
|
|
68
66
|
}
|
|
@@ -4,6 +4,8 @@ exports.call = call;
|
|
|
4
4
|
const acceptedOffer_1 = require("../../repo/acceptedOffer");
|
|
5
5
|
const accountingReport_1 = require("../../repo/accountingReport");
|
|
6
6
|
const action_1 = require("../../repo/action");
|
|
7
|
+
const authorizeOffer_1 = require("../../repo/action/authorizeOffer");
|
|
8
|
+
const authorizePaymentMethod_1 = require("../../repo/action/authorizePaymentMethod");
|
|
7
9
|
const order_1 = require("../../repo/order");
|
|
8
10
|
const orderInTransaction_1 = require("../../repo/orderInTransaction");
|
|
9
11
|
const setting_1 = require("../../repo/setting");
|
|
@@ -23,6 +25,8 @@ function call(data) {
|
|
|
23
25
|
acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
|
|
24
26
|
accountingReport: new accountingReport_1.AccountingReportRepo(connection),
|
|
25
27
|
action: new action_1.ActionRepo(connection),
|
|
28
|
+
authorizeOfferAction: new authorizeOffer_1.AuthorizeOfferActionRepo(connection),
|
|
29
|
+
authorizePaymentMethodAction: new authorizePaymentMethod_1.AuthorizePaymentMethodActionRepo(connection),
|
|
26
30
|
order: new order_1.OrderRepo(connection),
|
|
27
31
|
orderInTransaction: new orderInTransaction_1.OrderInTransactionRepo(connection),
|
|
28
32
|
setting: new setting_1.SettingRepo(connection),
|
|
@@ -14,7 +14,6 @@ import type { TaskRepo } from '../../repo/task';
|
|
|
14
14
|
import type { TransactionRepo } from '../../repo/transaction';
|
|
15
15
|
import type { PlaceOrderRepo } from '../../repo/transaction/placeOrder';
|
|
16
16
|
import type { ReturnOrderRepo } from '../../repo/transaction/returnOrder';
|
|
17
|
-
import type { MoneyTransferRepo } from '../../repo/transaction/moneyTransfer';
|
|
18
17
|
/**
|
|
19
18
|
* 取引に関わるリソースを削除する
|
|
20
19
|
* 冪等性を確保すること
|
|
@@ -35,5 +34,4 @@ export declare function deleteTransaction(params: factory.task.IData<factory.tas
|
|
|
35
34
|
transaction: TransactionRepo;
|
|
36
35
|
placeOrder: PlaceOrderRepo;
|
|
37
36
|
returnOrder: ReturnOrderRepo;
|
|
38
|
-
moneyTransfer: MoneyTransferRepo;
|
|
39
37
|
}) => Promise<void>;
|
|
@@ -74,15 +74,7 @@ function createDeleteTransactionTasksByAgentId(params) {
|
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
else {
|
|
77
|
-
|
|
78
|
-
project: { id: { $eq: params.object.project.id } },
|
|
79
|
-
agent: {
|
|
80
|
-
ids: [agentIdSpecified],
|
|
81
|
-
typeOf: factory.personType.Person
|
|
82
|
-
},
|
|
83
|
-
typeOf: transactionTypeOf,
|
|
84
|
-
inclusion: ['typeOf', 'startDate', 'endDate', 'object', 'project']
|
|
85
|
-
});
|
|
77
|
+
throw new factory.errors.NotImplemented(`${transactionTypeOf} not implemented`);
|
|
86
78
|
}
|
|
87
79
|
const deleteAt = new Date();
|
|
88
80
|
let deleteTransactionTasks;
|
|
@@ -144,34 +136,6 @@ function createDeleteTransactionTasksByAgentId(params) {
|
|
|
144
136
|
};
|
|
145
137
|
});
|
|
146
138
|
break;
|
|
147
|
-
case factory.transactionType.MoneyTransfer:
|
|
148
|
-
deleteTransactionTasks = transactions.map((transaction) => {
|
|
149
|
-
return {
|
|
150
|
-
project: transaction.project,
|
|
151
|
-
name: factory.taskName.DeleteTransaction,
|
|
152
|
-
status: factory.taskStatus.Ready,
|
|
153
|
-
runsAt: deleteAt,
|
|
154
|
-
remainingNumberOfTries: 3,
|
|
155
|
-
numberOfTried: 0,
|
|
156
|
-
executionResults: [],
|
|
157
|
-
data: {
|
|
158
|
-
object: {
|
|
159
|
-
specifyingMethod: factory.action.update.deleteAction.ObjectAsTransactionSpecifyingMethod.Id,
|
|
160
|
-
id: transaction.id,
|
|
161
|
-
object: {
|
|
162
|
-
...(transaction.object.pendingTransaction !== undefined)
|
|
163
|
-
? { pendingTransaction: transaction.object.pendingTransaction }
|
|
164
|
-
: undefined
|
|
165
|
-
},
|
|
166
|
-
project: transaction.project,
|
|
167
|
-
startDate: transaction.startDate,
|
|
168
|
-
typeOf: transaction.typeOf,
|
|
169
|
-
...(transaction.endDate !== undefined) ? { endDate: transaction.endDate } : undefined
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
});
|
|
174
|
-
break;
|
|
175
139
|
default:
|
|
176
140
|
throw new factory.errors.NotImplemented(`${transactionTypeOf} not implemented`);
|
|
177
141
|
}
|
|
@@ -207,11 +171,7 @@ function deleteTransactionById(params) {
|
|
|
207
171
|
})).shift();
|
|
208
172
|
}
|
|
209
173
|
else {
|
|
210
|
-
|
|
211
|
-
ids: [deletingTransactionId],
|
|
212
|
-
typeOf: params.object.typeOf,
|
|
213
|
-
inclusion: ['typeOf', 'project', 'status', 'result']
|
|
214
|
-
})).shift();
|
|
174
|
+
throw new factory.errors.NotImplemented(`object not implemented. typeOf:${params.object.typeOf}`);
|
|
215
175
|
}
|
|
216
176
|
if (transaction === undefined) {
|
|
217
177
|
// すでに削除済
|
|
@@ -300,11 +260,6 @@ function deleteTransactionById(params) {
|
|
|
300
260
|
// 取引削除
|
|
301
261
|
await repos.transaction.findByIdAndDelete({ id: transaction.id });
|
|
302
262
|
break;
|
|
303
|
-
// implemented(2022-06-09~)
|
|
304
|
-
case factory.transactionType.MoneyTransfer:
|
|
305
|
-
// 取引削除
|
|
306
|
-
await repos.transaction.findByIdAndDelete({ id: transaction.id });
|
|
307
|
-
break;
|
|
308
263
|
default:
|
|
309
264
|
throw new factory.errors.NotImplemented(`${transactionTypeOf} not implemented`);
|
|
310
265
|
}
|
|
@@ -2,7 +2,6 @@ import * as 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
4
|
export type IAuthorizeProductOffer = factory.action.authorize.offer.product.IAction;
|
|
5
|
-
export type IAuthorizeMoneyTransferOffer = factory.action.authorize.offer.moneyTransfer.IAction;
|
|
6
5
|
export type IAuthorizePaymentAction = Pick<factory.action.authorize.paymentMethod.any.IAction, 'id' | 'result' | 'endDate'> & {
|
|
7
6
|
object: Pick<factory.action.authorize.paymentMethod.any.IObject, 'typeOf' | 'paymentMethodId'>;
|
|
8
7
|
};
|