@chevre/domain 21.8.0-alpha.2 → 21.8.0-alpha.21
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/db/stats.ts +22 -0
- package/example/src/chevre/migrateOrderPaymentMethodIdentifier.ts +81 -0
- package/example/src/chevre/migratePayTransactionPaymentMethodId.ts +72 -0
- package/example/src/chevre/migratePayTransactionPaymentMethodIdentifier.ts +78 -0
- package/example/src/chevre/processPay.ts +3 -4
- package/example/src/chevre/searchTasks.ts +31 -0
- package/lib/chevre/repo/assetTransaction.d.ts +16 -1
- package/lib/chevre/repo/assetTransaction.js +54 -2
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +3 -0
- package/lib/chevre/repo/mongoose/schemas/order.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/task.js +6 -0
- package/lib/chevre/repo/order.d.ts +15 -0
- package/lib/chevre/repo/order.js +34 -1
- package/lib/chevre/repo/task.d.ts +4 -1
- package/lib/chevre/repo/task.js +108 -22
- package/lib/chevre/service/assetTransaction/pay/account/validation.js +2 -2
- package/lib/chevre/service/assetTransaction/pay/factory.js +5 -3
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +3 -3
- package/lib/chevre/service/assetTransaction/pay.js +65 -46
- package/lib/chevre/service/assetTransaction/reserve.js +48 -7
- package/lib/chevre/service/delivery.js +17 -0
- package/lib/chevre/service/offer/event/voidTransaction.js +7 -2
- package/lib/chevre/service/order/confirmPayTransaction.d.ts +0 -2
- package/lib/chevre/service/order/confirmPayTransaction.js +29 -40
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +27 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +226 -0
- package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +8 -5
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +73 -87
- package/lib/chevre/service/order/onOrderStatusChanged.js +98 -73
- package/lib/chevre/service/order/payOrder.d.ts +2 -10
- package/lib/chevre/service/order/payOrder.js +4 -45
- package/lib/chevre/service/order/placeOrder.js +12 -11
- package/lib/chevre/service/order.d.ts +3 -1
- package/lib/chevre/service/order.js +6 -2
- package/lib/chevre/service/payment/any/factory.js +24 -7
- package/lib/chevre/service/payment/any.js +22 -18
- package/lib/chevre/service/payment/creditCard.js +12 -12
- package/lib/chevre/service/payment/movieTicket/validation.js +2 -2
- package/lib/chevre/service/payment/movieTicket.js +10 -11
- package/lib/chevre/service/payment/paymentCard.js +9 -12
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +3 -0
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +1 -4
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +1 -5
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.d.ts +3 -0
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +1 -4
- package/lib/chevre/service/task/confirmPayTransaction.js +1 -3
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.d.ts +6 -0
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +37 -0
- package/lib/chevre/service/task/onOrderPaymentCompleted.d.ts +6 -0
- package/lib/chevre/service/task/onOrderPaymentCompleted.js +35 -0
- package/lib/chevre/service/task/returnPayTransaction.js +8 -3
- package/lib/chevre/service/transaction/placeOrderInProgress/result.js +16 -4
- package/lib/chevre/service/transaction/placeOrderInProgress.js +4 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +7 -6
- package/lib/chevre/service/transaction/returnOrder.js +5 -1
- package/lib/chevre/settings.d.ts +1 -2
- package/lib/chevre/settings.js +2 -5
- package/package.json +2 -2
- package/example/src/chevre/migrateEventOrganizer.ts +0 -154
|
@@ -12,16 +12,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.confirmPayTransaction = void 0;
|
|
13
13
|
const factory = require("../../factory");
|
|
14
14
|
const PayTransactionService = require("../assetTransaction/pay");
|
|
15
|
-
const payOrder_1 = require("../order/payOrder");
|
|
16
15
|
function confirmPayTransaction(data) {
|
|
17
16
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
var _a, _b;
|
|
18
18
|
// アクション開始
|
|
19
19
|
const action = yield repos.action.start(data);
|
|
20
20
|
try {
|
|
21
21
|
for (const confirmingTransaction of data.object) {
|
|
22
|
-
yield PayTransactionService.confirm({
|
|
23
|
-
transactionNumber: confirmingTransaction.transactionNumber,
|
|
24
|
-
potentialActions: {
|
|
22
|
+
yield PayTransactionService.confirm(Object.assign({ transactionNumber: confirmingTransaction.transactionNumber, potentialActions: {
|
|
25
23
|
pay: {
|
|
26
24
|
purpose: {
|
|
27
25
|
typeOf: data.purpose.typeOf,
|
|
@@ -29,8 +27,9 @@ function confirmPayTransaction(data) {
|
|
|
29
27
|
orderNumber: data.purpose.orderNumber
|
|
30
28
|
}
|
|
31
29
|
}
|
|
32
|
-
}
|
|
33
|
-
|
|
30
|
+
} }, (typeof ((_b = (_a = confirmingTransaction.object) === null || _a === void 0 ? void 0 : _a.paymentMethod) === null || _b === void 0 ? void 0 : _b.identifier) === 'string')
|
|
31
|
+
? { object: { paymentMethod: { identifier: confirmingTransaction.object.paymentMethod.identifier } } }
|
|
32
|
+
: undefined))({
|
|
34
33
|
action: repos.action,
|
|
35
34
|
accountingReport: repos.accountingReport,
|
|
36
35
|
assetTransaction: repos.assetTransaction,
|
|
@@ -59,50 +58,40 @@ function confirmPayTransaction(data) {
|
|
|
59
58
|
yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
60
59
|
// processOrder連携(2023-08-23~)
|
|
61
60
|
yield onConfirmed(data)({
|
|
62
|
-
|
|
63
|
-
order: repos.order,
|
|
64
|
-
registerActionInProgress: repos.registerServiceInProgress,
|
|
65
|
-
task: repos.task,
|
|
66
|
-
transaction: repos.transaction
|
|
61
|
+
task: repos.task
|
|
67
62
|
});
|
|
68
63
|
});
|
|
69
64
|
}
|
|
70
65
|
exports.confirmPayTransaction = confirmPayTransaction;
|
|
71
66
|
function onConfirmed(params) {
|
|
72
67
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
var _a, _b;
|
|
73
69
|
if (params.processOrder === true) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
let allPayTransactionConfirmed = false;
|
|
83
|
-
const paymentMethodIds = order.paymentMethods.filter((invoice) => typeof invoice.paymentMethodId === 'string' && invoice.paymentMethodId.length > 0)
|
|
84
|
-
.map((invoice) => invoice.paymentMethodId);
|
|
85
|
-
if (paymentMethodIds.length > 0) {
|
|
86
|
-
const referencedPayTransactions = yield repos.assetTransaction.search({
|
|
87
|
-
project: { id: { $eq: params.project.id } },
|
|
88
|
-
typeOf: factory.assetTransactionType.Pay,
|
|
89
|
-
transactionNumber: { $in: paymentMethodIds }
|
|
90
|
-
}, ['status']);
|
|
91
|
-
allPayTransactionConfirmed =
|
|
92
|
-
referencedPayTransactions.every((payTransation) => payTransation.status === factory.transactionStatusType.Confirmed);
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
allPayTransactionConfirmed = true;
|
|
96
|
-
}
|
|
97
|
-
if (allPayTransactionConfirmed) {
|
|
98
|
-
yield (0, payOrder_1.payOrder)({
|
|
99
|
-
project: { id: params.project.id },
|
|
100
|
-
object: {
|
|
70
|
+
for (const confirmingTransaction of params.object) {
|
|
71
|
+
// タスク冪等作成
|
|
72
|
+
const onAssetTransactionStatusChangedTaskData = {
|
|
73
|
+
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
74
|
+
object: Object.assign({ typeOf: factory.assetTransactionType.Pay, transactionNumber: confirmingTransaction.transactionNumber, status: factory.transactionStatusType.Confirmed }, (typeof ((_b = (_a = confirmingTransaction.object) === null || _a === void 0 ? void 0 : _a.paymentMethod) === null || _b === void 0 ? void 0 : _b.identifier) === 'string')
|
|
75
|
+
? { object: { paymentMethod: { identifier: confirmingTransaction.object.paymentMethod.identifier } } }
|
|
76
|
+
: undefined),
|
|
77
|
+
purpose: {
|
|
101
78
|
confirmationNumber: params.purpose.confirmationNumber,
|
|
102
|
-
orderNumber: params.purpose.orderNumber
|
|
79
|
+
orderNumber: params.purpose.orderNumber,
|
|
80
|
+
typeOf: 'Order'
|
|
103
81
|
},
|
|
104
82
|
useOnOrderStatusChanged: params.useOnOrderStatusChanged === true
|
|
105
|
-
}
|
|
83
|
+
};
|
|
84
|
+
const onAssetTransactionStatusChangedTask = {
|
|
85
|
+
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
86
|
+
name: factory.taskName.OnAssetTransactionStatusChanged,
|
|
87
|
+
status: factory.taskStatus.Ready,
|
|
88
|
+
runsAt: new Date(),
|
|
89
|
+
remainingNumberOfTries: 10,
|
|
90
|
+
numberOfTried: 0,
|
|
91
|
+
executionResults: [],
|
|
92
|
+
data: onAssetTransactionStatusChangedTaskData
|
|
93
|
+
};
|
|
94
|
+
yield repos.task.createOnAssetTransactionStatusChangedTaskIfNotExist(onAssetTransactionStatusChangedTask, { emitImmediately: true });
|
|
106
95
|
}
|
|
107
96
|
}
|
|
108
97
|
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { RedisRepository as RegisterServiceInProgressRepo } from '../../repo/action/registerServiceInProgress';
|
|
2
|
+
import { MongoRepository as AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
3
|
+
import { MongoRepository as OrderRepo } from '../../repo/order';
|
|
4
|
+
import { MongoRepository as TaskRepo } from '../../repo/task';
|
|
5
|
+
import { MongoRepository as TransactionRepo } from '../../repo/transaction';
|
|
6
|
+
import * as factory from '../../factory';
|
|
7
|
+
declare function onAssetTransactionStatusChanged(params: factory.task.IData<factory.taskName.OnAssetTransactionStatusChanged>): (repos: {
|
|
8
|
+
assetTransaction: AssetTransactionRepo;
|
|
9
|
+
order: OrderRepo;
|
|
10
|
+
registerActionInProgress: RegisterServiceInProgressRepo;
|
|
11
|
+
task: TaskRepo;
|
|
12
|
+
transaction: TransactionRepo;
|
|
13
|
+
}) => Promise<void>;
|
|
14
|
+
declare function paymentDue2Processing(params: {
|
|
15
|
+
project: {
|
|
16
|
+
id: string;
|
|
17
|
+
};
|
|
18
|
+
confirmationNumber: string;
|
|
19
|
+
orderNumber: string;
|
|
20
|
+
useOnOrderStatusChanged: boolean;
|
|
21
|
+
}): (repos: {
|
|
22
|
+
order: OrderRepo;
|
|
23
|
+
registerActionInProgress: RegisterServiceInProgressRepo;
|
|
24
|
+
task: TaskRepo;
|
|
25
|
+
transaction: TransactionRepo;
|
|
26
|
+
}) => Promise<void>;
|
|
27
|
+
export { onAssetTransactionStatusChanged, paymentDue2Processing };
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.paymentDue2Processing = exports.onAssetTransactionStatusChanged = void 0;
|
|
13
|
+
const findPlaceOrderTransaction_1 = require("./findPlaceOrderTransaction");
|
|
14
|
+
const onOrderStatusChanged_1 = require("./onOrderStatusChanged");
|
|
15
|
+
const factory = require("../../factory");
|
|
16
|
+
function onAssetTransactionStatusChanged(params) {
|
|
17
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
var _a, _b, _c, _d, _e;
|
|
19
|
+
if (typeof params.useOnOrderStatusChanged !== 'boolean') {
|
|
20
|
+
throw new factory.errors.Argument('useOnOrderStatusChanged', 'must be boolean');
|
|
21
|
+
}
|
|
22
|
+
switch (params.object.status) {
|
|
23
|
+
case factory.transactionStatusType.Confirmed:
|
|
24
|
+
switch (params.object.typeOf) {
|
|
25
|
+
case factory.assetTransactionType.Pay:
|
|
26
|
+
const orderNumber = (_a = params.purpose) === null || _a === void 0 ? void 0 : _a.orderNumber;
|
|
27
|
+
const confirmationNumber = (_b = params.purpose) === null || _b === void 0 ? void 0 : _b.confirmationNumber;
|
|
28
|
+
// 確定時の決済方法区分指定(2023-08-29~)
|
|
29
|
+
const specifiedPaymentMethodIdentifire = (_e = (_d = (_c = params.object) === null || _c === void 0 ? void 0 : _c.object) === null || _d === void 0 ? void 0 : _d.paymentMethod) === null || _e === void 0 ? void 0 : _e.identifier;
|
|
30
|
+
if (typeof specifiedPaymentMethodIdentifire === 'string' && specifiedPaymentMethodIdentifire.length > 0) {
|
|
31
|
+
yield fixPaymentMethodIdentifierIfPossible({
|
|
32
|
+
project: { id: params.project.id },
|
|
33
|
+
paymentMethodId: params.object.transactionNumber,
|
|
34
|
+
paymentMethod: { identifier: specifiedPaymentMethodIdentifire },
|
|
35
|
+
referencesOrder: { orderNumber }
|
|
36
|
+
})(repos);
|
|
37
|
+
}
|
|
38
|
+
if (typeof orderNumber === 'string' && typeof confirmationNumber === 'string') {
|
|
39
|
+
// PayTransactionのステータス検証
|
|
40
|
+
const processable = yield isProcessable({ project: { id: params.project.id }, orderNumber })(repos);
|
|
41
|
+
if (processable) {
|
|
42
|
+
yield paymentDue2Processing({
|
|
43
|
+
project: { id: params.project.id },
|
|
44
|
+
confirmationNumber,
|
|
45
|
+
orderNumber,
|
|
46
|
+
useOnOrderStatusChanged: params.useOnOrderStatusChanged
|
|
47
|
+
})(repos);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
break;
|
|
51
|
+
default:
|
|
52
|
+
// no op
|
|
53
|
+
}
|
|
54
|
+
break;
|
|
55
|
+
case factory.transactionStatusType.Canceled:
|
|
56
|
+
case factory.transactionStatusType.Expired:
|
|
57
|
+
switch (params.object.typeOf) {
|
|
58
|
+
case factory.assetTransactionType.Pay:
|
|
59
|
+
// 注文が存在すればキャンセル(2023-08-30~)
|
|
60
|
+
yield cancelOrderIfExist({
|
|
61
|
+
project: { id: params.project.id },
|
|
62
|
+
paymentMethodId: params.object.transactionNumber,
|
|
63
|
+
useOnOrderStatusChanged: params.useOnOrderStatusChanged
|
|
64
|
+
})(repos);
|
|
65
|
+
break;
|
|
66
|
+
default:
|
|
67
|
+
// no op
|
|
68
|
+
}
|
|
69
|
+
break;
|
|
70
|
+
default:
|
|
71
|
+
// no op
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
exports.onAssetTransactionStatusChanged = onAssetTransactionStatusChanged;
|
|
76
|
+
function fixPaymentMethodIdentifierIfPossible(params) {
|
|
77
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
const referencedPayTransactions = yield repos.assetTransaction.search({
|
|
79
|
+
project: { id: { $eq: params.project.id } },
|
|
80
|
+
typeOf: factory.assetTransactionType.Pay,
|
|
81
|
+
statuses: [factory.transactionStatusType.Confirmed],
|
|
82
|
+
transactionNumber: { $in: [params.paymentMethodId] }
|
|
83
|
+
}, ['object']);
|
|
84
|
+
const referencedPayTransaction = referencedPayTransactions.shift();
|
|
85
|
+
if (referencedPayTransaction === undefined) {
|
|
86
|
+
throw new factory.errors.NotFound(factory.assetTransactionType.Pay);
|
|
87
|
+
}
|
|
88
|
+
// 対面決済かつ決済取引上の決済方法区分と一致すれば、注文を変更
|
|
89
|
+
if (referencedPayTransaction.object.typeOf === factory.service.paymentService.PaymentServiceType.FaceToFace
|
|
90
|
+
&& referencedPayTransaction.object.paymentMethod.identifier === params.paymentMethod.identifier) {
|
|
91
|
+
yield repos.order.fixPaymentMethodIdentifier({
|
|
92
|
+
project: { id: params.project.id },
|
|
93
|
+
orderNumber: params.referencesOrder.orderNumber,
|
|
94
|
+
invoice: {
|
|
95
|
+
paymentMethodId: params.paymentMethodId,
|
|
96
|
+
paymentMethod: { identifier: params.paymentMethod.identifier }
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function isProcessable(params) {
|
|
103
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
104
|
+
// 注文のpaymentMethodIdを取得
|
|
105
|
+
const order = yield repos.order.findByOrderNumber({
|
|
106
|
+
orderNumber: params.orderNumber,
|
|
107
|
+
project: { id: params.project.id },
|
|
108
|
+
inclusion: ['paymentMethods'],
|
|
109
|
+
exclusion: []
|
|
110
|
+
});
|
|
111
|
+
// PayTransactionのステータス検証
|
|
112
|
+
let allPayTransactionConfirmed = false;
|
|
113
|
+
const paymentMethodIds = order.paymentMethods.filter((invoice) => typeof invoice.paymentMethodId === 'string' && invoice.paymentMethodId.length > 0)
|
|
114
|
+
.map((invoice) => invoice.paymentMethodId);
|
|
115
|
+
if (paymentMethodIds.length > 0) {
|
|
116
|
+
const referencedPayTransactions = yield repos.assetTransaction.search({
|
|
117
|
+
project: { id: { $eq: params.project.id } },
|
|
118
|
+
typeOf: factory.assetTransactionType.Pay,
|
|
119
|
+
transactionNumber: { $in: paymentMethodIds }
|
|
120
|
+
}, ['status']);
|
|
121
|
+
allPayTransactionConfirmed =
|
|
122
|
+
referencedPayTransactions.every((payTransation) => payTransation.status === factory.transactionStatusType.Confirmed);
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
allPayTransactionConfirmed = true;
|
|
126
|
+
}
|
|
127
|
+
return allPayTransactionConfirmed;
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
function paymentDue2Processing(params) {
|
|
131
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
132
|
+
const placeOrderTransaction = yield (0, findPlaceOrderTransaction_1.findPlaceOrderTransaction)({
|
|
133
|
+
project: { id: params.project.id },
|
|
134
|
+
confirmationNumber: params.confirmationNumber,
|
|
135
|
+
orderNumber: params.orderNumber
|
|
136
|
+
})({ transaction: repos.transaction });
|
|
137
|
+
let order = yield repos.order.findByOrderNumber({
|
|
138
|
+
orderNumber: params.orderNumber,
|
|
139
|
+
project: { id: params.project.id },
|
|
140
|
+
inclusion: [],
|
|
141
|
+
exclusion: []
|
|
142
|
+
});
|
|
143
|
+
try {
|
|
144
|
+
order = yield repos.order.changeStatus({
|
|
145
|
+
project: { id: order.project.id },
|
|
146
|
+
orderNumber: params.orderNumber,
|
|
147
|
+
orderStatus: factory.orderStatus.OrderProcessing,
|
|
148
|
+
previousOrderStatus: factory.orderStatus.OrderPaymentDue
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
let throwsError = true;
|
|
153
|
+
// すでにステータスが煤でいた場合、OrderPaymentDue->OrderProcessingの処理自体は成功しているので、後処理を続行する
|
|
154
|
+
order = yield repos.order.findByOrderNumber({
|
|
155
|
+
orderNumber: params.orderNumber,
|
|
156
|
+
project: { id: params.project.id },
|
|
157
|
+
inclusion: [],
|
|
158
|
+
exclusion: []
|
|
159
|
+
});
|
|
160
|
+
if (order.orderStatus === factory.orderStatus.OrderDelivered
|
|
161
|
+
|| order.orderStatus === factory.orderStatus.OrderReturned) {
|
|
162
|
+
throwsError = false;
|
|
163
|
+
}
|
|
164
|
+
if (throwsError) {
|
|
165
|
+
throw error;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (params.useOnOrderStatusChanged) {
|
|
169
|
+
yield (0, onOrderStatusChanged_1.onOrderStatusChanged)({
|
|
170
|
+
order: Object.assign(Object.assign({}, order), { orderStatus: factory.orderStatus.OrderProcessing // 強制的にOrderProcessingとして処理する
|
|
171
|
+
}),
|
|
172
|
+
placeOrderTransaction
|
|
173
|
+
})({
|
|
174
|
+
registerActionInProgress: repos.registerActionInProgress,
|
|
175
|
+
task: repos.task
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
exports.paymentDue2Processing = paymentDue2Processing;
|
|
181
|
+
function cancelOrderIfExist(params) {
|
|
182
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
183
|
+
if (params.paymentMethodId.length === 0) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
// 注文のpaymentMethodIdを取得
|
|
187
|
+
const ordersByPaymentMethodId = yield repos.order.search({
|
|
188
|
+
limit: 1,
|
|
189
|
+
page: 1,
|
|
190
|
+
paymentMethods: {
|
|
191
|
+
paymentMethodIds: [params.paymentMethodId]
|
|
192
|
+
},
|
|
193
|
+
project: { id: { $eq: params.project.id } }
|
|
194
|
+
}, { confirmationNumber: 1, orderNumber: 1 });
|
|
195
|
+
const orderByPaymentMethodId = ordersByPaymentMethodId.shift();
|
|
196
|
+
if (orderByPaymentMethodId !== undefined) {
|
|
197
|
+
const placeOrderTransaction = yield (0, findPlaceOrderTransaction_1.findPlaceOrderTransaction)({
|
|
198
|
+
project: { id: params.project.id },
|
|
199
|
+
confirmationNumber: orderByPaymentMethodId.confirmationNumber,
|
|
200
|
+
orderNumber: orderByPaymentMethodId.orderNumber
|
|
201
|
+
})({ transaction: repos.transaction });
|
|
202
|
+
let order;
|
|
203
|
+
try {
|
|
204
|
+
order = yield repos.order.changeStatus({
|
|
205
|
+
project: { id: params.project.id },
|
|
206
|
+
orderNumber: orderByPaymentMethodId.orderNumber,
|
|
207
|
+
orderStatus: factory.orderStatus.OrderCancelled,
|
|
208
|
+
previousOrderStatus: factory.orderStatus.OrderPaymentDue
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
throw error;
|
|
213
|
+
}
|
|
214
|
+
if (params.useOnOrderStatusChanged) {
|
|
215
|
+
yield (0, onOrderStatusChanged_1.onOrderStatusChanged)({
|
|
216
|
+
order: Object.assign(Object.assign({}, order), { orderStatus: factory.orderStatus.OrderCancelled // 強制的にOrderCancelledとして処理する
|
|
217
|
+
}),
|
|
218
|
+
placeOrderTransaction
|
|
219
|
+
})({
|
|
220
|
+
registerActionInProgress: repos.registerActionInProgress,
|
|
221
|
+
task: repos.task
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
}
|
|
@@ -21,9 +21,6 @@ export declare function createConfirmRegisterServiceActionObjectByOrder(params:
|
|
|
21
21
|
order: factory.order.IOrder;
|
|
22
22
|
}): factory.action.interact.confirm.registerService.IObject[];
|
|
23
23
|
export type IExternalOrder = Pick<factory.order.IOrder, 'project' | 'typeOf' | 'seller' | 'customer' | 'confirmationNumber' | 'orderNumber' | 'price' | 'priceCurrency' | 'orderDate' | 'name' | 'orderStatus' | 'orderedItem' | 'paymentMethods'>;
|
|
24
|
-
/**
|
|
25
|
-
* 注文作成後のアクション
|
|
26
|
-
*/
|
|
27
24
|
export declare function createOnPlaceOrderTasksByTransaction(params: {
|
|
28
25
|
object: factory.order.IOrder | IExternalOrder;
|
|
29
26
|
potentialActions?: factory.action.trade.order.IPotentialActions;
|
|
@@ -33,11 +30,17 @@ export declare function createOnPlaceOrderTasksByTransaction(params: {
|
|
|
33
30
|
*/
|
|
34
31
|
export declare function createOnOrderSentTasksByTransaction(params: {
|
|
35
32
|
potentialActions?: factory.action.transfer.send.order.IPotentialActions;
|
|
36
|
-
}): (import("@chevre/factory/lib/task").IAttributes | import("@chevre/factory/lib/task/confirmMoneyTransfer").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/createEvent").IAttributes | import("@chevre/factory/lib/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/task/givePointAward").IAttributes | import("@chevre/factory/lib/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/task/onEventChanged").IAttributes | import("@chevre/factory/lib/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/task/placeOrder").IAttributes | import("@chevre/factory/lib/task/returnOrder").IAttributes | import("@chevre/factory/lib/task/returnMoneyTransfer").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/syncScreeningRooms").IAttributes | import("@chevre/factory/lib/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/task/useReservation").IAttributes | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").IAttributes | import("@chevre/factory/lib/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/voidReserveTransaction").IAttributes)[];
|
|
33
|
+
}): (import("@chevre/factory/lib/task").IAttributes | import("@chevre/factory/lib/task/confirmMoneyTransfer").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/createEvent").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/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/returnMoneyTransfer").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/syncScreeningRooms").IAttributes | import("@chevre/factory/lib/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/task/useReservation").IAttributes | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").IAttributes | import("@chevre/factory/lib/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/voidReserveTransaction").IAttributes)[];
|
|
37
34
|
/**
|
|
38
35
|
* 注文返品後のアクション
|
|
39
36
|
*/
|
|
40
37
|
export declare function createOnOrderReturnedTasksByTransaction(params: {
|
|
41
38
|
potentialActions?: factory.action.transfer.returnAction.order.IPotentialActions;
|
|
42
|
-
}): (import("@chevre/factory/lib/task").IAttributes | import("@chevre/factory/lib/task/confirmMoneyTransfer").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/createEvent").IAttributes | import("@chevre/factory/lib/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/task/givePointAward").IAttributes | import("@chevre/factory/lib/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/task/onEventChanged").IAttributes | import("@chevre/factory/lib/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/task/placeOrder").IAttributes | import("@chevre/factory/lib/task/returnOrder").IAttributes | import("@chevre/factory/lib/task/returnMoneyTransfer").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/syncScreeningRooms").IAttributes | import("@chevre/factory/lib/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/task/useReservation").IAttributes | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").IAttributes | import("@chevre/factory/lib/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/voidReserveTransaction").IAttributes)[];
|
|
39
|
+
}): (import("@chevre/factory/lib/task").IAttributes | import("@chevre/factory/lib/task/confirmMoneyTransfer").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/createEvent").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/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/returnMoneyTransfer").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/syncScreeningRooms").IAttributes | import("@chevre/factory/lib/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/task/useReservation").IAttributes | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").IAttributes | import("@chevre/factory/lib/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/voidReserveTransaction").IAttributes)[];
|
|
40
|
+
/**
|
|
41
|
+
* 注文中止時のアクション
|
|
42
|
+
*/
|
|
43
|
+
export declare function createOnOrderCancelledTasksByTransaction(params: {
|
|
44
|
+
transaction?: factory.transaction.placeOrder.ITransaction;
|
|
45
|
+
}): (import("@chevre/factory/lib/task").IAttributes | import("@chevre/factory/lib/task/confirmMoneyTransfer").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/createEvent").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/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/returnMoneyTransfer").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/syncScreeningRooms").IAttributes | import("@chevre/factory/lib/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/task/useReservation").IAttributes | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").IAttributes | import("@chevre/factory/lib/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/voidReserveTransaction").IAttributes)[];
|
|
43
46
|
export {};
|
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
var _a;
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.createOnOrderReturnedTasksByTransaction = exports.createOnOrderSentTasksByTransaction = exports.createOnPlaceOrderTasksByTransaction = exports.createConfirmRegisterServiceActionObjectByOrder = exports.createConfirmReservationActionObject4COAByOrder = exports.createConfirmReservationActionObject4ChevreByOrder = exports.createInformTasks = exports.getOrderWithToken = void 0;
|
|
13
|
+
exports.createOnOrderCancelledTasksByTransaction = exports.createOnOrderReturnedTasksByTransaction = exports.createOnOrderSentTasksByTransaction = exports.createOnPlaceOrderTasksByTransaction = exports.createConfirmRegisterServiceActionObjectByOrder = exports.createConfirmReservationActionObject4COAByOrder = exports.createConfirmReservationActionObject4ChevreByOrder = exports.createInformTasks = exports.getOrderWithToken = void 0;
|
|
14
14
|
const google_libphonenumber_1 = require("google-libphonenumber");
|
|
15
15
|
const jwt = require("jsonwebtoken");
|
|
16
16
|
const util_1 = require("util");
|
|
@@ -262,71 +262,6 @@ function createConfirmRegisterServiceActionObjectByOrder(params) {
|
|
|
262
262
|
});
|
|
263
263
|
}
|
|
264
264
|
exports.createConfirmRegisterServiceActionObjectByOrder = createConfirmRegisterServiceActionObjectByOrder;
|
|
265
|
-
/**
|
|
266
|
-
* 注文作成後のアクション
|
|
267
|
-
*/
|
|
268
|
-
// export function onPlaceOrder(params: {
|
|
269
|
-
// object: factory.order.IOrder | IExternalOrder;
|
|
270
|
-
// potentialActions?: factory.action.trade.order.IPotentialActions;
|
|
271
|
-
// }) {
|
|
272
|
-
// return async (repos: {
|
|
273
|
-
// task: TaskRepo;
|
|
274
|
-
// }) => {
|
|
275
|
-
// const potentialActions = params.potentialActions;
|
|
276
|
-
// const now = new Date();
|
|
277
|
-
// // potentialActionsのためのタスクを生成
|
|
278
|
-
// const taskAttributes: factory.task.IAttributes<factory.taskName>[] = [];
|
|
279
|
-
// // tslint:disable-next-line:no-single-line-block-comment
|
|
280
|
-
// /* istanbul ignore else */
|
|
281
|
-
// if (potentialActions !== undefined) {
|
|
282
|
-
// // tslint:disable-next-line:no-single-line-block-comment
|
|
283
|
-
// /* istanbul ignore else */
|
|
284
|
-
// if (potentialActions.sendOrder !== undefined) {
|
|
285
|
-
// const sendOrderTask: factory.task.IAttributes<factory.taskName.SendOrder> = {
|
|
286
|
-
// project: potentialActions.sendOrder.project,
|
|
287
|
-
// name: factory.taskName.SendOrder,
|
|
288
|
-
// status: factory.taskStatus.Ready,
|
|
289
|
-
// runsAt: now, // なるはやで実行
|
|
290
|
-
// remainingNumberOfTries: 10,
|
|
291
|
-
// numberOfTried: 0,
|
|
292
|
-
// executionResults: [],
|
|
293
|
-
// // data: potentialActions.sendOrder
|
|
294
|
-
// data: {
|
|
295
|
-
// project: potentialActions.sendOrder.project,
|
|
296
|
-
// object: {
|
|
297
|
-
// ...potentialActions.sendOrder.object,
|
|
298
|
-
// confirmationNumber: params.object.confirmationNumber
|
|
299
|
-
// },
|
|
300
|
-
// ...(potentialActions.sendOrder.potentialActions !== undefined)
|
|
301
|
-
// ? { potentialActions: potentialActions.sendOrder.potentialActions }
|
|
302
|
-
// : undefined
|
|
303
|
-
// }
|
|
304
|
-
// };
|
|
305
|
-
// taskAttributes.push(sendOrderTask);
|
|
306
|
-
// }
|
|
307
|
-
// // ポイント付与
|
|
308
|
-
// // tslint:disable-next-line:no-single-line-block-comment
|
|
309
|
-
// /* istanbul ignore else */
|
|
310
|
-
// if (Array.isArray(potentialActions.givePointAward)) {
|
|
311
|
-
// taskAttributes.push(...potentialActions.givePointAward.map(
|
|
312
|
-
// (a): factory.task.IAttributes<factory.taskName.GivePointAward> => {
|
|
313
|
-
// return {
|
|
314
|
-
// project: a.project,
|
|
315
|
-
// name: factory.taskName.GivePointAward,
|
|
316
|
-
// status: factory.taskStatus.Ready,
|
|
317
|
-
// runsAt: now, // なるはやで実行
|
|
318
|
-
// remainingNumberOfTries: 10,
|
|
319
|
-
// numberOfTried: 0,
|
|
320
|
-
// executionResults: [],
|
|
321
|
-
// data: a
|
|
322
|
-
// };
|
|
323
|
-
// }));
|
|
324
|
-
// }
|
|
325
|
-
// }
|
|
326
|
-
// // タスク保管
|
|
327
|
-
// await repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
328
|
-
// };
|
|
329
|
-
// }
|
|
330
265
|
function createOnPlaceOrderTasksByTransaction(params) {
|
|
331
266
|
const potentialActions = params.potentialActions;
|
|
332
267
|
const now = new Date();
|
|
@@ -335,29 +270,33 @@ function createOnPlaceOrderTasksByTransaction(params) {
|
|
|
335
270
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
336
271
|
/* istanbul ignore else */
|
|
337
272
|
if (potentialActions !== undefined) {
|
|
273
|
+
// 冗長なsendOrderタスク作成を回避(createSendOrderTransactionTaskIfNotExistへ移行)(2023-08-25~)
|
|
338
274
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
339
275
|
/* istanbul ignore else */
|
|
340
|
-
if (potentialActions.sendOrder !== undefined) {
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
276
|
+
// if (potentialActions.sendOrder !== undefined) {
|
|
277
|
+
// const sendOrderTaskData: factory.task.IData<factory.taskName.SendOrder> = {
|
|
278
|
+
// project: potentialActions.sendOrder.project,
|
|
279
|
+
// object: {
|
|
280
|
+
// ...potentialActions.sendOrder.object,
|
|
281
|
+
// confirmationNumber: params.object.confirmationNumber
|
|
282
|
+
// }
|
|
283
|
+
// // 廃止(2023-08-21~)
|
|
284
|
+
// // ...(potentialActions.sendOrder.potentialActions !== undefined)
|
|
285
|
+
// // ? { potentialActions: potentialActions.sendOrder.potentialActions }
|
|
286
|
+
// // : undefined
|
|
287
|
+
// };
|
|
288
|
+
// const sendOrderTask: factory.task.IAttributes<factory.taskName.SendOrder> = {
|
|
289
|
+
// project: potentialActions.sendOrder.project,
|
|
290
|
+
// name: factory.taskName.SendOrder,
|
|
291
|
+
// status: factory.taskStatus.Ready,
|
|
292
|
+
// runsAt: now, // なるはやで実行
|
|
293
|
+
// remainingNumberOfTries: 10,
|
|
294
|
+
// numberOfTried: 0,
|
|
295
|
+
// executionResults: [],
|
|
296
|
+
// data: sendOrderTaskData
|
|
297
|
+
// };
|
|
298
|
+
// taskAttributes.push(sendOrderTask);
|
|
299
|
+
// }
|
|
361
300
|
// ポイント付与
|
|
362
301
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
363
302
|
/* istanbul ignore else */
|
|
@@ -503,3 +442,50 @@ function createOnOrderReturnedTasksByTransaction(params) {
|
|
|
503
442
|
return taskAttributes;
|
|
504
443
|
}
|
|
505
444
|
exports.createOnOrderReturnedTasksByTransaction = createOnOrderReturnedTasksByTransaction;
|
|
445
|
+
/**
|
|
446
|
+
* 注文中止時のアクション
|
|
447
|
+
*/
|
|
448
|
+
function createOnOrderCancelledTasksByTransaction(params) {
|
|
449
|
+
var _a;
|
|
450
|
+
const now = new Date();
|
|
451
|
+
const taskAttributes = [];
|
|
452
|
+
if (typeof ((_a = params.transaction) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
|
|
453
|
+
const voidPaymentTaskAttributes = {
|
|
454
|
+
project: params.transaction.project,
|
|
455
|
+
name: factory.taskName.VoidPayTransaction,
|
|
456
|
+
status: factory.taskStatus.Ready,
|
|
457
|
+
runsAt: now,
|
|
458
|
+
remainingNumberOfTries: 10,
|
|
459
|
+
numberOfTried: 0,
|
|
460
|
+
executionResults: [],
|
|
461
|
+
data: {
|
|
462
|
+
project: params.transaction.project,
|
|
463
|
+
purpose: {
|
|
464
|
+
typeOf: params.transaction.typeOf,
|
|
465
|
+
id: params.transaction.id,
|
|
466
|
+
result: { order: { orderStatus: factory.orderStatus.OrderCancelled } }
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
const voidReserveTaskAttributes = {
|
|
471
|
+
project: params.transaction.project,
|
|
472
|
+
name: factory.taskName.VoidReserveTransaction,
|
|
473
|
+
status: factory.taskStatus.Ready,
|
|
474
|
+
runsAt: now,
|
|
475
|
+
remainingNumberOfTries: 10,
|
|
476
|
+
numberOfTried: 0,
|
|
477
|
+
executionResults: [],
|
|
478
|
+
data: {
|
|
479
|
+
project: params.transaction.project,
|
|
480
|
+
purpose: {
|
|
481
|
+
typeOf: params.transaction.typeOf,
|
|
482
|
+
id: params.transaction.id,
|
|
483
|
+
result: { order: { orderStatus: factory.orderStatus.OrderCancelled } }
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
};
|
|
487
|
+
taskAttributes.push(voidPaymentTaskAttributes, voidReserveTaskAttributes);
|
|
488
|
+
}
|
|
489
|
+
return taskAttributes;
|
|
490
|
+
}
|
|
491
|
+
exports.createOnOrderCancelledTasksByTransaction = createOnOrderCancelledTasksByTransaction;
|