@chevre/domain 24.0.0-alpha.35 → 24.0.0-alpha.36
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/authorizeProductOffer.js +7 -4
- package/lib/chevre/repo/mongoose/schemas/task.js +1 -0
- package/lib/chevre/repo/order.js +1 -0
- package/lib/chevre/service/offer/event/authorize/factory.js +0 -2
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.js +0 -2
- package/lib/chevre/service/offer/product/factory.d.ts +5 -5
- package/lib/chevre/service/offer/product/factory.js +13 -5
- package/lib/chevre/service/offer/product.d.ts +1 -1
- package/lib/chevre/service/offer/product.js +9 -5
- package/lib/chevre/service/payment/any/factory.js +1 -0
- package/lib/chevre/service/task/syncResourcesFromCOA.js +2 -0
- package/lib/chevre/service/transaction/deleteTransaction.js +1 -0
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/factory.d.ts +1 -0
- package/lib/chevre/service/transaction/placeOrder/confirm.js +15 -14
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +1 -0
- package/package.json +2 -2
|
@@ -43,10 +43,13 @@ class AuthorizeProductOfferActionRepo extends actionProcess_1.ActionProcessRepo
|
|
|
43
43
|
typeOf: { $eq: factory.offerType.Offer }
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
|
-
return authorizeActions.filter((a) =>
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
return authorizeActions.filter((a) =>
|
|
47
|
+
// Array.isArray(a.object)
|
|
48
|
+
// && a.object.length > 0
|
|
49
|
+
// // && a.object[0].typeOf === factory.offerType.Offer
|
|
50
|
+
// && availableProductTypes.indexOf(a.object[0].itemOffered.typeOf) >= 0
|
|
51
|
+
a.object.typeOf === factory.offerType.AggregateOffer
|
|
52
|
+
&& availableProductTypes_1.availableProductTypes.indexOf(a.object.itemOffered.typeOf) >= 0);
|
|
50
53
|
}
|
|
51
54
|
}
|
|
52
55
|
exports.AuthorizeProductOfferActionRepo = AuthorizeProductOfferActionRepo;
|
package/lib/chevre/repo/order.js
CHANGED
|
@@ -853,6 +853,7 @@ class OrderRepo {
|
|
|
853
853
|
}, {
|
|
854
854
|
$set: {
|
|
855
855
|
'paymentMethods.$[invoice].paymentMethod.identifier': params.invoice.paymentMethod.identifier,
|
|
856
|
+
// eslint-disable-next-line no-warning-comments
|
|
856
857
|
// TODO 互換性維持対応としてtypeOfも変更しているが、そのうち廃止(2023-08-30)
|
|
857
858
|
'paymentMethods.$[invoice].typeOf': params.invoice.paymentMethod.identifier
|
|
858
859
|
}
|
|
@@ -121,8 +121,6 @@ function createAuthorizeSeatReservationActionAttributes(params) {
|
|
|
121
121
|
event: authorizeObjectEvent
|
|
122
122
|
// pendingTransaction: params.pendingTransaction, // discontinue(2024-06-22~)
|
|
123
123
|
// ...(params.broker !== undefined) ? { broker: params.broker } : undefined // discontinue(2024-06-24~)
|
|
124
|
-
// useResultAcceptedOffers: false // discontinue(2024-06-24~)
|
|
125
|
-
// acceptedOffer: acceptedOffers // discontinue(2024-06-19~)
|
|
126
124
|
};
|
|
127
125
|
const instrument = {
|
|
128
126
|
// typeOf: 'WebAPI',
|
|
@@ -49,10 +49,8 @@ function createAuthorizeSeatReservationActionAttributes(params) {
|
|
|
49
49
|
const authorizeObject = {
|
|
50
50
|
typeOf: factory.action.authorize.offer.eventService.ObjectType.SeatReservation,
|
|
51
51
|
id: params.acceptAction.id,
|
|
52
|
-
// acceptedOffer: params.acceptedOffers, // discontinue acceptedOffers(2024-06-21~)
|
|
53
52
|
event: authorizeObjectEvent,
|
|
54
53
|
pendingTransaction: params.pendingTransaction
|
|
55
|
-
// useResultAcceptedOffers: false // discontinue(2024-06-24~)
|
|
56
54
|
};
|
|
57
55
|
const instrument = {
|
|
58
56
|
// typeOf: 'WebAPI',
|
|
@@ -4,26 +4,26 @@ export declare function createRegisterServiceStartParams(params: {
|
|
|
4
4
|
id: string;
|
|
5
5
|
typeOf: factory.organizationType.Project;
|
|
6
6
|
};
|
|
7
|
-
object: factory.action.authorize.offer.product.
|
|
7
|
+
object: factory.action.authorize.offer.product.IAcceptedOffer[];
|
|
8
8
|
transaction: Pick<factory.transaction.ITransaction<factory.transactionType>, 'seller' | 'expires'>;
|
|
9
9
|
transactionNumber: string;
|
|
10
10
|
}): factory.assetTransaction.registerService.IStartParamsWithoutDetail;
|
|
11
11
|
export declare function createActionAttributes(params: {
|
|
12
|
-
acceptedOffer: factory.action.authorize.offer.product.
|
|
12
|
+
acceptedOffer: factory.action.authorize.offer.product.IAcceptedOffer[];
|
|
13
13
|
transaction: Pick<factory.transaction.ITransaction<factory.transactionType.PlaceOrder>, 'agent' | 'id' | 'project' | 'seller' | 'typeOf'>;
|
|
14
14
|
transactionNumber: string;
|
|
15
15
|
}): factory.action.authorize.offer.product.IAttributes;
|
|
16
16
|
export declare function acceptedOffers2amount(params: {
|
|
17
17
|
acceptedOffers: IResultAcceptedOffer;
|
|
18
18
|
}): number;
|
|
19
|
-
type IResultAcceptedOffer = factory.
|
|
19
|
+
type IResultAcceptedOffer = factory.order.IAcceptedOffer<factory.order.IPermit>[];
|
|
20
20
|
export declare function responseBody2resultAcceptedOffer(params: {
|
|
21
21
|
project: {
|
|
22
22
|
id: string;
|
|
23
23
|
typeOf: factory.organizationType.Project;
|
|
24
24
|
};
|
|
25
25
|
responseBody: factory.assetTransaction.registerService.ITransaction;
|
|
26
|
-
acceptedOffer: factory.action.authorize.offer.product.
|
|
26
|
+
acceptedOffer: factory.action.authorize.offer.product.IAcceptedOffer[];
|
|
27
27
|
}): IResultAcceptedOffer;
|
|
28
28
|
export declare function createResult(params: {
|
|
29
29
|
project: {
|
|
@@ -32,6 +32,6 @@ export declare function createResult(params: {
|
|
|
32
32
|
};
|
|
33
33
|
requestBody: factory.assetTransaction.registerService.IStartParamsWithoutDetail;
|
|
34
34
|
responseBody: factory.assetTransaction.registerService.ITransaction;
|
|
35
|
-
acceptedOffer: factory.action.authorize.offer.product.
|
|
35
|
+
acceptedOffer: factory.action.authorize.offer.product.IAcceptedOffer[];
|
|
36
36
|
}): factory.action.authorize.offer.product.IResult;
|
|
37
37
|
export {};
|
|
@@ -79,6 +79,13 @@ function createRegisterServiceStartParams(params) {
|
|
|
79
79
|
}
|
|
80
80
|
function createActionAttributes(params) {
|
|
81
81
|
const transaction = params.transaction;
|
|
82
|
+
const actionObject = {
|
|
83
|
+
typeOf: factory.offerType.AggregateOffer,
|
|
84
|
+
itemOffered: {
|
|
85
|
+
id: params.acceptedOffer[0].itemOffered.id,
|
|
86
|
+
typeOf: params.acceptedOffer[0].itemOffered.typeOf
|
|
87
|
+
}
|
|
88
|
+
};
|
|
82
89
|
return {
|
|
83
90
|
project: transaction.project,
|
|
84
91
|
typeOf: factory.actionType.AuthorizeAction,
|
|
@@ -86,7 +93,8 @@ function createActionAttributes(params) {
|
|
|
86
93
|
typeOf: factory.assetTransactionType.RegisterService,
|
|
87
94
|
transactionNumber: params.transactionNumber
|
|
88
95
|
},
|
|
89
|
-
object: params.acceptedOffer,
|
|
96
|
+
// object: params.acceptedOffer,
|
|
97
|
+
object: actionObject, // optimize(2026-03-13~)
|
|
90
98
|
agent: {
|
|
91
99
|
id: transaction.seller.id,
|
|
92
100
|
typeOf: transaction.seller.typeOf,
|
|
@@ -199,7 +207,7 @@ function responseBody2resultAcceptedOffer(params) {
|
|
|
199
207
|
const permitAcceptedOffer = {
|
|
200
208
|
typeOf: responseBodyObject.typeOf,
|
|
201
209
|
id: offer.id,
|
|
202
|
-
name: offer.name,
|
|
210
|
+
// name: offer.name,
|
|
203
211
|
itemOffered,
|
|
204
212
|
priceSpecification,
|
|
205
213
|
serialNumber: params.responseBody.transactionNumber
|
|
@@ -214,10 +222,10 @@ function createResult(params) {
|
|
|
214
222
|
// 金額計算
|
|
215
223
|
const amount = acceptedOffers2amount({ acceptedOffers: acceptedOffers4result });
|
|
216
224
|
return {
|
|
225
|
+
typeOf: factory.offerType.AggregateOffer,
|
|
217
226
|
price: amount,
|
|
218
227
|
priceCurrency: factory.priceCurrency.JPY,
|
|
219
|
-
//
|
|
220
|
-
|
|
221
|
-
responseBody: params.responseBody
|
|
228
|
+
// requestBody: params.requestBody, // discontinue(2026-03-13~)
|
|
229
|
+
// responseBody: params.responseBody // discontinue(2026-03-13~)
|
|
222
230
|
};
|
|
223
231
|
}
|
|
@@ -77,7 +77,7 @@ export declare function authorize(params: {
|
|
|
77
77
|
id: string;
|
|
78
78
|
typeOf: factory.organizationType.Project;
|
|
79
79
|
};
|
|
80
|
-
object: factory.action.authorize.offer.product.
|
|
80
|
+
object: factory.action.authorize.offer.product.IAcceptedOffer[];
|
|
81
81
|
agent: {
|
|
82
82
|
id: string;
|
|
83
83
|
typeOf: factory.personType.Person | factory.creativeWorkType.WebApplication;
|
|
@@ -245,13 +245,17 @@ function voidTransaction(params) {
|
|
|
245
245
|
}
|
|
246
246
|
})
|
|
247
247
|
.then((actions) => actions
|
|
248
|
-
.filter((a) =>
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
248
|
+
.filter((a) =>
|
|
249
|
+
// Array.isArray(a.object)
|
|
250
|
+
// && a.object.length > 0
|
|
251
|
+
// && a.object[0].typeOf === factory.offerType.Offer
|
|
252
|
+
// && availableProductTypes.indexOf(a.object[0].itemOffered.typeOf) >= 0
|
|
253
|
+
a.object.typeOf === factory.offerType.AggregateOffer
|
|
254
|
+
&& availableProductTypes_1.availableProductTypes.indexOf(a.object.itemOffered.typeOf) >= 0));
|
|
252
255
|
}
|
|
253
256
|
await Promise.all(authorizeActions.map(async (action) => {
|
|
254
|
-
const productId = action.object[0]?.itemOffered?.id;
|
|
257
|
+
// const productId = action.object[0]?.itemOffered?.id;
|
|
258
|
+
const productId = action.object?.itemOffered?.id;
|
|
255
259
|
if (typeof productId === 'string') {
|
|
256
260
|
// 廃止(2023-12-07~)
|
|
257
261
|
// await processUnlockRegisterMembershipService({
|
|
@@ -276,6 +276,7 @@ function createAuthorizeResult(params) {
|
|
|
276
276
|
typeOf: factory.action.authorize.paymentMethod.any.ResultType.Payment,
|
|
277
277
|
referencesOrder // add(2025-11-23~)
|
|
278
278
|
};
|
|
279
|
+
// eslint-disable-next-line no-warning-comments
|
|
279
280
|
// TODO 保留 resultにメンバーシップを追加(2024-08-13~)
|
|
280
281
|
// let resultAsPermit: factory.action.authorize.paymentMethod.any.IResultAsPermit | undefined;
|
|
281
282
|
// if (typeof params.permit?.identifier === 'string') {
|
|
@@ -144,6 +144,7 @@ function syncEventSeries(params) {
|
|
|
144
144
|
project: { typeOf: factory.organizationType.Project, id: params.project.id },
|
|
145
145
|
typeOf: factory.actionType.ReplaceAction,
|
|
146
146
|
agent: params.agent,
|
|
147
|
+
// eslint-disable-next-line no-warning-comments
|
|
147
148
|
// TODO define object
|
|
148
149
|
object: {
|
|
149
150
|
...params.object,
|
|
@@ -212,6 +213,7 @@ function syncEvents(params) {
|
|
|
212
213
|
project: { typeOf: factory.organizationType.Project, id: params.project.id },
|
|
213
214
|
typeOf: factory.actionType.ReplaceAction,
|
|
214
215
|
agent: params.agent,
|
|
216
|
+
// eslint-disable-next-line no-warning-comments
|
|
215
217
|
// TODO define object
|
|
216
218
|
object: {
|
|
217
219
|
...params.object,
|
|
@@ -221,6 +221,7 @@ function deleteTransactionById(params) {
|
|
|
221
221
|
default:
|
|
222
222
|
throw new factory.errors.NotImplemented(`${transaction.status} not implemented`);
|
|
223
223
|
}
|
|
224
|
+
// eslint-disable-next-line no-warning-comments
|
|
224
225
|
// TODO サービス登録取引を削除
|
|
225
226
|
// 決済取引を削除
|
|
226
227
|
const deletePayTransactionsByPlaceOrderResult = await deletePayTransactionsByPlaceOrder({ authorizeActions, transaction })(repos);
|
|
@@ -4,5 +4,6 @@ export type IAuthorizeEventServiceOffer = factory.action.authorize.offer.eventSe
|
|
|
4
4
|
export type IAuthorizeProductOffer = factory.action.authorize.offer.product.IAction;
|
|
5
5
|
export type IAuthorizePaymentAction = Pick<factory.action.authorize.paymentMethod.any.IAction, 'id' | 'result' | 'endDate'> & {
|
|
6
6
|
object: Pick<factory.action.authorize.paymentMethod.any.IObject, 'typeOf' | 'paymentMethodId'>;
|
|
7
|
+
instrument?: never;
|
|
7
8
|
};
|
|
8
9
|
export type IPayTransaction = Pick<factory.assetTransaction.pay.ITransaction, 'object'>;
|
|
@@ -31,7 +31,6 @@ const debug_1 = __importDefault(require("debug"));
|
|
|
31
31
|
const moment_1 = __importDefault(require("moment"));
|
|
32
32
|
const errorHandler_1 = require("../../../errorHandler");
|
|
33
33
|
const factory = __importStar(require("../../../factory"));
|
|
34
|
-
const availableProductTypes_1 = require("../../../factory/availableProductTypes");
|
|
35
34
|
// import { Settings } from '../../../settings';
|
|
36
35
|
const factory_1 = require("../../order/placeOrder/factory");
|
|
37
36
|
const orderedItem_1 = require("../../order/placeOrder/factory/orderedItem");
|
|
@@ -245,27 +244,29 @@ function dissolveAuthorizeActions(completedAuthorizeActions) {
|
|
|
245
244
|
completedAuthorizeActions.forEach((a) => {
|
|
246
245
|
let serialNumber;
|
|
247
246
|
if (Array.isArray(a.object)) {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
247
|
+
throw new factory.errors.NotImplemented('authorizeAction object as an array discontinued.'); // discontinue(2026-03-13~)
|
|
248
|
+
// if (
|
|
249
|
+
// a.object.length > 0
|
|
250
|
+
// && a.object.every(({ typeOf }) => typeOf === factory.offerType.Offer)
|
|
251
|
+
// && a.object.every(({ itemOffered }) => availableProductTypes.indexOf(itemOffered.typeOf) >= 0)
|
|
252
|
+
// ) {
|
|
253
|
+
// authorizeProductOfferActions.push(<IAuthorizeProductOffer>a);
|
|
254
|
+
// serialNumber = (<IAuthorizeProductOffer>a).instrument.transactionNumber;
|
|
255
|
+
// }
|
|
254
256
|
}
|
|
255
257
|
else {
|
|
256
258
|
if (a.object.typeOf === factory.action.authorize.offer.eventService.ObjectType.SeatReservation) {
|
|
257
259
|
authorizeEventServiceOfferActions.push(a);
|
|
258
|
-
const assetTransactionNumber = a.instrument
|
|
260
|
+
const assetTransactionNumber = a.instrument?.transactionNumber;
|
|
259
261
|
if (typeof assetTransactionNumber !== 'string') {
|
|
260
262
|
throw new factory.errors.NotFound('instrument.transactionNumber', `action.instrument.transactionNumber not found. [${a.id}]`);
|
|
261
263
|
}
|
|
262
264
|
serialNumber = assetTransactionNumber;
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
// serialNumber = (<IAuthorizeMoneyTransferOffer>a).instrument.transactionNumber;
|
|
265
|
+
}
|
|
266
|
+
else if (a.object.typeOf === factory.offerType.AggregateOffer
|
|
267
|
+
&& a.instrument?.typeOf === factory.assetTransactionType.RegisterService) {
|
|
268
|
+
authorizeProductOfferActions.push(a);
|
|
269
|
+
serialNumber = a.instrument.transactionNumber;
|
|
269
270
|
}
|
|
270
271
|
else if (a.object.typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment) {
|
|
271
272
|
authorizePaymentActions.push(a);
|
|
@@ -214,6 +214,7 @@ function createTasks(params, setting
|
|
|
214
214
|
else {
|
|
215
215
|
taskAttributes.push(voidReserveTaskAttributes, voidPaymentTaskAttributes);
|
|
216
216
|
}
|
|
217
|
+
// eslint-disable-next-line no-warning-comments
|
|
217
218
|
// TODO reimplement
|
|
218
219
|
// temporarily discontinue VoidRegisterServiceTransaction VoidMoneyTransferTransaction(2025-02-25~)
|
|
219
220
|
// const voidRegisterServiceTaskAttributes: factory.task.IAttributes<factory.taskName.VoidRegisterServiceTransaction> = {
|
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": "6.0.0-alpha.
|
|
14
|
+
"@chevre/factory": "6.0.0-alpha.1",
|
|
15
15
|
"@cinerino/sdk": "13.2.0",
|
|
16
16
|
"@motionpicture/coa-service": "9.6.0",
|
|
17
17
|
"@motionpicture/gmo-service": "5.4.0-alpha.1",
|
|
@@ -99,5 +99,5 @@
|
|
|
99
99
|
"postversion": "git push origin --tags",
|
|
100
100
|
"prepublishOnly": "npm run clean && npm run build"
|
|
101
101
|
},
|
|
102
|
-
"version": "24.0.0-alpha.
|
|
102
|
+
"version": "24.0.0-alpha.36"
|
|
103
103
|
}
|