@chevre/domain 25.2.0-alpha.0 → 25.2.0-alpha.10
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/action/actionProcess.js +62 -72
- package/lib/chevre/repo/action.d.ts +4 -1
- package/lib/chevre/repo/action.js +3 -2
- package/lib/chevre/repo/assetTransaction.d.ts +1 -1
- package/lib/chevre/repo/assetTransaction.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/action.js +67 -66
- package/lib/chevre/service/offer/event/authorize/factory.d.ts +2 -1
- package/lib/chevre/service/offer/event/authorize/factory.js +13 -25
- package/lib/chevre/service/offer/event/authorize.d.ts +4 -0
- package/lib/chevre/service/offer/event/authorize.js +2 -6
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4coa.js +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +2 -0
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.js +6 -13
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +5 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +5 -10
- package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.d.ts +5 -0
- package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.js +3 -32
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.d.ts +0 -1
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +1 -2
- package/lib/chevre/service/payment/any/authorize.js +6 -32
- package/lib/chevre/service/payment/any/factory.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.d.ts +22 -0
- package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.js +120 -0
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +9 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +109 -93
- package/lib/chevre/service/transaction/placeOrder/confirm.d.ts +7 -0
- package/lib/chevre/service/transaction/placeOrder/confirm.js +17 -42
- package/package.json +2 -2
|
@@ -5,6 +5,7 @@ import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
|
|
|
5
5
|
import type { AuthorizationRepo } from '../../../repo/authorization';
|
|
6
6
|
import type { ConfirmationNumberRepo } from '../../../repo/confirmationNumber';
|
|
7
7
|
import type { MessageRepo } from '../../../repo/message';
|
|
8
|
+
import type { OfferRepo } from '../../../repo/offer/unitPriceInCatalog';
|
|
8
9
|
import type { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
|
|
9
10
|
import type { ProjectRepo } from '../../../repo/project';
|
|
10
11
|
import type { SettingRepo } from '../../../repo/setting';
|
|
@@ -19,6 +20,7 @@ interface IConfirmOperationRepos {
|
|
|
19
20
|
assetTransaction: AssetTransactionRepo;
|
|
20
21
|
authorization: AuthorizationRepo;
|
|
21
22
|
message: MessageRepo;
|
|
23
|
+
offer: OfferRepo;
|
|
22
24
|
project: ProjectRepo;
|
|
23
25
|
placeOrder: PlaceOrderRepo;
|
|
24
26
|
orderInTransaction: OrderInTransactionRepo;
|
|
@@ -39,6 +41,11 @@ interface IConfirmOptions {
|
|
|
39
41
|
* 注文における最大CreditCardIF決済方法数
|
|
40
42
|
*/
|
|
41
43
|
maxNumCreditCardPaymentMethod: number;
|
|
44
|
+
/**
|
|
45
|
+
* 2026-07-06~
|
|
46
|
+
* 実験的に
|
|
47
|
+
*/
|
|
48
|
+
usePrepareUnitPriceOfferConditions?: boolean;
|
|
42
49
|
}
|
|
43
50
|
type IConfirmParams = PlaceOrderFactory.IConfirmParams;
|
|
44
51
|
interface IConfirmResult {
|
|
@@ -12,6 +12,7 @@ const factory_2 = require("../../order/placeOrder/factory");
|
|
|
12
12
|
const orderedItem_1 = require("../../order/placeOrder/factory/orderedItem");
|
|
13
13
|
const result_1 = require("./confirm/factory/result");
|
|
14
14
|
const potentialActions_1 = require("./confirm/potentialActions");
|
|
15
|
+
const prepareUnitPriceOfferConditions_1 = require("./confirm/prepareUnitPriceOfferConditions");
|
|
15
16
|
const publishCode_1 = require("./confirm/publishCode");
|
|
16
17
|
const validation_1 = require("./confirm/validation");
|
|
17
18
|
const publishConfirmationNumberIfNotExist_1 = require("./publishConfirmationNumberIfNotExist");
|
|
@@ -114,6 +115,16 @@ function confirm(params, options) {
|
|
|
114
115
|
project: { id: transaction.project.id }
|
|
115
116
|
}))
|
|
116
117
|
.filter(({ serialNumber }) => typeof serialNumber === 'string' && serialNumbers.includes(serialNumber));
|
|
118
|
+
// 単価オファーの全適用条件を検証するために、単価オファーを参照(2026-07-06~)
|
|
119
|
+
let unitPriceOfferConditions;
|
|
120
|
+
const { usePrepareUnitPriceOfferConditions } = options;
|
|
121
|
+
if (usePrepareUnitPriceOfferConditions === true) {
|
|
122
|
+
unitPriceOfferConditions = await (0, prepareUnitPriceOfferConditions_1.prepareUnitPriceOfferConditions)({
|
|
123
|
+
project: { id: transaction.project.id, },
|
|
124
|
+
acceptedOffers,
|
|
125
|
+
authorizeEventServiceOfferActions
|
|
126
|
+
})({ offer: repos.offer });
|
|
127
|
+
}
|
|
117
128
|
// authorizePaymentActionsからpayTransactionsを参照(2024-06-20~)
|
|
118
129
|
let payTransactions = [];
|
|
119
130
|
// 決済承認アクションのinstrument依存をobject依存へ変更(2025-12-14~)
|
|
@@ -134,22 +145,10 @@ function confirm(params, options) {
|
|
|
134
145
|
orderNumber, transaction,
|
|
135
146
|
acceptPayActions,
|
|
136
147
|
authorizePaymentActions, authorizeEventServiceOfferActions,
|
|
137
|
-
// authorizeProductOfferActions,
|
|
138
148
|
acceptedOffers, payTransactions, customer,
|
|
139
|
-
...(typeof code === 'string') ? { code } : undefined
|
|
149
|
+
...(typeof code === 'string') ? { code } : undefined,
|
|
150
|
+
...((Array.isArray(unitPriceOfferConditions)) && { unitPriceOfferConditions })
|
|
140
151
|
}, options);
|
|
141
|
-
// discontinue emailMessageRepo
|
|
142
|
-
// // デフォルトEメールメッセージを検索
|
|
143
|
-
// let emailMessageOnOrderSent: factory.creativeWork.message.email.ICreativeWork | undefined;
|
|
144
|
-
// if (repos.emailMessage !== undefined) {
|
|
145
|
-
// const searchEmailMessagesResult = await repos.emailMessage.search({
|
|
146
|
-
// limit: 1,
|
|
147
|
-
// page: 1,
|
|
148
|
-
// project: { id: { $eq: transaction.project.id } },
|
|
149
|
-
// about: { identifier: { $eq: factory.creativeWork.message.email.AboutIdentifier.OnOrderSent } }
|
|
150
|
-
// });
|
|
151
|
-
// emailMessageOnOrderSent = searchEmailMessagesResult.shift();
|
|
152
|
-
// }
|
|
153
152
|
// ポストアクションを作成
|
|
154
153
|
const setting = await repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['defaultSenderEmail']);
|
|
155
154
|
if (typeof setting?.defaultSenderEmail !== 'string') {
|
|
@@ -319,17 +318,17 @@ function createResult(params, options) {
|
|
|
319
318
|
}
|
|
320
319
|
});
|
|
321
320
|
// 取引の確定条件が全て整っているかどうか確認
|
|
322
|
-
(0, validation_1.validateTransaction)(transaction, params.acceptPayActions, params.authorizePaymentActions, params.authorizeEventServiceOfferActions,
|
|
323
|
-
// params.authorizeProductOfferActions,
|
|
324
|
-
eventReservationAcceptedOffers, params.payTransactions, params.customer);
|
|
321
|
+
(0, validation_1.validateTransaction)(transaction, params.acceptPayActions, params.authorizePaymentActions, params.authorizeEventServiceOfferActions, eventReservationAcceptedOffers, params.payTransactions, params.customer);
|
|
325
322
|
const { paymentMethods, price } = (0, factory_2.createPaymentMethods)({ authorizePaymentActions: params.authorizePaymentActions });
|
|
326
323
|
const orderedItem = (0, orderedItem_1.acceptedOffers2orderedItem)({
|
|
327
324
|
eventReservationAcceptedOffers
|
|
328
325
|
});
|
|
329
326
|
(0, validation_1.validateEventOffers)({
|
|
327
|
+
project: { id: transaction.project.id },
|
|
330
328
|
order: { price },
|
|
331
329
|
paymentMethods,
|
|
332
|
-
|
|
330
|
+
authorizeOfferActions: params.authorizeEventServiceOfferActions,
|
|
331
|
+
...((Array.isArray(params.unitPriceOfferConditions)) && { unitPriceOfferConditions: params.unitPriceOfferConditions })
|
|
333
332
|
});
|
|
334
333
|
// 注文オファー検証
|
|
335
334
|
(0, validation_1.validateAcceptedOffers)({
|
|
@@ -390,21 +389,6 @@ function createResult(params, options) {
|
|
|
390
389
|
}
|
|
391
390
|
function searchAcceptPayActions(params) {
|
|
392
391
|
return async (repos) => {
|
|
393
|
-
// let acceptPayActions = <IAcceptPayAction[]>await repos.action.search(
|
|
394
|
-
// {
|
|
395
|
-
// project: { id: { $eq: params.project.id } },
|
|
396
|
-
// typeOf: { $eq: factory.actionType.AcceptAction },
|
|
397
|
-
// actionStatus: { $in: [factory.actionStatusType.CompletedActionStatus] },
|
|
398
|
-
// purpose: {
|
|
399
|
-
// id: { $in: [params.id] },
|
|
400
|
-
// typeOf: { $in: [factory.transactionType.PlaceOrder] }
|
|
401
|
-
// },
|
|
402
|
-
// object: {
|
|
403
|
-
// typeOf: { $eq: factory.assetTransactionType.Pay }
|
|
404
|
-
// }
|
|
405
|
-
// },
|
|
406
|
-
// ['object', 'endDate', 'result']
|
|
407
|
-
// );
|
|
408
392
|
let acceptPayActions = await repos.acceptPayAction.findAcceptActionsByPurpose({
|
|
409
393
|
project: { id: params.project.id },
|
|
410
394
|
actionStatus: factory_1.factory.actionStatusType.CompletedActionStatus,
|
|
@@ -423,15 +407,6 @@ function searchAcceptPayActions(params) {
|
|
|
423
407
|
function searchAuthorizeActions(params) {
|
|
424
408
|
return async (repos) => {
|
|
425
409
|
// 取引に対する全ての承認アクションをマージ
|
|
426
|
-
// let authorizeActions = <IAuthorizeOfferOrPaymentAction[]>await repos.action.searchByPurpose({
|
|
427
|
-
// typeOf: factory.actionType.AuthorizeAction,
|
|
428
|
-
// purpose: {
|
|
429
|
-
// typeOf: factory.transactionType.PlaceOrder,
|
|
430
|
-
// id: params.id
|
|
431
|
-
// },
|
|
432
|
-
// // Completedに絞る(2023-05-16~)
|
|
433
|
-
// actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
|
|
434
|
-
// });
|
|
435
410
|
let authorizeActions = [
|
|
436
411
|
...await repos.authorizePaymentMethodAction.findAuthorizePaymentMethodActionsByPurpose({
|
|
437
412
|
purpose: {
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.600.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.600.0",
|
|
14
|
-
"@chevre/factory": "9.5.0-alpha.
|
|
14
|
+
"@chevre/factory": "9.5.0-alpha.5",
|
|
15
15
|
"@motionpicture/coa-service": "10.0.0",
|
|
16
16
|
"@motionpicture/gmo-service": "6.1.0-alpha.0",
|
|
17
17
|
"@sendgrid/client": "8.1.4",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"postversion": "git push origin --tags",
|
|
92
92
|
"prepublishOnly": "npm run clean && npm run build"
|
|
93
93
|
},
|
|
94
|
-
"version": "25.2.0-alpha.
|
|
94
|
+
"version": "25.2.0-alpha.10"
|
|
95
95
|
}
|