@chevre/domain 25.0.0-alpha.9 → 25.0.0
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/message.d.ts +7 -15
- package/lib/chevre/repo/message.js +37 -74
- package/lib/chevre/repo/mongoose/schemas/message.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/order.js +2 -110
- package/lib/chevre/repo/mongoose/schemas/setting.d.ts +7 -9
- package/lib/chevre/repo/mongoose/schemas/setting.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/transaction.js +51 -50
- package/lib/chevre/repo/order.d.ts +1 -7
- package/lib/chevre/repo/order.js +56 -26
- package/lib/chevre/repo/orderInTransaction.d.ts +41 -22
- package/lib/chevre/repo/orderInTransaction.js +108 -79
- package/lib/chevre/repo/passport.d.ts +5 -2
- package/lib/chevre/repo/setting/waiter.d.ts +17 -0
- package/lib/chevre/repo/setting/waiter.js +39 -0
- package/lib/chevre/repo/setting.d.ts +12 -11
- package/lib/chevre/repo/setting.js +6 -18
- package/lib/chevre/repo/task.d.ts +1 -1
- package/lib/chevre/repo/transaction/placeOrder.d.ts +1 -6
- package/lib/chevre/repo/transaction/placeOrder.js +37 -26
- package/lib/chevre/repo/transaction.d.ts +1 -1
- package/lib/chevre/repo/transaction.js +2 -2
- package/lib/chevre/repository.d.ts +5 -0
- package/lib/chevre/repository.js +11 -0
- package/lib/chevre/service/assetTransaction/reserve/start.d.ts +0 -2
- package/lib/chevre/service/offer/any.d.ts +1 -3
- package/lib/chevre/service/offer/any.js +7 -8
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +0 -2
- package/lib/chevre/service/offer/event/authorize.d.ts +0 -4
- package/lib/chevre/service/offer/event/authorize.js +5 -8
- package/lib/chevre/service/offer/event/voidTransaction.js +29 -17
- package/lib/chevre/service/offer/event/voidTransactionByActionId.js +16 -12
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.d.ts +0 -6
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +10 -12
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +6 -7
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +20 -17
- package/lib/chevre/service/order/deleteOrder.d.ts +6 -10
- package/lib/chevre/service/order/deleteOrder.js +7 -48
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.d.ts +4 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +1 -26
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +3 -2
- package/lib/chevre/service/order/placeOrder/factory.d.ts +1 -1
- package/lib/chevre/service/order/placeOrder/factory.js +6 -6
- package/lib/chevre/service/order/placeOrder/voidAcceptedOfferIfNecessary.d.ts +1 -3
- package/lib/chevre/service/order/placeOrder/voidAcceptedOfferIfNecessary.js +3 -15
- package/lib/chevre/service/order/placeOrder.js +6 -6
- package/lib/chevre/service/order.d.ts +1 -2
- package/lib/chevre/service/order.js +1 -5
- package/lib/chevre/service/payment/any/authorize/fixOrderAsNeeded.d.ts +2 -4
- package/lib/chevre/service/payment/any/authorize/fixOrderAsNeeded.js +4 -6
- package/lib/chevre/service/payment/any/authorize.d.ts +2 -0
- package/lib/chevre/service/payment/any/publishPaymentUrl.d.ts +0 -4
- package/lib/chevre/service/payment/any/publishPaymentUrl.js +5 -8
- package/lib/chevre/service/task/acceptCOAOffer.js +8 -10
- package/lib/chevre/service/task/authorizePayment.js +2 -6
- package/lib/chevre/service/task/deleteTransaction.js +2 -10
- package/lib/chevre/service/task/publishPaymentUrl.js +6 -9
- package/lib/chevre/service/taskHandler.js +0 -1
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +8 -16
- package/lib/chevre/service/transaction/deleteTransaction.js +46 -145
- package/lib/chevre/service/transaction/placeOrder/confirm/factory/result.d.ts +7 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.d.ts +3 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.d.ts +3 -2
- package/lib/chevre/service/transaction/placeOrder/confirm.d.ts +2 -5
- package/lib/chevre/service/transaction/placeOrder/confirm.js +29 -24
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +2 -3
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +45 -54
- package/lib/chevre/service/transaction/placeOrder/exportTasksById.d.ts +0 -4
- package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +2 -3
- package/lib/chevre/service/transaction/placeOrder/issueOrderNumberIfNotExist.d.ts +5 -0
- package/lib/chevre/service/transaction/placeOrder/issueOrderNumberIfNotExist.js +37 -23
- package/lib/chevre/service/transaction/placeOrder/start/factory.d.ts +20 -4
- package/lib/chevre/service/transaction/placeOrder/start/factory.js +20 -7
- package/lib/chevre/service/transaction/placeOrder/start.d.ts +9 -4
- package/lib/chevre/service/transaction/placeOrder/start.js +18 -1
- package/lib/chevre/service/transaction/placeOrder/updateAgent.d.ts +0 -4
- package/lib/chevre/service/transaction/placeOrder/updateAgent.js +19 -22
- package/lib/chevre/service/transaction/placeOrder.d.ts +1 -2
- package/lib/chevre/service/transaction/placeOrder.js +1 -3
- package/lib/chevre/service/transaction.d.ts +0 -4
- package/lib/chevre/service/transaction.js +1 -1
- package/lib/chevre/service.d.ts +0 -2
- package/lib/chevre/service.js +0 -2
- package/package.json +2 -2
- package/lib/chevre/factory/order.d.ts +0 -2
- package/lib/chevre/factory/order.js +0 -5
- package/lib/chevre/service/order/placeOrderWithoutTransaction.d.ts +0 -22
- package/lib/chevre/service/order/placeOrderWithoutTransaction.js +0 -51
- package/lib/chevre/service/task/deletePerson.d.ts +0 -6
- package/lib/chevre/service/task/deletePerson.js +0 -465
|
@@ -122,16 +122,18 @@ class PlaceOrderRepo {
|
|
|
122
122
|
if (Array.isArray(sellerIdIn)) {
|
|
123
123
|
andConditions.push({ 'seller.id': { $exists: true, $in: sellerIdIn } });
|
|
124
124
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
125
|
+
// result.orderは完全に廃止したので検索条件としても廃止(2026-06-26~)
|
|
126
|
+
// const resultOrderNumberIn = params.result?.order?.orderNumbers;
|
|
127
|
+
// if (Array.isArray(resultOrderNumberIn)) {
|
|
128
|
+
// andConditions.push({ 'result.order.orderNumber': { $exists: true, $in: resultOrderNumberIn } });
|
|
129
|
+
// }
|
|
130
|
+
// result.orderは完全に廃止したので検索条件としても廃止(2026-06-26~)
|
|
131
|
+
// const resultOrderConfirmationNumberEq = params.result?.order?.confirmationNumber?.$eq;
|
|
132
|
+
// if (typeof resultOrderConfirmationNumberEq === 'string') {
|
|
133
|
+
// andConditions.push({
|
|
134
|
+
// 'result.order.confirmationNumber': { $exists: true, $eq: resultOrderConfirmationNumberEq }
|
|
135
|
+
// });
|
|
136
|
+
// }
|
|
135
137
|
const objectOrderNumberEq = params.object?.orderNumber?.$eq;
|
|
136
138
|
if (typeof objectOrderNumberEq === 'string') {
|
|
137
139
|
andConditions.push({ 'object.orderNumber': { $exists: true, $eq: objectOrderNumberEq } });
|
|
@@ -200,22 +202,30 @@ class PlaceOrderRepo {
|
|
|
200
202
|
}
|
|
201
203
|
return doc.object.paymentMethods;
|
|
202
204
|
}
|
|
203
|
-
/**
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
async findInProgressOrderNumberById(params
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
205
|
+
// /**
|
|
206
|
+
// * 取引の注文番号を検索する
|
|
207
|
+
// */
|
|
208
|
+
// public async findInProgressOrderNumberById(params: {
|
|
209
|
+
// id: string;
|
|
210
|
+
// }): Promise<string | undefined> {
|
|
211
|
+
// const doc = await this.transactionModel.findOne(
|
|
212
|
+
// {
|
|
213
|
+
// _id: { $eq: params.id },
|
|
214
|
+
// typeOf: { $eq: factory.transactionType.PlaceOrder },
|
|
215
|
+
// status: { $eq: factory.transactionStatusType.InProgress }
|
|
216
|
+
// },
|
|
217
|
+
// { 'object.orderNumber': 1 }
|
|
218
|
+
// )
|
|
219
|
+
// .lean<{ object: Pick<factory.transaction.placeOrder.IObject, 'orderNumber'> }>() // 2024-08-26~
|
|
220
|
+
// .exec();
|
|
221
|
+
// if (doc === null) {
|
|
222
|
+
// throw new factory.errors.NotFound(
|
|
223
|
+
// this.transactionModel.modelName,
|
|
224
|
+
// `${factory.transactionType.PlaceOrder} ${factory.transactionStatusType.InProgress} not found`
|
|
225
|
+
// );
|
|
226
|
+
// }
|
|
227
|
+
// return doc.object.orderNumber;
|
|
228
|
+
// }
|
|
219
229
|
/**
|
|
220
230
|
* 取引の確認番号を検索する
|
|
221
231
|
*/
|
|
@@ -430,6 +440,7 @@ class PlaceOrderRepo {
|
|
|
430
440
|
status: factory_1.factory.transactionStatusType.Confirmed, // ステータス変更
|
|
431
441
|
endDate,
|
|
432
442
|
'object.orderDate': params.object.orderDate, // add(2026-06-15~)
|
|
443
|
+
'object.orderNumber': params.object.orderNumber, // add(2026-06-27~)
|
|
433
444
|
result: params.result, // resultを更新
|
|
434
445
|
potentialActions: params.potentialActions // resultを更新
|
|
435
446
|
}, {
|
|
@@ -130,7 +130,7 @@ export declare class TransactionRepo {
|
|
|
130
130
|
$lt: Date;
|
|
131
131
|
};
|
|
132
132
|
}): Promise<import("mongodb").DeleteResult>;
|
|
133
|
-
getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & (({
|
|
133
|
+
getCursor(conditions: any, projection: any, sort?: factory.sortType): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & (({
|
|
134
134
|
object: import("@chevre/factory/lib/chevre/transaction/placeOrder").IObject;
|
|
135
135
|
error?: any;
|
|
136
136
|
project: import("@chevre/factory/lib/chevre/transaction").IProject;
|
|
@@ -316,9 +316,9 @@ class TransactionRepo {
|
|
|
316
316
|
})
|
|
317
317
|
.exec();
|
|
318
318
|
}
|
|
319
|
-
getCursor(conditions, projection) {
|
|
319
|
+
getCursor(conditions, projection, sort) {
|
|
320
320
|
return this.transactionModel.find(conditions, projection)
|
|
321
|
-
.sort({ startDate: factory_1.factory.sortType.Descending })
|
|
321
|
+
.sort({ startDate: (sort === factory_1.factory.sortType.Ascending) ? sort : factory_1.factory.sortType.Descending })
|
|
322
322
|
.cursor();
|
|
323
323
|
}
|
|
324
324
|
async aggregatePlaceOrder(params) {
|
|
@@ -81,6 +81,7 @@ import type { ServiceAvailableHourRepo } from './repo/service/availableHour';
|
|
|
81
81
|
import type { SettingRepo } from './repo/setting';
|
|
82
82
|
import type { IntegrationSettingRepo } from './repo/setting/integration';
|
|
83
83
|
import type { JWTSettingRepo } from './repo/setting/jwt';
|
|
84
|
+
import type { WaiterSettingRepo } from './repo/setting/waiter';
|
|
84
85
|
import type { StockHolderRepo } from './repo/stockHolder';
|
|
85
86
|
import type { TaskRepo } from './repo/task';
|
|
86
87
|
import type { TicketRepo } from './repo/ticket';
|
|
@@ -446,6 +447,10 @@ export declare namespace setting {
|
|
|
446
447
|
namespace JWT {
|
|
447
448
|
function createInstance(...params: ConstructorParameters<typeof JWTSettingRepo>): Promise<JWTSettingRepo>;
|
|
448
449
|
}
|
|
450
|
+
type Waiter = WaiterSettingRepo;
|
|
451
|
+
namespace Waiter {
|
|
452
|
+
function createInstance(...params: ConstructorParameters<typeof WaiterSettingRepo>): Promise<WaiterSettingRepo>;
|
|
453
|
+
}
|
|
449
454
|
}
|
|
450
455
|
export type StockHolder = StockHolderRepo;
|
|
451
456
|
export declare namespace StockHolder {
|
package/lib/chevre/repository.js
CHANGED
|
@@ -933,6 +933,17 @@ var setting;
|
|
|
933
933
|
}
|
|
934
934
|
JWT.createInstance = createInstance;
|
|
935
935
|
})(JWT = setting.JWT || (setting.JWT = {}));
|
|
936
|
+
let Waiter;
|
|
937
|
+
(function (Waiter) {
|
|
938
|
+
let repo;
|
|
939
|
+
async function createInstance(...params) {
|
|
940
|
+
if (repo === undefined) {
|
|
941
|
+
repo = (await import('./repo/setting/waiter.js')).WaiterSettingRepo;
|
|
942
|
+
}
|
|
943
|
+
return new repo(...params);
|
|
944
|
+
}
|
|
945
|
+
Waiter.createInstance = createInstance;
|
|
946
|
+
})(Waiter = setting.Waiter || (setting.Waiter = {}));
|
|
936
947
|
})(setting || (exports.setting = setting = {}));
|
|
937
948
|
var StockHolder;
|
|
938
949
|
(function (StockHolder) {
|
|
@@ -15,7 +15,6 @@ import type { PaymentServiceRepo } from '../../../repo/paymentService';
|
|
|
15
15
|
import { SeatRepo } from '../../../repo/place/seat';
|
|
16
16
|
import type { PriceSpecificationRepo } from '../../../repo/priceSpecification';
|
|
17
17
|
import type { ProductRepo } from '../../../repo/product';
|
|
18
|
-
import type { ProjectRepo } from '../../../repo/project';
|
|
19
18
|
import type { OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
|
|
20
19
|
import type { SettingRepo } from '../../../repo/setting';
|
|
21
20
|
import type { StockHolderRepo } from '../../../repo/stockHolder';
|
|
@@ -37,7 +36,6 @@ interface IStartOperationRepos {
|
|
|
37
36
|
paymentService: PaymentServiceRepo;
|
|
38
37
|
product: ProductRepo;
|
|
39
38
|
priceSpecification: PriceSpecificationRepo;
|
|
40
|
-
project: ProjectRepo;
|
|
41
39
|
seat: SeatRepo;
|
|
42
40
|
setting: SettingRepo;
|
|
43
41
|
task: TaskRepo;
|
|
@@ -6,13 +6,11 @@ interface IAcceptOfferOperationRepos {
|
|
|
6
6
|
type IAcceptOfferOperation<T> = (repos: IAcceptOfferOperationRepos) => Promise<T>;
|
|
7
7
|
export type IAuthorizeActionWithInstrument = Pick<factory.action.authorize.offer.eventService.IAction, 'instrument'>;
|
|
8
8
|
export declare function acceptOffer(params: {
|
|
9
|
-
orderNumber: string;
|
|
10
9
|
project: {
|
|
11
10
|
id: string;
|
|
12
11
|
};
|
|
13
12
|
placeOrderId: string;
|
|
14
13
|
acceptedOffers: IMinimizedAcceptedOffer[] | factory.order.ICOAAcceptedOffer[];
|
|
15
|
-
broker?: factory.order.IBroker;
|
|
16
14
|
}): IAcceptOfferOperation<void>;
|
|
17
15
|
export declare function voidAcceptedOffer(params: {
|
|
18
16
|
/**
|
|
@@ -22,7 +20,7 @@ export declare function voidAcceptedOffer(params: {
|
|
|
22
20
|
* instrument.serialNumberからvoidする場合に指定
|
|
23
21
|
*/
|
|
24
22
|
authorizeActionsWithInstrument: IAuthorizeActionWithInstrument[];
|
|
25
|
-
|
|
23
|
+
placeOrderId: string;
|
|
26
24
|
}): (repos: {
|
|
27
25
|
orderInTransaction: OrderInTransactionRepo;
|
|
28
26
|
}) => Promise<void>;
|
|
@@ -10,18 +10,16 @@ const factory_1 = require("../../factory");
|
|
|
10
10
|
const debug = (0, debug_1.default)('chevre-domain:service:offer');
|
|
11
11
|
function acceptOffer(params) {
|
|
12
12
|
return async (repos) => {
|
|
13
|
-
await repos.orderInTransaction.
|
|
14
|
-
orderNumber: params.orderNumber,
|
|
13
|
+
await repos.orderInTransaction.acceptOfferByIdentifier({
|
|
15
14
|
project: { id: params.project.id, typeOf: factory_1.factory.organizationType.Project },
|
|
16
15
|
identifier: params.placeOrderId,
|
|
17
|
-
acceptedOffers: params.acceptedOffers
|
|
18
|
-
...((params.broker !== undefined) && { broker: params.broker })
|
|
16
|
+
acceptedOffers: params.acceptedOffers
|
|
19
17
|
});
|
|
20
18
|
};
|
|
21
19
|
}
|
|
22
20
|
function voidAcceptedOffer(params) {
|
|
23
21
|
return async (repos) => {
|
|
24
|
-
const {
|
|
22
|
+
const { placeOrderId } = params;
|
|
25
23
|
// let reservationNumbers: string[] = [];
|
|
26
24
|
// authorizeActions.forEach((authorizeAction) => {
|
|
27
25
|
// const reserveTransactionNumberByAction = authorizeAction.object.pendingTransaction?.transactionNumber;
|
|
@@ -42,10 +40,11 @@ function voidAcceptedOffer(params) {
|
|
|
42
40
|
const serialNumbers = params.authorizeActionsWithInstrument
|
|
43
41
|
.filter(({ instrument }) => typeof instrument.transactionNumber === 'string')
|
|
44
42
|
.map(({ instrument }) => String(instrument.transactionNumber));
|
|
45
|
-
debug('removing acceptedOffers from PlaceOrder...',
|
|
43
|
+
debug('removing acceptedOffers from PlaceOrder...', placeOrderId, 'serialNumbers:', serialNumbers);
|
|
46
44
|
if (serialNumbers.length > 0) {
|
|
47
|
-
const result = await repos.orderInTransaction.
|
|
48
|
-
orderNumber,
|
|
45
|
+
const result = await repos.orderInTransaction.voidAcceptedOfferByIdentifier({
|
|
46
|
+
// orderNumber,
|
|
47
|
+
identifier: placeOrderId,
|
|
49
48
|
acceptedOffers: { serialNumber: { $in: serialNumbers } }
|
|
50
49
|
});
|
|
51
50
|
debug('acceptedOffers removed from PlaceOrder by serialNumbers.', result);
|
|
@@ -15,7 +15,6 @@ import type { PaymentServiceRepo } from '../../../../repo/paymentService';
|
|
|
15
15
|
import type { SeatRepo } from '../../../../repo/place/seat';
|
|
16
16
|
import type { PriceSpecificationRepo } from '../../../../repo/priceSpecification';
|
|
17
17
|
import type { ProductRepo } from '../../../../repo/product';
|
|
18
|
-
import type { ProjectRepo } from '../../../../repo/project';
|
|
19
18
|
import type { OfferRateLimitRepo } from '../../../../repo/rateLimit/offer';
|
|
20
19
|
import type { SettingRepo } from '../../../../repo/setting';
|
|
21
20
|
import type { StockHolderRepo } from '../../../../repo/stockHolder';
|
|
@@ -63,7 +62,6 @@ declare function processStartReserve4chevre(params: {
|
|
|
63
62
|
paymentService: PaymentServiceRepo;
|
|
64
63
|
product: ProductRepo;
|
|
65
64
|
priceSpecification: PriceSpecificationRepo;
|
|
66
|
-
project: ProjectRepo;
|
|
67
65
|
seat: SeatRepo;
|
|
68
66
|
setting: SettingRepo;
|
|
69
67
|
task: TaskRepo;
|
|
@@ -13,12 +13,10 @@ import type { OfferRepo } from '../../../repo/offer/unitPriceInCatalog';
|
|
|
13
13
|
import type { OfferCatalogRepo } from '../../../repo/offerCatalog';
|
|
14
14
|
import type { OfferCatalogItemRepo } from '../../../repo/offerCatalogItem';
|
|
15
15
|
import type { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
|
|
16
|
-
import type { OrderNumberRepo } from '../../../repo/orderNumber';
|
|
17
16
|
import type { PaymentServiceRepo } from '../../../repo/paymentService';
|
|
18
17
|
import type { SeatRepo } from '../../../repo/place/seat';
|
|
19
18
|
import type { PriceSpecificationRepo } from '../../../repo/priceSpecification';
|
|
20
19
|
import type { ProductRepo } from '../../../repo/product';
|
|
21
|
-
import type { ProjectRepo } from '../../../repo/project';
|
|
22
20
|
import type { OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
|
|
23
21
|
import type { SettingRepo } from '../../../repo/setting';
|
|
24
22
|
import type { StockHolderRepo } from '../../../repo/stockHolder';
|
|
@@ -43,11 +41,9 @@ interface IAuthorizeRepos {
|
|
|
43
41
|
offerCatalogItem: OfferCatalogItemRepo;
|
|
44
42
|
offerRateLimit: OfferRateLimitRepo;
|
|
45
43
|
orderInTransaction: OrderInTransactionRepo;
|
|
46
|
-
orderNumber: OrderNumberRepo;
|
|
47
44
|
paymentService: PaymentServiceRepo;
|
|
48
45
|
priceSpecification: PriceSpecificationRepo;
|
|
49
46
|
product: ProductRepo;
|
|
50
|
-
project: ProjectRepo;
|
|
51
47
|
seat: SeatRepo;
|
|
52
48
|
setting: SettingRepo;
|
|
53
49
|
task: TaskRepo;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.authorize = authorize;
|
|
4
4
|
const factory_1 = require("../../../factory");
|
|
5
|
-
const issueOrderNumberIfNotExist_1 = require("../../transaction/placeOrder/issueOrderNumberIfNotExist");
|
|
6
5
|
const any_1 = require("../any");
|
|
7
6
|
const defaultOffer_1 = require("./authorize/defaultOffer");
|
|
8
7
|
const factory_2 = require("./authorize/factory");
|
|
@@ -25,11 +24,11 @@ function authorize(params, options) {
|
|
|
25
24
|
})(repos);
|
|
26
25
|
let acceptedOffers4result;
|
|
27
26
|
const now = new Date();
|
|
28
|
-
|
|
27
|
+
// 注文ドキュメントを参照(2026-06-24~)
|
|
28
|
+
const orderNumber = await repos.orderInTransaction.findOrderNumberByIdentifier({
|
|
29
|
+
identifier: transaction.id,
|
|
29
30
|
project: { id: params.project.id },
|
|
30
|
-
|
|
31
|
-
object: { orderDate: now }
|
|
32
|
-
})(repos);
|
|
31
|
+
}, { onlyPlaceOrder: true });
|
|
33
32
|
// まず取引番号発行
|
|
34
33
|
const { transactionNumber } = await repos.transactionNumber.publishByTimestamp({ startDate: now });
|
|
35
34
|
const actionAttributes = (0, factory_2.createAuthorizeSeatReservationActionAttributes)({
|
|
@@ -64,11 +63,9 @@ function authorize(params, options) {
|
|
|
64
63
|
};
|
|
65
64
|
});
|
|
66
65
|
await (0, any_1.acceptOffer)({
|
|
67
|
-
orderNumber,
|
|
68
66
|
project: transaction.project,
|
|
69
67
|
placeOrderId: transaction.id,
|
|
70
|
-
acceptedOffers: minimizedAcceptedOffers
|
|
71
|
-
...((typeof params.object.broker?.typeOf === 'string') && { broker: params.object.broker })
|
|
68
|
+
acceptedOffers: minimizedAcceptedOffers
|
|
72
69
|
})(repos);
|
|
73
70
|
}
|
|
74
71
|
}
|
|
@@ -48,23 +48,35 @@ function voidTransaction(params) {
|
|
|
48
48
|
default:
|
|
49
49
|
// no op
|
|
50
50
|
}
|
|
51
|
-
// add orderInTransaction(2024-01-15~)
|
|
52
|
-
// USE_CREATE_ORDER_ON_OFFER_ACCEPTEDの場合、orderNumber発行済のはず
|
|
53
|
-
const orderNumberByTransaction = transaction.object.orderNumber;
|
|
54
|
-
if (typeof orderNumberByTransaction === 'string') {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
51
|
+
// // add orderInTransaction(2024-01-15~)
|
|
52
|
+
// // USE_CREATE_ORDER_ON_OFFER_ACCEPTEDの場合、orderNumber発行済のはず
|
|
53
|
+
// const orderNumberByTransaction = transaction.object.orderNumber;
|
|
54
|
+
// if (typeof orderNumberByTransaction === 'string') {
|
|
55
|
+
// switch (transaction.status) {
|
|
56
|
+
// case factory.transactionStatusType.Confirmed:
|
|
57
|
+
// // 確定取引の場合、不要なオファーのみ除外
|
|
58
|
+
// await voidAcceptedOffer({
|
|
59
|
+
// // authorizeActions,
|
|
60
|
+
// authorizeActionsWithInstrument: authorizeActions,
|
|
61
|
+
// orderNumber: orderNumberByTransaction
|
|
62
|
+
// })(repos);
|
|
63
|
+
// break;
|
|
64
|
+
// default:
|
|
65
|
+
// // orderInTransaction自体を削除
|
|
66
|
+
// await repos.orderInTransaction.deleteByOrderNumber({ orderNumber: orderNumberByTransaction });
|
|
67
|
+
// }
|
|
68
|
+
// }
|
|
69
|
+
switch (transaction.status) {
|
|
70
|
+
case factory_1.factory.transactionStatusType.Confirmed:
|
|
71
|
+
// 確定取引の場合、不要なオファーのみ除外
|
|
72
|
+
await (0, any_1.voidAcceptedOffer)({
|
|
73
|
+
authorizeActionsWithInstrument: authorizeActions,
|
|
74
|
+
placeOrderId: params.purpose.id
|
|
75
|
+
})(repos);
|
|
76
|
+
break;
|
|
77
|
+
default:
|
|
78
|
+
// orderInTransaction自体を削除
|
|
79
|
+
await repos.orderInTransaction.deleteByIdentifier({ identifier: params.purpose.id });
|
|
68
80
|
}
|
|
69
81
|
await Promise.all(authorizeActions.map(async (action) => {
|
|
70
82
|
await repos.authorizeOfferAction.cancelWithVoid({ typeOf: action.typeOf, id: action.id, cancelAction });
|
|
@@ -26,7 +26,7 @@ function voidTransactionByActionId(params) {
|
|
|
26
26
|
// if (transaction.agent.id !== params.agent.id) {
|
|
27
27
|
// throw new factory.errors.Forbidden('Transaction not yours');
|
|
28
28
|
// }
|
|
29
|
-
const orderNumber = await repos.placeOrder.findInProgressOrderNumberById({ id: params.purpose.id });
|
|
29
|
+
// const orderNumber = await repos.placeOrder.findInProgressOrderNumberById({ id: params.purpose.id });
|
|
30
30
|
const action = await repos.authorizeOfferAction.findById({ typeOf: factory_1.factory.actionType.AuthorizeAction, id: params.id });
|
|
31
31
|
if (action.purpose.typeOf !== transaction.typeOf || action.purpose.id !== transaction.id) {
|
|
32
32
|
throw new factory_1.factory.errors.Argument('Transaction', 'Action not found in the transaction');
|
|
@@ -34,17 +34,21 @@ function voidTransactionByActionId(params) {
|
|
|
34
34
|
// MongoDBでcompleteステータスであるにも関わらず、Chevreでは削除されている、というのが最悪の状況
|
|
35
35
|
// それだけは回避するためにMongoDBを先に変更
|
|
36
36
|
await repos.authorizeOfferAction.cancelWithVoid({ typeOf: factory_1.factory.actionType.AuthorizeAction, id: params.id, cancelAction });
|
|
37
|
-
// add orderInTransaction(2024-01-15~)
|
|
38
|
-
// USE_CREATE_ORDER_ON_OFFER_ACCEPTEDの場合、orderNumber発行済のはず
|
|
39
|
-
// const orderNumberByTransaction = transaction.object.orderNumber;
|
|
40
|
-
const orderNumberByTransaction = orderNumber; // transaction.objectへのアクセス回避(2024-05-30~)
|
|
41
|
-
if (typeof orderNumberByTransaction === 'string') {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
37
|
+
// // add orderInTransaction(2024-01-15~)
|
|
38
|
+
// // USE_CREATE_ORDER_ON_OFFER_ACCEPTEDの場合、orderNumber発行済のはず
|
|
39
|
+
// // const orderNumberByTransaction = transaction.object.orderNumber;
|
|
40
|
+
// const orderNumberByTransaction = orderNumber; // transaction.objectへのアクセス回避(2024-05-30~)
|
|
41
|
+
// if (typeof orderNumberByTransaction === 'string') {
|
|
42
|
+
// await voidAcceptedOffer({
|
|
43
|
+
// // authorizeActions: [action],
|
|
44
|
+
// authorizeActionsWithInstrument: [action],
|
|
45
|
+
// orderNumber: orderNumberByTransaction
|
|
46
|
+
// })(repos);
|
|
47
|
+
// }
|
|
48
|
+
await (0, any_1.voidAcceptedOffer)({
|
|
49
|
+
authorizeActionsWithInstrument: [action],
|
|
50
|
+
placeOrderId: params.purpose.id
|
|
51
|
+
})(repos);
|
|
48
52
|
switch (action.instrument.typeOf) {
|
|
49
53
|
case factory_1.factory.assetTransactionType.COAReserveTransaction: {
|
|
50
54
|
const { reserveService } = repos;
|
|
@@ -2,15 +2,11 @@ import type { COA } from '@motionpicture/coa-service';
|
|
|
2
2
|
import type { AcceptCOAOfferActionRepo } from '../../../repo/action/acceptCOAOffer';
|
|
3
3
|
import type { AuthorizeOfferActionRepo } from '../../../repo/action/authorizeOffer';
|
|
4
4
|
import type { EventRepo } from '../../../repo/event';
|
|
5
|
-
import type { OrderNumberRepo } from '../../../repo/orderNumber';
|
|
6
|
-
import type { ProjectRepo } from '../../../repo/project';
|
|
7
5
|
import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
8
6
|
import { factory } from '../../../factory';
|
|
9
7
|
interface IAcceptRepos {
|
|
10
8
|
action: AcceptCOAOfferActionRepo;
|
|
11
9
|
event: EventRepo;
|
|
12
|
-
orderNumber: OrderNumberRepo;
|
|
13
|
-
project: ProjectRepo;
|
|
14
10
|
placeOrder: PlaceOrderRepo;
|
|
15
11
|
reserveService: COA.service.Reserve;
|
|
16
12
|
masterService: COA.service.Master;
|
|
@@ -19,8 +15,6 @@ interface IReAcceptRepos {
|
|
|
19
15
|
action: AcceptCOAOfferActionRepo;
|
|
20
16
|
authorizeOfferAction: AuthorizeOfferActionRepo;
|
|
21
17
|
event: EventRepo;
|
|
22
|
-
orderNumber: OrderNumberRepo;
|
|
23
|
-
project: ProjectRepo;
|
|
24
18
|
placeOrder: PlaceOrderRepo;
|
|
25
19
|
reserveService: COA.service.Reserve;
|
|
26
20
|
masterService: COA.service.Master;
|
|
@@ -4,7 +4,6 @@ exports.acceptOffer = acceptOffer;
|
|
|
4
4
|
exports.reAcceptOffer = reAcceptOffer;
|
|
5
5
|
const errorHandler_1 = require("../../../errorHandler");
|
|
6
6
|
const factory_1 = require("../../../factory");
|
|
7
|
-
const issueOrderNumberIfNotExist_1 = require("../../transaction/placeOrder/issueOrderNumberIfNotExist");
|
|
8
7
|
const authorize_1 = require("./acceptOffer/authorize");
|
|
9
8
|
const factory_2 = require("./acceptOffer/factory");
|
|
10
9
|
function findCOAInfo(params) {
|
|
@@ -39,12 +38,11 @@ function acceptOffer(params) {
|
|
|
39
38
|
typeOf: factory_1.factory.transactionType.PlaceOrder,
|
|
40
39
|
id: params.purpose.id
|
|
41
40
|
}, ['project', 'agent', 'typeOf']);
|
|
42
|
-
//
|
|
43
|
-
await
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
})(repos);
|
|
41
|
+
// // 注文ドキュメントを参照(2026-06-24~)
|
|
42
|
+
// const orderNumber = await repos.orderInTransaction.findOrderNumberByIdentifier({
|
|
43
|
+
// identifier: transaction.id,
|
|
44
|
+
// project: { id: transaction.project.id },
|
|
45
|
+
// });
|
|
48
46
|
const coaInfo = await findCOAInfo({ id: params.object.event.id, project: { id: transaction.project.id } })(repos);
|
|
49
47
|
const updTmpReserveSeatArgs = (0, factory_2.createUpdTmpReserveSeatArgs)({ object: params.object, coaInfo });
|
|
50
48
|
let updTmpReserveSeatResult;
|
|
@@ -125,11 +123,11 @@ function reAcceptOffer(params) {
|
|
|
125
123
|
typeOf: factory_1.factory.transactionType.PlaceOrder,
|
|
126
124
|
id: params.purpose.id
|
|
127
125
|
}, ['project', 'agent', 'typeOf']);
|
|
128
|
-
const orderNumber = await repos.placeOrder.findInProgressOrderNumberById({ id: transaction.id });
|
|
129
|
-
if (typeof orderNumber !== 'string') {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
126
|
+
// const orderNumber = await repos.placeOrder.findInProgressOrderNumberById({ id: transaction.id });
|
|
127
|
+
// if (typeof orderNumber !== 'string') {
|
|
128
|
+
// // 事前に発行されているはず
|
|
129
|
+
// throw new factory.errors.NotFound('transaction.object.orderNumber');
|
|
130
|
+
// }
|
|
133
131
|
const coaInfo = await findCOAInfo({ id: params.object.event.id, project: { id: transaction.project.id } })(repos);
|
|
134
132
|
// 承認アクション存在検証
|
|
135
133
|
await repos.authorizeOfferAction.findById({ id: params.potentialActions.id, typeOf: factory_1.factory.actionType.AuthorizeAction }, ['id'], []);
|
|
@@ -32,7 +32,7 @@ export declare function responseBody2acceptedOffers4result(params: {
|
|
|
32
32
|
responseBody: IResponseBody;
|
|
33
33
|
acceptedOffer: IAcceptedOffer4COA[];
|
|
34
34
|
event: Pick<IMinimizedIndividualEvent, 'coaInfo' | 'doorTime' | 'endDate' | 'id' | 'location' | 'startDate' | 'superEvent' | 'typeOf' | 'identifier' | 'name'>;
|
|
35
|
-
seller
|
|
35
|
+
seller?: never;
|
|
36
36
|
bookingTime: Date;
|
|
37
37
|
totalPrice: number;
|
|
38
38
|
}): IResultAcceptedOffer[];
|
|
@@ -80,11 +80,11 @@ function authorize(params) {
|
|
|
80
80
|
await repos.action.giveUp({ typeOf: failedAction.typeOf, id: failedAction.id, error });
|
|
81
81
|
throw error;
|
|
82
82
|
}
|
|
83
|
-
const orderNumber = await repos.placeOrder.findInProgressOrderNumberById({ id: params.transaction.id });
|
|
84
|
-
if (typeof orderNumber !== 'string') {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
83
|
+
// const orderNumber = await repos.placeOrder.findInProgressOrderNumberById({ id: params.transaction.id });
|
|
84
|
+
// if (typeof orderNumber !== 'string') {
|
|
85
|
+
// // 事前に発行されているはず(acceptCOAOfferにて)
|
|
86
|
+
// throw new factory.errors.NotFound('transaction.object.orderNumber');
|
|
87
|
+
// }
|
|
88
88
|
let result;
|
|
89
89
|
// 承認アクションを開始
|
|
90
90
|
const actionAttributes = (0, factory_1.createAuthorizeSeatReservationActionAttributes)({
|
|
@@ -103,7 +103,7 @@ function authorize(params) {
|
|
|
103
103
|
responseBody: params.result.responseBody,
|
|
104
104
|
acceptedOffer: acceptedOffers,
|
|
105
105
|
event: screeningEvent,
|
|
106
|
-
seller: transaction.seller,
|
|
106
|
+
// seller: transaction.seller,
|
|
107
107
|
bookingTime: (0, moment_1.default)(action.startDate)
|
|
108
108
|
.toDate(),
|
|
109
109
|
totalPrice: price
|
|
@@ -117,7 +117,6 @@ function authorize(params) {
|
|
|
117
117
|
// add orderInTransaction(2024-01-15~)
|
|
118
118
|
// if (params.options.useCreateOrderOnOfferAccepted) {
|
|
119
119
|
await (0, any_1.acceptOffer)({
|
|
120
|
-
orderNumber,
|
|
121
120
|
project: transaction.project,
|
|
122
121
|
placeOrderId: params.transaction.id,
|
|
123
122
|
acceptedOffers: acceptedOffers4result
|
|
@@ -22,11 +22,11 @@ function changeOffers(params) {
|
|
|
22
22
|
if (transaction.agent.id !== params.agent.id) {
|
|
23
23
|
throw new factory_2.factory.errors.Forbidden('Transaction not yours');
|
|
24
24
|
}
|
|
25
|
-
const orderNumber = await repos.placeOrder.findInProgressOrderNumberById({ id: params.transaction.id });
|
|
26
|
-
if (typeof orderNumber !== 'string') {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
25
|
+
// const orderNumber = await repos.placeOrder.findInProgressOrderNumberById({ id: params.transaction.id });
|
|
26
|
+
// if (typeof orderNumber !== 'string') {
|
|
27
|
+
// // 事前に発行されているはず
|
|
28
|
+
// throw new factory.errors.NotFound('transaction.object.orderNumber');
|
|
29
|
+
// }
|
|
30
30
|
// 取引内のアクションかどうか確認
|
|
31
31
|
const authorizeAction = await repos.action.findById({ typeOf: factory_2.factory.actionType.AuthorizeAction, id: params.id });
|
|
32
32
|
if (authorizeAction.purpose.typeOf !== transaction.typeOf || authorizeAction.purpose.id !== transaction.id) {
|
|
@@ -126,7 +126,7 @@ function changeOffers(params) {
|
|
|
126
126
|
responseBody: updTmpReserveSeatResult,
|
|
127
127
|
acceptedOffer: acceptedOffers,
|
|
128
128
|
event: screeningEvent,
|
|
129
|
-
seller: transaction.seller,
|
|
129
|
+
// seller: transaction.seller,
|
|
130
130
|
bookingTime: (0, moment_1.default)(authorizeAction.startDate)
|
|
131
131
|
.toDate(),
|
|
132
132
|
totalPrice: price
|
|
@@ -139,20 +139,23 @@ function changeOffers(params) {
|
|
|
139
139
|
// ActiveActionStatus->CompletedActionStatusで再実装(2024-01-15~)
|
|
140
140
|
await repos.action.reStart({ id: authorizeAction.id, typeOf: authorizeAction.typeOf });
|
|
141
141
|
try {
|
|
142
|
-
// まずvoidAcceptedOffer
|
|
143
|
-
// const orderNumberByTransaction = transaction.object.orderNumber;
|
|
144
|
-
const orderNumberByTransaction = orderNumber; // transaction.objectへのアクセス回避(2024-05-30~)
|
|
145
|
-
if (typeof orderNumberByTransaction === 'string') {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
142
|
+
// // まずvoidAcceptedOffer
|
|
143
|
+
// // const orderNumberByTransaction = transaction.object.orderNumber;
|
|
144
|
+
// const orderNumberByTransaction = orderNumber; // transaction.objectへのアクセス回避(2024-05-30~)
|
|
145
|
+
// if (typeof orderNumberByTransaction === 'string') {
|
|
146
|
+
// await voidAcceptedOffer({
|
|
147
|
+
// // authorizeActions: [authorizeAction],
|
|
148
|
+
// authorizeActionsWithInstrument: [authorizeAction],
|
|
149
|
+
// orderNumber: orderNumberByTransaction
|
|
150
|
+
// })(repos);
|
|
151
|
+
// }
|
|
152
|
+
await (0, any_1.voidAcceptedOffer)({
|
|
153
|
+
authorizeActionsWithInstrument: [authorizeAction],
|
|
154
|
+
placeOrderId: params.transaction.id
|
|
155
|
+
})(repos);
|
|
152
156
|
// add orderInTransaction(2024-01-15~)
|
|
153
157
|
// if (params.options.useCreateOrderOnOfferAccepted) {
|
|
154
158
|
await (0, any_1.acceptOffer)({
|
|
155
|
-
orderNumber,
|
|
156
159
|
project: transaction.project,
|
|
157
160
|
placeOrderId: params.transaction.id,
|
|
158
161
|
acceptedOffers: acceptedOffers4result
|
|
@@ -1,28 +1,24 @@
|
|
|
1
1
|
import type { AcceptedOfferRepo } from '../../repo/acceptedOffer';
|
|
2
2
|
import type { AccountingReportRepo } from '../../repo/accountingReport';
|
|
3
|
-
import type { EventRepo } from '../../repo/event';
|
|
4
3
|
import type { NoteRepo } from '../../repo/note';
|
|
5
4
|
import type { OrderRepo } from '../../repo/order';
|
|
6
|
-
import type { OwnershipInfoRepo } from '../../repo/ownershipInfo';
|
|
7
5
|
import type { ReservationRepo } from '../../repo/reservation';
|
|
8
|
-
import type { SettingRepo } from '../../repo/setting';
|
|
9
|
-
import type { TaskRepo } from '../../repo/task';
|
|
10
|
-
import { factory } from '../../factory';
|
|
11
6
|
/**
|
|
12
7
|
* 注文に関わるリソースを削除する
|
|
13
8
|
* 冪等性を確保すること
|
|
14
9
|
*/
|
|
15
10
|
declare function deleteOrder(params: {
|
|
16
|
-
object:
|
|
11
|
+
object: {
|
|
12
|
+
/**
|
|
13
|
+
* 注文取引ID
|
|
14
|
+
*/
|
|
15
|
+
identifier: string;
|
|
16
|
+
};
|
|
17
17
|
}): (repos: {
|
|
18
18
|
acceptedOffer: AcceptedOfferRepo;
|
|
19
19
|
accountingReport: AccountingReportRepo;
|
|
20
|
-
event: EventRepo;
|
|
21
20
|
note: NoteRepo;
|
|
22
21
|
order: OrderRepo;
|
|
23
|
-
ownershipInfo: OwnershipInfoRepo;
|
|
24
22
|
reservation: ReservationRepo;
|
|
25
|
-
setting: SettingRepo;
|
|
26
|
-
task: TaskRepo;
|
|
27
23
|
}) => Promise<void>;
|
|
28
24
|
export { deleteOrder };
|