@chevre/domain 21.7.0-alpha.9 → 21.8.0-alpha.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/emailMessageBuilder.js +2 -1
- package/lib/chevre/repo/assetTransaction.js +22 -23
- 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 +139 -110
- package/lib/chevre/service/order/payOrder.d.ts +23 -0
- package/lib/chevre/service/order/payOrder.js +74 -0
- package/lib/chevre/service/order/placeOrder.d.ts +1 -3
- package/lib/chevre/service/order/placeOrder.js +33 -76
- 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 +3 -2
- package/lib/chevre/service/task/confirmPayTransaction.js +56 -0
- 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/result.js +1 -1
- 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 +1 -1
- package/lib/chevre/settings.js +2 -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
|
@@ -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,9 +105,10 @@ 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
|
-
paymentStatus: factory.paymentStatusType.
|
|
111
|
+
paymentStatus: factory.paymentStatusType.PaymentAutomaticallyApplied,
|
|
111
112
|
paymentMethodId: (typeof ((_f = payTransactionObject.paymentMethod) === null || _f === void 0 ? void 0 : _f.paymentMethodId) === 'string')
|
|
112
113
|
? payTransactionObject.paymentMethod.paymentMethodId
|
|
113
114
|
: '',
|
|
@@ -10,8 +10,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.call = void 0;
|
|
13
|
+
const factory = require("../../factory");
|
|
13
14
|
const accountingReport_1 = require("../../repo/accountingReport");
|
|
14
15
|
const action_1 = require("../../repo/action");
|
|
16
|
+
const registerServiceInProgress_1 = require("../../repo/action/registerServiceInProgress");
|
|
15
17
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
16
18
|
const event_1 = require("../../repo/event");
|
|
17
19
|
const order_1 = require("../../repo/order");
|
|
@@ -19,12 +21,17 @@ const product_1 = require("../../repo/product");
|
|
|
19
21
|
const project_1 = require("../../repo/project");
|
|
20
22
|
const seller_1 = require("../../repo/seller");
|
|
21
23
|
const task_1 = require("../../repo/task");
|
|
24
|
+
const transaction_1 = require("../../repo/transaction");
|
|
22
25
|
const PayTransactionService = require("../assetTransaction/pay");
|
|
26
|
+
const payOrder_1 = require("../order/payOrder");
|
|
23
27
|
/**
|
|
24
28
|
* タスク実行関数
|
|
25
29
|
*/
|
|
26
30
|
function call(data) {
|
|
27
31
|
return (settings) => __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
if (settings.redisClient === undefined) {
|
|
33
|
+
throw new factory.errors.Argument('settings', 'redisClient required');
|
|
34
|
+
}
|
|
28
35
|
const actionRepo = new action_1.MongoRepository(settings.connection);
|
|
29
36
|
const assetTransactionRepo = new assetTransaction_1.MongoRepository(settings.connection);
|
|
30
37
|
const orderRepo = new order_1.MongoRepository(settings.connection);
|
|
@@ -34,6 +41,8 @@ function call(data) {
|
|
|
34
41
|
const projectRepo = new project_1.MongoRepository(settings.connection);
|
|
35
42
|
const sellerRepo = new seller_1.MongoRepository(settings.connection);
|
|
36
43
|
const taskRepo = new task_1.MongoRepository(settings.connection);
|
|
44
|
+
const transactionRepo = new transaction_1.MongoRepository(settings.connection);
|
|
45
|
+
const registerServiceInProgressRepo = new registerServiceInProgress_1.RedisRepository(settings.redisClient);
|
|
37
46
|
// アクション開始
|
|
38
47
|
const action = yield actionRepo.start(data);
|
|
39
48
|
try {
|
|
@@ -76,6 +85,53 @@ function call(data) {
|
|
|
76
85
|
// アクション完了
|
|
77
86
|
const actionResult = {};
|
|
78
87
|
yield actionRepo.complete({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
88
|
+
// processOrder連携(2023-08-23~)
|
|
89
|
+
yield onConfirmed(data)({
|
|
90
|
+
assetTransaction: assetTransactionRepo,
|
|
91
|
+
order: orderRepo,
|
|
92
|
+
registerActionInProgress: registerServiceInProgressRepo,
|
|
93
|
+
task: taskRepo,
|
|
94
|
+
transaction: transactionRepo
|
|
95
|
+
});
|
|
79
96
|
});
|
|
80
97
|
}
|
|
81
98
|
exports.call = call;
|
|
99
|
+
function onConfirmed(params) {
|
|
100
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
101
|
+
if (params.processOrder === true) {
|
|
102
|
+
// 注文のpaymentMethodIdを取得
|
|
103
|
+
const order = yield repos.order.findByOrderNumber({
|
|
104
|
+
orderNumber: params.purpose.orderNumber,
|
|
105
|
+
project: { id: params.project.id },
|
|
106
|
+
inclusion: ['paymentMethods'],
|
|
107
|
+
exclusion: []
|
|
108
|
+
});
|
|
109
|
+
// PayTransactionのステータス検証
|
|
110
|
+
let allPayTransactionConfirmed = false;
|
|
111
|
+
const paymentMethodIds = order.paymentMethods.filter((invoice) => typeof invoice.paymentMethodId === 'string' && invoice.paymentMethodId.length > 0)
|
|
112
|
+
.map((invoice) => invoice.paymentMethodId);
|
|
113
|
+
if (paymentMethodIds.length > 0) {
|
|
114
|
+
const referencedPayTransactions = yield repos.assetTransaction.search({
|
|
115
|
+
project: { id: { $eq: params.project.id } },
|
|
116
|
+
typeOf: factory.assetTransactionType.Pay,
|
|
117
|
+
transactionNumber: { $in: paymentMethodIds }
|
|
118
|
+
}, ['status']);
|
|
119
|
+
allPayTransactionConfirmed =
|
|
120
|
+
referencedPayTransactions.every((payTransation) => payTransation.status === factory.transactionStatusType.Confirmed);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
allPayTransactionConfirmed = true;
|
|
124
|
+
}
|
|
125
|
+
if (allPayTransactionConfirmed) {
|
|
126
|
+
yield (0, payOrder_1.payOrder)({
|
|
127
|
+
project: { id: params.project.id },
|
|
128
|
+
object: {
|
|
129
|
+
confirmationNumber: params.purpose.confirmationNumber,
|
|
130
|
+
orderNumber: params.purpose.orderNumber
|
|
131
|
+
},
|
|
132
|
+
useOnOrderStatusChanged: params.useOnOrderStatusChanged === true
|
|
133
|
+
})(repos);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
@@ -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
|
+
*/
|