@chevre/domain 21.28.0-alpha.4 → 21.28.0-alpha.5
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/transaction/deleteTransaction.js +6 -30
- package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.js +2 -10
- package/lib/chevre/service/transaction/moneyTransfer.js +9 -23
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +3 -19
- package/lib/chevre/service/transaction/placeOrderInProgress/confirm.js +7 -19
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/sendEmailMessage.js +1 -6
- package/lib/chevre/service/transaction/placeOrderInProgress/result/orderedItem.js +1 -5
- package/lib/chevre/service/transaction/placeOrderInProgress/result.js +5 -13
- package/lib/chevre/service/transaction/placeOrderInProgress/start.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateStartRequest.js +4 -2
- package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +2 -10
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +6 -10
- package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +3 -5
- package/lib/chevre/service/transaction/returnOrder/potentialActions.js +2 -2
- package/lib/chevre/service/transaction/returnOrder/preStart.js +7 -11
- package/lib/chevre/service/transaction/returnOrder.js +1 -7
- package/lib/chevre/service/transaction/validation.js +1 -1
- package/lib/chevre/service/transaction.js +11 -14
- package/package.json +1 -1
|
@@ -63,19 +63,11 @@ function createDeleteTransactionTasksByAgentId(params) {
|
|
|
63
63
|
numberOfTried: 0,
|
|
64
64
|
executionResults: [],
|
|
65
65
|
data: {
|
|
66
|
-
object: {
|
|
67
|
-
specifyingMethod: factory.task.deleteTransaction.SpecifyingMethod.Id,
|
|
68
|
-
endDate: transaction.endDate,
|
|
69
|
-
id: transaction.id,
|
|
70
|
-
object: Object.assign(Object.assign({}, (typeof transaction.object.confirmationNumber === 'string')
|
|
66
|
+
object: Object.assign({ specifyingMethod: factory.task.deleteTransaction.SpecifyingMethod.Id, id: transaction.id, object: Object.assign(Object.assign({}, (typeof transaction.object.confirmationNumber === 'string')
|
|
71
67
|
? { confirmationNumber: transaction.object.confirmationNumber }
|
|
72
68
|
: undefined), (typeof transaction.object.orderNumber === 'string')
|
|
73
69
|
? { orderNumber: transaction.object.orderNumber }
|
|
74
|
-
: undefined),
|
|
75
|
-
project: transaction.project,
|
|
76
|
-
startDate: transaction.startDate,
|
|
77
|
-
typeOf: transaction.typeOf
|
|
78
|
-
}
|
|
70
|
+
: undefined), project: transaction.project, startDate: transaction.startDate, typeOf: transaction.typeOf }, (transaction.endDate !== undefined) ? { endDate: transaction.endDate } : undefined)
|
|
79
71
|
}
|
|
80
72
|
};
|
|
81
73
|
});
|
|
@@ -91,17 +83,9 @@ function createDeleteTransactionTasksByAgentId(params) {
|
|
|
91
83
|
numberOfTried: 0,
|
|
92
84
|
executionResults: [],
|
|
93
85
|
data: {
|
|
94
|
-
object: {
|
|
95
|
-
specifyingMethod: factory.task.deleteTransaction.SpecifyingMethod.Id,
|
|
96
|
-
endDate: transaction.endDate,
|
|
97
|
-
id: transaction.id,
|
|
98
|
-
object: {
|
|
86
|
+
object: Object.assign({ specifyingMethod: factory.task.deleteTransaction.SpecifyingMethod.Id, id: transaction.id, object: {
|
|
99
87
|
order: transaction.object.order
|
|
100
|
-
},
|
|
101
|
-
project: transaction.project,
|
|
102
|
-
startDate: transaction.startDate,
|
|
103
|
-
typeOf: transaction.typeOf
|
|
104
|
-
}
|
|
88
|
+
}, project: transaction.project, startDate: transaction.startDate, typeOf: transaction.typeOf }, (transaction.endDate !== undefined) ? { endDate: transaction.endDate } : undefined)
|
|
105
89
|
}
|
|
106
90
|
};
|
|
107
91
|
});
|
|
@@ -117,17 +101,9 @@ function createDeleteTransactionTasksByAgentId(params) {
|
|
|
117
101
|
numberOfTried: 0,
|
|
118
102
|
executionResults: [],
|
|
119
103
|
data: {
|
|
120
|
-
object: {
|
|
121
|
-
specifyingMethod: factory.task.deleteTransaction.SpecifyingMethod.Id,
|
|
122
|
-
endDate: transaction.endDate,
|
|
123
|
-
id: transaction.id,
|
|
124
|
-
object: Object.assign({}, (transaction.object.pendingTransaction !== undefined)
|
|
104
|
+
object: Object.assign({ specifyingMethod: factory.task.deleteTransaction.SpecifyingMethod.Id, id: transaction.id, object: Object.assign({}, (transaction.object.pendingTransaction !== undefined)
|
|
125
105
|
? { pendingTransaction: transaction.object.pendingTransaction }
|
|
126
|
-
: undefined),
|
|
127
|
-
project: transaction.project,
|
|
128
|
-
startDate: transaction.startDate,
|
|
129
|
-
typeOf: transaction.typeOf
|
|
130
|
-
}
|
|
106
|
+
: undefined), project: transaction.project, startDate: transaction.startDate, typeOf: transaction.typeOf }, (transaction.endDate !== undefined) ? { endDate: transaction.endDate } : undefined)
|
|
131
107
|
}
|
|
132
108
|
};
|
|
133
109
|
});
|
|
@@ -36,17 +36,9 @@ function createTasks(params) {
|
|
|
36
36
|
numberOfTried: 0,
|
|
37
37
|
executionResults: [],
|
|
38
38
|
data: {
|
|
39
|
-
object: {
|
|
40
|
-
specifyingMethod: factory.task.deleteTransaction.SpecifyingMethod.Id,
|
|
41
|
-
endDate: transaction.endDate,
|
|
42
|
-
id: transaction.id,
|
|
43
|
-
object: Object.assign({}, (transaction.object.pendingTransaction !== undefined)
|
|
39
|
+
object: Object.assign({ specifyingMethod: factory.task.deleteTransaction.SpecifyingMethod.Id, id: transaction.id, object: Object.assign({}, (transaction.object.pendingTransaction !== undefined)
|
|
44
40
|
? { pendingTransaction: transaction.object.pendingTransaction }
|
|
45
|
-
: undefined),
|
|
46
|
-
project: transaction.project,
|
|
47
|
-
startDate: transaction.startDate,
|
|
48
|
-
typeOf: transaction.typeOf
|
|
49
|
-
}
|
|
41
|
+
: undefined), project: transaction.project, startDate: transaction.startDate, typeOf: transaction.typeOf }, (transaction.endDate !== undefined) ? { endDate: transaction.endDate } : undefined)
|
|
50
42
|
}
|
|
51
43
|
};
|
|
52
44
|
taskAttributes.push(deleteTransactionTask);
|
|
@@ -73,16 +73,11 @@ function authorizePaymentCard(params) {
|
|
|
73
73
|
yield processAuthorizePaymentCard({
|
|
74
74
|
project: { id: transaction.project.id },
|
|
75
75
|
agent: { id: transaction.agent.id },
|
|
76
|
-
object: {
|
|
77
|
-
project: { typeOf: transaction.project.typeOf, id: transaction.project.id },
|
|
78
|
-
typeOf: factory.offerType.AggregateOffer,
|
|
79
|
-
itemOffered: {
|
|
76
|
+
object: Object.assign({ project: { typeOf: transaction.project.typeOf, id: transaction.project.id }, typeOf: factory.offerType.AggregateOffer, itemOffered: {
|
|
80
77
|
typeOf: factory.actionType.MoneyTransfer,
|
|
81
|
-
amount: {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
currency: transaction.object.amount.currency
|
|
85
|
-
},
|
|
78
|
+
amount: Object.assign({ typeOf: 'MonetaryAmount', currency: transaction.object.amount.currency }, (typeof transaction.object.amount.value === 'number')
|
|
79
|
+
? { value: transaction.object.amount.value }
|
|
80
|
+
: undefined),
|
|
86
81
|
toLocation: toLocation,
|
|
87
82
|
object: {
|
|
88
83
|
pendingTransaction: {
|
|
@@ -91,20 +86,13 @@ function authorizePaymentCard(params) {
|
|
|
91
86
|
transactionNumber: ''
|
|
92
87
|
}
|
|
93
88
|
}
|
|
94
|
-
},
|
|
95
|
-
fromLocation: fromLocation,
|
|
96
|
-
seller: {
|
|
97
|
-
// project: transaction.project,
|
|
89
|
+
}, fromLocation: fromLocation, seller: {
|
|
98
90
|
id: transaction.seller.id,
|
|
99
91
|
typeOf: transaction.seller.typeOf,
|
|
100
92
|
name: (typeof transaction.seller.name === 'string')
|
|
101
93
|
? transaction.seller.name
|
|
102
94
|
: String((_a = transaction.seller.name) === null || _a === void 0 ? void 0 : _a.ja)
|
|
103
|
-
},
|
|
104
|
-
price: 0,
|
|
105
|
-
priceCurrency: factory.priceCurrency.JPY,
|
|
106
|
-
description: transaction.object.description
|
|
107
|
-
},
|
|
95
|
+
}, price: 0, priceCurrency: factory.priceCurrency.JPY }, (typeof transaction.object.description === 'string') ? { description: transaction.object.description } : undefined),
|
|
108
96
|
purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
109
97
|
})(repos);
|
|
110
98
|
}
|
|
@@ -256,11 +244,9 @@ function createAuthorizeMoneyTransferOfferActionAttributes(params) {
|
|
|
256
244
|
typeOf: factory.offerType.Offer,
|
|
257
245
|
itemOffered: {
|
|
258
246
|
typeOf: factory.actionType.MoneyTransfer,
|
|
259
|
-
amount: {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
value: params.object.itemOffered.amount.value
|
|
263
|
-
},
|
|
247
|
+
amount: Object.assign({ typeOf: 'MonetaryAmount', currency: params.object.itemOffered.amount.currency }, (typeof params.object.itemOffered.amount.value === 'number')
|
|
248
|
+
? { value: params.object.itemOffered.amount.value }
|
|
249
|
+
: undefined),
|
|
264
250
|
toLocation: params.object.itemOffered.toLocation,
|
|
265
251
|
object: {
|
|
266
252
|
pendingTransaction: {
|
|
@@ -14,15 +14,7 @@ function createTasks(params) {
|
|
|
14
14
|
const taskRunsAt = params.runsAt;
|
|
15
15
|
const transactionWebhookUrls = (Array.isArray(settings_1.settings.transactionWebhookUrls)) ? settings_1.settings.transactionWebhookUrls : [];
|
|
16
16
|
const triggerWebhookTaskAttributes = transactionWebhookUrls.map((webhookUrl) => {
|
|
17
|
-
const informObject = {
|
|
18
|
-
id: transaction.id,
|
|
19
|
-
typeOf: transaction.typeOf,
|
|
20
|
-
endDate: transaction.endDate,
|
|
21
|
-
project: transaction.project,
|
|
22
|
-
seller: transaction.seller,
|
|
23
|
-
startDate: transaction.startDate,
|
|
24
|
-
status: transaction.status
|
|
25
|
-
};
|
|
17
|
+
const informObject = Object.assign({ id: transaction.id, typeOf: transaction.typeOf, project: transaction.project, seller: transaction.seller, startDate: transaction.startDate, status: transaction.status }, (transaction.endDate !== undefined) ? { endDate: transaction.endDate } : undefined);
|
|
26
18
|
return {
|
|
27
19
|
project: transaction.project,
|
|
28
20
|
name: factory.taskName.TriggerWebhook,
|
|
@@ -71,19 +63,11 @@ function createTasks(params) {
|
|
|
71
63
|
numberOfTried: 0,
|
|
72
64
|
executionResults: [],
|
|
73
65
|
data: {
|
|
74
|
-
object: {
|
|
75
|
-
specifyingMethod: factory.task.deleteTransaction.SpecifyingMethod.Id,
|
|
76
|
-
endDate: transaction.endDate,
|
|
77
|
-
id: transaction.id,
|
|
78
|
-
object: Object.assign(Object.assign({}, (typeof transaction.object.confirmationNumber === 'string')
|
|
66
|
+
object: Object.assign({ specifyingMethod: factory.task.deleteTransaction.SpecifyingMethod.Id, id: transaction.id, object: Object.assign(Object.assign({}, (typeof transaction.object.confirmationNumber === 'string')
|
|
79
67
|
? { confirmationNumber: transaction.object.confirmationNumber }
|
|
80
68
|
: undefined), (typeof transaction.object.orderNumber === 'string')
|
|
81
69
|
? { orderNumber: transaction.object.orderNumber }
|
|
82
|
-
: undefined),
|
|
83
|
-
project: transaction.project,
|
|
84
|
-
startDate: transaction.startDate,
|
|
85
|
-
typeOf: transaction.typeOf
|
|
86
|
-
}
|
|
70
|
+
: undefined), project: transaction.project, startDate: transaction.startDate, typeOf: transaction.typeOf }, (transaction.endDate !== undefined) ? { endDate: transaction.endDate } : undefined)
|
|
87
71
|
}
|
|
88
72
|
};
|
|
89
73
|
// 確定取引にも決済承認中止タスクを追加(2023-05-03~)
|
|
@@ -79,13 +79,11 @@ function confirm(params) {
|
|
|
79
79
|
.filter(({ serialNumber }) => typeof serialNumber === 'string' && serialNumbers.includes(serialNumber));
|
|
80
80
|
debug('confirming PlaceOrder...', orderNumber, acceptedOffers.length, 'acceptedOffers found in orderInTransaction.');
|
|
81
81
|
}
|
|
82
|
-
const { result, eventId, reservationIds } = createResult(Object.assign(Object.assign({}, params), { orderNumber, transaction: transaction, authorizePaymentActions,
|
|
82
|
+
const { result, eventId, reservationIds } = createResult(Object.assign(Object.assign(Object.assign({}, params), { orderNumber, transaction: transaction, authorizePaymentActions,
|
|
83
83
|
authorizeEventServiceOfferActions,
|
|
84
84
|
authorizeMoneyTansferActions,
|
|
85
85
|
authorizeProductOfferActions,
|
|
86
|
-
|
|
87
|
-
code,
|
|
88
|
-
acceptedOffers }));
|
|
86
|
+
acceptedOffers }), (typeof code === 'string') ? { code } : undefined));
|
|
89
87
|
// デフォルトEメールメッセージを検索
|
|
90
88
|
let emailMessageOnOrderSent;
|
|
91
89
|
if (repos.emailMessage !== undefined) {
|
|
@@ -98,14 +96,9 @@ function confirm(params) {
|
|
|
98
96
|
emailMessageOnOrderSent = searchEmailMessagesResult.shift();
|
|
99
97
|
}
|
|
100
98
|
// ポストアクションを作成
|
|
101
|
-
const potentialActions = yield (0, potentialActions_1.createPotentialActions)({
|
|
102
|
-
order: result.order,
|
|
99
|
+
const potentialActions = yield (0, potentialActions_1.createPotentialActions)(Object.assign(Object.assign({ order: result.order,
|
|
103
100
|
// order: orderWithAcceptedOffers, // 現時点でcreateEmailMessageでorder.acceptedOffersを使用している(2024-02-06~)
|
|
104
|
-
potentialActions: params.potentialActions,
|
|
105
|
-
transaction: transaction,
|
|
106
|
-
emailMessage: emailMessageOnOrderSent
|
|
107
|
-
// authorizeActions: completedAuthorizeActions
|
|
108
|
-
});
|
|
101
|
+
transaction: transaction }, (params.potentialActions !== undefined) ? { potentialActions: params.potentialActions } : undefined), (emailMessageOnOrderSent !== undefined) ? { emailMessage: emailMessageOnOrderSent } : undefined));
|
|
109
102
|
// ステータス変更
|
|
110
103
|
try {
|
|
111
104
|
yield repos.transaction.confirm({
|
|
@@ -126,9 +119,7 @@ function confirm(params) {
|
|
|
126
119
|
throw error;
|
|
127
120
|
}
|
|
128
121
|
const { order } = result;
|
|
129
|
-
return Object.assign({ order,
|
|
130
|
-
eventId,
|
|
131
|
-
reservationIds }, (typeof code === 'string') ? { code } : undefined);
|
|
122
|
+
return Object.assign(Object.assign(Object.assign({ order }, (typeof code === 'string') ? { code } : undefined), (typeof eventId === 'string') ? { eventId } : undefined), (Array.isArray(reservationIds)) ? { reservationIds } : undefined);
|
|
132
123
|
});
|
|
133
124
|
}
|
|
134
125
|
exports.confirm = confirm;
|
|
@@ -305,15 +296,12 @@ function createResult(params) {
|
|
|
305
296
|
eventId = reservationIdsResult.eventId;
|
|
306
297
|
reservationIds = reservationIdsResult.reservationIds;
|
|
307
298
|
}
|
|
308
|
-
return {
|
|
299
|
+
return Object.assign(Object.assign({
|
|
309
300
|
// orderWithAcceptedOffers: order,
|
|
310
301
|
result: Object.assign({ order,
|
|
311
302
|
authorizeActions, numAcceptedOffers: params.acceptedOffers.length, options: {
|
|
312
303
|
ignoreAccpetedOffersFromResult: true
|
|
313
|
-
} }, (typeof params.code === 'string') ? { code: params.code } : undefined),
|
|
314
|
-
eventId,
|
|
315
|
-
reservationIds
|
|
316
|
-
};
|
|
304
|
+
} }, (typeof params.code === 'string') ? { code: params.code } : undefined) }, (typeof eventId === 'string') ? { eventId } : undefined), (Array.isArray(reservationIds)) ? { reservationIds } : undefined);
|
|
317
305
|
}
|
|
318
306
|
function searchAuthorizeActions(params) {
|
|
319
307
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/sendEmailMessage.js
CHANGED
|
@@ -36,12 +36,7 @@ function createSendEmailMessageActions(params) {
|
|
|
36
36
|
const sendEmailMessageOnOrderSentParams = (_e = (_d = (_c = (_b = (_a = params.potentialActions) === null || _a === void 0 ? void 0 : _a.order) === null || _b === void 0 ? void 0 : _b.potentialActions) === null || _c === void 0 ? void 0 : _c.sendOrder) === null || _d === void 0 ? void 0 : _d.potentialActions) === null || _e === void 0 ? void 0 : _e.sendEmailMessage;
|
|
37
37
|
if (Array.isArray(sendEmailMessageOnOrderSentParams)) {
|
|
38
38
|
yield Promise.all(sendEmailMessageOnOrderSentParams.map((s) => __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
const emailMessage = yield emailMessageBuilder.createSendOrderMessage({
|
|
40
|
-
// project: params.order.project,
|
|
41
|
-
order: params.order,
|
|
42
|
-
email: s.object,
|
|
43
|
-
emailMessage: params.emailMessage
|
|
44
|
-
});
|
|
39
|
+
const emailMessage = yield emailMessageBuilder.createSendOrderMessage(Object.assign(Object.assign({ order: params.order }, (s.object !== undefined) ? { email: s.object } : undefined), (params.emailMessage !== undefined) ? { emailMessage: params.emailMessage } : undefined));
|
|
45
40
|
sendEmailMessageActions.push({
|
|
46
41
|
project: params.order.project,
|
|
47
42
|
typeOf: factory.actionType.SendAction,
|
|
@@ -44,11 +44,7 @@ function reservationOffers2orderedItem(params) {
|
|
|
44
44
|
if (reservationFor.typeOf === factory.eventType.ScreeningEvent
|
|
45
45
|
&& issuedThrough.typeOf === factory.product.ProductType.EventService) {
|
|
46
46
|
const reservationFor4orderedItem = {
|
|
47
|
-
location: {
|
|
48
|
-
branchCode: reservationFor.location.branchCode,
|
|
49
|
-
name: reservationFor.location.name,
|
|
50
|
-
typeOf: reservationFor.location.typeOf
|
|
51
|
-
},
|
|
47
|
+
location: Object.assign({ branchCode: reservationFor.location.branchCode, typeOf: reservationFor.location.typeOf }, (reservationFor.location.name !== undefined) ? { name: reservationFor.location.name } : undefined),
|
|
52
48
|
typeOf: reservationFor.typeOf,
|
|
53
49
|
id: reservationFor.id,
|
|
54
50
|
name: reservationFor.name,
|
|
@@ -71,19 +71,11 @@ function createPaymentMethods(params) {
|
|
|
71
71
|
const paymentMethodOfInvoice = Object.assign({ identifier: paymentMethodType }, (typeof paymentMethodAmountCurrencyByAuthorizeAction === 'string') ?
|
|
72
72
|
{ amount: { currency: paymentMethodAmountCurrencyByAuthorizeAction } } // CreditCardIFのカード通貨区分を追加(2023-08-15~)
|
|
73
73
|
: undefined);
|
|
74
|
-
paymentMethods.push({
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
paymentMethodId: resultAsInvoice.paymentMethodId,
|
|
80
|
-
paymentStatus: resultAsInvoice.paymentStatus,
|
|
81
|
-
totalPaymentDue: resultAsInvoice.totalPaymentDue,
|
|
82
|
-
paymentMethod: paymentMethodOfInvoice
|
|
83
|
-
// ...(USE_ORDER_PAYMENT_METHOD_TYPE_OF) // 完全廃止(2024-01-17~)
|
|
84
|
-
// ? { typeOf: paymentMethodType }
|
|
85
|
-
// : undefined
|
|
86
|
-
});
|
|
74
|
+
paymentMethods.push(Object.assign({ accountId: resultAsInvoice.accountId, additionalProperty: (Array.isArray(resultAsInvoice.additionalProperty)) ? resultAsInvoice.additionalProperty : [], issuedThrough: resultAsInvoice.issuedThrough, name: resultAsInvoice.name, paymentMethodId: resultAsInvoice.paymentMethodId, paymentStatus: resultAsInvoice.paymentStatus, paymentMethod: paymentMethodOfInvoice }, (resultAsInvoice.totalPaymentDue !== undefined) ? { totalPaymentDue: resultAsInvoice.totalPaymentDue } : undefined
|
|
75
|
+
// ...(USE_ORDER_PAYMENT_METHOD_TYPE_OF) // 完全廃止(2024-01-17~)
|
|
76
|
+
// ? { typeOf: paymentMethodType }
|
|
77
|
+
// : undefined
|
|
78
|
+
));
|
|
87
79
|
});
|
|
88
80
|
// 決済方法から注文金額の計算
|
|
89
81
|
price += params.authorizePaymentActions
|
|
@@ -22,7 +22,7 @@ function start(params) {
|
|
|
22
22
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
23
23
|
var _a;
|
|
24
24
|
const { passport, customerType } = yield (0, validation_1.validateWaiterPassport)(params);
|
|
25
|
-
const { memeberOfPayload, sellerMakesOffer, seller } = yield (0, validateStartRequest_1.validateStartRequest)(Object.assign({ project: { id: params.project.id }, seller: { id: params.seller.id }
|
|
25
|
+
const { memeberOfPayload, sellerMakesOffer, seller } = yield (0, validateStartRequest_1.validateStartRequest)(Object.assign(Object.assign(Object.assign({ project: { id: params.project.id }, seller: { id: params.seller.id } }, (typeof (passport === null || passport === void 0 ? void 0 : passport.scope) === 'string') ? { customerType } : undefined), (params.object.clientUser !== undefined) ? { clientUser: params.object.clientUser } : undefined), (typeof params.agent.memberOfToken === 'string') ? { memberOfToken: params.agent.memberOfToken } : undefined))(repos);
|
|
26
26
|
const expiresInSeconds = (_a = sellerMakesOffer.eligibleTransactionDuration) === null || _a === void 0 ? void 0 : _a.maxValue;
|
|
27
27
|
if (typeof expiresInSeconds !== 'number') {
|
|
28
28
|
throw new factory.errors.NotFound('eligibleTransactionDuration.maxValue');
|
package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateStartRequest.js
CHANGED
|
@@ -49,6 +49,7 @@ function verifyMembershipToken(params) {
|
|
|
49
49
|
return result;
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
+
// tslint:disable-next-line:max-func-body-length
|
|
52
53
|
function validateStartRequest(params) {
|
|
53
54
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
54
55
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -119,10 +120,11 @@ function validateStartRequest(params) {
|
|
|
119
120
|
const verifySecret = (_d = (_c = iamMember.member.member[0]) === null || _c === void 0 ? void 0 : _c.memberOf) === null || _d === void 0 ? void 0 : _d.secret; // ひとまず1種類のメンバーシップのみ対応
|
|
120
121
|
const verifyIssuer = (_f = (_e = iamMember.member.member[0]) === null || _e === void 0 ? void 0 : _e.memberOf) === null || _f === void 0 ? void 0 : _f.issuer; // ひとまず1種類のメンバーシップのみ対応
|
|
121
122
|
if (typeof verifySecret === 'string') {
|
|
122
|
-
memeberOfPayload = yield verifyMembershipToken({ token: params.memberOfToken
|
|
123
|
+
memeberOfPayload = yield verifyMembershipToken(Object.assign(Object.assign({ secret: verifySecret }, (typeof params.memberOfToken === 'string') ? { token: params.memberOfToken } : undefined), (typeof verifyIssuer === 'string') ? { issuer: verifyIssuer } : undefined));
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
|
-
return { sellerMakesOffer,
|
|
126
|
+
return Object.assign({ sellerMakesOffer,
|
|
127
|
+
seller }, (memeberOfPayload !== undefined) ? { memeberOfPayload } : undefined);
|
|
126
128
|
});
|
|
127
129
|
}
|
|
128
130
|
exports.validateStartRequest = validateStartRequest;
|
|
@@ -36,17 +36,9 @@ function createTasks(params) {
|
|
|
36
36
|
numberOfTried: 0,
|
|
37
37
|
executionResults: [],
|
|
38
38
|
data: {
|
|
39
|
-
object: {
|
|
40
|
-
specifyingMethod: factory.task.deleteTransaction.SpecifyingMethod.Id,
|
|
41
|
-
endDate: transaction.endDate,
|
|
42
|
-
id: transaction.id,
|
|
43
|
-
object: {
|
|
39
|
+
object: Object.assign({ specifyingMethod: factory.task.deleteTransaction.SpecifyingMethod.Id, id: transaction.id, object: {
|
|
44
40
|
order: transaction.object.order
|
|
45
|
-
},
|
|
46
|
-
project: transaction.project,
|
|
47
|
-
startDate: transaction.startDate,
|
|
48
|
-
typeOf: transaction.typeOf
|
|
49
|
-
}
|
|
41
|
+
}, project: transaction.project, startDate: transaction.startDate, typeOf: transaction.typeOf }, (transaction.endDate !== undefined) ? { endDate: transaction.endDate } : undefined)
|
|
50
42
|
}
|
|
51
43
|
};
|
|
52
44
|
taskAttributes.push(deleteTransactionTask);
|
|
@@ -115,11 +115,9 @@ function createReturnPaymentMethodActions(params) {
|
|
|
115
115
|
return paymentMethod.issuedThrough.typeOf !== factory.service.paymentService.PaymentServiceType.MovieTicket;
|
|
116
116
|
})
|
|
117
117
|
.map((referencedInvoice) => __awaiter(this, void 0, void 0, function* () {
|
|
118
|
-
const potentialActionsOnRefund = yield createReturnPaymentMethodPotentialActions({
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
returnOrderActionParams: params.returnOrderActionParams
|
|
122
|
-
});
|
|
118
|
+
const potentialActionsOnRefund = yield createReturnPaymentMethodPotentialActions(Object.assign({ paymentMethod: { paymentMethodId: referencedInvoice.paymentMethodId }, order: params.order }, (params.returnOrderActionParams !== undefined)
|
|
119
|
+
? { returnOrderActionParams: params.returnOrderActionParams }
|
|
120
|
+
: undefined));
|
|
123
121
|
const { paymentStatus } = referencedInvoice, referencedInvoiceAsObject = __rest(referencedInvoice, ["paymentStatus"]);
|
|
124
122
|
const object = Object.assign(Object.assign({}, referencedInvoiceAsObject), { typeOf: 'Invoice' });
|
|
125
123
|
return {
|
|
@@ -185,11 +183,9 @@ function createReturnPaymentMethodIssuedThroughMovieTicketActions(params) {
|
|
|
185
183
|
return returnPaymentMethod;
|
|
186
184
|
})
|
|
187
185
|
.map((referencedInvoice) => __awaiter(this, void 0, void 0, function* () {
|
|
188
|
-
const potentialActionsOnRefund = yield createReturnPaymentMethodPotentialActions({
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
returnOrderActionParams: params.returnOrderActionParams
|
|
192
|
-
});
|
|
186
|
+
const potentialActionsOnRefund = yield createReturnPaymentMethodPotentialActions(Object.assign({ paymentMethod: { paymentMethodId: referencedInvoice.paymentMethodId }, order: params.order }, (params.returnOrderActionParams !== undefined)
|
|
187
|
+
? { returnOrderActionParams: params.returnOrderActionParams }
|
|
188
|
+
: undefined));
|
|
193
189
|
const { paymentStatus } = referencedInvoice, referencedInvoiceAsObject = __rest(referencedInvoice, ["paymentStatus"]);
|
|
194
190
|
const object = Object.assign(Object.assign({}, referencedInvoiceAsObject), { typeOf: 'Invoice' });
|
|
195
191
|
return {
|
|
@@ -36,11 +36,9 @@ function createSendEmailMessaegActionsOnReturn(params) {
|
|
|
36
36
|
const sendEmailMessage = (_b = (_a = params.returnOrderActionParams) === null || _a === void 0 ? void 0 : _a.potentialActions) === null || _b === void 0 ? void 0 : _b.sendEmailMessage;
|
|
37
37
|
if (Array.isArray(sendEmailMessage)) {
|
|
38
38
|
sendEmailMessaegActionsOnReturn.push(...yield Promise.all(sendEmailMessage.map((sendEmailMessageParams) => __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
const emailMessage = yield emailMessageBuilder.createReturnOrderMessage({
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
emailMessage: params.emailMessageOnOrderReturned
|
|
43
|
-
});
|
|
39
|
+
const emailMessage = yield emailMessageBuilder.createReturnOrderMessage(Object.assign(Object.assign({ order }, (sendEmailMessageParams.object !== undefined) ? { email: sendEmailMessageParams.object } : undefined), (params.emailMessageOnOrderReturned !== undefined)
|
|
40
|
+
? { emailMessage: params.emailMessageOnOrderReturned }
|
|
41
|
+
: undefined));
|
|
44
42
|
return {
|
|
45
43
|
project: order.project,
|
|
46
44
|
typeOf: factory.actionType.SendAction,
|
|
@@ -31,7 +31,7 @@ function createPotentialActions(params) {
|
|
|
31
31
|
}
|
|
32
32
|
const returnOrderActionParams = returnOrderParams === null || returnOrderParams === void 0 ? void 0 : returnOrderParams.find((p) => { var _a; return ((_a = p.object) === null || _a === void 0 ? void 0 : _a.orderNumber) === order.orderNumber; });
|
|
33
33
|
// 決済返却アクション
|
|
34
|
-
const returnPaymentMethodActions = yield (0, returnPaymentMethod_1.createReturnPaymentMethodActions)(Object.assign(Object.assign({}, params), { order, returnOrderActionParams }));
|
|
34
|
+
const returnPaymentMethodActions = yield (0, returnPaymentMethod_1.createReturnPaymentMethodActions)(Object.assign(Object.assign(Object.assign({}, params), { order }), (returnOrderActionParams !== undefined) ? { returnOrderActionParams } : undefined));
|
|
35
35
|
// ポイント特典の数だけ、返却アクションを作成
|
|
36
36
|
const returnPointAwardActions = yield (0, returnPointAward_1.createReturnPointAwardActions)(Object.assign(Object.assign({}, params), { order }));
|
|
37
37
|
// onOrderReturnedで生成へ移行(2024-02-04~)
|
|
@@ -41,7 +41,7 @@ function createPotentialActions(params) {
|
|
|
41
41
|
// moneyTransferAcceptedOffers: params.moneyTransferAcceptedOffers
|
|
42
42
|
// });
|
|
43
43
|
// 返品後のEメール送信アクション
|
|
44
|
-
const sendEmailMessaegActionsOnReturn = yield (0, sendEmailMessage_1.createSendEmailMessaegActionsOnReturn)(Object.assign(Object.assign({}, params), { order, returnOrderActionParams }));
|
|
44
|
+
const sendEmailMessaegActionsOnReturn = yield (0, sendEmailMessage_1.createSendEmailMessaegActionsOnReturn)(Object.assign(Object.assign(Object.assign({}, params), { order }), (returnOrderActionParams !== undefined) ? { returnOrderActionParams } : undefined));
|
|
45
45
|
const potentialActionsOnReturnOrder = {
|
|
46
46
|
returnPaymentMethod: returnPaymentMethodActions,
|
|
47
47
|
// returnMoneyTransfer: returnMoneyTransferActions, // onOrderReturnedで生成へ移行(2024-02-04~)
|
|
@@ -81,19 +81,13 @@ function preStart(params) {
|
|
|
81
81
|
inclusion: ['hasMerchantReturnPolicy'],
|
|
82
82
|
exclusion: []
|
|
83
83
|
});
|
|
84
|
-
const appliedReturnPolicy = yield findApplicableReturnPolicy({
|
|
85
|
-
acceptedOffers,
|
|
84
|
+
const appliedReturnPolicy = yield findApplicableReturnPolicy(Object.assign({ acceptedOffers,
|
|
86
85
|
events,
|
|
87
86
|
offerItemConditions,
|
|
88
|
-
orders,
|
|
89
|
-
returningDate: now,
|
|
90
|
-
reason: params.object.reason,
|
|
91
|
-
returnPolicies,
|
|
92
|
-
returnPolicySettingsByProject: hasMerchantReturnPolicy,
|
|
87
|
+
orders, returningDate: now, reason: params.object.reason, returnPolicies,
|
|
93
88
|
offers,
|
|
94
89
|
policiesByOffer,
|
|
95
|
-
usedReservationExists
|
|
96
|
-
});
|
|
90
|
+
usedReservationExists }, (hasMerchantReturnPolicy !== undefined) ? { returnPolicySettingsByProject: hasMerchantReturnPolicy } : undefined));
|
|
97
91
|
validateAppliedReturnPolicy({ merchantReturnPolicy: appliedReturnPolicy });
|
|
98
92
|
// アイテム検証
|
|
99
93
|
yield validateItems({ orders, reason: params.object.reason })({ order: repos.order, reservation: repos.reservation });
|
|
@@ -418,8 +412,10 @@ function findApplicableReturnPolicy(params) {
|
|
|
418
412
|
throw new factory.errors.NotFound('OfferItemCondition');
|
|
419
413
|
}
|
|
420
414
|
}
|
|
421
|
-
return Object.assign({
|
|
422
|
-
returnFeesMovieTicket, typeOf: appliedReturnPolicy.typeOf }, (typeof
|
|
415
|
+
return Object.assign(Object.assign({ restockingFee: appliedReturnPolicy.restockingFee, returnFees,
|
|
416
|
+
returnFeesMovieTicket, typeOf: appliedReturnPolicy.typeOf }, (typeof appliedReturnPolicy.merchantReturnDays === 'number')
|
|
417
|
+
? { merchantReturnDays: appliedReturnPolicy.merchantReturnDays }
|
|
418
|
+
: undefined), (typeof (appliedItemCondition === null || appliedItemCondition === void 0 ? void 0 : appliedItemCondition.typeOf) === 'string') ? { itemCondition: appliedItemCondition } : undefined);
|
|
423
419
|
});
|
|
424
420
|
}
|
|
425
421
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
@@ -105,13 +105,7 @@ function confirm(params) {
|
|
|
105
105
|
emailMessageOnOrderReturned = searchEmailMessagesResult.shift();
|
|
106
106
|
}
|
|
107
107
|
const result = {};
|
|
108
|
-
const potentialActions = yield (0, potentialActions_1.createPotentialActions)({
|
|
109
|
-
dateReturned: params.object.order.dateReturned,
|
|
110
|
-
orders: orders,
|
|
111
|
-
potentialActions: params.potentialActions,
|
|
112
|
-
transaction: transaction,
|
|
113
|
-
emailMessageOnOrderReturned: emailMessageOnOrderReturned
|
|
114
|
-
});
|
|
108
|
+
const potentialActions = yield (0, potentialActions_1.createPotentialActions)(Object.assign(Object.assign({ dateReturned: params.object.order.dateReturned, orders: orders, transaction: transaction }, (params.potentialActions !== undefined) ? { potentialActions: params.potentialActions } : undefined), (emailMessageOnOrderReturned !== undefined) ? { emailMessageOnOrderReturned } : undefined));
|
|
115
109
|
// ステータス変更
|
|
116
110
|
yield repos.transaction.confirm({
|
|
117
111
|
typeOf: transaction.typeOf,
|
|
@@ -95,7 +95,7 @@ function validateWaiterPassport(params) {
|
|
|
95
95
|
// tslint:disable-next-line:no-magic-numbers
|
|
96
96
|
customerType = splittedScope[3];
|
|
97
97
|
}
|
|
98
|
-
return { customerType, passport };
|
|
98
|
+
return Object.assign(Object.assign({}, (typeof customerType === 'string') ? { customerType } : undefined), { passport });
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
101
|
exports.validateWaiterPassport = validateWaiterPassport;
|
|
@@ -81,35 +81,32 @@ exports.updateAgent = updateAgent;
|
|
|
81
81
|
function exportTasks(params) {
|
|
82
82
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
83
83
|
var _a;
|
|
84
|
-
const transaction = yield repos.transaction.startExportTasks(Object.assign(
|
|
84
|
+
const transaction = yield repos.transaction.startExportTasks(Object.assign(Object.assign(Object.assign({ status: params.status, tasksExportAction: {
|
|
85
85
|
agent: {
|
|
86
86
|
name: (typeof ((_a = params.tasksExportAction) === null || _a === void 0 ? void 0 : _a.agent.name) === 'string')
|
|
87
87
|
? params.tasksExportAction.agent.name
|
|
88
88
|
: settings_1.DEFAULT_TASKS_EXPORT_AGENT_NAME
|
|
89
89
|
}
|
|
90
|
-
} }, (typeof params.id === 'string') ? { id: params.id } : undefined));
|
|
90
|
+
} }, (params.typeOf !== undefined) ? { typeOf: params.typeOf } : undefined), (params.project !== undefined) ? { project: params.project } : undefined), (typeof params.id === 'string') ? { id: params.id } : undefined));
|
|
91
91
|
if (transaction === null) {
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
94
|
// 失敗してもここでは戻さない(RUNNINGのまま待機)
|
|
95
95
|
switch (transaction.typeOf) {
|
|
96
96
|
case factory.transactionType.MoneyTransfer:
|
|
97
|
-
yield MoneyTransferTransactionService.exportTasksById({
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
})(repos);
|
|
97
|
+
yield MoneyTransferTransactionService.exportTasksById(Object.assign({ id: transaction.id }, (typeof params.runsTasksAfterInSeconds === 'number')
|
|
98
|
+
? { runsTasksAfterInSeconds: params.runsTasksAfterInSeconds }
|
|
99
|
+
: undefined))(repos);
|
|
101
100
|
break;
|
|
102
101
|
case factory.transactionType.PlaceOrder:
|
|
103
|
-
yield PlaceOrderTransactionService.exportTasksById({
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
})(repos);
|
|
102
|
+
yield PlaceOrderTransactionService.exportTasksById(Object.assign({ id: transaction.id }, (typeof params.runsTasksAfterInSeconds === 'number')
|
|
103
|
+
? { runsTasksAfterInSeconds: params.runsTasksAfterInSeconds }
|
|
104
|
+
: undefined))(repos);
|
|
107
105
|
break;
|
|
108
106
|
case factory.transactionType.ReturnOrder:
|
|
109
|
-
yield ReturnOrderTransactionService.exportTasksById({
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
})(repos);
|
|
107
|
+
yield ReturnOrderTransactionService.exportTasksById(Object.assign({ id: transaction.id }, (typeof params.runsTasksAfterInSeconds === 'number')
|
|
108
|
+
? { runsTasksAfterInSeconds: params.runsTasksAfterInSeconds }
|
|
109
|
+
: undefined))(repos);
|
|
113
110
|
break;
|
|
114
111
|
default:
|
|
115
112
|
}
|
package/package.json
CHANGED