@chevre/domain 21.7.0-alpha.9 → 21.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/example/src/chevre/countDelayedTasks.ts +1 -1
- package/example/src/chevre/createDeleteTransactionTasks.ts +108 -0
- package/example/src/chevre/createDeleteTransactionTasksIfNotExist.ts +98 -0
- package/example/src/chevre/deleteRunsAtPassedCertainPeriod.ts +28 -0
- package/example/src/chevre/deleteTasksByName.ts +1 -1
- package/example/src/chevre/migrateAuthorizePaymentActionResult.ts +1 -1
- package/example/src/chevre/migrateOwnershipInfos2newUserPool.ts +4 -1
- package/example/src/chevre/unsetUnnecessaryFields.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/offer.d.ts +4 -4
- package/lib/chevre/repo/mongoose/schemas/offer.js +5 -6
- package/lib/chevre/repo/project.d.ts +1 -0
- package/lib/chevre/repo/project.js +10 -4
- package/lib/chevre/repo/task.d.ts +6 -2
- package/lib/chevre/repo/task.js +25 -1
- package/lib/chevre/repo/transaction.d.ts +25 -1
- package/lib/chevre/repo/transaction.js +6 -1
- package/lib/chevre/service/notification.js +13 -6
- package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +20 -0
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +242 -1
- package/lib/chevre/service/order/onOrderStatusChanged.d.ts +2 -1
- package/lib/chevre/service/order/onOrderStatusChanged.js +120 -106
- package/lib/chevre/service/order/placeOrder.d.ts +1 -3
- package/lib/chevre/service/order/placeOrder.js +15 -74
- package/lib/chevre/service/order/returnOrder.d.ts +1 -2
- package/lib/chevre/service/order/returnOrder.js +15 -97
- package/lib/chevre/service/order/sendOrder.d.ts +0 -1
- package/lib/chevre/service/order/sendOrder.js +6 -68
- package/lib/chevre/service/payment/any/factory.js +2 -1
- package/lib/chevre/service/task/confirmRegisterServiceTransaction.d.ts +1 -1
- package/lib/chevre/service/task/confirmRegisterServiceTransaction.js +6 -6
- package/lib/chevre/service/transaction/moneyTransfer/factory.js +1 -5
- package/lib/chevre/service/transaction/moneyTransfer.js +0 -1
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +12 -6
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.d.ts +4 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +92 -88
- package/lib/chevre/service/transaction/placeOrderInProgress.js +0 -2
- package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +8 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions.js +7 -4
- package/lib/chevre/service/transaction/returnOrder.js +0 -1
- package/lib/chevre/settings.d.ts +0 -1
- package/lib/chevre/settings.js +1 -2
- package/package.json +3 -3
- package/example/src/chevre/checkOrderMembershipTasks.ts +0 -127
- package/example/src/chevre/transaction/callOrderMembershipServiceTask.ts +0 -65
- package/example/src/chevre/transaction/orderMembershipService.ts +0 -105
- package/lib/chevre/service/task/orderProgramMembership.d.ts +0 -6
- package/lib/chevre/service/task/orderProgramMembership.js +0 -98
- package/lib/chevre/service/transaction/orderProgramMembership.d.ts +0 -50
- package/lib/chevre/service/transaction/orderProgramMembership.js +0 -349
|
@@ -98,12 +98,6 @@ function placeOrderWithoutTransaction(params) {
|
|
|
98
98
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
99
99
|
var _a;
|
|
100
100
|
const order = params.object;
|
|
101
|
-
// 注文番号から取引と注文をfixする
|
|
102
|
-
// const { order, placeOrderTransaction } = await createOrderFromBody({
|
|
103
|
-
// project: { id: params.project.id },
|
|
104
|
-
// confirmationNumber: params.object.confirmationNumber,
|
|
105
|
-
// orderNumber: params.object.orderNumber
|
|
106
|
-
// })({ transaction: repos.transaction });
|
|
107
101
|
// アクションを作成する(2022-04-11~)
|
|
108
102
|
const maskedCustomer = (0, order_1.createMaskedCustomer)(order, { noProfile: true });
|
|
109
103
|
const simpleOrder = {
|
|
@@ -145,24 +139,23 @@ function placeOrderWithoutTransaction(params) {
|
|
|
145
139
|
yield repos.action.complete({ typeOf: orderActionAttributes.typeOf, id: action.id, result: {} });
|
|
146
140
|
// 経理レポートを保管
|
|
147
141
|
yield (0, createAccountingReportIfNotExist_1.createAccountingReportIfNotExist)(order)({ accountingReport: repos.accountingReport });
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
});
|
|
152
|
-
// 潜在アクション
|
|
153
|
-
yield onPlaceOrder({
|
|
154
|
-
object: order,
|
|
155
|
-
potentialActions: params.potentialActions
|
|
156
|
-
})(repos);
|
|
142
|
+
// await onOrderStatusChanged({ order: <factory.order.IOrder>order })({
|
|
143
|
+
// registerActionInProgress: repos.registerActionInProgress,
|
|
144
|
+
// task: repos.task
|
|
145
|
+
// });
|
|
157
146
|
});
|
|
158
147
|
}
|
|
159
148
|
exports.placeOrderWithoutTransaction = placeOrderWithoutTransaction;
|
|
160
149
|
/**
|
|
161
150
|
* 注文を作成する
|
|
162
151
|
*/
|
|
152
|
+
// tslint:disable-next-line:max-func-body-length
|
|
163
153
|
function placeOrder(params) {
|
|
164
154
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
165
155
|
var _a;
|
|
156
|
+
if (typeof params.useOnOrderStatusChanged !== 'boolean') {
|
|
157
|
+
throw new factory.errors.Argument('useOnOrderStatusChanged', 'must be boolean');
|
|
158
|
+
}
|
|
166
159
|
// 注文番号から取引と注文をfixする
|
|
167
160
|
const { order, placeOrderTransaction } = yield createOrderFromBody({
|
|
168
161
|
project: { id: params.project.id },
|
|
@@ -226,71 +219,19 @@ function placeOrder(params) {
|
|
|
226
219
|
}
|
|
227
220
|
yield repos.action.complete({ typeOf: orderActionAttributes.typeOf, id: action.id, result: {} });
|
|
228
221
|
}
|
|
229
|
-
if (params.useOnOrderStatusChanged
|
|
222
|
+
if (params.useOnOrderStatusChanged) {
|
|
230
223
|
// 経理レポートを保管
|
|
231
224
|
yield (0, createAccountingReportIfNotExist_1.createAccountingReportIfNotExist)(order)({ accountingReport: repos.accountingReport });
|
|
232
|
-
yield (0, onOrderStatusChanged_1.onOrderStatusChanged)({ order })({
|
|
225
|
+
yield (0, onOrderStatusChanged_1.onOrderStatusChanged)({ order, placeOrderTransaction })({
|
|
233
226
|
registerActionInProgress: repos.registerActionInProgress,
|
|
234
227
|
task: repos.task
|
|
235
228
|
});
|
|
236
229
|
}
|
|
237
|
-
//
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
})(repos);
|
|
230
|
+
// onOrderStatusChangedへ移行(2023-08-17~)
|
|
231
|
+
// await onPlaceOrder({
|
|
232
|
+
// object: order,
|
|
233
|
+
// potentialActions: params.potentialActions
|
|
234
|
+
// })(repos);
|
|
242
235
|
});
|
|
243
236
|
}
|
|
244
237
|
exports.placeOrder = placeOrder;
|
|
245
|
-
/**
|
|
246
|
-
* 注文作成後のアクション
|
|
247
|
-
*/
|
|
248
|
-
function onPlaceOrder(params) {
|
|
249
|
-
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
250
|
-
const potentialActions = params.potentialActions;
|
|
251
|
-
const now = new Date();
|
|
252
|
-
// potentialActionsのためのタスクを生成
|
|
253
|
-
const taskAttributes = [];
|
|
254
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
255
|
-
/* istanbul ignore else */
|
|
256
|
-
if (potentialActions !== undefined) {
|
|
257
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
258
|
-
/* istanbul ignore else */
|
|
259
|
-
if (potentialActions.sendOrder !== undefined) {
|
|
260
|
-
const sendOrderTask = {
|
|
261
|
-
project: potentialActions.sendOrder.project,
|
|
262
|
-
name: factory.taskName.SendOrder,
|
|
263
|
-
status: factory.taskStatus.Ready,
|
|
264
|
-
runsAt: now,
|
|
265
|
-
remainingNumberOfTries: 10,
|
|
266
|
-
numberOfTried: 0,
|
|
267
|
-
executionResults: [],
|
|
268
|
-
// data: potentialActions.sendOrder
|
|
269
|
-
data: Object.assign({ project: potentialActions.sendOrder.project, object: Object.assign(Object.assign({}, potentialActions.sendOrder.object), { confirmationNumber: params.object.confirmationNumber }) }, (potentialActions.sendOrder.potentialActions !== undefined)
|
|
270
|
-
? { potentialActions: potentialActions.sendOrder.potentialActions }
|
|
271
|
-
: undefined)
|
|
272
|
-
};
|
|
273
|
-
taskAttributes.push(sendOrderTask);
|
|
274
|
-
}
|
|
275
|
-
// ポイント付与
|
|
276
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
277
|
-
/* istanbul ignore else */
|
|
278
|
-
if (Array.isArray(potentialActions.givePointAward)) {
|
|
279
|
-
taskAttributes.push(...potentialActions.givePointAward.map((a) => {
|
|
280
|
-
return {
|
|
281
|
-
project: a.project,
|
|
282
|
-
name: factory.taskName.GivePointAward,
|
|
283
|
-
status: factory.taskStatus.Ready,
|
|
284
|
-
runsAt: now,
|
|
285
|
-
remainingNumberOfTries: 10,
|
|
286
|
-
numberOfTried: 0,
|
|
287
|
-
executionResults: [],
|
|
288
|
-
data: a
|
|
289
|
-
};
|
|
290
|
-
}));
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
// タスク保管
|
|
294
|
-
yield repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
295
|
-
});
|
|
296
|
-
}
|
|
@@ -9,12 +9,11 @@ declare function returnOrder(params: {
|
|
|
9
9
|
agent: factory.action.transfer.returnAction.order.IAgent;
|
|
10
10
|
object: {
|
|
11
11
|
orderNumber: string;
|
|
12
|
-
dateReturned
|
|
12
|
+
dateReturned: Date;
|
|
13
13
|
};
|
|
14
14
|
project: {
|
|
15
15
|
id: string;
|
|
16
16
|
};
|
|
17
|
-
potentialActions?: factory.action.transfer.returnAction.order.IPotentialActions;
|
|
18
17
|
useOnOrderStatusChanged: boolean;
|
|
19
18
|
}): (repos: {
|
|
20
19
|
action: ActionRepo;
|
|
@@ -14,9 +14,12 @@ const order_1 = require("../../factory/order");
|
|
|
14
14
|
const factory_1 = require("../delivery/factory");
|
|
15
15
|
const onOrderStatusChanged_1 = require("./onOrderStatusChanged");
|
|
16
16
|
const factory = require("../../factory");
|
|
17
|
-
// tslint:disable-next-line:max-func-body-length
|
|
18
17
|
function returnOrder(params) {
|
|
18
|
+
// tslint:disable-next-line:max-func-body-length
|
|
19
19
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
if (typeof params.useOnOrderStatusChanged !== 'boolean') {
|
|
21
|
+
throw new factory.errors.Argument('useOnOrderStatusChanged', 'must be boolean');
|
|
22
|
+
}
|
|
20
23
|
const orderNumber = params.object.orderNumber;
|
|
21
24
|
const dateReturned = (params.object.dateReturned instanceof Date)
|
|
22
25
|
? params.object.dateReturned
|
|
@@ -28,10 +31,6 @@ function returnOrder(params) {
|
|
|
28
31
|
inclusion: [],
|
|
29
32
|
exclusion: []
|
|
30
33
|
});
|
|
31
|
-
// プロジェクト条件検証
|
|
32
|
-
if (order.project.id !== params.project.id) {
|
|
33
|
-
throw new factory.errors.NotFound('Order');
|
|
34
|
-
}
|
|
35
34
|
// 返品取引検索
|
|
36
35
|
const returnOrderTransactions = yield repos.transaction.search({
|
|
37
36
|
limit: 1,
|
|
@@ -61,7 +60,14 @@ function returnOrder(params) {
|
|
|
61
60
|
orderDate: order.orderDate,
|
|
62
61
|
dateReturned
|
|
63
62
|
};
|
|
64
|
-
const returnOrderActionAttributes =
|
|
63
|
+
const returnOrderActionAttributes = {
|
|
64
|
+
agent: returner,
|
|
65
|
+
object: simpleOrder,
|
|
66
|
+
project: order.project,
|
|
67
|
+
recipient: order.seller,
|
|
68
|
+
typeOf: factory.actionType.ReturnAction
|
|
69
|
+
// ...(params.potentialActions !== undefined) ? { potentialActions: params.potentialActions } : undefined
|
|
70
|
+
};
|
|
65
71
|
let returnedOwnershipInfos = [];
|
|
66
72
|
// アクション開始
|
|
67
73
|
const action = yield repos.action.start(returnOrderActionAttributes);
|
|
@@ -88,14 +94,15 @@ function returnOrder(params) {
|
|
|
88
94
|
}
|
|
89
95
|
const result = returnedOwnershipInfos;
|
|
90
96
|
yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: result });
|
|
91
|
-
if (params.useOnOrderStatusChanged
|
|
97
|
+
if (params.useOnOrderStatusChanged) {
|
|
92
98
|
yield (0, onOrderStatusChanged_1.onOrderStatusChanged)({ order, returnOrderTransaction })({
|
|
93
99
|
registerActionInProgress: repos.registerServiceInProgress,
|
|
94
100
|
task: repos.task
|
|
95
101
|
});
|
|
96
102
|
}
|
|
97
103
|
// 潜在アクション
|
|
98
|
-
|
|
104
|
+
// onOrderStatusChangedへ移行(2023-08-19~)
|
|
105
|
+
// await onReturn(returnOrderActionAttributes)({ task: repos.task });
|
|
99
106
|
});
|
|
100
107
|
}
|
|
101
108
|
exports.returnOrder = returnOrder;
|
|
@@ -122,98 +129,9 @@ function processReturnOrder(order, dateReturned) {
|
|
|
122
129
|
return ownershipInfoByDB;
|
|
123
130
|
}
|
|
124
131
|
});
|
|
125
|
-
// const ownershipInfoReturned: IOwnershipInfo = await repos.ownershipInfo.ownershipInfoModel.findOneAndUpdate(
|
|
126
|
-
// {
|
|
127
|
-
// 'project.id': { $eq: order.project.id },
|
|
128
|
-
// identifier: String(ownershipInfo.identifier)
|
|
129
|
-
// },
|
|
130
|
-
// { ownedThrough: dateReturned },
|
|
131
|
-
// { new: true }
|
|
132
|
-
// )
|
|
133
|
-
// .select({ __v: 0, createdAt: 0, updatedAt: 0 })
|
|
134
|
-
// .exec()
|
|
135
|
-
// .then((doc) => {
|
|
136
|
-
// // 存在しない場合はいったん保留
|
|
137
|
-
// if (doc === null) {
|
|
138
|
-
// return ownershipInfo;
|
|
139
|
-
// } else {
|
|
140
|
-
// return doc.toObject();
|
|
141
|
-
// }
|
|
142
|
-
// });
|
|
143
132
|
returnedOwnershipInfos.push(ownershipInfoReturned);
|
|
144
133
|
})));
|
|
145
134
|
}
|
|
146
135
|
return returnedOwnershipInfos;
|
|
147
136
|
});
|
|
148
137
|
}
|
|
149
|
-
/**
|
|
150
|
-
* 返品アクション後の処理
|
|
151
|
-
* 注文返品後に何をすべきかは返品アクションのpotentialActionsとして定義されているはずなので、それらをタスクとして登録します。
|
|
152
|
-
*/
|
|
153
|
-
function onReturn(returnActionAttributes) {
|
|
154
|
-
// tslint:disable-next-line:max-func-body-length
|
|
155
|
-
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
156
|
-
const now = new Date();
|
|
157
|
-
const taskAttributes = [];
|
|
158
|
-
const potentialActions = returnActionAttributes.potentialActions;
|
|
159
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
160
|
-
/* istanbul ignore else */
|
|
161
|
-
if (potentialActions !== undefined) {
|
|
162
|
-
// 入金返却タスク
|
|
163
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
164
|
-
/* istanbul ignore else */
|
|
165
|
-
if (Array.isArray(potentialActions.returnMoneyTransfer)) {
|
|
166
|
-
taskAttributes.push(...potentialActions.returnMoneyTransfer.map((a) => {
|
|
167
|
-
return {
|
|
168
|
-
project: a.project,
|
|
169
|
-
name: factory.taskName.ReturnMoneyTransfer,
|
|
170
|
-
status: factory.taskStatus.Ready,
|
|
171
|
-
runsAt: now,
|
|
172
|
-
remainingNumberOfTries: 10,
|
|
173
|
-
numberOfTried: 0,
|
|
174
|
-
executionResults: [],
|
|
175
|
-
data: a
|
|
176
|
-
};
|
|
177
|
-
}));
|
|
178
|
-
}
|
|
179
|
-
// ポイントインセンティブ返却タスク
|
|
180
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
181
|
-
/* istanbul ignore else */
|
|
182
|
-
if (Array.isArray(potentialActions.returnPointAward)) {
|
|
183
|
-
taskAttributes.push(...potentialActions.returnPointAward.map((a) => {
|
|
184
|
-
return {
|
|
185
|
-
project: a.project,
|
|
186
|
-
name: factory.taskName.ReturnPointAward,
|
|
187
|
-
status: factory.taskStatus.Ready,
|
|
188
|
-
runsAt: now,
|
|
189
|
-
remainingNumberOfTries: 10,
|
|
190
|
-
numberOfTried: 0,
|
|
191
|
-
executionResults: [],
|
|
192
|
-
data: a
|
|
193
|
-
};
|
|
194
|
-
}));
|
|
195
|
-
}
|
|
196
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
197
|
-
/* istanbul ignore else */
|
|
198
|
-
if (Array.isArray(potentialActions.sendEmailMessage)) {
|
|
199
|
-
potentialActions.sendEmailMessage.forEach((s) => {
|
|
200
|
-
const sendEmailMessageTask = {
|
|
201
|
-
project: s.project,
|
|
202
|
-
name: factory.taskName.SendEmailMessage,
|
|
203
|
-
status: factory.taskStatus.Ready,
|
|
204
|
-
runsAt: now,
|
|
205
|
-
remainingNumberOfTries: 3,
|
|
206
|
-
numberOfTried: 0,
|
|
207
|
-
executionResults: [],
|
|
208
|
-
data: {
|
|
209
|
-
actionAttributes: s
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
taskAttributes.push(sendEmailMessageTask);
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
// タスク保管
|
|
217
|
-
yield repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
218
|
-
});
|
|
219
|
-
}
|
|
@@ -25,7 +25,6 @@ declare function sendOrder(params: {
|
|
|
25
25
|
confirmationNumber: string;
|
|
26
26
|
orderNumber: string;
|
|
27
27
|
};
|
|
28
|
-
potentialActions?: factory.action.transfer.send.order.IPotentialActions;
|
|
29
28
|
useOnOrderStatusChanged: boolean;
|
|
30
29
|
}): ISendOperation<void>;
|
|
31
30
|
export { sendOrder };
|
|
@@ -22,6 +22,9 @@ function sendOrder(params) {
|
|
|
22
22
|
// tslint:disable-next-line:max-func-body-length
|
|
23
23
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
24
24
|
var _a;
|
|
25
|
+
if (typeof params.useOnOrderStatusChanged !== 'boolean') {
|
|
26
|
+
throw new factory.errors.Argument('useOnOrderStatusChanged', 'must be boolean');
|
|
27
|
+
}
|
|
25
28
|
try {
|
|
26
29
|
const orderNumber = params.object.orderNumber;
|
|
27
30
|
const confirmationNumber = params.object.confirmationNumber;
|
|
@@ -96,7 +99,7 @@ function sendOrder(params) {
|
|
|
96
99
|
}
|
|
97
100
|
const result = ownershipInfos;
|
|
98
101
|
yield repos.action.complete({ typeOf: sendOrderActionAttributes.typeOf, id: action.id, result: result });
|
|
99
|
-
if (params.useOnOrderStatusChanged
|
|
102
|
+
if (params.useOnOrderStatusChanged) {
|
|
100
103
|
yield (0, onOrderStatusChanged_1.onOrderStatusChanged)({ order, placeOrderTransaction })({
|
|
101
104
|
registerActionInProgress: repos.registerActionInProgress,
|
|
102
105
|
task: repos.task
|
|
@@ -119,73 +122,8 @@ function sendOrder(params) {
|
|
|
119
122
|
throw error;
|
|
120
123
|
}
|
|
121
124
|
}
|
|
122
|
-
|
|
125
|
+
// onOrderStatusChangedへ移行(2023-08-17~)
|
|
126
|
+
// await onSend(params)({ task: repos.task });
|
|
123
127
|
});
|
|
124
128
|
}
|
|
125
129
|
exports.sendOrder = sendOrder;
|
|
126
|
-
/**
|
|
127
|
-
* 注文配送後のアクション
|
|
128
|
-
*/
|
|
129
|
-
function onSend(params) {
|
|
130
|
-
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
131
|
-
const potentialActions = params.potentialActions;
|
|
132
|
-
const now = new Date();
|
|
133
|
-
const taskAttributes = [];
|
|
134
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
135
|
-
/* istanbul ignore else */
|
|
136
|
-
if (potentialActions !== undefined) {
|
|
137
|
-
if (Array.isArray(potentialActions.registerService)) {
|
|
138
|
-
taskAttributes.push(...potentialActions.registerService.map((a) => {
|
|
139
|
-
return {
|
|
140
|
-
project: a.project,
|
|
141
|
-
name: factory.taskName.ConfirmRegisterService,
|
|
142
|
-
status: factory.taskStatus.Ready,
|
|
143
|
-
runsAt: now,
|
|
144
|
-
remainingNumberOfTries: 10,
|
|
145
|
-
numberOfTried: 0,
|
|
146
|
-
executionResults: [],
|
|
147
|
-
data: a
|
|
148
|
-
};
|
|
149
|
-
}));
|
|
150
|
-
}
|
|
151
|
-
// 通貨転送
|
|
152
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
153
|
-
/* istanbul ignore else */
|
|
154
|
-
if (Array.isArray(potentialActions.moneyTransfer)) {
|
|
155
|
-
taskAttributes.push(...potentialActions.moneyTransfer.map((a) => {
|
|
156
|
-
return {
|
|
157
|
-
project: a.project,
|
|
158
|
-
name: factory.taskName.ConfirmMoneyTransfer,
|
|
159
|
-
status: factory.taskStatus.Ready,
|
|
160
|
-
runsAt: now,
|
|
161
|
-
remainingNumberOfTries: 10,
|
|
162
|
-
numberOfTried: 0,
|
|
163
|
-
executionResults: [],
|
|
164
|
-
data: a
|
|
165
|
-
};
|
|
166
|
-
}));
|
|
167
|
-
}
|
|
168
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
169
|
-
/* istanbul ignore else */
|
|
170
|
-
if (Array.isArray(potentialActions.sendEmailMessage)) {
|
|
171
|
-
potentialActions.sendEmailMessage.forEach((s) => {
|
|
172
|
-
const sendEmailMessageTask = {
|
|
173
|
-
project: s.project,
|
|
174
|
-
name: factory.taskName.SendEmailMessage,
|
|
175
|
-
status: factory.taskStatus.Ready,
|
|
176
|
-
runsAt: now,
|
|
177
|
-
remainingNumberOfTries: 3,
|
|
178
|
-
numberOfTried: 0,
|
|
179
|
-
executionResults: [],
|
|
180
|
-
data: {
|
|
181
|
-
actionAttributes: s
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
taskAttributes.push(sendEmailMessageTask);
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
// タスク保管
|
|
189
|
-
yield repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
190
|
-
});
|
|
191
|
-
}
|
|
@@ -105,7 +105,8 @@ function createAuthorizeResult(params) {
|
|
|
105
105
|
// 廃止(2023-08-07~)
|
|
106
106
|
// amount: params.object.amount,
|
|
107
107
|
issuedThrough,
|
|
108
|
-
|
|
108
|
+
// 完全廃止(paymentMethodAsObjectへ完全移行)(2023-08-16~)
|
|
109
|
+
// paymentMethod: params.object.paymentMethod,
|
|
109
110
|
paymentMethodAsObject,
|
|
110
111
|
paymentStatus: factory.paymentStatusType.PaymentDue,
|
|
111
112
|
paymentMethodId: (typeof ((_f = payTransactionObject.paymentMethod) === null || _f === void 0 ? void 0 : _f.paymentMethodId) === 'string')
|
|
@@ -12,6 +12,6 @@ export declare function confirmRegisterServiceTransaction(params: factory.action
|
|
|
12
12
|
assetTransaction: AssetTransactionRepo;
|
|
13
13
|
task: TaskRepo;
|
|
14
14
|
}) => Promise<void>;
|
|
15
|
-
export declare function onRegistered(
|
|
15
|
+
export declare function onRegistered(__: factory.action.interact.confirm.registerService.IAttributes): (repos: {
|
|
16
16
|
task: TaskRepo;
|
|
17
17
|
}) => Promise<void>;
|
|
@@ -85,15 +85,15 @@ function confirmRegisterServiceTransaction(params) {
|
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
exports.confirmRegisterServiceTransaction = confirmRegisterServiceTransaction;
|
|
88
|
-
function onRegistered(
|
|
88
|
+
function onRegistered(__) {
|
|
89
89
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
90
|
-
var _a;
|
|
91
90
|
const taskAttributes = [];
|
|
92
91
|
// 次のメンバーシップ注文タスクを作成
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
// 廃止(2023-08-18~)
|
|
93
|
+
// const orderProgramMembershipTasks = actionAttributes.potentialActions?.orderProgramMembership;
|
|
94
|
+
// if (Array.isArray(orderProgramMembershipTasks)) {
|
|
95
|
+
// taskAttributes.push(...orderProgramMembershipTasks);
|
|
96
|
+
// }
|
|
97
97
|
// タスク保管
|
|
98
98
|
yield repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
99
99
|
});
|
|
@@ -14,12 +14,8 @@ function createStartParams(params, passport, seller, amount, fromLocation, toLoc
|
|
|
14
14
|
id: String(seller.id),
|
|
15
15
|
name: seller.name,
|
|
16
16
|
typeOf: seller.typeOf
|
|
17
|
-
// ↓最適化(2022-05-24~)
|
|
18
|
-
// ...{ project: seller.project }
|
|
19
17
|
},
|
|
20
|
-
object: Object.assign(Object.assign({ amount: amount, fromLocation: fromLocation, toLocation: toLocation,
|
|
21
|
-
// authorizeActions: [],
|
|
22
|
-
pendingTransaction: Object.assign({ transactionNumber }, (typeof ((_a = params.object.pendingTransaction) === null || _a === void 0 ? void 0 : _a.identifier) === 'string')
|
|
18
|
+
object: Object.assign(Object.assign({ amount: amount, fromLocation: fromLocation, toLocation: toLocation, pendingTransaction: Object.assign({ transactionNumber }, (typeof ((_a = params.object.pendingTransaction) === null || _a === void 0 ? void 0 : _a.identifier) === 'string')
|
|
23
19
|
? { identifier: params.object.pendingTransaction.identifier }
|
|
24
20
|
: undefined) }, (passport !== undefined) ? { passport } : undefined), (typeof params.object.description === 'string') ? { description: params.object.description } : undefined),
|
|
25
21
|
expires: params.expires
|
|
@@ -130,6 +130,17 @@ function createTasks(params) {
|
|
|
130
130
|
throw new factory.errors.NotFound('Transaction Result');
|
|
131
131
|
}
|
|
132
132
|
const orderActionAttributes = potentialActions.order;
|
|
133
|
+
const placeOrderTaskData = {
|
|
134
|
+
project: orderActionAttributes.project,
|
|
135
|
+
object: {
|
|
136
|
+
confirmationNumber: orderFromTransaction.confirmationNumber,
|
|
137
|
+
orderNumber: orderActionAttributes.object.orderNumber
|
|
138
|
+
}
|
|
139
|
+
// 廃止(2023-08-21~)
|
|
140
|
+
// ...(orderActionAttributes.potentialActions !== undefined)
|
|
141
|
+
// ? { potentialActions: orderActionAttributes.potentialActions }
|
|
142
|
+
// : undefined
|
|
143
|
+
};
|
|
133
144
|
const placeOrderTaskAttributes = {
|
|
134
145
|
project: transaction.project,
|
|
135
146
|
name: factory.taskName.PlaceOrder,
|
|
@@ -138,12 +149,7 @@ function createTasks(params) {
|
|
|
138
149
|
remainingNumberOfTries: 10,
|
|
139
150
|
numberOfTried: 0,
|
|
140
151
|
executionResults: [],
|
|
141
|
-
data:
|
|
142
|
-
confirmationNumber: orderFromTransaction.confirmationNumber,
|
|
143
|
-
orderNumber: orderActionAttributes.object.orderNumber
|
|
144
|
-
} }, (orderActionAttributes.potentialActions !== undefined)
|
|
145
|
-
? { potentialActions: orderActionAttributes.potentialActions }
|
|
146
|
-
: undefined)
|
|
152
|
+
data: placeOrderTaskData
|
|
147
153
|
};
|
|
148
154
|
taskAttributes.push(placeOrderTaskAttributes);
|
|
149
155
|
break;
|
package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.d.ts
CHANGED
|
@@ -4,3 +4,7 @@ export declare function createRegisterServiceActions(params: {
|
|
|
4
4
|
transaction: factory.transaction.placeOrder.ITransaction;
|
|
5
5
|
authorizeActions: factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>>[];
|
|
6
6
|
}): Promise<factory.action.interact.confirm.registerService.IAttributes[]>;
|
|
7
|
+
/**
|
|
8
|
+
* ssktsへの互換性対応として
|
|
9
|
+
* 次回メンバーシップ注文タスクを作成する
|
|
10
|
+
*/
|