@chevre/domain 24.1.0-alpha.59 → 24.1.0-alpha.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/chevre/service/order/deleteOrder.d.ts +1 -1
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.d.ts +1 -1
- package/lib/chevre/service/order/placeOrder/factory.js +9 -0
- package/lib/chevre/service/order/placeOrder.d.ts +2 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/factory/result.d.ts +0 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/factory/result.js +5 -5
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.d.ts +7 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.d.ts +7 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +3 -1
- package/lib/chevre/service/transaction/placeOrder/confirm.js +18 -38
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@ import { factory } from '../../factory';
|
|
|
13
13
|
* 冪等性を確保すること
|
|
14
14
|
*/
|
|
15
15
|
declare function deleteOrder(params: {
|
|
16
|
-
object: Pick<factory.order.IOrder, '
|
|
16
|
+
object: Pick<factory.order.IOrder, 'orderNumber'>;
|
|
17
17
|
}): (repos: {
|
|
18
18
|
acceptedOffer: AcceptedOfferRepo;
|
|
19
19
|
accountingReport: AccountingReportRepo;
|
|
@@ -22,4 +22,4 @@ declare function createPlacingOrderFromExistingTransaction(params: {
|
|
|
22
22
|
placeOrderTransaction: IPlaceOrderTransaction;
|
|
23
23
|
serialNumbers: string[];
|
|
24
24
|
}>;
|
|
25
|
-
export { ICreatePlacingOrderFromExistingTransactionRepos, createPlacingOrderFromExistingTransaction };
|
|
25
|
+
export { ICreatePlacingOrderFromExistingTransactionRepos, IPlacingOrder, createPlacingOrderFromExistingTransaction };
|
|
@@ -92,11 +92,20 @@ function createPlacingOrder(params) {
|
|
|
92
92
|
const orderedItem = (0, orderedItem_1.acceptedOffers2orderedItem)({
|
|
93
93
|
eventReservationAcceptedOffers,
|
|
94
94
|
});
|
|
95
|
+
const confirmationNumber = transaction.object.confirmationNumber;
|
|
96
|
+
if (typeof confirmationNumber !== 'string') {
|
|
97
|
+
// 事前に発行済なはずなので、ありえないフロー
|
|
98
|
+
throw new factory_1.factory.errors.Internal('object.confirmationNumber undefined');
|
|
99
|
+
}
|
|
95
100
|
return {
|
|
96
101
|
...orderByTransaction,
|
|
102
|
+
confirmationNumber,
|
|
103
|
+
typeOf: factory_1.factory.order.OrderType.Order, // 取引保管を廃止するためにここで指定(2026-06-14~)
|
|
104
|
+
orderStatus: factory_1.factory.orderStatus.OrderPaymentDue, // 取引保管を廃止するためにここで指定(2026-06-14~)
|
|
97
105
|
seller, // 2024-06-17~
|
|
98
106
|
paymentMethods, // 2024-06-17~
|
|
99
107
|
price, // 2024-06-17~
|
|
108
|
+
priceCurrency: factory_1.factory.priceCurrency.JPY, // 取引保管を廃止するためにここで指定(2026-06-14~)
|
|
100
109
|
orderDate: (0, moment_1.default)(orderByTransaction.orderDate)
|
|
101
110
|
.toDate(),
|
|
102
111
|
orderedItem, // 2024-06-18~
|
|
@@ -10,6 +10,7 @@ import type { TaskRepo } from '../../repo/task';
|
|
|
10
10
|
import type { PlaceOrderRepo } from '../../repo/transaction/placeOrder';
|
|
11
11
|
import { factory } from '../../factory';
|
|
12
12
|
import type { IntegrationSettingRepo as Settings } from '../../repo/setting/integration';
|
|
13
|
+
import { IPlacingOrder } from './placeOrder/createPlacingOrderFromExistingTransaction';
|
|
13
14
|
interface IPlaceOrderRepos {
|
|
14
15
|
acceptedOffer: AcceptedOfferRepo;
|
|
15
16
|
accountingReport: AccountingReportRepo;
|
|
@@ -36,6 +37,6 @@ declare function placeOrder(params: {
|
|
|
36
37
|
};
|
|
37
38
|
useOnOrderStatusChanged: boolean;
|
|
38
39
|
}): (repos: IPlaceOrderRepos, settings: Settings) => Promise<{
|
|
39
|
-
order:
|
|
40
|
+
order: IPlacingOrder;
|
|
40
41
|
}>;
|
|
41
42
|
export { IPlaceOrderRepos, placeOrder };
|
|
@@ -5,7 +5,6 @@ import { factory } from '../../../../../factory';
|
|
|
5
5
|
declare function createOrderAsResult(params: {
|
|
6
6
|
orderNumber: string;
|
|
7
7
|
orderDate: Date;
|
|
8
|
-
orderStatus: factory.orderStatus;
|
|
9
8
|
price: number;
|
|
10
9
|
}): factory.transaction.placeOrder.IOrderAsResult;
|
|
11
10
|
export { createOrderAsResult };
|
|
@@ -6,16 +6,16 @@ const factory_1 = require("../../../../../factory");
|
|
|
6
6
|
* 注文取引結果としての注文を生成する
|
|
7
7
|
*/
|
|
8
8
|
function createOrderAsResult(params) {
|
|
9
|
-
const { orderDate, orderNumber,
|
|
9
|
+
const { orderDate, orderNumber, price } = params;
|
|
10
10
|
return {
|
|
11
|
+
confirmationNumber: '',
|
|
12
|
+
orderNumber,
|
|
13
|
+
orderDate,
|
|
11
14
|
typeOf: factory_1.factory.order.OrderType.Order,
|
|
12
15
|
price,
|
|
13
16
|
priceCurrency: factory_1.factory.priceCurrency.JPY,
|
|
14
|
-
|
|
15
|
-
orderNumber,
|
|
17
|
+
orderStatus: factory_1.factory.orderStatus.OrderPaymentDue // 注文作成時のステータスとなる
|
|
16
18
|
// url: '', // discontinue(2026-06-11~)
|
|
17
|
-
orderStatus,
|
|
18
|
-
orderDate,
|
|
19
19
|
// identifier: [] // discontinue(2026-06-11~)
|
|
20
20
|
};
|
|
21
21
|
}
|
package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.d.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { factory } from '../../../../../factory';
|
|
2
2
|
import type { ISetting } from '../../../../../repo/setting';
|
|
3
3
|
export declare function createSendEmailMessageActions(params: {
|
|
4
|
-
order: factory.transaction.placeOrder.IOrderAsResult
|
|
4
|
+
order: factory.transaction.placeOrder.IOrderAsResult & {
|
|
5
|
+
confirmationNumber: string;
|
|
6
|
+
orderStatus: factory.orderStatus;
|
|
7
|
+
price: number;
|
|
8
|
+
priceCurrency: factory.priceCurrency;
|
|
9
|
+
typeOf: factory.order.OrderType;
|
|
10
|
+
};
|
|
5
11
|
customer: factory.order.ICustomer;
|
|
6
12
|
seller: factory.order.ISeller;
|
|
7
13
|
paymentMethods: factory.order.IReferencedInvoice[];
|
|
@@ -4,7 +4,13 @@ import type { ISetting } from '../../../../repo/setting';
|
|
|
4
4
|
* 取引のポストアクションを作成する
|
|
5
5
|
*/
|
|
6
6
|
export declare function createPotentialActions(params: {
|
|
7
|
-
order: factory.transaction.placeOrder.IOrderAsResult
|
|
7
|
+
order: factory.transaction.placeOrder.IOrderAsResult & {
|
|
8
|
+
confirmationNumber: string;
|
|
9
|
+
orderStatus: factory.orderStatus.OrderPaymentDue;
|
|
10
|
+
price: number;
|
|
11
|
+
priceCurrency: factory.priceCurrency;
|
|
12
|
+
typeOf: factory.order.OrderType;
|
|
13
|
+
};
|
|
8
14
|
customer: factory.order.ICustomer;
|
|
9
15
|
seller: factory.order.ISeller;
|
|
10
16
|
paymentMethods: factory.order.IReferencedInvoice[];
|
|
@@ -36,7 +36,9 @@ export declare function validatePaymentMethods(params: {
|
|
|
36
36
|
* 興行オファー適用条件確認
|
|
37
37
|
*/
|
|
38
38
|
export declare function validateEventOffers(params: {
|
|
39
|
-
order:
|
|
39
|
+
order: {
|
|
40
|
+
price: number;
|
|
41
|
+
};
|
|
40
42
|
paymentMethods: factory.order.IReferencedInvoice[];
|
|
41
43
|
authorizeEventServiceOfferActions: Pick<IAuthorizeEventServiceOffer, 'id' | 'instrument' | 'object' | 'result'>[];
|
|
42
44
|
}): void;
|
|
@@ -118,7 +118,7 @@ function confirm(params, options) {
|
|
|
118
118
|
// let customer: factory.order.ICustomer = createCustomer({ transaction });
|
|
119
119
|
const customer = await repos.orderInTransaction.findCustomerByOrderNumber({ orderNumber: { $eq: orderNumber } });
|
|
120
120
|
const seller = (0, factory_2.createSeller)({ transaction });
|
|
121
|
-
const { paymentMethods, result, eventId, reservationIds } = createResult({
|
|
121
|
+
const { paymentMethods, placingOrder, result, eventId, reservationIds } = createResult({
|
|
122
122
|
...params,
|
|
123
123
|
orderNumber, transaction,
|
|
124
124
|
acceptPayActions,
|
|
@@ -144,7 +144,7 @@ function confirm(params, options) {
|
|
|
144
144
|
throw new factory_1.factory.errors.NotFound('setting.defaultSenderEmail');
|
|
145
145
|
}
|
|
146
146
|
const { emailMessages, potentialActions } = await (0, potentialActions_1.createPotentialActions)({
|
|
147
|
-
order:
|
|
147
|
+
order: placingOrder, // createEmailMessageでのorder.acceptedOffersへの依存性を排除したのでこちらでよいはず(2024-02-21~)
|
|
148
148
|
customer,
|
|
149
149
|
seller,
|
|
150
150
|
paymentMethods,
|
|
@@ -305,18 +305,7 @@ function createResult(params, options) {
|
|
|
305
305
|
eventReservationAcceptedOffers, params.payTransactions, params.customer);
|
|
306
306
|
const { paymentMethods, price } = (0, factory_2.createPaymentMethods)({ authorizePaymentActions: params.authorizePaymentActions });
|
|
307
307
|
const orderedItem = (0, orderedItem_1.acceptedOffers2orderedItem)({
|
|
308
|
-
eventReservationAcceptedOffers
|
|
309
|
-
// productAcceptedOffers,
|
|
310
|
-
// moneyTransferAcceptedOffers
|
|
311
|
-
});
|
|
312
|
-
// 注文作成
|
|
313
|
-
const orderAsResult = (0, result_1.createOrderAsResult)({
|
|
314
|
-
orderNumber: params.orderNumber,
|
|
315
|
-
orderDate: params.result.order.orderDate,
|
|
316
|
-
orderStatus: factory_1.factory.orderStatus.OrderPaymentDue, // 注文作成時のステータスとなる
|
|
317
|
-
// orderedItem,
|
|
318
|
-
// paymentMethods,
|
|
319
|
-
price
|
|
308
|
+
eventReservationAcceptedOffers
|
|
320
309
|
});
|
|
321
310
|
(0, validation_1.validateEventOffers)({
|
|
322
311
|
order: { price },
|
|
@@ -335,17 +324,24 @@ function createResult(params, options) {
|
|
|
335
324
|
});
|
|
336
325
|
(0, validation_1.validatePaymentMethods)({ order: { paymentMethods } }, options);
|
|
337
326
|
// 確認番号を発行
|
|
338
|
-
const { confirmationNumber
|
|
339
|
-
//
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
result: params.result
|
|
327
|
+
const { confirmationNumber } = createConfirmationNumber({ transaction });
|
|
328
|
+
// 注文作成
|
|
329
|
+
const orderAsResult = (0, result_1.createOrderAsResult)({
|
|
330
|
+
orderNumber: params.orderNumber,
|
|
331
|
+
orderDate: params.result.order.orderDate,
|
|
332
|
+
price
|
|
345
333
|
});
|
|
346
334
|
orderAsResult.confirmationNumber = confirmationNumber;
|
|
347
335
|
// orderAsResult.identifier = identifier; // discontinue(2026-06-11~)
|
|
348
336
|
// orderAsResult.url = url; // discontinue(2026-06-11~)
|
|
337
|
+
const placingOrder = {
|
|
338
|
+
...orderAsResult,
|
|
339
|
+
confirmationNumber,
|
|
340
|
+
typeOf: factory_1.factory.order.OrderType.Order,
|
|
341
|
+
price,
|
|
342
|
+
priceCurrency: factory_1.factory.priceCurrency.JPY,
|
|
343
|
+
orderStatus: factory_1.factory.orderStatus.OrderPaymentDue
|
|
344
|
+
};
|
|
349
345
|
const authorizeActions = [
|
|
350
346
|
...params.authorizePaymentActions.map(({ id }) => ({ id })),
|
|
351
347
|
...params.authorizeEventServiceOfferActions.map(({ id }) => ({ id })),
|
|
@@ -361,6 +357,7 @@ function createResult(params, options) {
|
|
|
361
357
|
}
|
|
362
358
|
return {
|
|
363
359
|
paymentMethods,
|
|
360
|
+
placingOrder,
|
|
364
361
|
result: {
|
|
365
362
|
order: orderAsResult,
|
|
366
363
|
authorizeActions, // 追加(2024-01-17~)
|
|
@@ -446,29 +443,12 @@ function searchAuthorizeActions(params) {
|
|
|
446
443
|
}
|
|
447
444
|
function createConfirmationNumber(params) {
|
|
448
445
|
const confirmationNumber = params.transaction.object.confirmationNumber;
|
|
449
|
-
// let url = '';
|
|
450
446
|
// 取引に確認番号が保管されていなければ、確認番号を発行
|
|
451
447
|
if (typeof confirmationNumber !== 'string') {
|
|
452
448
|
// 事前に発行済なはずなので、ありえないフロー
|
|
453
449
|
throw new factory_1.factory.errors.Internal('object.confirmationNumber undefined');
|
|
454
450
|
}
|
|
455
|
-
// // URLの指定があれば上書き
|
|
456
|
-
// /* istanbul ignore if */
|
|
457
|
-
// if (typeof params.result.order.url === 'string') {
|
|
458
|
-
// url = params.result.order.url;
|
|
459
|
-
// } else /* istanbul ignore next */ if (typeof params.result.order.url === 'function') {
|
|
460
|
-
// /* istanbul ignore next */
|
|
461
|
-
// url = (params.result.order.url as IOrderURLGenerator)(params.order);
|
|
462
|
-
// }
|
|
463
|
-
// // 識別子の指定があれば上書き
|
|
464
|
-
// const identifier: factory.order.IIdentifier = [
|
|
465
|
-
// ...(Array.isArray(params.result.order.identifier)) ? params.result.order.identifier : [],
|
|
466
|
-
// // 取引に指定があれば追加
|
|
467
|
-
// ...(Array.isArray(params.transaction.object.identifier)) ? params.transaction.object.identifier : []
|
|
468
|
-
// ];
|
|
469
451
|
return {
|
|
470
452
|
confirmationNumber,
|
|
471
|
-
// url,
|
|
472
|
-
// identifier
|
|
473
453
|
};
|
|
474
454
|
}
|
package/package.json
CHANGED