@chevre/domain 21.35.0-alpha.26 → 21.35.0-alpha.28
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/example/src/chevre/investigateCheckMovieTicketActions.ts +1 -1
- package/example/src/chevre/migrateAuthorizeEventServiceOfferCOA.ts +1 -1
- package/example/src/chevre/migrateAuthorizeEventServiceOfferChevre.ts +1 -1
- package/example/src/chevre/migrateAuthorizeEventServiceOfferInstrument.ts +23 -11
- package/example/src/chevre/migrateAuthorizeEventServiceOfferResult.ts +1 -1
- package/lib/chevre/service/offer/event/factory.js +16 -7
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +2 -2
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/factory.js +9 -8
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +2 -2
- package/lib/chevre/service/order/placeOrder/factory.js +4 -6
- package/lib/chevre/service/task/confirmReserveTransaction.js +3 -3
- package/lib/chevre/service/transaction/placeOrderInProgress/confirm.js +11 -14
- package/lib/chevre/service/transaction/placeOrderInProgress/result.d.ts +1 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/result.js +25 -20
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +21 -5
- package/lib/chevre/service/transaction.d.ts +1 -1
- package/lib/chevre/service/transaction.js +10 -5
- package/package.json +2 -2
|
@@ -22,7 +22,7 @@ async function main() {
|
|
|
22
22
|
// .add(-180, 'days')
|
|
23
23
|
// },
|
|
24
24
|
'object.typeOf': { $exists: true, $eq: chevre.factory.action.authorize.offer.eventService.ObjectType.SeatReservation },
|
|
25
|
-
'instrument.typeOf': { $exists: true, $eq:
|
|
25
|
+
'instrument.typeOf': { $exists: true, $eq: chevre.factory.assetTransactionType.COAReserveTransaction }
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
__id: 1, startDate: 1, project: 1, typeOf: 1, actionStatus: 1, instrument: 1, object: 1
|
|
@@ -42,7 +42,7 @@ async function main() {
|
|
|
42
42
|
>>doc.toObject();
|
|
43
43
|
|
|
44
44
|
let migrated = false;
|
|
45
|
-
if (authorizeAction.instrument.typeOf ===
|
|
45
|
+
if (authorizeAction.instrument.typeOf === chevre.factory.assetTransactionType.COAReserveTransaction) {
|
|
46
46
|
migrated = true;
|
|
47
47
|
} else {
|
|
48
48
|
const pendingTransaction = authorizeAction.object.pendingTransaction;
|
|
@@ -18,14 +18,18 @@ async function main() {
|
|
|
18
18
|
typeOf: { $eq: chevre.factory.actionType.AuthorizeAction },
|
|
19
19
|
// actionStatus: { $eq: chevre.factory.actionStatusType.CompletedActionStatus },
|
|
20
20
|
startDate: {
|
|
21
|
-
$lte: moment()
|
|
21
|
+
// $lte: moment()
|
|
22
|
+
// // tslint:disable-next-line:no-magic-numbers
|
|
23
|
+
// .add(-90, 'days'),
|
|
24
|
+
$lte: moment('2023-07-22T01:17:42.541Z')
|
|
22
25
|
// tslint:disable-next-line:no-magic-numbers
|
|
23
|
-
.
|
|
26
|
+
.toDate()
|
|
24
27
|
// $gte: moment()
|
|
25
28
|
// // tslint:disable-next-line:no-magic-numbers
|
|
26
29
|
// .add(-180, 'days')
|
|
27
30
|
},
|
|
28
|
-
'object.typeOf': { $exists: true, $eq: chevre.factory.action.authorize.offer.eventService.ObjectType.SeatReservation }
|
|
31
|
+
'object.typeOf': { $exists: true, $eq: chevre.factory.action.authorize.offer.eventService.ObjectType.SeatReservation },
|
|
32
|
+
'project.id': { $ne: 'sskts-production' }
|
|
29
33
|
},
|
|
30
34
|
{
|
|
31
35
|
__id: 1, startDate: 1, endDate: 1, result: 1, project: 1, typeOf: 1, actionStatus: 1, instrument: 1, object: 1
|
|
@@ -46,7 +50,7 @@ async function main() {
|
|
|
46
50
|
const { instrument } = authorizeAction;
|
|
47
51
|
|
|
48
52
|
let migrated = false;
|
|
49
|
-
if ((instrument.typeOf ===
|
|
53
|
+
if ((instrument.typeOf === chevre.factory.assetTransactionType.COAReserveTransaction
|
|
50
54
|
|| instrument.typeOf === chevre.factory.assetTransactionType.Reserve)
|
|
51
55
|
&& typeof instrument.transactionNumber === 'string'
|
|
52
56
|
) {
|
|
@@ -66,24 +70,32 @@ async function main() {
|
|
|
66
70
|
}
|
|
67
71
|
const pendingTransaction = (authorizeAction.object).pendingTransaction;
|
|
68
72
|
const transactionNumber = pendingTransaction?.transactionNumber;
|
|
69
|
-
if (typeof transactionNumber !== 'string' || transactionNumber === '') {
|
|
70
|
-
throw new Error(`pendingTransaction must exist [${authorizeAction.id}]`);
|
|
71
|
-
}
|
|
72
73
|
let newInstrument: IInstrumentAsAssetTransaction;
|
|
73
|
-
if (pendingTransaction?.typeOf ===
|
|
74
|
+
if (pendingTransaction?.typeOf === chevre.factory.assetTransactionType.COAReserveTransaction) {
|
|
74
75
|
newInstrument = {
|
|
75
|
-
typeOf:
|
|
76
|
+
typeOf: chevre.factory.assetTransactionType.COAReserveTransaction,
|
|
76
77
|
identifier: chevre.factory.service.webAPI.Identifier.COA,
|
|
77
|
-
transactionNumber
|
|
78
|
+
...(typeof transactionNumber === 'string') ? { transactionNumber } : { transactionNumber: '' }
|
|
78
79
|
};
|
|
79
80
|
} else if (pendingTransaction?.typeOf === chevre.factory.assetTransactionType.Reserve) {
|
|
81
|
+
if (typeof transactionNumber !== 'string' || transactionNumber === '') {
|
|
82
|
+
throw new Error(`pendingTransaction must exist [${authorizeAction.id}]`);
|
|
83
|
+
}
|
|
80
84
|
newInstrument = {
|
|
81
85
|
typeOf: chevre.factory.assetTransactionType.Reserve,
|
|
82
86
|
identifier: chevre.factory.service.webAPI.Identifier.Chevre,
|
|
83
87
|
transactionNumber
|
|
84
88
|
};
|
|
85
89
|
} else {
|
|
86
|
-
|
|
90
|
+
if (instrument.identifier === chevre.factory.service.webAPI.Identifier.COA) {
|
|
91
|
+
newInstrument = {
|
|
92
|
+
typeOf: chevre.factory.assetTransactionType.COAReserveTransaction,
|
|
93
|
+
identifier: chevre.factory.service.webAPI.Identifier.COA,
|
|
94
|
+
...(typeof transactionNumber === 'string') ? { transactionNumber } : { transactionNumber: '' }
|
|
95
|
+
};
|
|
96
|
+
} else {
|
|
97
|
+
throw new Error(`invalid pendingTransaction [${(<any>pendingTransaction)?.typeOf}] [${authorizeAction.id}]`);
|
|
98
|
+
}
|
|
87
99
|
}
|
|
88
100
|
|
|
89
101
|
console.log(
|
|
@@ -51,7 +51,7 @@ async function main() {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
let migrated = false;
|
|
54
|
-
if (authorizeAction.instrument.typeOf ===
|
|
54
|
+
if (authorizeAction.instrument.typeOf === chevre.factory.assetTransactionType.COAReserveTransaction
|
|
55
55
|
|| (<any>authorizeAction.instrument).identifier === chevre.factory.service.webAPI.Identifier.COA) {
|
|
56
56
|
migrated = true;
|
|
57
57
|
} else {
|
|
@@ -88,10 +88,24 @@ function createAuthorizeSeatReservationActionAttributes(params) {
|
|
|
88
88
|
// },
|
|
89
89
|
typeOf: event.typeOf
|
|
90
90
|
};
|
|
91
|
+
const object = {
|
|
92
|
+
typeOf: factory.action.authorize.offer.eventService.ObjectType.SeatReservation,
|
|
93
|
+
event: authorizeObjectEvent
|
|
94
|
+
// pendingTransaction: params.pendingTransaction, // discontinue(2024-06-22~)
|
|
95
|
+
// ...(params.broker !== undefined) ? { broker: params.broker } : undefined // discontinue(2024-06-24~)
|
|
96
|
+
// useResultAcceptedOffers: false // discontinue(2024-06-24~)
|
|
97
|
+
// acceptedOffer: acceptedOffers // discontinue(2024-06-19~)
|
|
98
|
+
};
|
|
99
|
+
const instrument = {
|
|
100
|
+
// typeOf: 'WebAPI',
|
|
101
|
+
typeOf: factory.assetTransactionType.Reserve,
|
|
102
|
+
identifier: factory.service.webAPI.Identifier.Chevre,
|
|
103
|
+
transactionNumber: params.instrument.transactionNumber
|
|
104
|
+
};
|
|
91
105
|
return {
|
|
92
106
|
project: transaction.project,
|
|
93
107
|
typeOf: factory.actionType.AuthorizeAction,
|
|
94
|
-
object
|
|
108
|
+
object,
|
|
95
109
|
agent: {
|
|
96
110
|
id: transaction.seller.id,
|
|
97
111
|
typeOf: transaction.seller.typeOf,
|
|
@@ -104,12 +118,7 @@ function createAuthorizeSeatReservationActionAttributes(params) {
|
|
|
104
118
|
id: transaction.agent.id
|
|
105
119
|
},
|
|
106
120
|
purpose: { typeOf: transaction.typeOf, id: transaction.id },
|
|
107
|
-
instrument
|
|
108
|
-
// typeOf: 'WebAPI',
|
|
109
|
-
typeOf: factory.assetTransactionType.Reserve,
|
|
110
|
-
identifier: factory.service.webAPI.Identifier.Chevre,
|
|
111
|
-
transactionNumber: params.instrument.transactionNumber
|
|
112
|
-
}
|
|
121
|
+
instrument
|
|
113
122
|
};
|
|
114
123
|
}
|
|
115
124
|
exports.createAuthorizeSeatReservationActionAttributes = createAuthorizeSeatReservationActionAttributes;
|
|
@@ -63,7 +63,7 @@ function acceptOffer(params) {
|
|
|
63
63
|
sameAs: { id: params.sameAs.id, typeOf: 'Task' },
|
|
64
64
|
potentialActions: params.potentialActions,
|
|
65
65
|
instrument: {
|
|
66
|
-
typeOf:
|
|
66
|
+
typeOf: factory.assetTransactionType.COAReserveTransaction
|
|
67
67
|
// requestBody: updTmpReserveSeatArgs // discontinue(2024-06-11~)
|
|
68
68
|
}
|
|
69
69
|
};
|
|
@@ -136,7 +136,7 @@ function reAcceptOffer(params) {
|
|
|
136
136
|
purpose: { id: transaction.id, typeOf: transaction.typeOf },
|
|
137
137
|
sameAs: { id: params.sameAs.id, typeOf: 'Task' },
|
|
138
138
|
potentialActions: params.potentialActions,
|
|
139
|
-
instrument: { typeOf:
|
|
139
|
+
instrument: { typeOf: factory.assetTransactionType.COAReserveTransaction }
|
|
140
140
|
};
|
|
141
141
|
let acceptedOffer;
|
|
142
142
|
const action = yield repos.action.start(actionAttributes);
|
|
@@ -48,7 +48,7 @@ function authorize(params) {
|
|
|
48
48
|
timeBegin: params.result.requestBody.timeBegin,
|
|
49
49
|
tmpReserveNum: params.result.responseBody.tmpReserveNum,
|
|
50
50
|
transactionNumber: params.result.responseBody.tmpReserveNum,
|
|
51
|
-
typeOf:
|
|
51
|
+
typeOf: factory.assetTransactionType.COAReserveTransaction
|
|
52
52
|
};
|
|
53
53
|
try {
|
|
54
54
|
// イベント取得属性最適化(2023-01-23~)
|
|
@@ -25,8 +25,14 @@ function createAuthorizeSeatReservationActionAttributes(params) {
|
|
|
25
25
|
id: params.acceptAction.id,
|
|
26
26
|
// acceptedOffer: params.acceptedOffers, // discontinue acceptedOffers(2024-06-21~)
|
|
27
27
|
event: authorizeObjectEvent,
|
|
28
|
-
pendingTransaction: params.pendingTransaction
|
|
29
|
-
useResultAcceptedOffers: false
|
|
28
|
+
pendingTransaction: params.pendingTransaction
|
|
29
|
+
// useResultAcceptedOffers: false // discontinue(2024-06-24~)
|
|
30
|
+
};
|
|
31
|
+
const instrument = {
|
|
32
|
+
// typeOf: 'WebAPI',
|
|
33
|
+
typeOf: factory.assetTransactionType.COAReserveTransaction,
|
|
34
|
+
identifier: factory.service.webAPI.Identifier.COA,
|
|
35
|
+
transactionNumber: params.pendingTransaction.transactionNumber
|
|
30
36
|
};
|
|
31
37
|
return {
|
|
32
38
|
project: transaction.project,
|
|
@@ -44,12 +50,7 @@ function createAuthorizeSeatReservationActionAttributes(params) {
|
|
|
44
50
|
id: transaction.agent.id
|
|
45
51
|
},
|
|
46
52
|
purpose: { typeOf: transaction.typeOf, id: transaction.id },
|
|
47
|
-
instrument
|
|
48
|
-
// typeOf: 'WebAPI',
|
|
49
|
-
typeOf: 'COAReserveTransaction',
|
|
50
|
-
identifier: factory.service.webAPI.Identifier.COA,
|
|
51
|
-
transactionNumber: params.pendingTransaction.transactionNumber
|
|
52
|
-
}
|
|
53
|
+
instrument
|
|
53
54
|
};
|
|
54
55
|
}
|
|
55
56
|
exports.createAuthorizeSeatReservationActionAttributes = createAuthorizeSeatReservationActionAttributes;
|
|
@@ -51,7 +51,7 @@ function onAssetTransactionStatusChanged(params) {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
break;
|
|
54
|
-
case
|
|
54
|
+
case factory.assetTransactionType.COAReserveTransaction:
|
|
55
55
|
if (typeof orderNumber === 'string' && typeof confirmationNumber === 'string') {
|
|
56
56
|
// 基本的に1注文に1予約番号なのでdeliverable = true
|
|
57
57
|
const deliverable = true;
|
|
@@ -99,7 +99,7 @@ function createConfirmReservationActionObject4COAByOrder(params) {
|
|
|
99
99
|
return {
|
|
100
100
|
optimized: true,
|
|
101
101
|
transactionNumber: reservationNumber,
|
|
102
|
-
typeOf:
|
|
102
|
+
typeOf: factory.assetTransactionType.COAReserveTransaction
|
|
103
103
|
};
|
|
104
104
|
});
|
|
105
105
|
}
|
|
@@ -100,7 +100,7 @@ function createConfirmReserveTransactionTasksIfNotExist(order, simpleOrder) {
|
|
|
100
100
|
// instrument廃止(2024-03-13~)
|
|
101
101
|
// instrument: {
|
|
102
102
|
// typeOf: 'WebAPI',
|
|
103
|
-
// identifier: (confirmObject.typeOf ===
|
|
103
|
+
// identifier: (confirmObject.typeOf === factory.assetTransactionType.COAReserveTransaction)
|
|
104
104
|
// ? factory.service.webAPI.Identifier.COA
|
|
105
105
|
// : factory.service.webAPI.Identifier.Chevre
|
|
106
106
|
// }
|
|
@@ -111,7 +111,7 @@ function createConfirmReserveTransactionTasksIfNotExist(order, simpleOrder) {
|
|
|
111
111
|
project: order.project,
|
|
112
112
|
name: factory.taskName.ConfirmReserveTransaction,
|
|
113
113
|
status: factory.taskStatus.Ready,
|
|
114
|
-
runsAt: (confirmObject.typeOf ===
|
|
114
|
+
runsAt: (confirmObject.typeOf === factory.assetTransactionType.COAReserveTransaction) ? taskRunsAt4coa : taskRunsAt,
|
|
115
115
|
remainingNumberOfTries: 10,
|
|
116
116
|
numberOfTried: 0,
|
|
117
117
|
executionResults: [],
|
|
@@ -105,7 +105,7 @@ function createReturnReserveTransactionTasks(order, simpleOrder) {
|
|
|
105
105
|
theaterCode: superEventLocationBranchCode,
|
|
106
106
|
reserveNum: reservationNumber,
|
|
107
107
|
telNum: telNum,
|
|
108
|
-
typeOf:
|
|
108
|
+
typeOf: factory.assetTransactionType.COAReserveTransaction
|
|
109
109
|
},
|
|
110
110
|
agent: order.project,
|
|
111
111
|
purpose: simpleOrder,
|
|
@@ -131,7 +131,7 @@ function createReturnReserveTransactionTasks(order, simpleOrder) {
|
|
|
131
131
|
project: order.project,
|
|
132
132
|
name: factory.taskName.ReturnReserveTransaction,
|
|
133
133
|
status: factory.taskStatus.Ready,
|
|
134
|
-
runsAt: (returnReserveTransactionAction.object.typeOf ===
|
|
134
|
+
runsAt: (returnReserveTransactionAction.object.typeOf === factory.assetTransactionType.COAReserveTransaction)
|
|
135
135
|
? taskRunsAt4coa
|
|
136
136
|
: taskRunsAt,
|
|
137
137
|
remainingNumberOfTries: 10,
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createPlacingOrder = void 0;
|
|
4
4
|
const moment = require("moment");
|
|
5
5
|
const factory = require("../../../factory");
|
|
6
|
-
const settings_1 = require("../../../settings");
|
|
7
6
|
const result_1 = require("../../transaction/placeOrderInProgress/result");
|
|
8
7
|
const orderedItem_1 = require("../../transaction/placeOrderInProgress/result/orderedItem");
|
|
9
8
|
function createPlacingOrder(params) {
|
|
@@ -15,7 +14,7 @@ function createPlacingOrder(params) {
|
|
|
15
14
|
}
|
|
16
15
|
// const orderedItems: factory.order.IOrderedItem[]
|
|
17
16
|
// = (Array.isArray(orderByTransaction.orderedItem)) ? orderByTransaction.orderedItem : [];
|
|
18
|
-
const customer =
|
|
17
|
+
// const customer = createCustomer({ transaction }); // no overwrite(2024-06-24~)
|
|
19
18
|
const seller = (0, result_1.createSeller)({ transaction });
|
|
20
19
|
const name = (typeof transaction.object.name === 'string') ? transaction.object.name : undefined;
|
|
21
20
|
const broker = (typeof ((_b = transaction.object.broker) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string') ? transaction.object.broker : undefined;
|
|
@@ -45,14 +44,13 @@ function createPlacingOrder(params) {
|
|
|
45
44
|
productAcceptedOffers,
|
|
46
45
|
moneyTransferAcceptedOffers
|
|
47
46
|
});
|
|
48
|
-
return Object.assign(Object.assign(Object.assign(Object.assign(
|
|
47
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({}, orderByTransaction), { seller,
|
|
49
48
|
paymentMethods,
|
|
50
49
|
price, orderDate: moment(orderByTransaction.orderDate)
|
|
51
50
|
.toDate(),
|
|
52
51
|
// orderedItem: orderedItems,
|
|
53
|
-
orderedItem }), (typeof name === 'string') ? { name } : undefined), (typeof (broker === null || broker === void 0 ? void 0 : broker.typeOf) === 'string') ? { broker } : undefined
|
|
54
|
-
|
|
55
|
-
: { customer } // 2024-06-17~
|
|
52
|
+
orderedItem }), (typeof name === 'string') ? { name } : undefined), (typeof (broker === null || broker === void 0 ? void 0 : broker.typeOf) === 'string') ? { broker } : undefined // 2024-06-17~
|
|
53
|
+
// customer // no overwrite(2024-06-24~)
|
|
56
54
|
// discontinue(2024-06-17~)
|
|
57
55
|
// ...(params.dateReturned !== null && params.dateReturned !== undefined)
|
|
58
56
|
// ? {
|
|
@@ -134,14 +134,14 @@ function confirmReserveTransaction(params, options) {
|
|
|
134
134
|
// let updReserveResult: COA.factory.reserve.IUpdReserveResult | undefined;
|
|
135
135
|
let recipe;
|
|
136
136
|
switch (params.object.typeOf) {
|
|
137
|
-
case
|
|
137
|
+
case factory.assetTransactionType.COAReserveTransaction:
|
|
138
138
|
// 最適化されたタスクに対応するため、ここでIObject4COAを注文から生成する(2024-01-24~)
|
|
139
139
|
const order = yield fixOrderAsPurpose({
|
|
140
140
|
project: { id: params.project.id },
|
|
141
141
|
purpose: params.purpose
|
|
142
142
|
})(repos);
|
|
143
143
|
const updReserveArgs = createConfirmObject4COAByOrder({ order, reservationNumber: params.object.transactionNumber });
|
|
144
|
-
const object4coa = Object.assign(Object.assign({}, updReserveArgs), { transactionNumber: params.object.transactionNumber, typeOf:
|
|
144
|
+
const object4coa = Object.assign(Object.assign({}, updReserveArgs), { transactionNumber: params.object.transactionNumber, typeOf: factory.assetTransactionType.COAReserveTransaction });
|
|
145
145
|
confirmActionObject = object4coa;
|
|
146
146
|
recipe = (0, factory_1.processConfirmCOAReserveResult2recipe)({
|
|
147
147
|
processConfirmCOAReserveResult: { updReserveArgs: object4coa },
|
|
@@ -159,7 +159,7 @@ function confirmReserveTransaction(params, options) {
|
|
|
159
159
|
try {
|
|
160
160
|
const object = confirmActionAttributes.object;
|
|
161
161
|
switch (object.typeOf) {
|
|
162
|
-
case
|
|
162
|
+
case factory.assetTransactionType.COAReserveTransaction:
|
|
163
163
|
// COA本予約
|
|
164
164
|
const processConfirmCOAReserveResult = yield COAReserveService.confirm({
|
|
165
165
|
project: { id: confirmActionAttributes.project.id },
|
|
@@ -15,7 +15,6 @@ const moment = require("moment");
|
|
|
15
15
|
const errorHandler_1 = require("../../../errorHandler");
|
|
16
16
|
const factory = require("../../../factory");
|
|
17
17
|
const availableProductTypes_1 = require("../../../factory/availableProductTypes");
|
|
18
|
-
const settings_1 = require("../../../settings");
|
|
19
18
|
const potentialActions_1 = require("./potentialActions");
|
|
20
19
|
const publishCode_1 = require("./publishCode");
|
|
21
20
|
const publishConfirmationNumberIfNotExist_1 = require("./publishConfirmationNumberIfNotExist");
|
|
@@ -27,12 +26,11 @@ const debug = createDebug('chevre-domain:service:transaction');
|
|
|
27
26
|
function processTransactionNotInProgress(transaction) {
|
|
28
27
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
29
28
|
if (transaction.status === factory.transactionStatusType.Confirmed) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
29
|
+
// retrieve customer from orderInTransaction(2024-06-24~)
|
|
30
|
+
// let resultCustomer: factory.order.ICustomer | undefined = createCustomer({ transaction });
|
|
31
|
+
const resultCustomer = yield repos.orderInTransaction.findCustomerByOrderNumber({
|
|
32
|
+
orderNumber: { $eq: String(transaction.object.orderNumber) }
|
|
33
|
+
});
|
|
36
34
|
if (resultCustomer === undefined) {
|
|
37
35
|
throw new factory.errors.ServiceUnavailable('resultCustomer undefined'); // impossible process
|
|
38
36
|
}
|
|
@@ -107,14 +105,13 @@ function confirm(params) {
|
|
|
107
105
|
transactionNumber: { $in: payTransactionNumbers }
|
|
108
106
|
}, ['object']);
|
|
109
107
|
}
|
|
108
|
+
// retrieve customer from orderInTransaction(2024-06-24~)
|
|
109
|
+
// let customer: factory.order.ICustomer = createCustomer({ transaction });
|
|
110
|
+
const customer = yield repos.orderInTransaction.findCustomerByOrderNumber({ orderNumber: { $eq: orderNumber } });
|
|
111
|
+
const seller = (0, result_1.createSeller)({ transaction });
|
|
110
112
|
const { paymentMethods, result, eventId, reservationIds } = createResult(Object.assign(Object.assign(Object.assign({}, params), { orderNumber, transaction,
|
|
111
113
|
authorizePaymentActions, authorizeEventServiceOfferActions, authorizeMoneyTansferActions, authorizeProductOfferActions,
|
|
112
|
-
acceptedOffers, payTransactions }), (typeof code === 'string') ? { code } : undefined));
|
|
113
|
-
let customer = (0, result_1.createCustomer)({ transaction });
|
|
114
|
-
if (settings_1.USE_EXPERIMENTAL_FEATURE) {
|
|
115
|
-
customer = yield repos.orderInTransaction.findCustomerByOrderNumber({ orderNumber: { $eq: orderNumber } });
|
|
116
|
-
}
|
|
117
|
-
const seller = (0, result_1.createSeller)({ transaction });
|
|
114
|
+
acceptedOffers, payTransactions, customer }), (typeof code === 'string') ? { code } : undefined));
|
|
118
115
|
// デフォルトEメールメッセージを検索
|
|
119
116
|
let emailMessageOnOrderSent;
|
|
120
117
|
if (repos.emailMessage !== undefined) {
|
|
@@ -285,7 +282,7 @@ function createResult(params) {
|
|
|
285
282
|
}
|
|
286
283
|
});
|
|
287
284
|
// 取引の確定条件が全て整っているかどうか確認
|
|
288
|
-
(0, validation_1.validateTransaction)(transaction, params.authorizePaymentActions, params.authorizeEventServiceOfferActions, params.authorizeMoneyTansferActions, params.authorizeProductOfferActions, eventReservationAcceptedOffers, params.payTransactions);
|
|
285
|
+
(0, validation_1.validateTransaction)(transaction, params.authorizePaymentActions, params.authorizeEventServiceOfferActions, params.authorizeMoneyTansferActions, params.authorizeProductOfferActions, eventReservationAcceptedOffers, params.payTransactions, params.customer);
|
|
289
286
|
const { paymentMethods, price } = (0, result_1.createPaymentMethods)({ authorizePaymentActions: params.authorizePaymentActions });
|
|
290
287
|
const orderedItem = (0, orderedItem_1.acceptedOffers2orderedItem)({
|
|
291
288
|
eventReservationAcceptedOffers,
|
|
@@ -15,13 +15,10 @@ declare function createOrder(params: {
|
|
|
15
15
|
declare function createSeller(params: {
|
|
16
16
|
transaction: Pick<factory.transaction.placeOrder.ITransaction, 'seller'>;
|
|
17
17
|
}): factory.order.ISeller;
|
|
18
|
-
declare function createCustomer(params: {
|
|
19
|
-
transaction: Pick<factory.transaction.placeOrder.ITransaction, 'object'>;
|
|
20
|
-
}): factory.order.ICustomer;
|
|
21
18
|
declare function createPaymentMethods(params: {
|
|
22
19
|
authorizePaymentActions: Pick<factory.action.authorize.paymentMethod.any.IAction, 'result'>[];
|
|
23
20
|
}): {
|
|
24
21
|
paymentMethods: factory.order.IReferencedInvoice[];
|
|
25
22
|
price: number;
|
|
26
23
|
};
|
|
27
|
-
export { createOrder,
|
|
24
|
+
export { createOrder, createSeller, createPaymentMethods };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPaymentMethods = exports.createSeller = exports.
|
|
3
|
+
exports.createPaymentMethods = exports.createSeller = exports.createOrder = void 0;
|
|
4
4
|
const factory = require("../../../factory");
|
|
5
5
|
// import { acceptedOffers2orderedItem } from './result/orderedItem';
|
|
6
6
|
/**
|
|
@@ -52,25 +52,30 @@ function createSeller(params) {
|
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
exports.createSeller = createSeller;
|
|
55
|
-
function createCustomer(params
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
55
|
+
// function createCustomer(params: {
|
|
56
|
+
// transaction: Pick<factory.transaction.placeOrder.ITransaction, 'object'>;
|
|
57
|
+
// }): factory.order.ICustomer {
|
|
58
|
+
// // transaction.object.customerはstart時点でapiが自動的に指定、あるいは、その後クライアントから変更されるか
|
|
59
|
+
// const customerByTransaction = params.transaction.object.customer;
|
|
60
|
+
// if (typeof customerByTransaction?.id !== 'string') {
|
|
61
|
+
// throw new factory.errors.Argument('transaction', 'object.customer.id undefined');
|
|
62
|
+
// }
|
|
63
|
+
// if (typeof customerByTransaction?.typeOf !== 'string') {
|
|
64
|
+
// throw new factory.errors.Argument('transaction', 'object.customer.typeOf undefined');
|
|
65
|
+
// }
|
|
66
|
+
// const customerName: string = (typeof customerByTransaction.name === 'string' && customerByTransaction.name.length > 0)
|
|
67
|
+
// ? customerByTransaction.name
|
|
68
|
+
// : `${customerByTransaction.givenName} ${customerByTransaction.familyName}`;
|
|
69
|
+
// // customer.nameが必ず存在するように
|
|
70
|
+
// if (customerName.length === 0) {
|
|
71
|
+
// throw new factory.errors.Argument('object.customer', 'customer name length: 0');
|
|
72
|
+
// }
|
|
73
|
+
// return {
|
|
74
|
+
// ...customerByTransaction,
|
|
75
|
+
// identifier: (Array.isArray(customerByTransaction.identifier)) ? customerByTransaction.identifier : [],
|
|
76
|
+
// name: customerName
|
|
77
|
+
// };
|
|
78
|
+
// }
|
|
74
79
|
function createPaymentMethods(params) {
|
|
75
80
|
const paymentMethods = [];
|
|
76
81
|
let price = 0;
|
|
@@ -10,7 +10,7 @@ export type IPayTransaction = Pick<factory.assetTransaction.pay.ITransaction, 'o
|
|
|
10
10
|
/**
|
|
11
11
|
* 取引が確定可能な状態かどうかをチェックする
|
|
12
12
|
*/
|
|
13
|
-
export declare function validateTransaction(transaction: Pick<factory.transaction.placeOrder.ITransaction, 'id' | 'object'>, authorizePaymentActions: IAuthorizePaymentAction[], authorizeEventServiceOfferActions: Pick<IAuthorizeEventServiceOffer, 'id' | 'result'>[], authorizeMoneyTansferActions: Pick<IAuthorizeMoneyTransferOffer, 'id' | 'result'>[], authorizeProductOfferActions: Pick<IAuthorizeProductOffer, 'id' | 'result'>[], eventReservationAcceptedOffers: factory.order.IAcceptedOffer<factory.order.IReservation>[], payTransactions: IPayTransaction[]): void;
|
|
13
|
+
export declare function validateTransaction(transaction: Pick<factory.transaction.placeOrder.ITransaction, 'id' | 'object'>, authorizePaymentActions: IAuthorizePaymentAction[], authorizeEventServiceOfferActions: Pick<IAuthorizeEventServiceOffer, 'id' | 'result'>[], authorizeMoneyTansferActions: Pick<IAuthorizeMoneyTransferOffer, 'id' | 'result'>[], authorizeProductOfferActions: Pick<IAuthorizeProductOffer, 'id' | 'result'>[], eventReservationAcceptedOffers: factory.order.IAcceptedOffer<factory.order.IReservation>[], payTransactions: IPayTransaction[], customer: factory.order.ICustomer): void;
|
|
14
14
|
export type IOrderURLGenerator = (order: factory.order.IOrder) => string;
|
|
15
15
|
/**
|
|
16
16
|
* 注文オファー数検証
|
|
@@ -13,8 +13,9 @@ const debug = createDebug('chevre-domain:service:transaction');
|
|
|
13
13
|
/**
|
|
14
14
|
* 取引が確定可能な状態かどうかをチェックする
|
|
15
15
|
*/
|
|
16
|
-
function validateTransaction(transaction, authorizePaymentActions, authorizeEventServiceOfferActions, authorizeMoneyTansferActions, authorizeProductOfferActions, eventReservationAcceptedOffers, payTransactions) {
|
|
17
|
-
validateProfile(transaction);
|
|
16
|
+
function validateTransaction(transaction, authorizePaymentActions, authorizeEventServiceOfferActions, authorizeMoneyTansferActions, authorizeProductOfferActions, eventReservationAcceptedOffers, payTransactions, customer) {
|
|
17
|
+
// validateProfile(transaction);
|
|
18
|
+
validateProfile({ customer });
|
|
18
19
|
validatePrice(authorizePaymentActions, authorizeEventServiceOfferActions, authorizeProductOfferActions, authorizeMoneyTansferActions);
|
|
19
20
|
// 利用可能な通貨単位に対して取引検証
|
|
20
21
|
validateMonetaryAmount(authorizePaymentActions, authorizeEventServiceOfferActions);
|
|
@@ -89,9 +90,20 @@ function findMovieTicketPaymentMethodTypesFromTransaction(authorizePaymentAction
|
|
|
89
90
|
// ];
|
|
90
91
|
return [...new Set(paymentMethodTypes)];
|
|
91
92
|
}
|
|
92
|
-
function validateProfile(transaction) {
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
// function validateProfile(transaction: Pick<factory.transaction.placeOrder.ITransaction, 'object'>) {
|
|
94
|
+
// // object.customerで検証(2022-05-26~)
|
|
95
|
+
// const profile = transaction.object.customer;
|
|
96
|
+
// const profileSatisfied = typeof profile?.typeOf === 'string' && profile.typeOf.length > 0
|
|
97
|
+
// && typeof profile.email === 'string' && profile.email.length > 0
|
|
98
|
+
// && typeof profile.familyName === 'string' && profile.familyName.length > 0
|
|
99
|
+
// && typeof profile.givenName === 'string' && profile.givenName.length > 0
|
|
100
|
+
// && typeof profile.telephone === 'string' && profile.telephone.length > 0;
|
|
101
|
+
// if (!profileSatisfied) {
|
|
102
|
+
// throw new factory.errors.Argument('Transaction', 'Customer Profile Required');
|
|
103
|
+
// }
|
|
104
|
+
// }
|
|
105
|
+
function validateProfile(params) {
|
|
106
|
+
const profile = params.customer;
|
|
95
107
|
const profileSatisfied = typeof (profile === null || profile === void 0 ? void 0 : profile.typeOf) === 'string' && profile.typeOf.length > 0
|
|
96
108
|
&& typeof profile.email === 'string' && profile.email.length > 0
|
|
97
109
|
&& typeof profile.familyName === 'string' && profile.familyName.length > 0
|
|
@@ -100,6 +112,10 @@ function validateProfile(transaction) {
|
|
|
100
112
|
if (!profileSatisfied) {
|
|
101
113
|
throw new factory.errors.Argument('Transaction', 'Customer Profile Required');
|
|
102
114
|
}
|
|
115
|
+
// customer.nameが必ず存在するように
|
|
116
|
+
if (typeof profile.name !== 'string' && profile.name === '') {
|
|
117
|
+
throw new factory.errors.Argument('Transaction', 'customer name required');
|
|
118
|
+
}
|
|
103
119
|
}
|
|
104
120
|
function validatePrice(authorizePaymentActions, authorizeEventServiceOfferActions, authorizeProductOfferActions, authorizeMoneyTansferActions) {
|
|
105
121
|
let priceByAgent = 0;
|
|
@@ -68,11 +68,16 @@ function fixCustomer(params) {
|
|
|
68
68
|
function updateAgent(params) {
|
|
69
69
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
70
70
|
const { customer, transaction } = yield fixCustomer(params)(repos);
|
|
71
|
-
const newAgent = {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
// const newAgent: Pick<factory.transaction.placeOrder.IAgent, 'id'> = {
|
|
72
|
+
// id: transaction.agent.id
|
|
73
|
+
// };
|
|
74
|
+
// discontinue saving in transaction(2024-06-24~)
|
|
75
|
+
// await repos.transaction.updateAgent({
|
|
76
|
+
// typeOf: params.typeOf,
|
|
77
|
+
// id: params.id,
|
|
78
|
+
// agent: newAgent,
|
|
79
|
+
// ...(customer !== undefined) ? { object: { customer } } : undefined
|
|
80
|
+
// });
|
|
76
81
|
// also save in orderInTransaction(2024-06-20~)
|
|
77
82
|
if (customer !== undefined) {
|
|
78
83
|
const orderNumber = yield PlaceOrderInProgressTransactionService.publishOrderNumberIfNotExist({
|
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.375.0-alpha.
|
|
13
|
+
"@chevre/factory": "4.375.0-alpha.20",
|
|
14
14
|
"@cinerino/sdk": "7.3.0-alpha.2",
|
|
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.35.0-alpha.
|
|
113
|
+
"version": "21.35.0-alpha.28"
|
|
114
114
|
}
|