@chevre/domain 24.0.0-alpha.1 → 24.0.0-alpha.11
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/repo/acceptedPaymentMethod.js +1 -1
- package/lib/chevre/repo/additionalProperty.js +1 -1
- package/lib/chevre/repo/aggregateOffer.js +1 -1
- package/lib/chevre/repo/confirmationNumber.js +2 -4
- package/lib/chevre/repo/creativeWork.js +1 -1
- package/lib/chevre/repo/eventOffer.js +1 -1
- package/lib/chevre/repo/eventSeries.js +1 -1
- package/lib/chevre/repo/identity.js +1 -2
- package/lib/chevre/repo/issuer.js +2 -4
- package/lib/chevre/repo/message.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/transaction.js +31 -0
- package/lib/chevre/repo/note.js +1 -1
- package/lib/chevre/repo/noteAboutOrder.js +1 -1
- package/lib/chevre/repo/offer/unitPriceInCatalog.js +1 -1
- package/lib/chevre/repo/offerItemCondition.js +1 -1
- package/lib/chevre/repo/order.js +1 -1
- package/lib/chevre/repo/orderInTransaction.d.ts +8 -0
- package/lib/chevre/repo/orderInTransaction.js +17 -4
- package/lib/chevre/repo/orderNumber.d.ts +3 -2
- package/lib/chevre/repo/orderNumber.js +25 -32
- package/lib/chevre/repo/place/movieTheater.js +1 -1
- package/lib/chevre/repo/place/seat.js +1 -1
- package/lib/chevre/repo/product.js +1 -1
- package/lib/chevre/repo/productOffer.js +1 -1
- package/lib/chevre/repo/project.js +1 -1
- package/lib/chevre/repo/reservation.js +1 -1
- package/lib/chevre/repo/role.js +1 -2
- package/lib/chevre/repo/seller.js +1 -1
- package/lib/chevre/repo/serviceOutputIdentifier.js +2 -4
- package/lib/chevre/repo/transaction/placeOrder.d.ts +140 -0
- package/lib/chevre/repo/transaction/placeOrder.js +528 -0
- package/lib/chevre/repo/transaction/returnOrder.d.ts +23 -0
- package/lib/chevre/repo/transaction/returnOrder.js +213 -0
- package/lib/chevre/repo/transaction.d.ts +11 -84
- package/lib/chevre/repo/transaction.js +331 -270
- package/lib/chevre/repo/transactionNumber.js +2 -4
- package/lib/chevre/repo/trip.js +1 -2
- package/lib/chevre/repository.d.ts +12 -0
- package/lib/chevre/repository.js +26 -1
- package/lib/chevre/service/account.js +14 -21
- package/lib/chevre/service/accountTransaction/deposit.js +2 -8
- package/lib/chevre/service/accountTransaction/transfer.js +2 -8
- package/lib/chevre/service/accountTransaction/withdraw.js +2 -8
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +24 -32
- package/lib/chevre/service/assetTransaction/cancelReservationCOA.js +2 -4
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +2 -23
- package/lib/chevre/service/assetTransaction/pay/check.js +6 -11
- package/lib/chevre/service/assetTransaction/pay/confirm.js +1 -2
- package/lib/chevre/service/assetTransaction/pay/searchGMOTrade.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/start/factory.d.ts +51 -3
- package/lib/chevre/service/assetTransaction/pay/start/factory.js +58 -21
- package/lib/chevre/service/assetTransaction/pay/start/preStart/fixPaymentService.d.ts +10 -0
- package/lib/chevre/service/assetTransaction/pay/start/preStart/fixPaymentService.js +88 -0
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorize.d.ts +53 -0
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorize.js +56 -0
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeMovieTicket.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeMovieTicket.js +1 -11
- package/lib/chevre/service/assetTransaction/pay/start.js +8 -132
- package/lib/chevre/service/assetTransaction/refund.js +13 -20
- package/lib/chevre/service/assetTransaction/registerService.js +1 -7
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.js +2 -4
- package/lib/chevre/service/assetTransaction/reserveCOA.js +2 -4
- package/lib/chevre/service/delivery/product/factory.js +1 -2
- package/lib/chevre/service/delivery/reservation/factory.js +1 -2
- package/lib/chevre/service/event/saveScreeningEvents.js +1 -0
- package/lib/chevre/service/event.js +0 -1
- package/lib/chevre/service/moneyTransfer.js +2 -2
- package/lib/chevre/service/notification/factory.js +1 -1
- package/lib/chevre/service/notification/notifyByEmail.js +50 -56
- package/lib/chevre/service/notification/sendEmailMessage.js +2 -3
- package/lib/chevre/service/notification/triggerWebhook.js +32 -37
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.js +1 -2
- package/lib/chevre/service/offer/event/authorize.d.ts +2 -2
- package/lib/chevre/service/offer/event/authorize.js +4 -4
- package/lib/chevre/service/offer/event/issueEventOfferTicket.d.ts +2 -2
- package/lib/chevre/service/offer/event/issueEventOfferTicket.js +1 -1
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.d.ts +0 -2
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.js +1 -0
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -2
- package/lib/chevre/service/offer/event/voidTransaction.js +2 -2
- package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +2 -2
- package/lib/chevre/service/offer/event/voidTransactionByActionId.js +2 -2
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer/authorize.js +1 -2
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.d.ts +2 -2
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +6 -6
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +2 -2
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +3 -10
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +2 -2
- package/lib/chevre/service/offer/moneyTransfer/authorize.d.ts +2 -2
- package/lib/chevre/service/offer/moneyTransfer/authorize.js +53 -57
- package/lib/chevre/service/offer/moneyTransfer/voidTransaction.d.ts +2 -2
- package/lib/chevre/service/offer/moneyTransfer/voidTransaction.js +4 -1
- package/lib/chevre/service/offer/product.d.ts +3 -3
- package/lib/chevre/service/offer/product.js +4 -4
- package/lib/chevre/service/order/confirmPayTransaction.d.ts +0 -2
- package/lib/chevre/service/order/confirmPayTransaction.js +1 -0
- package/lib/chevre/service/order/findPlaceOrderTransaction.d.ts +2 -2
- package/lib/chevre/service/order/findPlaceOrderTransaction.js +1 -1
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +4 -4
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +10 -19
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +1 -1
- package/lib/chevre/service/order/onOrderUpdated.js +1 -2
- package/lib/chevre/service/order/payOrder.d.ts +2 -2
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.d.ts +2 -2
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +2 -3
- package/lib/chevre/service/order/placeOrder.d.ts +2 -2
- package/lib/chevre/service/order/returnOrder.d.ts +2 -2
- package/lib/chevre/service/order/returnOrder.js +2 -2
- package/lib/chevre/service/order/sendOrder.d.ts +2 -2
- package/lib/chevre/service/order/sendOrder.js +1 -1
- package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.d.ts +3 -3
- package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts +3 -3
- package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.js +1 -1
- package/lib/chevre/service/payment/any/fixOrderAsNeeded.d.ts +2 -2
- package/lib/chevre/service/payment/any/fixOrderAsNeeded.js +4 -8
- package/lib/chevre/service/payment/any/publishPaymentUrl/fixTransactionNumberOnPublishPaymentUrl.d.ts +2 -2
- package/lib/chevre/service/payment/any.d.ts +6 -6
- package/lib/chevre/service/payment/any.js +10 -11
- package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.js +1 -2
- package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard3ds.d.ts +1 -1
- package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard3ds.js +1 -2
- package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard3dsResult2recipe.d.ts +1 -1
- package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCardResult2recipe.d.ts +1 -1
- package/lib/chevre/service/payment/creditCard/factory.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket/authorize.js +1 -1
- package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.js +2 -4
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +4 -6
- package/lib/chevre/service/payment/movieTicket/voidTransaction.js +1 -2
- package/lib/chevre/service/payment/paymentCard.js +2 -4
- package/lib/chevre/service/report/telemetry.d.ts +4 -0
- package/lib/chevre/service/report/telemetry.js +7 -12
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +2 -6
- package/lib/chevre/service/task/acceptCOAOffer.js +6 -4
- package/lib/chevre/service/task/authorizePayment.js +4 -2
- package/lib/chevre/service/task/confirmPayTransaction.js +2 -2
- package/lib/chevre/service/task/confirmReserveTransaction.js +1 -2
- package/lib/chevre/service/task/deleteTransaction.js +5 -1
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +4 -2
- package/lib/chevre/service/task/onOrderPaymentCompleted.js +2 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.js +3 -6
- package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated/syncOfferCatalog.js +1 -1
- package/lib/chevre/service/task/pay.js +1 -2
- package/lib/chevre/service/task/placeOrder.js +6 -4
- package/lib/chevre/service/task/publishPaymentUrl.js +4 -2
- package/lib/chevre/service/task/returnOrder.js +4 -4
- package/lib/chevre/service/task/returnPayTransaction.js +4 -3
- package/lib/chevre/service/task/sendOrder.js +2 -2
- package/lib/chevre/service/task/voidMoneyTransferTransaction.js +6 -3
- package/lib/chevre/service/task/voidPayTransaction.js +4 -2
- package/lib/chevre/service/task/voidRegisterServiceTransaction.js +3 -3
- package/lib/chevre/service/task/voidReserveTransaction.js +5 -4
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +4 -0
- package/lib/chevre/service/transaction/deleteTransaction.js +57 -15
- package/lib/chevre/service/transaction/moneyTransfer.js +15 -23
- package/lib/chevre/service/transaction/placeOrder/confirm/publishCode.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm.d.ts +2 -2
- package/lib/chevre/service/transaction/placeOrder/confirm.js +12 -13
- package/lib/chevre/service/transaction/placeOrder/exportTasksById.d.ts +2 -2
- package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/{publishOrderNumberIfNotExist.d.ts → issueOrderNumberIfNotExist.d.ts} +4 -4
- package/lib/chevre/service/transaction/placeOrder/{publishOrderNumberIfNotExist.js → issueOrderNumberIfNotExist.js} +21 -13
- package/lib/chevre/service/transaction/placeOrder/publishConfirmationNumberIfNotExist.d.ts +2 -2
- package/lib/chevre/service/transaction/placeOrder/publishConfirmationNumberIfNotExist.js +3 -3
- package/lib/chevre/service/transaction/placeOrder/start/validateStartRequest.js +1 -2
- package/lib/chevre/service/transaction/placeOrder/start.d.ts +3 -3
- package/lib/chevre/service/transaction/placeOrder/start.js +2 -2
- package/lib/chevre/service/transaction/placeOrder/updateAgent.d.ts +23 -0
- package/lib/chevre/service/transaction/placeOrder/updateAgent.js +126 -0
- package/lib/chevre/service/transaction/placeOrder.d.ts +2 -1
- package/lib/chevre/service/transaction/placeOrder.js +3 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions.js +1 -2
- package/lib/chevre/service/transaction/returnOrder/preStart/getReturnPolicyByProject.js +1 -1
- package/lib/chevre/service/transaction/returnOrder.js +4 -4
- package/lib/chevre/service/transaction.d.ts +5 -21
- package/lib/chevre/service/transaction.js +5 -111
- package/package.json +6 -18
|
@@ -41,64 +41,58 @@ function notifyByEmail(params) {
|
|
|
41
41
|
const message = util.format('\n%s\n%s\n%s\n%s\n%s\n\n%s', `[${logLevel}] ${shortSubject}`, `now:${(new Date()).toISOString()}`, `pid:${process.pid}`, `GAE_APPLICATION:${process.env.GAE_APPLICATION}`,
|
|
42
42
|
// `GAE_INSTANCE:${process.env.GAE_INSTANCE}`,
|
|
43
43
|
`GAE_SERVICE:${process.env.GAE_SERVICE}`, params.content);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (typeof apiKey !== 'string') {
|
|
48
|
-
throw new factory.errors.Internal('API Key not found');
|
|
49
|
-
}
|
|
50
|
-
const senderName = credentials.sendGrid.alert?.sender?.name;
|
|
51
|
-
const senderEmail = credentials.sendGrid.alert?.sender?.email;
|
|
52
|
-
const toRecipientEmail = (Array.isArray(credentials.sendGrid.alert?.toRecipient))
|
|
53
|
-
? credentials.sendGrid.alert?.toRecipient.at(0)?.email
|
|
54
|
-
: undefined;
|
|
55
|
-
if (typeof senderName !== 'string') {
|
|
56
|
-
throw new factory.errors.Internal('senderName not found');
|
|
57
|
-
}
|
|
58
|
-
if (typeof senderEmail !== 'string') {
|
|
59
|
-
throw new factory.errors.Internal('senderEmail not found');
|
|
60
|
-
}
|
|
61
|
-
if (typeof toRecipientEmail !== 'string') {
|
|
62
|
-
throw new factory.errors.Internal('toRecipientEmail not found');
|
|
63
|
-
}
|
|
64
|
-
const emailMessageFrom = {
|
|
65
|
-
name: senderName,
|
|
66
|
-
email: senderEmail
|
|
67
|
-
};
|
|
68
|
-
const subject = `[${logLevel}] ${shortSubject}`;
|
|
69
|
-
const emailDatas = [{
|
|
70
|
-
name: 'developers',
|
|
71
|
-
email: toRecipientEmail
|
|
72
|
-
}];
|
|
73
|
-
const sgClient = new client_1.Client();
|
|
74
|
-
sgClient.setApiKey(apiKey);
|
|
75
|
-
// const response = await sgMail.sendMultiple(msg);
|
|
76
|
-
const response = await sgClient.request({
|
|
77
|
-
body: {
|
|
78
|
-
content: [{ type: 'text/plain', value: message }],
|
|
79
|
-
from: emailMessageFrom,
|
|
80
|
-
personalizations: [{ to: emailDatas }],
|
|
81
|
-
subject,
|
|
82
|
-
custom_args: {
|
|
83
|
-
emailMessage: subject
|
|
84
|
-
// actionId: action.id,
|
|
85
|
-
// projectId: project.id
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
method: 'POST',
|
|
89
|
-
url: '/v3/mail/send'
|
|
90
|
-
});
|
|
91
|
-
// check the response.
|
|
92
|
-
if (response[0].statusCode !== http_status_1.ACCEPTED) {
|
|
93
|
-
throw new factory.errors.Internal(`sendgrid request not accepted. response is ${util.inspect(response)}`);
|
|
94
|
-
}
|
|
95
|
-
const { statusCode } = response[0];
|
|
96
|
-
// const statusMessage = response[1];
|
|
97
|
-
result = { statusCode };
|
|
44
|
+
const apiKey = credentials.sendGrid.apiKey;
|
|
45
|
+
if (typeof apiKey !== 'string') {
|
|
46
|
+
throw new factory.errors.Internal('API Key not found');
|
|
98
47
|
}
|
|
99
|
-
|
|
100
|
-
|
|
48
|
+
const senderName = credentials.sendGrid.alert?.sender?.name;
|
|
49
|
+
const senderEmail = credentials.sendGrid.alert?.sender?.email;
|
|
50
|
+
const toRecipientEmail = (Array.isArray(credentials.sendGrid.alert?.toRecipient))
|
|
51
|
+
? credentials.sendGrid.alert?.toRecipient.at(0)?.email
|
|
52
|
+
: undefined;
|
|
53
|
+
if (typeof senderName !== 'string') {
|
|
54
|
+
throw new factory.errors.Internal('senderName not found');
|
|
101
55
|
}
|
|
56
|
+
if (typeof senderEmail !== 'string') {
|
|
57
|
+
throw new factory.errors.Internal('senderEmail not found');
|
|
58
|
+
}
|
|
59
|
+
if (typeof toRecipientEmail !== 'string') {
|
|
60
|
+
throw new factory.errors.Internal('toRecipientEmail not found');
|
|
61
|
+
}
|
|
62
|
+
const emailMessageFrom = {
|
|
63
|
+
name: senderName,
|
|
64
|
+
email: senderEmail
|
|
65
|
+
};
|
|
66
|
+
const subject = `[${logLevel}] ${shortSubject}`;
|
|
67
|
+
const emailDatas = [{
|
|
68
|
+
name: 'developers',
|
|
69
|
+
email: toRecipientEmail
|
|
70
|
+
}];
|
|
71
|
+
const sgClient = new client_1.Client();
|
|
72
|
+
sgClient.setApiKey(apiKey);
|
|
73
|
+
// const response = await sgMail.sendMultiple(msg);
|
|
74
|
+
const response = await sgClient.request({
|
|
75
|
+
body: {
|
|
76
|
+
content: [{ type: 'text/plain', value: message }],
|
|
77
|
+
from: emailMessageFrom,
|
|
78
|
+
personalizations: [{ to: emailDatas }],
|
|
79
|
+
subject,
|
|
80
|
+
custom_args: {
|
|
81
|
+
emailMessage: subject
|
|
82
|
+
// actionId: action.id,
|
|
83
|
+
// projectId: project.id
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
method: 'POST',
|
|
87
|
+
url: '/v3/mail/send'
|
|
88
|
+
});
|
|
89
|
+
// check the response.
|
|
90
|
+
if (response[0].statusCode !== http_status_1.ACCEPTED) {
|
|
91
|
+
throw new factory.errors.Internal(`sendgrid request not accepted. response is ${util.inspect(response)}`);
|
|
92
|
+
}
|
|
93
|
+
const { statusCode } = response[0];
|
|
94
|
+
// const statusMessage = response[1];
|
|
95
|
+
const result = { statusCode };
|
|
102
96
|
return { result };
|
|
103
97
|
};
|
|
104
98
|
}
|
|
@@ -43,7 +43,6 @@ function createMailData(params) {
|
|
|
43
43
|
id: params.project.id,
|
|
44
44
|
inclusion: ['settings']
|
|
45
45
|
});
|
|
46
|
-
let mailData;
|
|
47
46
|
let apiKey = credentials.sendGrid.apiKey;
|
|
48
47
|
// プロジェクト固有のSendGrid設定があれば、そちらを使用
|
|
49
48
|
if (typeof project.settings?.sendgridApiKey === 'string' && project.settings.sendgridApiKey.length > 0) {
|
|
@@ -82,7 +81,7 @@ function createMailData(params) {
|
|
|
82
81
|
};
|
|
83
82
|
})
|
|
84
83
|
: [];
|
|
85
|
-
mailData = {
|
|
84
|
+
const mailData = {
|
|
86
85
|
to: emailDatas,
|
|
87
86
|
from: emailMessageFrom,
|
|
88
87
|
subject,
|
|
@@ -104,7 +103,7 @@ function sendEmailMessage(params) {
|
|
|
104
103
|
});
|
|
105
104
|
const startingAction = createSendEmailMessageActionAttributes(params);
|
|
106
105
|
const action = await repos.action.start(startingAction, { recipe });
|
|
107
|
-
let result
|
|
106
|
+
let result;
|
|
108
107
|
try {
|
|
109
108
|
mailData.customArgs = {
|
|
110
109
|
emailMessage: emailMessage.identifier,
|
|
@@ -171,45 +171,40 @@ function processInformAction(params, options) {
|
|
|
171
171
|
signature = signRequest({ requestBody, timestamp, secretKey });
|
|
172
172
|
}
|
|
173
173
|
if (useFetchAPI) {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
headers.append(`X-${headerIdentifier}-Webhook-Signature`, signature);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
const res = await fetch(urlTemplate, {
|
|
183
|
-
method: 'POST',
|
|
184
|
-
headers,
|
|
185
|
-
body: requestBody, // body data type must match "Content-Type" header
|
|
186
|
-
...(typeof timeout === 'number')
|
|
187
|
-
? { signal: AbortSignal.timeout(timeout) }
|
|
188
|
-
: undefined
|
|
189
|
-
});
|
|
190
|
-
let body;
|
|
191
|
-
try {
|
|
192
|
-
body = await res.text();
|
|
193
|
-
}
|
|
194
|
-
catch (error) {
|
|
195
|
-
// no op
|
|
196
|
-
}
|
|
197
|
-
switch (res.status) {
|
|
198
|
-
case http_status_1.OK:
|
|
199
|
-
case http_status_1.CREATED:
|
|
200
|
-
case http_status_1.ACCEPTED:
|
|
201
|
-
case http_status_1.NO_CONTENT:
|
|
202
|
-
result = {
|
|
203
|
-
statusCode: res.status,
|
|
204
|
-
useFetchAPI
|
|
205
|
-
};
|
|
206
|
-
break;
|
|
207
|
-
default:
|
|
208
|
-
throw new factory.errors.Internal(`statusCode: ${res.status} body: ${body}`);
|
|
174
|
+
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
175
|
+
if (typeof headerIdentifier === 'string' && headerIdentifier !== '') {
|
|
176
|
+
headers.append(`X-${headerIdentifier}-Webhook-Timestamp`, String(timestamp));
|
|
177
|
+
if (typeof signature === 'string') {
|
|
178
|
+
headers.append(`X-${headerIdentifier}-Webhook-Signature`, signature);
|
|
209
179
|
}
|
|
210
180
|
}
|
|
211
|
-
|
|
212
|
-
|
|
181
|
+
const res = await fetch(urlTemplate, {
|
|
182
|
+
method: 'POST',
|
|
183
|
+
headers,
|
|
184
|
+
body: requestBody, // body data type must match "Content-Type" header
|
|
185
|
+
...(typeof timeout === 'number')
|
|
186
|
+
? { signal: AbortSignal.timeout(timeout) }
|
|
187
|
+
: undefined
|
|
188
|
+
});
|
|
189
|
+
let body;
|
|
190
|
+
try {
|
|
191
|
+
body = await res.text();
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
// no op
|
|
195
|
+
}
|
|
196
|
+
switch (res.status) {
|
|
197
|
+
case http_status_1.OK:
|
|
198
|
+
case http_status_1.CREATED:
|
|
199
|
+
case http_status_1.ACCEPTED:
|
|
200
|
+
case http_status_1.NO_CONTENT:
|
|
201
|
+
result = {
|
|
202
|
+
statusCode: res.status,
|
|
203
|
+
useFetchAPI
|
|
204
|
+
};
|
|
205
|
+
break;
|
|
206
|
+
default:
|
|
207
|
+
throw new factory.errors.Internal(`statusCode: ${res.status} body: ${body}`);
|
|
213
208
|
}
|
|
214
209
|
}
|
|
215
210
|
else {
|
|
@@ -35,7 +35,6 @@ function processStartReserve4chevre(params, options) {
|
|
|
35
35
|
// }
|
|
36
36
|
) => {
|
|
37
37
|
const { event, transaction, transactionNumber } = params;
|
|
38
|
-
let acceptedOffers4result = [];
|
|
39
38
|
// 予約取引開始
|
|
40
39
|
const startParams = (0, factory_1.createReserveTransactionStartParams)({
|
|
41
40
|
project: transaction.project,
|
|
@@ -69,7 +68,7 @@ function processStartReserve4chevre(params, options) {
|
|
|
69
68
|
// stockHoldUntilDaysAfterEventEnd: params.stockHoldUntilDaysAfterEventEnd
|
|
70
69
|
}, options)(repos, settings);
|
|
71
70
|
// 予約取引結果から注文オファーを生成する
|
|
72
|
-
acceptedOffers4result = (0, factory_1.responseBody2acceptedOffers4result)({
|
|
71
|
+
const acceptedOffers4result = (0, factory_1.responseBody2acceptedOffers4result)({
|
|
73
72
|
issuedThrough: startReserveTransactionResult.issuedThrough,
|
|
74
73
|
reservationFor: startReserveTransactionResult.reservationFor,
|
|
75
74
|
objectSubReservations: startReserveTransactionResult.objectSubReservations,
|
|
@@ -26,7 +26,7 @@ import type { SettingRepo } from '../../../repo/setting';
|
|
|
26
26
|
import type { StockHolderRepo } from '../../../repo/stockHolder';
|
|
27
27
|
import type { TaskRepo } from '../../../repo/task';
|
|
28
28
|
import type { TicketRepo } from '../../../repo/ticket';
|
|
29
|
-
import type {
|
|
29
|
+
import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
30
30
|
import type { TransactionNumberRepo } from '../../../repo/transactionNumber';
|
|
31
31
|
interface IAuthorizeRepos {
|
|
32
32
|
action: ActionRepo;
|
|
@@ -55,7 +55,7 @@ interface IAuthorizeRepos {
|
|
|
55
55
|
setting: SettingRepo;
|
|
56
56
|
task: TaskRepo;
|
|
57
57
|
ticket: TicketRepo;
|
|
58
|
-
|
|
58
|
+
placeOrder: PlaceOrderRepo;
|
|
59
59
|
transactionNumber: TransactionNumberRepo;
|
|
60
60
|
}
|
|
61
61
|
type IAuthorizeOperation<T> = (repos: IAuthorizeRepos, settings: Settings) => Promise<T>;
|
|
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.authorize = authorize;
|
|
27
27
|
const factory = __importStar(require("../../../factory"));
|
|
28
|
-
const
|
|
28
|
+
const issueOrderNumberIfNotExist_1 = require("../../transaction/placeOrder/issueOrderNumberIfNotExist");
|
|
29
29
|
const any_1 = require("../any");
|
|
30
30
|
const defaultOffer_1 = require("./authorize/defaultOffer");
|
|
31
31
|
const factory_1 = require("./authorize/factory");
|
|
@@ -50,9 +50,9 @@ function authorize(params, options) {
|
|
|
50
50
|
store: params.store,
|
|
51
51
|
noOfferSpecified
|
|
52
52
|
})(repos);
|
|
53
|
-
let acceptedOffers4result
|
|
53
|
+
let acceptedOffers4result;
|
|
54
54
|
const now = new Date();
|
|
55
|
-
const orderNumber = await (0,
|
|
55
|
+
const orderNumber = await (0, issueOrderNumberIfNotExist_1.issueOrderNumberIfNotExist)({
|
|
56
56
|
project: { id: params.project.id },
|
|
57
57
|
id: transaction.id,
|
|
58
58
|
object: { orderDate: now }
|
|
@@ -106,7 +106,7 @@ function authorize(params, options) {
|
|
|
106
106
|
}
|
|
107
107
|
function validateCreateRequest(params) {
|
|
108
108
|
return async (repos) => {
|
|
109
|
-
const transaction = await repos.
|
|
109
|
+
const transaction = await repos.placeOrder.findPlaceOrderInProgressById({
|
|
110
110
|
typeOf: factory.transactionType.PlaceOrder,
|
|
111
111
|
id: params.transaction.id
|
|
112
112
|
}, ['agent', 'expires', 'project', 'seller', 'typeOf', 'instrument']);
|
|
@@ -8,7 +8,7 @@ import type { MemberRepo } from '../../../repo/member';
|
|
|
8
8
|
import type { MemberProgramRepo } from '../../../repo/memberProgram';
|
|
9
9
|
import type { ProductOfferRepo } from '../../../repo/productOffer';
|
|
10
10
|
import type { TicketRepo } from '../../../repo/ticket';
|
|
11
|
-
import type {
|
|
11
|
+
import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
12
12
|
declare function issueEventOfferTicket(params: {
|
|
13
13
|
now: Date;
|
|
14
14
|
audience: Pick<factory.action.authorize.offer.eventService.IPurpose, 'id'>;
|
|
@@ -41,7 +41,7 @@ declare function issueEventOfferTicket(params: {
|
|
|
41
41
|
memberProgram: MemberProgramRepo;
|
|
42
42
|
productOffer: ProductOfferRepo;
|
|
43
43
|
ticket: TicketRepo;
|
|
44
|
-
|
|
44
|
+
placeOrder: PlaceOrderRepo;
|
|
45
45
|
}) => Promise<{
|
|
46
46
|
ticketToken: string;
|
|
47
47
|
}>;
|
|
@@ -86,7 +86,7 @@ function issueEventOfferTicket(params) {
|
|
|
86
86
|
return async (repos) => {
|
|
87
87
|
const { now, audience, eventId, eventOfferId, ticketedOffer, author, project, instrument } = params;
|
|
88
88
|
// 取引は存在するか
|
|
89
|
-
const transaction = await repos.
|
|
89
|
+
const transaction = await repos.placeOrder.findPlaceOrderInProgressById({ typeOf: factory.transactionType.PlaceOrder, id: audience.id }, ['expires', 'typeOf', 'seller']);
|
|
90
90
|
// イベントは存在するか
|
|
91
91
|
const event = await repos.event.projectEventFieldsById({ id: eventId }, ['project', 'offers', 'identifier']);
|
|
92
92
|
// 取引番号発行
|
|
@@ -8,7 +8,6 @@ import type { ReservationRepo } from '../../../../repo/reservation';
|
|
|
8
8
|
import type { SettingRepo } from '../../../../repo/setting';
|
|
9
9
|
import type { StockHolderRepo } from '../../../../repo/stockHolder';
|
|
10
10
|
import type { TaskRepo } from '../../../../repo/task';
|
|
11
|
-
import type { TransactionRepo } from '../../../../repo/transaction';
|
|
12
11
|
interface IVoidTransactionRepos {
|
|
13
12
|
action: ActionRepo;
|
|
14
13
|
assetTransaction: AssetTransactionRepo;
|
|
@@ -18,7 +17,6 @@ interface IVoidTransactionRepos {
|
|
|
18
17
|
reservation: ReservationRepo;
|
|
19
18
|
setting: SettingRepo;
|
|
20
19
|
task: TaskRepo;
|
|
21
|
-
transaction: TransactionRepo;
|
|
22
20
|
}
|
|
23
21
|
declare function processVoidTransaction4chevre(params: {
|
|
24
22
|
action: factory.action.authorize.offer.eventService.IAction;
|
|
@@ -25,6 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.processVoidTransaction4chevre = processVoidTransaction4chevre;
|
|
27
27
|
const factory = __importStar(require("../../../../factory"));
|
|
28
|
+
// import type { TransactionRepo } from '../../../../repo/transaction';
|
|
28
29
|
const reserve_1 = require("../../../assetTransaction/reserve");
|
|
29
30
|
function processVoidTransaction4chevre(params) {
|
|
30
31
|
return async (repos, settings) => {
|
|
@@ -9,7 +9,7 @@ import type { ReservationRepo } from '../../../repo/reservation';
|
|
|
9
9
|
import type { SettingRepo } from '../../../repo/setting';
|
|
10
10
|
import type { StockHolderRepo } from '../../../repo/stockHolder';
|
|
11
11
|
import type { TaskRepo } from '../../../repo/task';
|
|
12
|
-
import type {
|
|
12
|
+
import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
13
13
|
interface IVoidTransactionRepos {
|
|
14
14
|
action: ActionRepo;
|
|
15
15
|
assetTransaction: AssetTransactionRepo;
|
|
@@ -19,7 +19,7 @@ interface IVoidTransactionRepos {
|
|
|
19
19
|
reservation: ReservationRepo;
|
|
20
20
|
setting: SettingRepo;
|
|
21
21
|
task: TaskRepo;
|
|
22
|
-
|
|
22
|
+
placeOrder: PlaceOrderRepo;
|
|
23
23
|
/**
|
|
24
24
|
* COAオファー承認取消の場合必須
|
|
25
25
|
*/
|
|
@@ -45,7 +45,7 @@ function voidTransaction(params) {
|
|
|
45
45
|
agent: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
46
46
|
...(typeof params.sameAs?.id === 'string') ? { sameAs: { id: params.sameAs.id, typeOf: 'Task' } } : undefined
|
|
47
47
|
};
|
|
48
|
-
const transaction = await repos.
|
|
48
|
+
const transaction = await repos.placeOrder.findPlaceOrderById({ typeOf: params.purpose.typeOf, id: params.purpose.id }, ['typeOf', 'status', 'object']);
|
|
49
49
|
// 興行オファー承認アクション検索
|
|
50
50
|
let authorizeActions = await repos.action.searchByPurpose({
|
|
51
51
|
typeOf: factory.actionType.AuthorizeAction,
|
|
@@ -124,7 +124,7 @@ function cancelAcceptActions(params) {
|
|
|
124
124
|
agent: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
125
125
|
...(typeof params.sameAs?.id === 'string') ? { sameAs: { id: params.sameAs.id, typeOf: 'Task' } } : undefined
|
|
126
126
|
};
|
|
127
|
-
const transaction = await repos.
|
|
127
|
+
const transaction = await repos.placeOrder.findPlaceOrderById({
|
|
128
128
|
typeOf: params.purpose.typeOf,
|
|
129
129
|
id: params.purpose.id
|
|
130
130
|
}, ['typeOf', 'status']);
|
|
@@ -9,7 +9,7 @@ import type { ReservationRepo } from '../../../repo/reservation';
|
|
|
9
9
|
import type { SettingRepo } from '../../../repo/setting';
|
|
10
10
|
import type { StockHolderRepo } from '../../../repo/stockHolder';
|
|
11
11
|
import type { TaskRepo } from '../../../repo/task';
|
|
12
|
-
import type {
|
|
12
|
+
import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
13
13
|
interface IVoidTransactionByActionIdRepos {
|
|
14
14
|
action: ActionRepo;
|
|
15
15
|
assetTransaction: AssetTransactionRepo;
|
|
@@ -19,7 +19,7 @@ interface IVoidTransactionByActionIdRepos {
|
|
|
19
19
|
reservation: ReservationRepo;
|
|
20
20
|
setting: SettingRepo;
|
|
21
21
|
task: TaskRepo;
|
|
22
|
-
|
|
22
|
+
placeOrder: PlaceOrderRepo;
|
|
23
23
|
/**
|
|
24
24
|
* COAオファー承認取消の場合必須
|
|
25
25
|
*/
|
|
@@ -42,14 +42,14 @@ function voidTransactionByActionId(params) {
|
|
|
42
42
|
agent: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
43
43
|
...(typeof params.sameAs?.id === 'string') ? { sameAs: { id: params.sameAs.id, typeOf: 'Task' } } : undefined
|
|
44
44
|
};
|
|
45
|
-
const transaction = await repos.
|
|
45
|
+
const transaction = await repos.placeOrder.findPlaceOrderInProgressById({
|
|
46
46
|
typeOf: factory.transactionType.PlaceOrder,
|
|
47
47
|
id: params.purpose.id
|
|
48
48
|
}, ['typeOf']);
|
|
49
49
|
// if (transaction.agent.id !== params.agent.id) {
|
|
50
50
|
// throw new factory.errors.Forbidden('Transaction not yours');
|
|
51
51
|
// }
|
|
52
|
-
const orderNumber = await repos.
|
|
52
|
+
const orderNumber = await repos.placeOrder.findInProgressOrderNumberById({ id: params.purpose.id });
|
|
53
53
|
const action = await repos.action.findById({ typeOf: factory.actionType.AuthorizeAction, id: params.id });
|
|
54
54
|
if (action.purpose.typeOf !== transaction.typeOf || action.purpose.id !== transaction.id) {
|
|
55
55
|
throw new factory.errors.Argument('Transaction', 'Action not found in the transaction');
|
|
@@ -191,7 +191,6 @@ function offer2availableSalesTicket(params) {
|
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
193
|
function availableSalesTicket2offerWithDetails(params) {
|
|
194
|
-
let offerWithDetails;
|
|
195
194
|
const availableSalesTicket = params.availableSalesTicket;
|
|
196
195
|
const offer = params.offer;
|
|
197
196
|
const includeGlasses = (offer.ticketInfo.addGlasses > 0);
|
|
@@ -248,7 +247,7 @@ function availableSalesTicket2offerWithDetails(params) {
|
|
|
248
247
|
? availableSalesTicket.limitCount
|
|
249
248
|
: 1
|
|
250
249
|
};
|
|
251
|
-
offerWithDetails = {
|
|
250
|
+
const offerWithDetails = {
|
|
252
251
|
// ticketCodeで照合するためidは不要(2023-03-22~)
|
|
253
252
|
// id: params.offerId,
|
|
254
253
|
// identifierはchevre/apiで自動補完(2023-03-10~)
|
|
@@ -3,14 +3,14 @@ import type { ActionRepo } from '../../../repo/action';
|
|
|
3
3
|
import type { EventRepo } from '../../../repo/event';
|
|
4
4
|
import type { OrderNumberRepo } from '../../../repo/orderNumber';
|
|
5
5
|
import type { ProjectRepo } from '../../../repo/project';
|
|
6
|
-
import type {
|
|
6
|
+
import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
7
7
|
import * as factory from '../../../factory';
|
|
8
8
|
interface IAcceptRepos {
|
|
9
9
|
action: ActionRepo;
|
|
10
10
|
event: EventRepo;
|
|
11
11
|
orderNumber: OrderNumberRepo;
|
|
12
12
|
project: ProjectRepo;
|
|
13
|
-
|
|
13
|
+
placeOrder: PlaceOrderRepo;
|
|
14
14
|
reserveService: COA.service.Reserve;
|
|
15
15
|
masterService: COA.service.Master;
|
|
16
16
|
}
|
|
@@ -27,7 +27,7 @@ exports.acceptOffer = acceptOffer;
|
|
|
27
27
|
exports.reAcceptOffer = reAcceptOffer;
|
|
28
28
|
const errorHandler_1 = require("../../../errorHandler");
|
|
29
29
|
const factory = __importStar(require("../../../factory"));
|
|
30
|
-
const
|
|
30
|
+
const issueOrderNumberIfNotExist_1 = require("../../transaction/placeOrder/issueOrderNumberIfNotExist");
|
|
31
31
|
const authorize_1 = require("./acceptOffer/authorize");
|
|
32
32
|
const factory_1 = require("./acceptOffer/factory");
|
|
33
33
|
function findCOAInfo(params) {
|
|
@@ -58,12 +58,12 @@ function acceptOffer(params) {
|
|
|
58
58
|
if (typeof params.sameAs.id !== 'string' || params.sameAs.id === '') {
|
|
59
59
|
throw new factory.errors.ArgumentNull('sameAs.id');
|
|
60
60
|
}
|
|
61
|
-
const transaction = await repos.
|
|
61
|
+
const transaction = await repos.placeOrder.findPlaceOrderInProgressById({
|
|
62
62
|
typeOf: factory.transactionType.PlaceOrder,
|
|
63
63
|
id: params.purpose.id
|
|
64
64
|
}, ['project', 'agent', 'typeOf']);
|
|
65
|
-
//
|
|
66
|
-
await (0,
|
|
65
|
+
// issueOrderNumber(2025-03-11~)
|
|
66
|
+
await (0, issueOrderNumberIfNotExist_1.issueOrderNumberIfNotExist)({
|
|
67
67
|
project: { id: transaction.project.id },
|
|
68
68
|
id: transaction.id,
|
|
69
69
|
object: { orderDate: new Date() }
|
|
@@ -144,11 +144,11 @@ function reAcceptOffer(params) {
|
|
|
144
144
|
if (typeof params.potentialActions?.id !== 'string' || params.potentialActions.id === '') {
|
|
145
145
|
throw new factory.errors.ArgumentNull('potentialActions.id');
|
|
146
146
|
}
|
|
147
|
-
const transaction = await repos.
|
|
147
|
+
const transaction = await repos.placeOrder.findPlaceOrderInProgressById({
|
|
148
148
|
typeOf: factory.transactionType.PlaceOrder,
|
|
149
149
|
id: params.purpose.id
|
|
150
150
|
}, ['project', 'agent', 'typeOf']);
|
|
151
|
-
const orderNumber = await repos.
|
|
151
|
+
const orderNumber = await repos.placeOrder.findInProgressOrderNumberById({ id: transaction.id });
|
|
152
152
|
if (typeof orderNumber !== 'string') {
|
|
153
153
|
// 事前に発行されているはず
|
|
154
154
|
throw new factory.errors.NotFound('transaction.object.orderNumber');
|
|
@@ -3,7 +3,7 @@ import type { CategoryCodeRepo } from '../../../repo/categoryCode';
|
|
|
3
3
|
import type { EventRepo } from '../../../repo/event';
|
|
4
4
|
import type { OfferRepo } from '../../../repo/offer/unitPriceInCatalog';
|
|
5
5
|
import type { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
|
|
6
|
-
import type {
|
|
6
|
+
import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
7
7
|
import { IRequestBody, IResponseBody } from './authorize/factory';
|
|
8
8
|
import { IAcceptedOfferBeforeAuthorize4COA } from './authorize/validateAcceptedOffers';
|
|
9
9
|
import * as factory from '../../../factory';
|
|
@@ -15,7 +15,7 @@ export interface IAuthorizeRepos {
|
|
|
15
15
|
event: EventRepo;
|
|
16
16
|
offer: OfferRepo;
|
|
17
17
|
orderInTransaction: OrderInTransactionRepo;
|
|
18
|
-
|
|
18
|
+
placeOrder: PlaceOrderRepo;
|
|
19
19
|
}
|
|
20
20
|
export type IAuthorizeOperation<T> = (repos: IAuthorizeRepos) => Promise<T>;
|
|
21
21
|
export type IAuthorizeOfferAction = factory.action.authorize.offer.eventService.IAction;
|
|
@@ -28,7 +28,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.authorize = authorize;
|
|
30
30
|
const moment_1 = __importDefault(require("moment"));
|
|
31
|
-
// import { publishOrderNumberIfNotExist } from '../../transaction/placeOrder/publishOrderNumberIfNotExist';
|
|
32
31
|
const any_1 = require("../any");
|
|
33
32
|
const factory_1 = require("./authorize/factory");
|
|
34
33
|
const validateAcceptedOffers_1 = require("./authorize/validateAcceptedOffers");
|
|
@@ -38,7 +37,7 @@ const factory = __importStar(require("../../../factory"));
|
|
|
38
37
|
*/
|
|
39
38
|
function authorize(params) {
|
|
40
39
|
return async (repos) => {
|
|
41
|
-
const transaction = await repos.
|
|
40
|
+
const transaction = await repos.placeOrder.findPlaceOrderInProgressById({
|
|
42
41
|
typeOf: factory.transactionType.PlaceOrder,
|
|
43
42
|
id: params.transaction.id
|
|
44
43
|
}, ['agent', 'project', 'seller', 'typeOf', 'instrument']);
|
|
@@ -104,15 +103,9 @@ function authorize(params) {
|
|
|
104
103
|
await repos.action.giveUp({ typeOf: failedAction.typeOf, id: failedAction.id, error });
|
|
105
104
|
throw error;
|
|
106
105
|
}
|
|
107
|
-
|
|
108
|
-
// const orderNumber = await publishOrderNumberIfNotExist({
|
|
109
|
-
// project: { id: transaction.project.id },
|
|
110
|
-
// id: transaction.id,
|
|
111
|
-
// object: { orderDate: now }
|
|
112
|
-
// })(repos);
|
|
113
|
-
const orderNumber = await repos.transaction.findInProgressOrderNumberById({ id: params.transaction.id });
|
|
106
|
+
const orderNumber = await repos.placeOrder.findInProgressOrderNumberById({ id: params.transaction.id });
|
|
114
107
|
if (typeof orderNumber !== 'string') {
|
|
115
|
-
// 事前に発行されているはず
|
|
108
|
+
// 事前に発行されているはず(acceptCOAOfferにて)
|
|
116
109
|
throw new factory.errors.NotFound('transaction.object.orderNumber');
|
|
117
110
|
}
|
|
118
111
|
let result;
|
|
@@ -37,14 +37,14 @@ const factory = __importStar(require("../../../factory"));
|
|
|
37
37
|
*/
|
|
38
38
|
function changeOffers(params) {
|
|
39
39
|
return async (repos) => {
|
|
40
|
-
const transaction = await repos.
|
|
40
|
+
const transaction = await repos.placeOrder.findPlaceOrderInProgressById({
|
|
41
41
|
typeOf: factory.transactionType.PlaceOrder,
|
|
42
42
|
id: params.transaction.id
|
|
43
43
|
}, ['typeOf', 'agent', 'project', 'seller']);
|
|
44
44
|
if (transaction.agent.id !== params.agent.id) {
|
|
45
45
|
throw new factory.errors.Forbidden('Transaction not yours');
|
|
46
46
|
}
|
|
47
|
-
const orderNumber = await repos.
|
|
47
|
+
const orderNumber = await repos.placeOrder.findInProgressOrderNumberById({ id: params.transaction.id });
|
|
48
48
|
if (typeof orderNumber !== 'string') {
|
|
49
49
|
// 事前に発行されているはず
|
|
50
50
|
throw new factory.errors.NotFound('transaction.object.orderNumber');
|
|
@@ -5,7 +5,7 @@ import type { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
|
|
|
5
5
|
import type { OrderNumberRepo } from '../../../repo/orderNumber';
|
|
6
6
|
import type { ProductRepo } from '../../../repo/product';
|
|
7
7
|
import type { ProjectRepo } from '../../../repo/project';
|
|
8
|
-
import type {
|
|
8
|
+
import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
9
9
|
import type { TransactionNumberRepo } from '../../../repo/transactionNumber';
|
|
10
10
|
interface IAuthorizeRepos {
|
|
11
11
|
action: ActionRepo;
|
|
@@ -14,7 +14,7 @@ interface IAuthorizeRepos {
|
|
|
14
14
|
assetTransaction: AssetTransactionRepo;
|
|
15
15
|
orderInTransaction: OrderInTransactionRepo;
|
|
16
16
|
orderNumber: OrderNumberRepo;
|
|
17
|
-
|
|
17
|
+
placeOrder: PlaceOrderRepo;
|
|
18
18
|
transactionNumber: TransactionNumberRepo;
|
|
19
19
|
}
|
|
20
20
|
type IAuthorizeOperation<T> = (repos: IAuthorizeRepos) => Promise<T>;
|