@chevre/domain 21.2.0-alpha.56 → 21.2.0-alpha.57
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/service/order/onOrderStatusChanged/factory.js +24 -41
- package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.js +4 -0
- package/lib/chevre/service/transaction/moneyTransfer/factory.js +3 -1
- package/lib/chevre/service/transaction/moneyTransfer/potentialActions.d.ts +1 -0
- package/lib/chevre/service/transaction/moneyTransfer/potentialActions.js +1 -1
- package/lib/chevre/service/transaction/moneyTransfer.js +5 -8
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +5 -0
- package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +0 -3
- package/lib/chevre/service/transaction/placeOrderInProgress.js +5 -1
- package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +3 -0
- package/lib/chevre/settings.d.ts +1 -0
- package/lib/chevre/settings.js +2 -1
- package/package.json +2 -2
|
@@ -26,32 +26,10 @@ function getOrderWithToken(params) {
|
|
|
26
26
|
if (typeof credentials_1.credentials.hub.clientId !== 'string') {
|
|
27
27
|
return params.order;
|
|
28
28
|
}
|
|
29
|
-
// 冗長な個人情報をマスク(最低限の情報に)
|
|
30
|
-
// const customer4orderToken: factory.order.ISimpleCustomer =
|
|
31
|
-
// (params.order.customer.typeOf === factory.organizationType.Organization)
|
|
32
|
-
// ? {
|
|
33
|
-
// id: params.order.customer.id,
|
|
34
|
-
// name: '****',
|
|
35
|
-
// // project: params.order.customer.project,
|
|
36
|
-
// typeOf: params.order.customer.typeOf
|
|
37
|
-
// }
|
|
38
|
-
// : {
|
|
39
|
-
// id: params.order.customer.id,
|
|
40
|
-
// typeOf: params.order.customer.typeOf
|
|
41
|
-
// };
|
|
42
|
-
// const seller4orderToken: Omit<factory.order.ISeller, 'name'> = {
|
|
43
|
-
// id: params.order.seller.id,
|
|
44
|
-
// typeOf: params.order.seller.typeOf
|
|
45
|
-
// };
|
|
46
29
|
// 最適化(2023-01-31~)
|
|
47
30
|
const order4token = {
|
|
48
31
|
typeOf: params.order.typeOf,
|
|
49
|
-
// seller: seller4orderToken,
|
|
50
|
-
// customer: customer4orderToken,
|
|
51
32
|
orderNumber: params.order.orderNumber
|
|
52
|
-
// price: params.order.price,
|
|
53
|
-
// priceCurrency: params.order.priceCurrency,
|
|
54
|
-
// orderDate: params.order.orderDate
|
|
55
33
|
};
|
|
56
34
|
const token = yield new Promise((resolve, reject) => {
|
|
57
35
|
// 所有権を暗号化する
|
|
@@ -163,26 +141,31 @@ const ORDER_STORAGE_PERIOD_IN_DAYS = (typeof process.env.ORDER_STORAGE_PERIOD_IN
|
|
|
163
141
|
// tslint:disable-next-line:no-magic-numbers
|
|
164
142
|
365;
|
|
165
143
|
function createDeleteTasks(order) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
.
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
144
|
+
if (settings_1.USE_DELETE_ORDER_TASK) {
|
|
145
|
+
return [{
|
|
146
|
+
project: order.project,
|
|
147
|
+
name: factory.taskName.DeleteOrder,
|
|
148
|
+
status: factory.taskStatus.Ready,
|
|
149
|
+
runsAt: moment(order.orderDate)
|
|
150
|
+
.add(ORDER_STORAGE_PERIOD_IN_DAYS, 'days')
|
|
151
|
+
.toDate(),
|
|
152
|
+
remainingNumberOfTries: 10,
|
|
153
|
+
numberOfTried: 0,
|
|
154
|
+
executionResults: [],
|
|
155
|
+
data: {
|
|
156
|
+
object: {
|
|
157
|
+
confirmationNumber: order.confirmationNumber,
|
|
158
|
+
orderDate: order.orderDate,
|
|
159
|
+
orderNumber: order.orderNumber,
|
|
160
|
+
project: order.project,
|
|
161
|
+
typeOf: order.typeOf
|
|
162
|
+
}
|
|
183
163
|
}
|
|
184
|
-
}
|
|
185
|
-
|
|
164
|
+
}];
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
return [];
|
|
168
|
+
}
|
|
186
169
|
}
|
|
187
170
|
exports.createDeleteTasks = createDeleteTasks;
|
|
188
171
|
function createConfirmReservationActionObject4ChevreByOrder(params) {
|
|
@@ -7,6 +7,7 @@ const settings_1 = require("../../../../settings");
|
|
|
7
7
|
/**
|
|
8
8
|
* 取引のタスクを作成する
|
|
9
9
|
*/
|
|
10
|
+
// tslint:disable-next-line:max-func-body-length
|
|
10
11
|
function createTasks(params) {
|
|
11
12
|
const taskAttributes = [];
|
|
12
13
|
const transaction = params.transaction;
|
|
@@ -38,6 +39,9 @@ function createTasks(params) {
|
|
|
38
39
|
object: {
|
|
39
40
|
endDate: transaction.endDate,
|
|
40
41
|
id: transaction.id,
|
|
42
|
+
object: Object.assign({}, (transaction.object.pendingTransaction !== undefined)
|
|
43
|
+
? { pendingTransaction: transaction.object.pendingTransaction }
|
|
44
|
+
: undefined),
|
|
41
45
|
project: transaction.project,
|
|
42
46
|
startDate: transaction.startDate,
|
|
43
47
|
typeOf: transaction.typeOf
|
|
@@ -17,7 +17,9 @@ function createStartParams(params, passport, seller, amount, fromLocation, toLoc
|
|
|
17
17
|
// ↓最適化(2022-05-24~)
|
|
18
18
|
// ...{ project: seller.project }
|
|
19
19
|
},
|
|
20
|
-
object: Object.assign(Object.assign({ amount: amount, fromLocation: fromLocation, toLocation: toLocation,
|
|
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')
|
|
21
23
|
? { identifier: params.object.pendingTransaction.identifier }
|
|
22
24
|
: undefined) }, (passport !== undefined) ? { passport } : undefined), (typeof params.object.description === 'string') ? { description: params.object.description } : undefined),
|
|
23
25
|
expires: params.expires
|
|
@@ -4,5 +4,6 @@ export type IAuthorizeMoneyTransferOffer = factory.action.authorize.offer.moneyT
|
|
|
4
4
|
* 取引のポストアクションを作成する
|
|
5
5
|
*/
|
|
6
6
|
export declare function createPotentialActions(params: {
|
|
7
|
+
authorizeActions: factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>>[];
|
|
7
8
|
transaction: factory.transaction.ITransaction<factory.transactionType.MoneyTransfer>;
|
|
8
9
|
}): Promise<factory.transaction.IPotentialActions<factory.transactionType.MoneyTransfer>>;
|
|
@@ -13,7 +13,7 @@ exports.createPotentialActions = void 0;
|
|
|
13
13
|
const factory = require("../../../factory");
|
|
14
14
|
function createMoneyTransferActions(params) {
|
|
15
15
|
const moneyTransferActions = [];
|
|
16
|
-
const authorizeMoneyTransferActions = params.
|
|
16
|
+
const authorizeMoneyTransferActions = params.authorizeActions
|
|
17
17
|
.filter((a) => a.actionStatus === factory.actionStatusType.CompletedActionStatus)
|
|
18
18
|
.filter((a) => a.object.typeOf === factory.offerType.Offer)
|
|
19
19
|
.filter((a) => { var _a; return ((_a = a.object.itemOffered) === null || _a === void 0 ? void 0 : _a.typeOf) === factory.actionType.MoneyTransfer; });
|
|
@@ -519,19 +519,17 @@ function confirm(params) {
|
|
|
519
519
|
// throw new factory.errors.Forbidden('Transaction not yours');
|
|
520
520
|
// }
|
|
521
521
|
// 取引に対する全ての承認アクションをマージ
|
|
522
|
-
|
|
522
|
+
const authorizeActions = yield searchAuthorizeActions({
|
|
523
523
|
transaction: transaction,
|
|
524
524
|
now: now
|
|
525
525
|
})(repos);
|
|
526
526
|
// ポストアクションを作成
|
|
527
|
-
const potentialActions = yield (0, potentialActions_1.createPotentialActions)({
|
|
528
|
-
transaction: transaction
|
|
529
|
-
});
|
|
527
|
+
const potentialActions = yield (0, potentialActions_1.createPotentialActions)({ authorizeActions, transaction });
|
|
530
528
|
// 取引確定
|
|
531
529
|
yield repos.transaction.confirm({
|
|
532
530
|
typeOf: factory.transactionType.MoneyTransfer,
|
|
533
531
|
id: transaction.id,
|
|
534
|
-
authorizeActions:
|
|
532
|
+
authorizeActions: [],
|
|
535
533
|
result: {},
|
|
536
534
|
potentialActions: potentialActions
|
|
537
535
|
});
|
|
@@ -551,9 +549,8 @@ function searchAuthorizeActions(params) {
|
|
|
551
549
|
});
|
|
552
550
|
// 万が一このプロセス中に他処理が発生してもそれらを無視するように、endDateでフィルタリング
|
|
553
551
|
authorizeActions = authorizeActions.filter((a) => {
|
|
554
|
-
return a.endDate
|
|
555
|
-
|
|
556
|
-
.toDate() < params.now;
|
|
552
|
+
return (a.endDate instanceof Date) && moment(a.endDate)
|
|
553
|
+
.isBefore(moment(params.now));
|
|
557
554
|
});
|
|
558
555
|
return authorizeActions;
|
|
559
556
|
});
|
|
@@ -78,6 +78,11 @@ function createTasks(params) {
|
|
|
78
78
|
object: {
|
|
79
79
|
endDate: transaction.endDate,
|
|
80
80
|
id: transaction.id,
|
|
81
|
+
object: Object.assign(Object.assign({}, (typeof transaction.object.confirmationNumber === 'string')
|
|
82
|
+
? { confirmationNumber: transaction.object.confirmationNumber }
|
|
83
|
+
: undefined), (typeof transaction.object.orderNumber === 'string')
|
|
84
|
+
? { orderNumber: transaction.object.orderNumber }
|
|
85
|
+
: undefined),
|
|
81
86
|
project: transaction.project,
|
|
82
87
|
startDate: transaction.startDate,
|
|
83
88
|
typeOf: transaction.typeOf
|
|
@@ -13,6 +13,7 @@ exports.voidAward = exports.authorizeAward = exports.publishOrderNumberIfNotExis
|
|
|
13
13
|
/**
|
|
14
14
|
* 進行中注文取引サービス
|
|
15
15
|
*/
|
|
16
|
+
const moment = require("moment");
|
|
16
17
|
const factory = require("../../factory");
|
|
17
18
|
const factory_1 = require("./placeOrderInProgress/factory");
|
|
18
19
|
const potentialActions_1 = require("./placeOrderInProgress/potentialActions");
|
|
@@ -262,7 +263,10 @@ function searchAuthorizeActions(params) {
|
|
|
262
263
|
actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
|
|
263
264
|
});
|
|
264
265
|
// 万が一このプロセス中に他処理が発生してもそれらを無視するように、endDateでフィルタリング
|
|
265
|
-
authorizeActions = authorizeActions.filter((a) =>
|
|
266
|
+
authorizeActions = authorizeActions.filter((a) => {
|
|
267
|
+
return (a.endDate instanceof Date) && moment(a.endDate)
|
|
268
|
+
.isBefore(moment(params.result.order.orderDate));
|
|
269
|
+
});
|
|
266
270
|
return authorizeActions;
|
|
267
271
|
});
|
|
268
272
|
}
|
package/lib/chevre/settings.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export declare const DEFAULT_TASKS_EXPORT_AGENT_NAME: string;
|
|
|
33
33
|
export declare const USE_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
|
|
34
34
|
export declare const USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
|
|
35
35
|
export declare const USE_NEW_EVENT_AVAILABILITY_KEY_FROM: moment.Moment;
|
|
36
|
+
export declare const USE_DELETE_ORDER_TASK: boolean;
|
|
36
37
|
export declare const INFORM_RESERVATION_TASK_DELAY_IN_SECONDS: number;
|
|
37
38
|
/**
|
|
38
39
|
* グローバル設定
|
package/lib/chevre/settings.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.settings = exports.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS = exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.ABORTED_TASKS_WITHOUT_REPORT = exports.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS = exports.TRIGGER_WEBHOOK_MAX_RETRY_COUNT = void 0;
|
|
3
|
+
exports.settings = exports.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS = exports.USE_DELETE_ORDER_TASK = exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.ABORTED_TASKS_WITHOUT_REPORT = exports.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS = exports.TRIGGER_WEBHOOK_MAX_RETRY_COUNT = void 0;
|
|
4
4
|
const moment = require("moment");
|
|
5
5
|
const factory = require("./factory");
|
|
6
6
|
const transactionWebhookUrls = (typeof process.env.INFORM_TRANSACTION_URL === 'string')
|
|
@@ -59,6 +59,7 @@ exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = process.env.USE_PAY_ASSET_TR
|
|
|
59
59
|
exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = (typeof process.env.USE_NEW_EVENT_AVAILABILITY_KEY_FROM === 'string')
|
|
60
60
|
? moment(process.env.USE_NEW_EVENT_AVAILABILITY_KEY_FROM)
|
|
61
61
|
: moment('2023-08-31T15:00:00Z');
|
|
62
|
+
exports.USE_DELETE_ORDER_TASK = process.env.USE_DELETE_ORDER_TASK === '1';
|
|
62
63
|
exports.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS = (typeof process.env.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS === 'string')
|
|
63
64
|
? Number(process.env.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS)
|
|
64
65
|
: 0;
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.313.0-alpha.
|
|
12
|
+
"@chevre/factory": "4.313.0-alpha.3",
|
|
13
13
|
"@cinerino/sdk": "3.156.0",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
@@ -117,5 +117,5 @@
|
|
|
117
117
|
"postversion": "git push origin --tags",
|
|
118
118
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
119
119
|
},
|
|
120
|
-
"version": "21.2.0-alpha.
|
|
120
|
+
"version": "21.2.0-alpha.57"
|
|
121
121
|
}
|