@chevre/domain 21.33.0-alpha.8 → 21.33.0-alpha.9
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/mongoose/schemas/transaction.js +2 -1
- package/lib/chevre/repo/transaction.js +3 -5
- package/lib/chevre/service/offer/event/authorize.js +6 -2
- package/lib/chevre/service/offer/event/voidTransactionByActionId.js +4 -17
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +6 -2
- package/lib/chevre/service/offer/eventServiceByCOA/cancel.js +4 -2
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +8 -2
- package/lib/chevre/service/payment/any/factory.d.ts +7 -1
- package/lib/chevre/service/payment/any/factory.js +2 -1
- package/lib/chevre/service/payment/any.js +8 -5
- package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +4 -9
- package/package.json +2 -2
|
@@ -23,7 +23,8 @@ const schemaDefinition = {
|
|
|
23
23
|
tasksExportAction: mongoose_1.SchemaTypes.Mixed,
|
|
24
24
|
tasksExportedAt: Date,
|
|
25
25
|
tasksExportationStatus: String,
|
|
26
|
-
potentialActions: mongoose_1.SchemaTypes.Mixed
|
|
26
|
+
potentialActions: mongoose_1.SchemaTypes.Mixed,
|
|
27
|
+
instrument: mongoose_1.SchemaTypes.Mixed
|
|
27
28
|
};
|
|
28
29
|
const schemaOptions = {
|
|
29
30
|
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
|
@@ -260,11 +260,9 @@ class MongoRepository {
|
|
|
260
260
|
};
|
|
261
261
|
}
|
|
262
262
|
else if (typeOf === factory.transactionType.PlaceOrder) {
|
|
263
|
-
const { agent, project, object, seller } = params;
|
|
264
|
-
creatingTransaction = {
|
|
265
|
-
|
|
266
|
-
agent, project, seller, object
|
|
267
|
-
};
|
|
263
|
+
const { agent, project, object, seller, instrument } = params;
|
|
264
|
+
creatingTransaction = Object.assign({ status, startDate, expires, typeOf, tasksExportAction, tasksExportationStatus,
|
|
265
|
+
agent, project, seller, object }, (typeof (instrument === null || instrument === void 0 ? void 0 : instrument.id) === 'string') ? { instrument } : undefined);
|
|
268
266
|
}
|
|
269
267
|
else if (typeOf === factory.transactionType.ReturnOrder) {
|
|
270
268
|
const { agent, project, object, seller } = params;
|
|
@@ -118,12 +118,16 @@ function validateCreateRequest(params) {
|
|
|
118
118
|
const transaction = yield repos.transaction.findInProgressById({
|
|
119
119
|
typeOf: factory.transactionType.PlaceOrder,
|
|
120
120
|
id: params.transaction.id
|
|
121
|
-
}, ['agent', 'expires', 'project', 'seller', 'typeOf', '
|
|
121
|
+
}, ['agent', 'expires', 'project', 'seller', 'typeOf', 'instrument']);
|
|
122
122
|
if (transaction.agent.id !== params.agent.id) {
|
|
123
123
|
throw new factory.errors.Forbidden('Transaction not yours');
|
|
124
124
|
}
|
|
125
125
|
// クライアント検証(2024-02-07~)
|
|
126
|
-
if (
|
|
126
|
+
// if (transaction.object.clientUser?.client_id !== params.store.id) {
|
|
127
|
+
// throw new factory.errors.Forbidden('client not match that of the transaction');
|
|
128
|
+
// }
|
|
129
|
+
const instrumentId = (_a = transaction.instrument) === null || _a === void 0 ? void 0 : _a.id;
|
|
130
|
+
if (typeof instrumentId === 'string' && instrumentId !== params.store.id) {
|
|
127
131
|
throw new factory.errors.Forbidden('client not match that of the transaction');
|
|
128
132
|
}
|
|
129
133
|
if (typeof ((_b = params.object.reservationFor) === null || _b === void 0 ? void 0 : _b.id) !== 'string' || params.object.reservationFor.id.length === 0) {
|
|
@@ -19,21 +19,6 @@ const processVoidTransaction4coa_1 = require("./voidTransaction/processVoidTrans
|
|
|
19
19
|
* 特定の承認アクションについて処理する
|
|
20
20
|
*/
|
|
21
21
|
function voidTransactionByActionId(params) {
|
|
22
|
-
// export function cancel(params: {
|
|
23
|
-
// project: { id: string; typeOf: factory.organizationType.Project };
|
|
24
|
-
// /**
|
|
25
|
-
// * 承認アクションID
|
|
26
|
-
// */
|
|
27
|
-
// id: string;
|
|
28
|
-
// /**
|
|
29
|
-
// * 取引進行者
|
|
30
|
-
// */
|
|
31
|
-
// agent: { id: string };
|
|
32
|
-
// /**
|
|
33
|
-
// * 取引
|
|
34
|
-
// */
|
|
35
|
-
// transaction: { id: string };
|
|
36
|
-
// }) {
|
|
37
22
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
38
23
|
var _a;
|
|
39
24
|
if (typeof params.id !== 'string' || params.id === '') {
|
|
@@ -43,10 +28,11 @@ function voidTransactionByActionId(params) {
|
|
|
43
28
|
const transaction = yield repos.transaction.findInProgressById({
|
|
44
29
|
typeOf: factory.transactionType.PlaceOrder,
|
|
45
30
|
id: params.purpose.id
|
|
46
|
-
}, ['typeOf'
|
|
31
|
+
}, ['typeOf']);
|
|
47
32
|
// if (transaction.agent.id !== params.agent.id) {
|
|
48
33
|
// throw new factory.errors.Forbidden('Transaction not yours');
|
|
49
34
|
// }
|
|
35
|
+
const orderNumber = yield repos.transaction.findInProgressOrderNumberById({ id: params.purpose.id });
|
|
50
36
|
const action = yield repos.action.findById({ typeOf: factory.actionType.AuthorizeAction, id: params.id });
|
|
51
37
|
if (action.purpose.typeOf !== transaction.typeOf || action.purpose.id !== transaction.id) {
|
|
52
38
|
throw new factory.errors.Argument('Transaction', 'Action not found in the transaction');
|
|
@@ -56,7 +42,8 @@ function voidTransactionByActionId(params) {
|
|
|
56
42
|
yield repos.action.cancelWithVoid({ typeOf: factory.actionType.AuthorizeAction, id: params.id, cancelAction });
|
|
57
43
|
// add orderInTransaction(2024-01-15~)
|
|
58
44
|
// USE_CREATE_ORDER_ON_OFFER_ACCEPTEDの場合、orderNumber発行済のはず
|
|
59
|
-
const orderNumberByTransaction = transaction.object.orderNumber;
|
|
45
|
+
// const orderNumberByTransaction = transaction.object.orderNumber;
|
|
46
|
+
const orderNumberByTransaction = orderNumber; // transaction.objectへのアクセス回避(2024-05-30~)
|
|
60
47
|
if (typeof orderNumberByTransaction === 'string') {
|
|
61
48
|
yield (0, any_1.voidAcceptedOffer)({
|
|
62
49
|
// authorizeActions: [action],
|
|
@@ -26,12 +26,16 @@ function authorize(params) {
|
|
|
26
26
|
const transaction = yield repos.transaction.findInProgressById({
|
|
27
27
|
typeOf: factory.transactionType.PlaceOrder,
|
|
28
28
|
id: params.transaction.id
|
|
29
|
-
}, ['agent', 'project', 'seller', 'typeOf', '
|
|
29
|
+
}, ['agent', 'project', 'seller', 'typeOf', 'instrument']);
|
|
30
30
|
if (transaction.agent.id !== params.agent.id) {
|
|
31
31
|
throw new factory.errors.Forbidden('Transaction not yours');
|
|
32
32
|
}
|
|
33
33
|
// クライアント検証(2024-02-07~)
|
|
34
|
-
if (
|
|
34
|
+
// if (transaction.object.clientUser?.client_id !== params.store.id) {
|
|
35
|
+
// throw new factory.errors.Forbidden('client not match that of the transaction');
|
|
36
|
+
// }
|
|
37
|
+
const instrumentId = (_a = transaction.instrument) === null || _a === void 0 ? void 0 : _a.id;
|
|
38
|
+
if (typeof instrumentId === 'string' && instrumentId !== params.store.id) {
|
|
35
39
|
throw new factory.errors.Forbidden('client not match that of the transaction');
|
|
36
40
|
}
|
|
37
41
|
let screeningEvent;
|
|
@@ -25,10 +25,11 @@ function cancel(params) {
|
|
|
25
25
|
const transaction = yield repos.transaction.findInProgressById({
|
|
26
26
|
typeOf: factory.transactionType.PlaceOrder,
|
|
27
27
|
id: params.transaction.id
|
|
28
|
-
}, ['typeOf', '
|
|
28
|
+
}, ['typeOf', 'agent']);
|
|
29
29
|
if (transaction.agent.id !== params.agent.id) {
|
|
30
30
|
throw new factory.errors.Forbidden('Transaction not yours');
|
|
31
31
|
}
|
|
32
|
+
const orderNumber = yield repos.transaction.findInProgressOrderNumberById({ id: params.transaction.id });
|
|
32
33
|
// 取引内のアクションかどうか確認
|
|
33
34
|
const action = yield repos.action.findById({ typeOf: factory.actionType.AuthorizeAction, id: params.id });
|
|
34
35
|
if (action.purpose.typeOf !== transaction.typeOf || action.purpose.id !== transaction.id) {
|
|
@@ -37,7 +38,8 @@ function cancel(params) {
|
|
|
37
38
|
yield repos.action.cancelWithVoid({ typeOf: factory.actionType.AuthorizeAction, id: params.id, cancelAction });
|
|
38
39
|
// add orderInTransaction(2024-01-15~)
|
|
39
40
|
// USE_CREATE_ORDER_ON_OFFER_ACCEPTEDの場合、orderNumber発行済のはず
|
|
40
|
-
const orderNumberByTransaction = transaction.object.orderNumber;
|
|
41
|
+
// const orderNumberByTransaction = transaction.object.orderNumber;
|
|
42
|
+
const orderNumberByTransaction = orderNumber; // transaction.objectへのアクセス回避(2024-05-30~)
|
|
41
43
|
if (typeof orderNumberByTransaction === 'string') {
|
|
42
44
|
yield (0, any_1.voidAcceptedOffer)({
|
|
43
45
|
// authorizeActions: [action],
|
|
@@ -26,10 +26,15 @@ function changeOffers(params) {
|
|
|
26
26
|
const transaction = yield repos.transaction.findInProgressById({
|
|
27
27
|
typeOf: factory.transactionType.PlaceOrder,
|
|
28
28
|
id: params.transaction.id
|
|
29
|
-
}, ['typeOf', '
|
|
29
|
+
}, ['typeOf', 'agent', 'project', 'seller']);
|
|
30
30
|
if (transaction.agent.id !== params.agent.id) {
|
|
31
31
|
throw new factory.errors.Forbidden('Transaction not yours');
|
|
32
32
|
}
|
|
33
|
+
const orderNumber = yield repos.transaction.findInProgressOrderNumberById({ id: params.transaction.id });
|
|
34
|
+
if (typeof orderNumber !== 'string') {
|
|
35
|
+
// 事前に発行されているはず
|
|
36
|
+
throw new factory.errors.NotFound('transaction.object.orderNumber');
|
|
37
|
+
}
|
|
33
38
|
// 取引内のアクションかどうか確認
|
|
34
39
|
const authorizeAction = yield repos.action.findById({ typeOf: factory.actionType.AuthorizeAction, id: params.id });
|
|
35
40
|
if (authorizeAction.purpose.typeOf !== transaction.typeOf || authorizeAction.purpose.id !== transaction.id) {
|
|
@@ -97,7 +102,8 @@ function changeOffers(params) {
|
|
|
97
102
|
yield repos.action.reStart({ id: authorizeAction.id });
|
|
98
103
|
try {
|
|
99
104
|
// まずvoidAcceptedOffer
|
|
100
|
-
const orderNumberByTransaction = transaction.object.orderNumber;
|
|
105
|
+
// const orderNumberByTransaction = transaction.object.orderNumber;
|
|
106
|
+
const orderNumberByTransaction = orderNumber; // transaction.objectへのアクセス回避(2024-05-30~)
|
|
101
107
|
if (typeof orderNumberByTransaction === 'string') {
|
|
102
108
|
yield (0, any_1.voidAcceptedOffer)({
|
|
103
109
|
// authorizeActions: [authorizeAction],
|
|
@@ -14,9 +14,15 @@ export declare function creatPayTransactionStartParams(params: {
|
|
|
14
14
|
accountId?: string;
|
|
15
15
|
object: factory.action.authorize.paymentMethod.any.IObject;
|
|
16
16
|
paymentServiceType: factory.service.paymentService.PaymentServiceType;
|
|
17
|
-
transaction: Pick<factory.transaction.ITransaction<factory.transactionType.PlaceOrder>, 'expires' | 'seller' | 'project'
|
|
17
|
+
transaction: Pick<factory.transaction.ITransaction<factory.transactionType.PlaceOrder>, 'expires' | 'seller' | 'project'>;
|
|
18
18
|
transactionNumber: string;
|
|
19
19
|
location?: factory.action.trade.pay.ILocation;
|
|
20
|
+
order: {
|
|
21
|
+
/**
|
|
22
|
+
* 決済カード決済承認の場合、事前発行済の確認番号を決済取引へ連携
|
|
23
|
+
*/
|
|
24
|
+
confirmationNumber?: string;
|
|
25
|
+
};
|
|
20
26
|
}): factory.assetTransaction.pay.IStartParamsWithoutDetail;
|
|
21
27
|
export declare function createMovieTicket(params: factory.action.trade.pay.IMovieTicket): factory.action.trade.pay.IMovieTicket;
|
|
22
28
|
export declare function createAuthorizeResult(params: {
|
|
@@ -17,7 +17,8 @@ function creatPayTransactionStartParams(params) {
|
|
|
17
17
|
.toDate();
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
const confirmationNumber = params.transaction.object.confirmationNumber;
|
|
20
|
+
// const confirmationNumber = params.transaction.object.confirmationNumber;
|
|
21
|
+
const confirmationNumber = params.order.confirmationNumber; // transaction.objectへのアクセス回避(2024-05-30~)
|
|
21
22
|
const issuedThroughId = (_a = params.object.issuedThrough) === null || _a === void 0 ? void 0 : _a.id;
|
|
22
23
|
const accountId = (typeof params.accountId === 'string')
|
|
23
24
|
? params.accountId
|
|
@@ -228,7 +228,7 @@ function publishPaymentUrl(params) {
|
|
|
228
228
|
throw new factory.errors.NotImplemented(`purpose.typeOf '${params.purpose.typeOf} not implemented'`);
|
|
229
229
|
}
|
|
230
230
|
try {
|
|
231
|
-
const transaction = yield repos.transaction.findInProgressById({ typeOf: params.purpose.typeOf, id: params.purpose.id }, ['expires', 'seller', 'project'
|
|
231
|
+
const transaction = yield repos.transaction.findInProgressById({ typeOf: params.purpose.typeOf, id: params.purpose.id }, ['expires', 'seller', 'project']);
|
|
232
232
|
const paymentServiceType = params.paymentServiceType;
|
|
233
233
|
// 取引番号生成
|
|
234
234
|
const { transactionNumber } = yield repos.transactionNumber.publishByTimestamp({
|
|
@@ -242,7 +242,8 @@ function publishPaymentUrl(params) {
|
|
|
242
242
|
paymentServiceType,
|
|
243
243
|
transaction: transaction,
|
|
244
244
|
transactionNumber: transactionNumber,
|
|
245
|
-
location: params.location
|
|
245
|
+
location: params.location,
|
|
246
|
+
order: {}
|
|
246
247
|
});
|
|
247
248
|
const taskId = (_a = params.sameAs) === null || _a === void 0 ? void 0 : _a.id;
|
|
248
249
|
result = yield PayTransactionService.publishPaymentUrl(startParams, {
|
|
@@ -294,8 +295,9 @@ function authorize(params) {
|
|
|
294
295
|
throw new factory.errors.NotImplemented(`purpose.typeOf '${params.purpose.typeOf} not implemented'`);
|
|
295
296
|
}
|
|
296
297
|
// MovieTicketの場合、確認番号を発行(着券に連携するため)(2024-05-27~)
|
|
298
|
+
let confirmationNumber;
|
|
297
299
|
if (params.paymentServiceType === factory.service.paymentService.PaymentServiceType.MovieTicket) {
|
|
298
|
-
yield (0, publishConfirmationNumberIfNotExist_1.publishConfirmationNumberIfNotExist)({
|
|
300
|
+
confirmationNumber = yield (0, publishConfirmationNumberIfNotExist_1.publishConfirmationNumberIfNotExist)({
|
|
299
301
|
id: params.purpose.id,
|
|
300
302
|
status: { $in: [factory.transactionStatusType.InProgress] },
|
|
301
303
|
object: { orderDate: new Date() }
|
|
@@ -304,7 +306,7 @@ function authorize(params) {
|
|
|
304
306
|
transaction: repos.transaction
|
|
305
307
|
});
|
|
306
308
|
}
|
|
307
|
-
const transaction = yield repos.transaction.findInProgressById({ typeOf: params.purpose.typeOf, id: params.purpose.id }, ['agent', 'expires', '
|
|
309
|
+
const transaction = yield repos.transaction.findInProgressById({ typeOf: params.purpose.typeOf, id: params.purpose.id }, ['agent', 'expires', 'typeOf', 'project', 'seller']);
|
|
308
310
|
const paymentServiceType = params.paymentServiceType;
|
|
309
311
|
// 取引番号生成
|
|
310
312
|
let transactionNumber;
|
|
@@ -386,7 +388,8 @@ function authorize(params) {
|
|
|
386
388
|
paymentServiceType,
|
|
387
389
|
transaction: transaction,
|
|
388
390
|
transactionNumber: transactionNumber,
|
|
389
|
-
location: params.location
|
|
391
|
+
location: params.location,
|
|
392
|
+
order: Object.assign({}, (typeof confirmationNumber === 'string') ? { confirmationNumber } : undefined)
|
|
390
393
|
});
|
|
391
394
|
payTransaction = yield PayTransactionService.start(startParams, Object.assign({ useCheckMovieTicketBeforePay: params.options.useCheckMovieTicketBeforePay, useCheckByIdentifierIfNotYet: params.options.useCheckByIdentifierIfNotYet, executor: (typeof taskId === 'string') ? { id: taskId } : {} }, (pendingPaymentAgencyTransaction !== undefined) ? { pendingPaymentAgencyTransaction } : undefined))(repos);
|
|
392
395
|
}
|
|
@@ -5,9 +5,11 @@ const factory = require("../../../factory");
|
|
|
5
5
|
function createStartParams(params, expiresInSeconds, passport, seller, broker, customerType, memeberOfPayload) {
|
|
6
6
|
var _a, _b, _c, _d, _e;
|
|
7
7
|
let clientUser;
|
|
8
|
+
let instrument;
|
|
8
9
|
if (typeof ((_a = params.object.clientUser) === null || _a === void 0 ? void 0 : _a.client_id) === 'string') {
|
|
9
10
|
const { sub, token_use, iss, exp, iat, version, jti, client_id, username, aud, typ } = params.object.clientUser;
|
|
10
11
|
clientUser = { sub, token_use, iss, exp, iat, version, jti, client_id, username, aud, typ };
|
|
12
|
+
instrument = { id: client_id, typeOf: factory.creativeWorkType.WebApplication };
|
|
11
13
|
}
|
|
12
14
|
const transactionObject = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (typeof ((_b = params.object.passport) === null || _b === void 0 ? void 0 : _b.token) === 'string') ? { passportToken: params.object.passport.token } : undefined), (typeof (passport === null || passport === void 0 ? void 0 : passport.scope) === 'string') ? { passport } : undefined), (typeof (clientUser === null || clientUser === void 0 ? void 0 : clientUser.client_id) === 'string') ? { clientUser } : undefined), (typeof ((_c = params.object) === null || _c === void 0 ? void 0 : _c.name) === 'string') ? { name: (_d = params.object) === null || _d === void 0 ? void 0 : _d.name } : undefined), (typeof (broker === null || broker === void 0 ? void 0 : broker.typeOf) === 'string') ? { broker: broker } : undefined), (typeof ((_e = params.object.customer) === null || _e === void 0 ? void 0 : _e.typeOf) === 'string') ? { customer: params.object.customer } : undefined), (typeof customerType === 'string') ? { customerType } : undefined);
|
|
13
15
|
if (typeof seller.id !== 'string') {
|
|
@@ -17,18 +19,11 @@ function createStartParams(params, expiresInSeconds, passport, seller, broker, c
|
|
|
17
19
|
throw new factory.errors.ArgumentNull('expiresInSeconds');
|
|
18
20
|
}
|
|
19
21
|
const agent = Object.assign(Object.assign({}, params.agent), (memeberOfPayload !== undefined) ? { memeberOfPayload } : undefined);
|
|
20
|
-
return {
|
|
21
|
-
project: { typeOf: seller.project.typeOf, id: seller.project.id },
|
|
22
|
-
typeOf: factory.transactionType.PlaceOrder,
|
|
23
|
-
agent,
|
|
24
|
-
seller: {
|
|
22
|
+
return Object.assign({ project: { typeOf: seller.project.typeOf, id: seller.project.id }, typeOf: factory.transactionType.PlaceOrder, agent, seller: {
|
|
25
23
|
id: seller.id,
|
|
26
24
|
name: seller.name,
|
|
27
25
|
typeOf: seller.typeOf,
|
|
28
26
|
additionalProperty: (Array.isArray(seller.additionalProperty)) ? seller.additionalProperty : [] // 追加特性を追加(2023-08-08~)
|
|
29
|
-
},
|
|
30
|
-
object: transactionObject,
|
|
31
|
-
expiresInSeconds
|
|
32
|
-
};
|
|
27
|
+
}, object: transactionObject, expiresInSeconds }, (typeof (instrument === null || instrument === void 0 ? void 0 : instrument.id) === 'string') ? { instrument } : undefined);
|
|
33
28
|
}
|
|
34
29
|
exports.createStartParams = createStartParams;
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/credential-providers": "3.433.0",
|
|
13
|
-
"@chevre/factory": "4.
|
|
13
|
+
"@chevre/factory": "4.373.0",
|
|
14
14
|
"@cinerino/sdk": "7.0.0-alpha.12",
|
|
15
15
|
"@motionpicture/coa-service": "9.4.0",
|
|
16
16
|
"@motionpicture/gmo-service": "5.3.0",
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"postversion": "git push origin --tags",
|
|
111
111
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
112
112
|
},
|
|
113
|
-
"version": "21.33.0-alpha.
|
|
113
|
+
"version": "21.33.0-alpha.9"
|
|
114
114
|
}
|