@chevre/domain 21.20.0-alpha.57 → 21.20.0-alpha.59
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/{migrateOrderPaymentMethodIdentifier.ts → migrateOrderAcceptedOfferSerialNumber.ts} +18 -19
- package/example/src/chevre/searchActions.ts +1 -0
- package/lib/chevre/repo/acceptedOffer.d.ts +12 -0
- package/lib/chevre/repo/acceptedOffer.js +27 -0
- package/lib/chevre/repo/action.js +45 -41
- package/lib/chevre/repo/orderInTransaction.d.ts +13 -0
- package/lib/chevre/repo/orderInTransaction.js +39 -0
- package/lib/chevre/service/offer/any.d.ts +6 -1
- package/lib/chevre/service/offer/any.js +13 -0
- package/lib/chevre/service/offer/event/cancel.js +1 -0
- package/lib/chevre/service/offer/event/voidTransaction.js +1 -0
- package/lib/chevre/service/offer/eventServiceByCOA/cancel.js +1 -0
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +1 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +2 -4
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +0 -1
- package/lib/chevre/service/order/placeOrder.d.ts +1 -1
- package/lib/chevre/service/order/placeOrder.js +42 -12
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +5 -0
- package/package.json +2 -2
|
@@ -10,14 +10,15 @@ import { chevre } from '../../../lib/index';
|
|
|
10
10
|
async function main() {
|
|
11
11
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
12
12
|
|
|
13
|
+
const acceptedOfferRepo = await chevre.repository.AcceptedOffer.createInstance(mongoose.connection);
|
|
13
14
|
const orderRepo = await chevre.repository.Order.createInstance(mongoose.connection);
|
|
14
15
|
|
|
15
16
|
const cursor = orderRepo.getCursor(
|
|
16
17
|
{
|
|
17
|
-
'
|
|
18
|
-
'
|
|
18
|
+
// 'acceptedOffers.serialNumber': { $exists: false },
|
|
19
|
+
'acceptedOffers.itemOffered.reservationNumber': { $exists: true },
|
|
19
20
|
// 'project.id': { $eq: project.id },
|
|
20
|
-
// orderNumber: { $eq: '
|
|
21
|
+
// orderNumber: { $eq: 'CIN7-9241554-5859799' },
|
|
21
22
|
orderDate: {
|
|
22
23
|
$gte: moment()
|
|
23
24
|
// tslint:disable-next-line:no-magic-numbers
|
|
@@ -33,7 +34,7 @@ async function main() {
|
|
|
33
34
|
orderDate: 1,
|
|
34
35
|
orderNumber: 1,
|
|
35
36
|
project: 1,
|
|
36
|
-
|
|
37
|
+
acceptedOffers: 1
|
|
37
38
|
}
|
|
38
39
|
);
|
|
39
40
|
console.log('orders found');
|
|
@@ -45,28 +46,26 @@ async function main() {
|
|
|
45
46
|
const order: Pick<
|
|
46
47
|
chevre.factory.order.IOrder,
|
|
47
48
|
'orderDate' | 'orderNumber' | 'project' | 'paymentMethods'
|
|
48
|
-
>
|
|
49
|
+
> & {
|
|
50
|
+
acceptedOffers: chevre.factory.order.IAcceptedOffer<chevre.factory.order.IReservation>[];
|
|
51
|
+
} = doc.toObject();
|
|
49
52
|
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
&&
|
|
54
|
-
// && invoice.paymentMethod.identifier === (<any>invoice).typeOf;
|
|
53
|
+
const alreadyMigrated = order.acceptedOffers.every((offer) => {
|
|
54
|
+
return typeof offer.serialNumber === 'string'
|
|
55
|
+
&& offer.serialNumber.length > 0
|
|
56
|
+
&& offer.itemOffered.reservationNumber === offer.serialNumber;
|
|
55
57
|
});
|
|
56
58
|
|
|
57
|
-
if (
|
|
58
|
-
console.log('noPayment.', order.project.id, order.orderNumber, order.orderDate, i);
|
|
59
|
-
} else if (alreadyMigrated) {
|
|
59
|
+
if (alreadyMigrated) {
|
|
60
60
|
console.log('already exist.', order.project.id, order.orderNumber, order.orderDate, i);
|
|
61
61
|
} else {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
await
|
|
62
|
+
for (const offer of order.acceptedOffers) {
|
|
63
|
+
console.log('updating...', order.project.id, order.orderNumber, order.orderDate, offer.itemOffered.reservationNumber, i);
|
|
64
|
+
await acceptedOfferRepo.fixSerialNumber({
|
|
65
65
|
project: { id: order.project.id },
|
|
66
66
|
orderNumber: order.orderNumber,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
paymentMethod: { identifier: (<any>invoice).typeOf }
|
|
67
|
+
acceptedOffers: {
|
|
68
|
+
serialNumber: offer.itemOffered.reservationNumber
|
|
70
69
|
}
|
|
71
70
|
});
|
|
72
71
|
}
|
|
@@ -15,6 +15,7 @@ async function main() {
|
|
|
15
15
|
const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
|
|
16
16
|
const actions = await actionRepo.search(
|
|
17
17
|
{
|
|
18
|
+
limit: 1,
|
|
18
19
|
// typeOf: { $eq: chevre.factory.actionType.CheckAction },
|
|
19
20
|
// project: { id: { $eq: project.id } },
|
|
20
21
|
// object: {
|
|
@@ -100,5 +100,17 @@ export declare class MongoRepository {
|
|
|
100
100
|
$in: string[];
|
|
101
101
|
};
|
|
102
102
|
}, field: IDistinctField): Promise<string[]>;
|
|
103
|
+
/**
|
|
104
|
+
* 互換性維持対応専用
|
|
105
|
+
*/
|
|
106
|
+
fixSerialNumber(params: {
|
|
107
|
+
project: {
|
|
108
|
+
id: string;
|
|
109
|
+
};
|
|
110
|
+
orderNumber: string;
|
|
111
|
+
acceptedOffers: {
|
|
112
|
+
serialNumber: string;
|
|
113
|
+
};
|
|
114
|
+
}): Promise<void>;
|
|
103
115
|
}
|
|
104
116
|
export {};
|
|
@@ -223,5 +223,32 @@ class MongoRepository {
|
|
|
223
223
|
.exec();
|
|
224
224
|
});
|
|
225
225
|
}
|
|
226
|
+
/**
|
|
227
|
+
* 互換性維持対応専用
|
|
228
|
+
*/
|
|
229
|
+
fixSerialNumber(params) {
|
|
230
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
231
|
+
const doc = yield this.orderModel.findOneAndUpdate({
|
|
232
|
+
orderNumber: { $eq: params.orderNumber },
|
|
233
|
+
'project.id': { $eq: params.project.id },
|
|
234
|
+
typeOf: { $eq: factory.order.OrderType.Order },
|
|
235
|
+
'acceptedOffers.itemOffered.reservationNumber': { $exists: true, $eq: params.acceptedOffers.serialNumber }
|
|
236
|
+
}, {
|
|
237
|
+
$set: {
|
|
238
|
+
'acceptedOffers.$[offer].serialNumber': params.acceptedOffers.serialNumber
|
|
239
|
+
}
|
|
240
|
+
}, {
|
|
241
|
+
arrayFilters: [{ 'offer.itemOffered.reservationNumber': { $eq: params.acceptedOffers.serialNumber } }],
|
|
242
|
+
new: true,
|
|
243
|
+
projection: {
|
|
244
|
+
_id: 1
|
|
245
|
+
}
|
|
246
|
+
})
|
|
247
|
+
.exec();
|
|
248
|
+
if (doc === null) {
|
|
249
|
+
throw new factory.errors.NotFound(this.orderModel.modelName);
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
}
|
|
226
253
|
}
|
|
227
254
|
exports.MongoRepository = MongoRepository;
|
|
@@ -22,13 +22,17 @@ class MongoRepository {
|
|
|
22
22
|
}
|
|
23
23
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
24
24
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
25
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68;
|
|
25
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69;
|
|
26
26
|
const andConditions = [];
|
|
27
|
-
const
|
|
27
|
+
const idIn = (_a = params.id) === null || _a === void 0 ? void 0 : _a.$in;
|
|
28
|
+
if (Array.isArray(idIn)) {
|
|
29
|
+
andConditions.push({ _id: { $in: idIn } });
|
|
30
|
+
}
|
|
31
|
+
const idNin = (_b = params.id) === null || _b === void 0 ? void 0 : _b.$nin;
|
|
28
32
|
if (Array.isArray(idNin)) {
|
|
29
33
|
andConditions.push({ _id: { $nin: idNin } });
|
|
30
34
|
}
|
|
31
|
-
const projectIdEq = (
|
|
35
|
+
const projectIdEq = (_d = (_c = params.project) === null || _c === void 0 ? void 0 : _c.id) === null || _d === void 0 ? void 0 : _d.$eq;
|
|
32
36
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
33
37
|
/* istanbul ignore else */
|
|
34
38
|
if (typeof projectIdEq === 'string') {
|
|
@@ -40,7 +44,7 @@ class MongoRepository {
|
|
|
40
44
|
}
|
|
41
45
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
42
46
|
/* istanbul ignore else */
|
|
43
|
-
const agentTypeOfIn = (
|
|
47
|
+
const agentTypeOfIn = (_f = (_e = params.agent) === null || _e === void 0 ? void 0 : _e.typeOf) === null || _f === void 0 ? void 0 : _f.$in;
|
|
44
48
|
if (Array.isArray(agentTypeOfIn)) {
|
|
45
49
|
andConditions.push({
|
|
46
50
|
'agent.typeOf': {
|
|
@@ -49,7 +53,7 @@ class MongoRepository {
|
|
|
49
53
|
}
|
|
50
54
|
});
|
|
51
55
|
}
|
|
52
|
-
const agentIdIn = (
|
|
56
|
+
const agentIdIn = (_h = (_g = params.agent) === null || _g === void 0 ? void 0 : _g.id) === null || _h === void 0 ? void 0 : _h.$in;
|
|
53
57
|
if (Array.isArray(agentIdIn)) {
|
|
54
58
|
andConditions.push({
|
|
55
59
|
'agent.id': {
|
|
@@ -58,11 +62,11 @@ class MongoRepository {
|
|
|
58
62
|
}
|
|
59
63
|
});
|
|
60
64
|
}
|
|
61
|
-
const instrumentTransactionNumberEq = (
|
|
65
|
+
const instrumentTransactionNumberEq = (_k = (_j = params.instrument) === null || _j === void 0 ? void 0 : _j.transactionNumber) === null || _k === void 0 ? void 0 : _k.$eq;
|
|
62
66
|
if (typeof instrumentTransactionNumberEq === 'string') {
|
|
63
67
|
andConditions.push({ 'instrument.transactionNumber': { $exists: true, $eq: instrumentTransactionNumberEq } });
|
|
64
68
|
}
|
|
65
|
-
const locationIdEq = (
|
|
69
|
+
const locationIdEq = (_m = (_l = params.location) === null || _l === void 0 ? void 0 : _l.id) === null || _m === void 0 ? void 0 : _m.$eq;
|
|
66
70
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
67
71
|
/* istanbul ignore else */
|
|
68
72
|
if (typeof locationIdEq === 'string') {
|
|
@@ -73,7 +77,7 @@ class MongoRepository {
|
|
|
73
77
|
}
|
|
74
78
|
});
|
|
75
79
|
}
|
|
76
|
-
const locationIdentifierEq = (
|
|
80
|
+
const locationIdentifierEq = (_p = (_o = params.location) === null || _o === void 0 ? void 0 : _o.identifier) === null || _p === void 0 ? void 0 : _p.$eq;
|
|
77
81
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
78
82
|
/* istanbul ignore else */
|
|
79
83
|
if (typeof locationIdentifierEq === 'string') {
|
|
@@ -84,7 +88,7 @@ class MongoRepository {
|
|
|
84
88
|
}
|
|
85
89
|
});
|
|
86
90
|
}
|
|
87
|
-
const objectMovieTicketsIdentifierEq = (
|
|
91
|
+
const objectMovieTicketsIdentifierEq = (_s = (_r = (_q = params.object) === null || _q === void 0 ? void 0 : _q.movieTickets) === null || _r === void 0 ? void 0 : _r.identifier) === null || _s === void 0 ? void 0 : _s.$eq;
|
|
88
92
|
if (typeof objectMovieTicketsIdentifierEq === 'string') {
|
|
89
93
|
andConditions.push({
|
|
90
94
|
'object.movieTickets.identifier': {
|
|
@@ -93,7 +97,7 @@ class MongoRepository {
|
|
|
93
97
|
}
|
|
94
98
|
});
|
|
95
99
|
}
|
|
96
|
-
const objectMovieTicketsServiceOutputReservationForIdEq = (_w = (_v = (_u = (_t =
|
|
100
|
+
const objectMovieTicketsServiceOutputReservationForIdEq = (_x = (_w = (_v = (_u = (_t = params.object) === null || _t === void 0 ? void 0 : _t.movieTickets) === null || _u === void 0 ? void 0 : _u.serviceOutput) === null || _v === void 0 ? void 0 : _v.reservationFor) === null || _w === void 0 ? void 0 : _w.id) === null || _x === void 0 ? void 0 : _x.$eq;
|
|
97
101
|
if (typeof objectMovieTicketsServiceOutputReservationForIdEq === 'string') {
|
|
98
102
|
andConditions.push({
|
|
99
103
|
'object.movieTickets.serviceOutput.reservationFor.id': {
|
|
@@ -104,7 +108,7 @@ class MongoRepository {
|
|
|
104
108
|
}
|
|
105
109
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
106
110
|
/* istanbul ignore else */
|
|
107
|
-
const objectPaymentMethodIdEq = (
|
|
111
|
+
const objectPaymentMethodIdEq = (_z = (_y = params.object) === null || _y === void 0 ? void 0 : _y.paymentMethodId) === null || _z === void 0 ? void 0 : _z.$eq;
|
|
108
112
|
if (typeof objectPaymentMethodIdEq === 'string') {
|
|
109
113
|
andConditions.push({
|
|
110
114
|
'object.paymentMethodId': {
|
|
@@ -113,7 +117,7 @@ class MongoRepository {
|
|
|
113
117
|
}
|
|
114
118
|
});
|
|
115
119
|
}
|
|
116
|
-
const objectObjectPaymentMethodIdEq = (
|
|
120
|
+
const objectObjectPaymentMethodIdEq = (_2 = (_1 = (_0 = params.object) === null || _0 === void 0 ? void 0 : _0.object) === null || _1 === void 0 ? void 0 : _1.paymentMethodId) === null || _2 === void 0 ? void 0 : _2.$eq;
|
|
117
121
|
if (typeof objectObjectPaymentMethodIdEq === 'string') {
|
|
118
122
|
andConditions.push({
|
|
119
123
|
'object.object.paymentMethodId': {
|
|
@@ -122,7 +126,7 @@ class MongoRepository {
|
|
|
122
126
|
}
|
|
123
127
|
});
|
|
124
128
|
}
|
|
125
|
-
const objectReservationForIdEq = (
|
|
129
|
+
const objectReservationForIdEq = (_5 = (_4 = (_3 = params.object) === null || _3 === void 0 ? void 0 : _3.reservationFor) === null || _4 === void 0 ? void 0 : _4.id) === null || _5 === void 0 ? void 0 : _5.$eq;
|
|
126
130
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
127
131
|
/* istanbul ignore else */
|
|
128
132
|
if (typeof objectReservationForIdEq === 'string') {
|
|
@@ -133,7 +137,7 @@ class MongoRepository {
|
|
|
133
137
|
}
|
|
134
138
|
});
|
|
135
139
|
}
|
|
136
|
-
const objectReservationNumberEq = (
|
|
140
|
+
const objectReservationNumberEq = (_7 = (_6 = params.object) === null || _6 === void 0 ? void 0 : _6.reservationNumber) === null || _7 === void 0 ? void 0 : _7.$eq;
|
|
137
141
|
if (typeof objectReservationNumberEq === 'string') {
|
|
138
142
|
andConditions.push({
|
|
139
143
|
'object.reservationNumber': {
|
|
@@ -142,7 +146,7 @@ class MongoRepository {
|
|
|
142
146
|
}
|
|
143
147
|
});
|
|
144
148
|
}
|
|
145
|
-
const objectReservationNumberIn = (
|
|
149
|
+
const objectReservationNumberIn = (_9 = (_8 = params.object) === null || _8 === void 0 ? void 0 : _8.reservationNumber) === null || _9 === void 0 ? void 0 : _9.$in;
|
|
146
150
|
if (Array.isArray(objectReservationNumberIn)) {
|
|
147
151
|
andConditions.push({
|
|
148
152
|
'object.reservationNumber': {
|
|
@@ -151,7 +155,7 @@ class MongoRepository {
|
|
|
151
155
|
}
|
|
152
156
|
});
|
|
153
157
|
}
|
|
154
|
-
const objectPaymentMethodAccountIdEq = (
|
|
158
|
+
const objectPaymentMethodAccountIdEq = (_12 = (_11 = (_10 = params.object) === null || _10 === void 0 ? void 0 : _10.paymentMethod) === null || _11 === void 0 ? void 0 : _11.accountId) === null || _12 === void 0 ? void 0 : _12.$eq;
|
|
155
159
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
156
160
|
/* istanbul ignore else */
|
|
157
161
|
if (typeof objectPaymentMethodAccountIdEq === 'string') {
|
|
@@ -162,7 +166,7 @@ class MongoRepository {
|
|
|
162
166
|
}
|
|
163
167
|
});
|
|
164
168
|
}
|
|
165
|
-
const objectPaymentMethodPaymentMethodIdEq = (
|
|
169
|
+
const objectPaymentMethodPaymentMethodIdEq = (_15 = (_14 = (_13 = params.object) === null || _13 === void 0 ? void 0 : _13.paymentMethod) === null || _14 === void 0 ? void 0 : _14.paymentMethodId) === null || _15 === void 0 ? void 0 : _15.$eq;
|
|
166
170
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
167
171
|
/* istanbul ignore else */
|
|
168
172
|
if (typeof objectPaymentMethodPaymentMethodIdEq === 'string') {
|
|
@@ -173,7 +177,7 @@ class MongoRepository {
|
|
|
173
177
|
}
|
|
174
178
|
});
|
|
175
179
|
}
|
|
176
|
-
const objectPaymentMethodPaymentMethodIdIn = (
|
|
180
|
+
const objectPaymentMethodPaymentMethodIdIn = (_18 = (_17 = (_16 = params.object) === null || _16 === void 0 ? void 0 : _16.paymentMethod) === null || _17 === void 0 ? void 0 : _17.paymentMethodId) === null || _18 === void 0 ? void 0 : _18.$in;
|
|
177
181
|
if (Array.isArray(objectPaymentMethodPaymentMethodIdIn)) {
|
|
178
182
|
andConditions.push({
|
|
179
183
|
'object.paymentMethod.paymentMethodId': {
|
|
@@ -182,7 +186,7 @@ class MongoRepository {
|
|
|
182
186
|
}
|
|
183
187
|
});
|
|
184
188
|
}
|
|
185
|
-
const objectPaymentMethodTypeOfEq = (
|
|
189
|
+
const objectPaymentMethodTypeOfEq = (_21 = (_20 = (_19 = params.object) === null || _19 === void 0 ? void 0 : _19.paymentMethod) === null || _20 === void 0 ? void 0 : _20.typeOf) === null || _21 === void 0 ? void 0 : _21.$eq;
|
|
186
190
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
187
191
|
/* istanbul ignore else */
|
|
188
192
|
if (typeof objectPaymentMethodTypeOfEq === 'string') {
|
|
@@ -193,7 +197,7 @@ class MongoRepository {
|
|
|
193
197
|
}
|
|
194
198
|
});
|
|
195
199
|
}
|
|
196
|
-
const objectTypeOfEq = (
|
|
200
|
+
const objectTypeOfEq = (_23 = (_22 = params.object) === null || _22 === void 0 ? void 0 : _22.typeOf) === null || _23 === void 0 ? void 0 : _23.$eq;
|
|
197
201
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
198
202
|
/* istanbul ignore else */
|
|
199
203
|
if (typeof objectTypeOfEq === 'string') {
|
|
@@ -204,7 +208,7 @@ class MongoRepository {
|
|
|
204
208
|
}
|
|
205
209
|
});
|
|
206
210
|
}
|
|
207
|
-
const objectTypeOfIn = (
|
|
211
|
+
const objectTypeOfIn = (_25 = (_24 = params.object) === null || _24 === void 0 ? void 0 : _24.typeOf) === null || _25 === void 0 ? void 0 : _25.$in;
|
|
208
212
|
if (Array.isArray(objectTypeOfIn)) {
|
|
209
213
|
andConditions.push({
|
|
210
214
|
'object.typeOf': {
|
|
@@ -213,7 +217,7 @@ class MongoRepository {
|
|
|
213
217
|
}
|
|
214
218
|
});
|
|
215
219
|
}
|
|
216
|
-
const objectIdEq = (
|
|
220
|
+
const objectIdEq = (_27 = (_26 = params.object) === null || _26 === void 0 ? void 0 : _26.id) === null || _27 === void 0 ? void 0 : _27.$eq;
|
|
217
221
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
218
222
|
/* istanbul ignore else */
|
|
219
223
|
if (typeof objectIdEq === 'string') {
|
|
@@ -224,7 +228,7 @@ class MongoRepository {
|
|
|
224
228
|
}
|
|
225
229
|
});
|
|
226
230
|
}
|
|
227
|
-
const objectIdIn = (
|
|
231
|
+
const objectIdIn = (_29 = (_28 = params.object) === null || _28 === void 0 ? void 0 : _28.id) === null || _29 === void 0 ? void 0 : _29.$in;
|
|
228
232
|
if (Array.isArray(objectIdIn)) {
|
|
229
233
|
andConditions.push({
|
|
230
234
|
'object.id': {
|
|
@@ -233,7 +237,7 @@ class MongoRepository {
|
|
|
233
237
|
}
|
|
234
238
|
});
|
|
235
239
|
}
|
|
236
|
-
const objectOrderNumberIn = (
|
|
240
|
+
const objectOrderNumberIn = (_31 = (_30 = params.object) === null || _30 === void 0 ? void 0 : _30.orderNumber) === null || _31 === void 0 ? void 0 : _31.$in;
|
|
237
241
|
if (Array.isArray(objectOrderNumberIn)) {
|
|
238
242
|
andConditions.push({
|
|
239
243
|
'object.orderNumber': {
|
|
@@ -242,7 +246,7 @@ class MongoRepository {
|
|
|
242
246
|
}
|
|
243
247
|
});
|
|
244
248
|
}
|
|
245
|
-
const objectEventIdIn = (
|
|
249
|
+
const objectEventIdIn = (_34 = (_33 = (_32 = params.object) === null || _32 === void 0 ? void 0 : _32.event) === null || _33 === void 0 ? void 0 : _33.id) === null || _34 === void 0 ? void 0 : _34.$in;
|
|
246
250
|
if (Array.isArray(objectEventIdIn)) {
|
|
247
251
|
andConditions.push({
|
|
248
252
|
'object.event.id': {
|
|
@@ -251,7 +255,7 @@ class MongoRepository {
|
|
|
251
255
|
}
|
|
252
256
|
});
|
|
253
257
|
}
|
|
254
|
-
const objectAcceptedOfferSeatNumberIn = (_40 = (_39 = (_38 = (_37 = (_36 = (_35 =
|
|
258
|
+
const objectAcceptedOfferSeatNumberIn = (_41 = (_40 = (_39 = (_38 = (_37 = (_36 = (_35 = params.object) === null || _35 === void 0 ? void 0 : _35.acceptedOffer) === null || _36 === void 0 ? void 0 : _36.itemOffered) === null || _37 === void 0 ? void 0 : _37.serviceOutput) === null || _38 === void 0 ? void 0 : _38.reservedTicket) === null || _39 === void 0 ? void 0 : _39.ticketedSeat) === null || _40 === void 0 ? void 0 : _40.seatNumber) === null || _41 === void 0 ? void 0 : _41.$in;
|
|
255
259
|
if (Array.isArray(objectAcceptedOfferSeatNumberIn)) {
|
|
256
260
|
andConditions.push({
|
|
257
261
|
'object.acceptedOffer.itemOffered.serviceOutput.reservedTicket.ticketedSeat.seatNumber': {
|
|
@@ -268,7 +272,7 @@ class MongoRepository {
|
|
|
268
272
|
});
|
|
269
273
|
}
|
|
270
274
|
else {
|
|
271
|
-
const typeOfEq = (
|
|
275
|
+
const typeOfEq = (_42 = params.typeOf) === null || _42 === void 0 ? void 0 : _42.$eq;
|
|
272
276
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
273
277
|
/* istanbul ignore else */
|
|
274
278
|
if (typeof typeOfEq === 'string') {
|
|
@@ -277,7 +281,7 @@ class MongoRepository {
|
|
|
277
281
|
});
|
|
278
282
|
}
|
|
279
283
|
}
|
|
280
|
-
const actionStatusIn = (
|
|
284
|
+
const actionStatusIn = (_43 = params.actionStatus) === null || _43 === void 0 ? void 0 : _43.$in;
|
|
281
285
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
282
286
|
/* istanbul ignore else */
|
|
283
287
|
if (Array.isArray(actionStatusIn)) {
|
|
@@ -308,7 +312,7 @@ class MongoRepository {
|
|
|
308
312
|
startDate: { $lte: startDateLte }
|
|
309
313
|
});
|
|
310
314
|
}
|
|
311
|
-
const fromLocationTypeOfIn = (
|
|
315
|
+
const fromLocationTypeOfIn = (_45 = (_44 = params.fromLocation) === null || _44 === void 0 ? void 0 : _44.typeOf) === null || _45 === void 0 ? void 0 : _45.$in;
|
|
312
316
|
if (Array.isArray(fromLocationTypeOfIn)) {
|
|
313
317
|
andConditions.push({
|
|
314
318
|
'fromLocation.typeOf': {
|
|
@@ -317,7 +321,7 @@ class MongoRepository {
|
|
|
317
321
|
}
|
|
318
322
|
});
|
|
319
323
|
}
|
|
320
|
-
const fromLocationAccountNumberIn = (
|
|
324
|
+
const fromLocationAccountNumberIn = (_47 = (_46 = params.fromLocation) === null || _46 === void 0 ? void 0 : _46.accountNumber) === null || _47 === void 0 ? void 0 : _47.$in;
|
|
321
325
|
if (Array.isArray(fromLocationAccountNumberIn)) {
|
|
322
326
|
andConditions.push({
|
|
323
327
|
'fromLocation.accountNumber': {
|
|
@@ -326,7 +330,7 @@ class MongoRepository {
|
|
|
326
330
|
}
|
|
327
331
|
});
|
|
328
332
|
}
|
|
329
|
-
const fromLocationAccountTypeIn = (
|
|
333
|
+
const fromLocationAccountTypeIn = (_49 = (_48 = params.fromLocation) === null || _48 === void 0 ? void 0 : _48.accountType) === null || _49 === void 0 ? void 0 : _49.$in;
|
|
330
334
|
if (Array.isArray(fromLocationAccountTypeIn)) {
|
|
331
335
|
andConditions.push({
|
|
332
336
|
'fromLocation.accountType': {
|
|
@@ -335,7 +339,7 @@ class MongoRepository {
|
|
|
335
339
|
}
|
|
336
340
|
});
|
|
337
341
|
}
|
|
338
|
-
const toLocationTypeOfIn = (
|
|
342
|
+
const toLocationTypeOfIn = (_51 = (_50 = params.toLocation) === null || _50 === void 0 ? void 0 : _50.typeOf) === null || _51 === void 0 ? void 0 : _51.$in;
|
|
339
343
|
if (Array.isArray(toLocationTypeOfIn)) {
|
|
340
344
|
andConditions.push({
|
|
341
345
|
'toLocation.typeOf': {
|
|
@@ -344,7 +348,7 @@ class MongoRepository {
|
|
|
344
348
|
}
|
|
345
349
|
});
|
|
346
350
|
}
|
|
347
|
-
const toLocationAccountNumberIn = (
|
|
351
|
+
const toLocationAccountNumberIn = (_53 = (_52 = params.toLocation) === null || _52 === void 0 ? void 0 : _52.accountNumber) === null || _53 === void 0 ? void 0 : _53.$in;
|
|
348
352
|
if (Array.isArray(toLocationAccountNumberIn)) {
|
|
349
353
|
andConditions.push({
|
|
350
354
|
'toLocation.accountNumber': {
|
|
@@ -353,7 +357,7 @@ class MongoRepository {
|
|
|
353
357
|
}
|
|
354
358
|
});
|
|
355
359
|
}
|
|
356
|
-
const toLocationAccountTypeIn = (
|
|
360
|
+
const toLocationAccountTypeIn = (_55 = (_54 = params.toLocation) === null || _54 === void 0 ? void 0 : _54.accountType) === null || _55 === void 0 ? void 0 : _55.$in;
|
|
357
361
|
if (Array.isArray(toLocationAccountTypeIn)) {
|
|
358
362
|
andConditions.push({
|
|
359
363
|
'toLocation.accountType': {
|
|
@@ -362,7 +366,7 @@ class MongoRepository {
|
|
|
362
366
|
}
|
|
363
367
|
});
|
|
364
368
|
}
|
|
365
|
-
const purposeTypeOfIn = (
|
|
369
|
+
const purposeTypeOfIn = (_57 = (_56 = params.purpose) === null || _56 === void 0 ? void 0 : _56.typeOf) === null || _57 === void 0 ? void 0 : _57.$in;
|
|
366
370
|
if (Array.isArray(purposeTypeOfIn)) {
|
|
367
371
|
andConditions.push({
|
|
368
372
|
'purpose.typeOf': {
|
|
@@ -371,7 +375,7 @@ class MongoRepository {
|
|
|
371
375
|
}
|
|
372
376
|
});
|
|
373
377
|
}
|
|
374
|
-
const purposeIdIn = (
|
|
378
|
+
const purposeIdIn = (_59 = (_58 = params.purpose) === null || _58 === void 0 ? void 0 : _58.id) === null || _59 === void 0 ? void 0 : _59.$in;
|
|
375
379
|
if (Array.isArray(purposeIdIn)) {
|
|
376
380
|
andConditions.push({
|
|
377
381
|
'purpose.id': {
|
|
@@ -380,7 +384,7 @@ class MongoRepository {
|
|
|
380
384
|
}
|
|
381
385
|
});
|
|
382
386
|
}
|
|
383
|
-
const purposeOrderNumberIn = (
|
|
387
|
+
const purposeOrderNumberIn = (_61 = (_60 = params.purpose) === null || _60 === void 0 ? void 0 : _60.orderNumber) === null || _61 === void 0 ? void 0 : _61.$in;
|
|
384
388
|
if (Array.isArray(purposeOrderNumberIn)) {
|
|
385
389
|
andConditions.push({
|
|
386
390
|
'purpose.orderNumber': {
|
|
@@ -389,7 +393,7 @@ class MongoRepository {
|
|
|
389
393
|
}
|
|
390
394
|
});
|
|
391
395
|
}
|
|
392
|
-
const resultTypeOfIn = (
|
|
396
|
+
const resultTypeOfIn = (_63 = (_62 = params.result) === null || _62 === void 0 ? void 0 : _62.typeOf) === null || _63 === void 0 ? void 0 : _63.$in;
|
|
393
397
|
if (Array.isArray(resultTypeOfIn)) {
|
|
394
398
|
andConditions.push({
|
|
395
399
|
'result.typeOf': {
|
|
@@ -398,7 +402,7 @@ class MongoRepository {
|
|
|
398
402
|
}
|
|
399
403
|
});
|
|
400
404
|
}
|
|
401
|
-
const resultIdIn = (
|
|
405
|
+
const resultIdIn = (_65 = (_64 = params.result) === null || _64 === void 0 ? void 0 : _64.id) === null || _65 === void 0 ? void 0 : _65.$in;
|
|
402
406
|
if (Array.isArray(resultIdIn)) {
|
|
403
407
|
andConditions.push({
|
|
404
408
|
'result.id': {
|
|
@@ -407,7 +411,7 @@ class MongoRepository {
|
|
|
407
411
|
}
|
|
408
412
|
});
|
|
409
413
|
}
|
|
410
|
-
const resultOrderNumberIn = (
|
|
414
|
+
const resultOrderNumberIn = (_67 = (_66 = params.result) === null || _66 === void 0 ? void 0 : _66.orderNumber) === null || _67 === void 0 ? void 0 : _67.$in;
|
|
411
415
|
if (Array.isArray(resultOrderNumberIn)) {
|
|
412
416
|
andConditions.push({
|
|
413
417
|
'result.orderNumber': {
|
|
@@ -416,7 +420,7 @@ class MongoRepository {
|
|
|
416
420
|
}
|
|
417
421
|
});
|
|
418
422
|
}
|
|
419
|
-
const resultCodeIn = (
|
|
423
|
+
const resultCodeIn = (_69 = (_68 = params.result) === null || _68 === void 0 ? void 0 : _68.code) === null || _69 === void 0 ? void 0 : _69.$in;
|
|
420
424
|
if (Array.isArray(resultCodeIn)) {
|
|
421
425
|
andConditions.push({
|
|
422
426
|
'result.code': {
|
|
@@ -32,6 +32,19 @@ export declare class MongoRepository {
|
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
34
|
}): Promise<import("mongodb").UpdateResult>;
|
|
35
|
+
/**
|
|
36
|
+
* serialNumberからオファーを除外する
|
|
37
|
+
* ホワイトリストとブラックリスト両方に対応
|
|
38
|
+
*/
|
|
39
|
+
voidAcceptedOfferBySerialNumber(params: {
|
|
40
|
+
orderNumber: string;
|
|
41
|
+
acceptedOffers: {
|
|
42
|
+
serialNumber: {
|
|
43
|
+
$in?: string[];
|
|
44
|
+
$nin?: string[];
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
}): Promise<import("mongodb").UpdateResult | undefined>;
|
|
35
48
|
deleteByOrderNumber(params: {
|
|
36
49
|
orderNumber: string;
|
|
37
50
|
}): Promise<import("mongodb").DeleteResult>;
|
|
@@ -107,6 +107,45 @@ class MongoRepository {
|
|
|
107
107
|
.exec();
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* serialNumberからオファーを除外する
|
|
112
|
+
* ホワイトリストとブラックリスト両方に対応
|
|
113
|
+
*/
|
|
114
|
+
voidAcceptedOfferBySerialNumber(params) {
|
|
115
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
116
|
+
const serialNumberIn = params.acceptedOffers.serialNumber.$in;
|
|
117
|
+
const serialNumberNin = params.acceptedOffers.serialNumber.$nin;
|
|
118
|
+
if (Array.isArray(serialNumberIn) && serialNumberIn.length > 0) {
|
|
119
|
+
return this.orderModel.updateOne({
|
|
120
|
+
typeOf: { $eq: factory.transactionType.PlaceOrder },
|
|
121
|
+
orderNumber: { $eq: params.orderNumber }
|
|
122
|
+
}, {
|
|
123
|
+
$pull: {
|
|
124
|
+
acceptedOffers: {
|
|
125
|
+
serialNumber: { $exists: true, $in: serialNumberIn }
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
})
|
|
129
|
+
.exec();
|
|
130
|
+
}
|
|
131
|
+
else if (Array.isArray(serialNumberNin) && serialNumberNin.length > 0) {
|
|
132
|
+
return this.orderModel.updateOne({
|
|
133
|
+
typeOf: { $eq: factory.transactionType.PlaceOrder },
|
|
134
|
+
orderNumber: { $eq: params.orderNumber }
|
|
135
|
+
}, {
|
|
136
|
+
$pull: {
|
|
137
|
+
acceptedOffers: {
|
|
138
|
+
serialNumber: { $nin: serialNumberNin }
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
})
|
|
142
|
+
.exec();
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}
|
|
110
149
|
deleteByOrderNumber(params) {
|
|
111
150
|
return __awaiter(this, void 0, void 0, function* () {
|
|
112
151
|
return this.orderModel.deleteOne({
|
|
@@ -11,6 +11,7 @@ interface IAcceptOfferOperationRepos {
|
|
|
11
11
|
}
|
|
12
12
|
type IAcceptOfferOperation<T> = (repos: IAcceptOfferOperationRepos) => Promise<T>;
|
|
13
13
|
type IAuthorizeEventServiceOfferAction = factory.action.authorize.offer.eventService.IAction<factory.service.webAPI.Identifier>;
|
|
14
|
+
export type IAuthorizeActionWithInstrument = Pick<factory.action.authorize.offer.moneyTransfer.IAction | factory.action.authorize.offer.product.IAction | factory.action.authorize.offer.eventService.IAction<factory.service.webAPI.Identifier>, 'instrument'>;
|
|
14
15
|
export declare function acceptOffer(params: {
|
|
15
16
|
project: {
|
|
16
17
|
id: string;
|
|
@@ -22,9 +23,13 @@ export declare function acceptOffer(params: {
|
|
|
22
23
|
}): IAcceptOfferOperation<void>;
|
|
23
24
|
export declare function voidAcceptedOffer(params: {
|
|
24
25
|
/**
|
|
25
|
-
*
|
|
26
|
+
* 取消対象の興行オファー承認アクション
|
|
26
27
|
*/
|
|
27
28
|
authorizeActions: Pick<IAuthorizeEventServiceOfferAction, 'object'>[];
|
|
29
|
+
/**
|
|
30
|
+
* instrument.serialNumberからvoidする場合に指定
|
|
31
|
+
*/
|
|
32
|
+
authorizeActionsWithInstrument: IAuthorizeActionWithInstrument[];
|
|
28
33
|
orderNumber: string;
|
|
29
34
|
}): (repos: {
|
|
30
35
|
orderInTransaction: OrderInTransactionRepo;
|
|
@@ -50,6 +50,19 @@ function voidAcceptedOffer(params) {
|
|
|
50
50
|
});
|
|
51
51
|
debug('acceptedOffers removed from PlaceOrder.', result);
|
|
52
52
|
}
|
|
53
|
+
if (Array.isArray(params.authorizeActionsWithInstrument)) {
|
|
54
|
+
const serialNumbers = params.authorizeActionsWithInstrument
|
|
55
|
+
.filter(({ instrument }) => typeof instrument.transactionNumber === 'string')
|
|
56
|
+
.map(({ instrument }) => String(instrument.transactionNumber));
|
|
57
|
+
debug('removing acceptedOffers from PlaceOrder...', orderNumber, 'serialNumbers:', serialNumbers);
|
|
58
|
+
if (serialNumbers.length > 0) {
|
|
59
|
+
const result = yield repos.orderInTransaction.voidAcceptedOfferBySerialNumber({
|
|
60
|
+
orderNumber,
|
|
61
|
+
acceptedOffers: { serialNumber: { $in: serialNumbers } }
|
|
62
|
+
});
|
|
63
|
+
debug('acceptedOffers removed from PlaceOrder by serialNumbers.', result);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
53
66
|
});
|
|
54
67
|
}
|
|
55
68
|
exports.voidAcceptedOffer = voidAcceptedOffer;
|
|
@@ -100,6 +100,7 @@ function changeOffers(params) {
|
|
|
100
100
|
if (typeof orderNumberByTransaction === 'string') {
|
|
101
101
|
yield (0, any_1.voidAcceptedOffer)({
|
|
102
102
|
authorizeActions: [authorizeAction],
|
|
103
|
+
authorizeActionsWithInstrument: [authorizeAction],
|
|
103
104
|
orderNumber: orderNumberByTransaction
|
|
104
105
|
})(repos);
|
|
105
106
|
}
|
|
@@ -245,14 +245,12 @@ function paymentDue2Processing(params) {
|
|
|
245
245
|
orderNumber: { $eq: order.orderNumber },
|
|
246
246
|
project: { id: { $eq: params.project.id } }
|
|
247
247
|
});
|
|
248
|
-
const moneyTransferTransactionNumbers = yield repos.acceptedOffer.distinctValues({ orderNumber: { $in: [params.orderNumber] } }, 'acceptedOffers.itemOffered.object.pendingTransaction.transactionNumber');
|
|
249
248
|
const itemOfferedTypeOfs = yield repos.acceptedOffer.distinctValues({ orderNumber: { $in: [params.orderNumber] } }, 'acceptedOffers.itemOffered.typeOf');
|
|
250
249
|
const serialNumbers = yield repos.acceptedOffer.distinctValues({ orderNumber: { $in: [params.orderNumber] } }, 'acceptedOffers.serialNumber');
|
|
251
|
-
debug('onAssetTransactionStatusChanged paymentDue2Processing: calling onOrderProcessing...', 'numAcceptedOffers:', numAcceptedOffers, '
|
|
250
|
+
debug('onAssetTransactionStatusChanged paymentDue2Processing: calling onOrderProcessing...', 'numAcceptedOffers:', numAcceptedOffers, 'itemOfferedTypeOfs:', itemOfferedTypeOfs, 'serialNumbers:', serialNumbers);
|
|
252
251
|
yield (0, onOrderStatusChanged_1.onOrderProcessing)({
|
|
253
252
|
order: Object.assign(Object.assign({}, order), { acceptedOffers,
|
|
254
|
-
numAcceptedOffers,
|
|
255
|
-
moneyTransferTransactionNumbers, itemOfferedTypeOf: itemOfferedTypeOfs[0], // 1つしかない前提
|
|
253
|
+
numAcceptedOffers, itemOfferedTypeOf: itemOfferedTypeOfs[0], // 1つしかない前提
|
|
256
254
|
serialNumbers, orderStatus: factory.orderStatus.OrderProcessing // 強制的にOrderProcessingとして処理する
|
|
257
255
|
}),
|
|
258
256
|
placeOrderTransaction
|
|
@@ -7,7 +7,6 @@ declare function onOrderProcessing(params: {
|
|
|
7
7
|
orderStatus: factory.orderStatus.OrderProcessing;
|
|
8
8
|
acceptedOffers: IAcceptedOffer[];
|
|
9
9
|
numAcceptedOffers: number;
|
|
10
|
-
moneyTransferTransactionNumbers: string[];
|
|
11
10
|
itemOfferedTypeOf: factory.order.IItemOffered['typeOf'];
|
|
12
11
|
serialNumbers: string[];
|
|
13
12
|
};
|
|
@@ -5,8 +5,8 @@ import type { MongoRepository as OrderRepo } from '../../repo/order';
|
|
|
5
5
|
import type { MongoRepository as OrderInTransactionRepo } from '../../repo/orderInTransaction';
|
|
6
6
|
import type { MongoRepository as TaskRepo } from '../../repo/task';
|
|
7
7
|
import type { MongoRepository as TransactionRepo } from '../../repo/transaction';
|
|
8
|
-
import { IExternalOrder } from './onOrderStatusChanged';
|
|
9
8
|
import * as factory from '../../factory';
|
|
9
|
+
import { IExternalOrder } from './onOrderStatusChanged';
|
|
10
10
|
/**
|
|
11
11
|
* 注文取引なしに注文を作成する
|
|
12
12
|
*/
|
|
@@ -12,14 +12,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.placeOrderWithoutTransaction = exports.placeOrder = void 0;
|
|
13
13
|
const createDebug = require("debug");
|
|
14
14
|
const moment = require("moment");
|
|
15
|
+
const factory = require("../../factory");
|
|
15
16
|
const order_1 = require("../../factory/order");
|
|
16
|
-
const
|
|
17
|
+
const settings_1 = require("../../settings");
|
|
17
18
|
const createAccountingReportIfNotExist_1 = require("./createAccountingReportIfNotExist");
|
|
18
19
|
const onAssetTransactionStatusChanged_1 = require("./onAssetTransactionStatusChanged");
|
|
19
20
|
const onOrderStatusChanged_1 = require("./onOrderStatusChanged");
|
|
20
|
-
const factory = require("../../factory");
|
|
21
|
-
const settings_1 = require("../../settings");
|
|
22
21
|
const debug = createDebug('chevre-domain:service:order');
|
|
22
|
+
// type IAuthorizeEventServiceOfferAction = factory.action.authorize.offer.eventService.IAction<factory.service.webAPI.Identifier>;
|
|
23
23
|
function createOrder(params) {
|
|
24
24
|
// 必要な属性についてDate型に変換(でないと検索クエリを効率的に使えない)
|
|
25
25
|
const acceptedOffers = (Array.isArray(params.acceptedOffers))
|
|
@@ -167,20 +167,50 @@ function voidAcceptedOfferIfNecessary(params) {
|
|
|
167
167
|
if (Array.isArray(authorizeActionsAsResult) && authorizeActionsAsResult.length > 0) {
|
|
168
168
|
const completedAuthorizeActionIds = authorizeActionsAsResult.map(({ id }) => id);
|
|
169
169
|
debug(completedAuthorizeActionIds.length, 'completedAuthorizeActionIds found from transaction', params.purpose.id);
|
|
170
|
-
const authorizeActions =
|
|
170
|
+
// const authorizeActions = <Pick<IAuthorizeEventServiceOfferAction, 'object'>[]>
|
|
171
|
+
// await repos.action.search(
|
|
172
|
+
// {
|
|
173
|
+
// typeOf: factory.actionType.AuthorizeAction,
|
|
174
|
+
// purpose: {
|
|
175
|
+
// typeOf: { $in: [factory.transactionType.PlaceOrder] },
|
|
176
|
+
// id: { $in: [params.purpose.id] }
|
|
177
|
+
// },
|
|
178
|
+
// object: { typeOf: { $eq: factory.action.authorize.offer.eventService.ObjectType.SeatReservation } },
|
|
179
|
+
// id: { $nin: completedAuthorizeActionIds }
|
|
180
|
+
// },
|
|
181
|
+
// ['object'],
|
|
182
|
+
// []
|
|
183
|
+
// );
|
|
184
|
+
const authorizeActionsWithInstrument = yield repos.action.search({
|
|
171
185
|
typeOf: factory.actionType.AuthorizeAction,
|
|
172
186
|
purpose: {
|
|
173
187
|
typeOf: { $in: [factory.transactionType.PlaceOrder] },
|
|
174
188
|
id: { $in: [params.purpose.id] }
|
|
175
189
|
},
|
|
176
|
-
object: {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
190
|
+
object: {
|
|
191
|
+
typeOf: {
|
|
192
|
+
$in: [
|
|
193
|
+
factory.action.authorize.offer.eventService.ObjectType.SeatReservation,
|
|
194
|
+
factory.offerType.Offer
|
|
195
|
+
]
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
id: { $in: completedAuthorizeActionIds }
|
|
199
|
+
}, ['instrument'], []);
|
|
200
|
+
const serialNumbersMustBeIn = authorizeActionsWithInstrument
|
|
201
|
+
.filter(({ instrument }) => typeof instrument.transactionNumber === 'string')
|
|
202
|
+
.map(({ instrument }) => String(instrument.transactionNumber));
|
|
203
|
+
debug('voidAcceptedOfferBySerialNumber processing...', params.object.orderNumber, 'serialNumbersMustBeIn:', serialNumbersMustBeIn);
|
|
204
|
+
const voidAcceptedOfferBySerialNumberResult = yield repos.orderInTransaction.voidAcceptedOfferBySerialNumber({
|
|
205
|
+
orderNumber: params.object.orderNumber,
|
|
206
|
+
acceptedOffers: { serialNumber: { $nin: serialNumbersMustBeIn } }
|
|
207
|
+
});
|
|
208
|
+
debug('voidAcceptedOfferBySerialNumber processed.', params.object.orderNumber, 'voidAcceptedOfferBySerialNumberResult:', voidAcceptedOfferBySerialNumberResult);
|
|
209
|
+
// await voidAcceptedOffer({
|
|
210
|
+
// authorizeActions,
|
|
211
|
+
// authorizeActionsWithInstrument,
|
|
212
|
+
// orderNumber: params.object.orderNumber
|
|
213
|
+
// })(repos);
|
|
184
214
|
}
|
|
185
215
|
});
|
|
186
216
|
}
|
|
@@ -235,6 +235,11 @@ function validateNumItems(params) {
|
|
|
235
235
|
throw new factory.errors.Argument('Transaction', (0, util_1.format)('Number of order items must be more than equal to %s', numItemsMinValue));
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
|
+
// itemOffered.typeOf数検証(2024-01-31~)
|
|
239
|
+
const itemOfferedTypeOfs = [...new Set(params.order.acceptedOffers.map((offer) => offer.itemOffered.typeOf))];
|
|
240
|
+
if (itemOfferedTypeOfs.length > 1) {
|
|
241
|
+
throw new factory.errors.Argument('Transaction', `different itemOffered.typeOfs contained. [${itemOfferedTypeOfs.join(',')}]`);
|
|
242
|
+
}
|
|
238
243
|
}
|
|
239
244
|
exports.validateNumItems = validateNumItems;
|
|
240
245
|
function validateOrderedItem(params) {
|
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.352.0-alpha.
|
|
13
|
+
"@chevre/factory": "4.352.0-alpha.15",
|
|
14
14
|
"@cinerino/sdk": "5.9.0-alpha.2",
|
|
15
15
|
"@motionpicture/coa-service": "9.3.0-alpha.4",
|
|
16
16
|
"@motionpicture/gmo-service": "5.3.0-alpha.2",
|
|
@@ -111,5 +111,5 @@
|
|
|
111
111
|
"postversion": "git push origin --tags",
|
|
112
112
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
113
113
|
},
|
|
114
|
-
"version": "21.20.0-alpha.
|
|
114
|
+
"version": "21.20.0-alpha.59"
|
|
115
115
|
}
|