@chevre/domain 25.0.0-alpha.16 → 25.0.0-alpha.18
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/orderInTransaction.d.ts +5 -0
- package/lib/chevre/repo/orderInTransaction.js +4 -3
- package/lib/chevre/repo/transaction.d.ts +1 -1
- package/lib/chevre/repo/transaction.js +2 -2
- package/lib/chevre/service/assetTransaction/reserve/start.d.ts +0 -2
- 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 +4 -5
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.d.ts +0 -8
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +5 -7
- package/lib/chevre/service/payment/any/authorize/fixOrderAsNeeded.d.ts +0 -4
- package/lib/chevre/service/payment/any/authorize/fixOrderAsNeeded.js +4 -6
- package/lib/chevre/service/payment/any/publishPaymentUrl.d.ts +0 -6
- package/lib/chevre/service/payment/any/publishPaymentUrl.js +5 -7
- package/lib/chevre/service/task/acceptCOAOffer.js +8 -8
- package/lib/chevre/service/task/publishPaymentUrl.js +6 -6
- package/lib/chevre/service/transaction/placeOrder/confirm.js +16 -15
- package/lib/chevre/service/transaction/placeOrder/issueOrderNumberIfNotExist.d.ts +0 -2
- package/lib/chevre/service/transaction/placeOrder/issueOrderNumberIfNotExist.js +11 -11
- package/lib/chevre/service/transaction/placeOrder/start.d.ts +0 -1
- package/lib/chevre/service/transaction/placeOrder/start.js +19 -21
- package/lib/chevre/service/transaction/placeOrder/updateAgent.d.ts +0 -4
- package/lib/chevre/service/transaction/placeOrder/updateAgent.js +4 -5
- package/package.json +1 -1
|
@@ -72,6 +72,11 @@ export declare class OrderInTransactionRepo extends AcceptedOfferInReserveRepo {
|
|
|
72
72
|
project: {
|
|
73
73
|
id: string;
|
|
74
74
|
};
|
|
75
|
+
}, options: {
|
|
76
|
+
/**
|
|
77
|
+
* 注文取引タイプのドキュメントのみを参照対象にするかどうか
|
|
78
|
+
*/
|
|
79
|
+
onlyPlaceOrder: boolean;
|
|
75
80
|
}): Promise<string>;
|
|
76
81
|
/**
|
|
77
82
|
* 注文取引からcustomerを参照する
|
|
@@ -49,12 +49,13 @@ class OrderInTransactionRepo extends acceptedOfferInReserve_1.AcceptedOfferInRes
|
|
|
49
49
|
* 注文取引から注文番号を参照する
|
|
50
50
|
* 存在しなければNotFoundError
|
|
51
51
|
*/
|
|
52
|
-
async findOrderNumberByIdentifier(params) {
|
|
52
|
+
async findOrderNumberByIdentifier(params, options) {
|
|
53
53
|
const { project, identifier } = params;
|
|
54
|
+
const onlyPlaceOrder = options.onlyPlaceOrder === true;
|
|
54
55
|
const doc = await this.orderModel.findOne({
|
|
55
56
|
identifier: { $eq: identifier },
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
'project.id': { $eq: project.id },
|
|
58
|
+
...((onlyPlaceOrder) && { typeOf: { $eq: factory_1.factory.transactionType.PlaceOrder } })
|
|
58
59
|
}, {
|
|
59
60
|
_id: 0,
|
|
60
61
|
orderNumber: 1
|
|
@@ -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) {
|
|
@@ -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;
|
|
@@ -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
|
-
}, { issueForce: false })(repos);
|
|
31
|
+
}, { onlyPlaceOrder: true });
|
|
33
32
|
// まず取引番号発行
|
|
34
33
|
const { transactionNumber } = await repos.transactionNumber.publishByTimestamp({ startDate: now });
|
|
35
34
|
const actionAttributes = (0, factory_2.createAuthorizeSeatReservationActionAttributes)({
|
|
@@ -2,17 +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 { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
|
|
6
|
-
import type { OrderNumberRepo } from '../../../repo/orderNumber';
|
|
7
|
-
import type { ProjectRepo } from '../../../repo/project';
|
|
8
5
|
import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
9
6
|
import { factory } from '../../../factory';
|
|
10
7
|
interface IAcceptRepos {
|
|
11
8
|
action: AcceptCOAOfferActionRepo;
|
|
12
9
|
event: EventRepo;
|
|
13
|
-
orderInTransaction: OrderInTransactionRepo;
|
|
14
|
-
orderNumber: OrderNumberRepo;
|
|
15
|
-
project: ProjectRepo;
|
|
16
10
|
placeOrder: PlaceOrderRepo;
|
|
17
11
|
reserveService: COA.service.Reserve;
|
|
18
12
|
masterService: COA.service.Master;
|
|
@@ -21,8 +15,6 @@ interface IReAcceptRepos {
|
|
|
21
15
|
action: AcceptCOAOfferActionRepo;
|
|
22
16
|
authorizeOfferAction: AuthorizeOfferActionRepo;
|
|
23
17
|
event: EventRepo;
|
|
24
|
-
orderNumber: OrderNumberRepo;
|
|
25
|
-
project: ProjectRepo;
|
|
26
18
|
placeOrder: PlaceOrderRepo;
|
|
27
19
|
reserveService: COA.service.Reserve;
|
|
28
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
|
-
}, { issueForce: false })(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;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { factory } from '../../../../factory';
|
|
2
2
|
import type { ConfirmationNumberRepo } from '../../../../repo/confirmationNumber';
|
|
3
3
|
import type { OrderInTransactionRepo } from '../../../../repo/orderInTransaction';
|
|
4
|
-
import type { OrderNumberRepo } from '../../../../repo/orderNumber';
|
|
5
|
-
import type { ProjectRepo } from '../../../../repo/project';
|
|
6
4
|
import type { PlaceOrderRepo } from '../../../../repo/transaction/placeOrder';
|
|
7
5
|
declare function fixOrderAsNeeded(params: {
|
|
8
6
|
project: {
|
|
@@ -10,11 +8,9 @@ declare function fixOrderAsNeeded(params: {
|
|
|
10
8
|
};
|
|
11
9
|
purpose: factory.action.authorize.paymentMethod.any.IPurpose;
|
|
12
10
|
}): (repos: {
|
|
13
|
-
project: ProjectRepo;
|
|
14
11
|
placeOrder: PlaceOrderRepo;
|
|
15
12
|
confirmationNumber: ConfirmationNumberRepo;
|
|
16
13
|
orderInTransaction: OrderInTransactionRepo;
|
|
17
|
-
orderNumber: OrderNumberRepo;
|
|
18
14
|
}) => Promise<{
|
|
19
15
|
confirmationNumber: string;
|
|
20
16
|
orderNumber: string;
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.fixOrderAsNeeded = fixOrderAsNeeded;
|
|
4
4
|
const factory_1 = require("../../../../factory");
|
|
5
5
|
const publishConfirmationNumberIfNotExist_1 = require("../../../transaction/placeOrder/publishConfirmationNumberIfNotExist");
|
|
6
|
-
const issueOrderNumberIfNotExist_1 = require("../../../transaction/placeOrder/issueOrderNumberIfNotExist");
|
|
7
6
|
function fixOrderAsNeeded(params) {
|
|
8
7
|
return async (repos) => {
|
|
9
8
|
const orderDate = new Date();
|
|
@@ -17,12 +16,11 @@ function fixOrderAsNeeded(params) {
|
|
|
17
16
|
object: { orderDate }
|
|
18
17
|
})(repos);
|
|
19
18
|
// }
|
|
20
|
-
//
|
|
21
|
-
const orderNumber = await
|
|
19
|
+
// 注文ドキュメントを参照(2026-06-24~)
|
|
20
|
+
const orderNumber = await repos.orderInTransaction.findOrderNumberByIdentifier({
|
|
21
|
+
identifier: params.purpose.id,
|
|
22
22
|
project: { id: params.project.id },
|
|
23
|
-
|
|
24
|
-
object: { orderDate }
|
|
25
|
-
}, { issueForce: false })(repos);
|
|
23
|
+
}, { onlyPlaceOrder: true });
|
|
26
24
|
return { confirmationNumber, orderNumber };
|
|
27
25
|
};
|
|
28
26
|
}
|
|
@@ -7,11 +7,8 @@ import type { AuthorizationRepo } from '../../../repo/authorization';
|
|
|
7
7
|
import type { EventRepo } from '../../../repo/event';
|
|
8
8
|
import type { EventSeriesRepo } from '../../../repo/eventSeries';
|
|
9
9
|
import type { IssuerRepo } from '../../../repo/issuer';
|
|
10
|
-
import type { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
|
|
11
|
-
import type { OrderNumberRepo } from '../../../repo/orderNumber';
|
|
12
10
|
import type { PaymentServiceRepo } from '../../../repo/paymentService';
|
|
13
11
|
import type { PaymentServiceProviderRepo } from '../../../repo/paymentServiceProvider';
|
|
14
|
-
import type { ProjectRepo } from '../../../repo/project';
|
|
15
12
|
import type { SellerPaymentAcceptedRepo } from '../../../repo/sellerPaymentAccepted';
|
|
16
13
|
import type { TicketRepo } from '../../../repo/ticket';
|
|
17
14
|
import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
@@ -25,12 +22,9 @@ interface IPublishPaymentUrlRepos {
|
|
|
25
22
|
event: EventRepo;
|
|
26
23
|
eventSeries: EventSeriesRepo;
|
|
27
24
|
issuer: IssuerRepo;
|
|
28
|
-
orderInTransaction: OrderInTransactionRepo;
|
|
29
|
-
orderNumber: OrderNumberRepo;
|
|
30
25
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
31
26
|
paymentService: PaymentServiceRepo;
|
|
32
27
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
33
|
-
project: ProjectRepo;
|
|
34
28
|
ticket: TicketRepo;
|
|
35
29
|
placeOrder: PlaceOrderRepo;
|
|
36
30
|
transactionNumber: TransactionNumberRepo;
|
|
@@ -36,7 +36,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.publishPaymentUrl = publishPaymentUrl;
|
|
37
37
|
const factory_1 = require("../../../factory");
|
|
38
38
|
const PayTransactionService = __importStar(require("../../assetTransaction/pay"));
|
|
39
|
-
const issueOrderNumberIfNotExist_1 = require("../../transaction/placeOrder/issueOrderNumberIfNotExist");
|
|
40
39
|
const fixTransactionNumberOnPublishPaymentUrl_1 = require("./publishPaymentUrl/fixTransactionNumberOnPublishPaymentUrl");
|
|
41
40
|
const factory_2 = require("./factory");
|
|
42
41
|
/**
|
|
@@ -53,12 +52,11 @@ function publishPaymentUrl(params) {
|
|
|
53
52
|
if (project.id !== transaction.project.id) {
|
|
54
53
|
throw new factory_1.factory.errors.NotFound(factory_1.factory.transactionType.PlaceOrder);
|
|
55
54
|
}
|
|
56
|
-
//
|
|
57
|
-
await
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}, { issueForce: false })(repos);
|
|
55
|
+
// // 注文ドキュメントを参照(2026-06-24~)
|
|
56
|
+
// const orderNumber = await repos.orderInTransaction.findOrderNumberByIdentifier({
|
|
57
|
+
// identifier: transaction.id,
|
|
58
|
+
// project: { id: transaction.project.id },
|
|
59
|
+
// });
|
|
62
60
|
// 取引番号生成
|
|
63
61
|
const { transactionNumber, ticketToken } = await (0, fixTransactionNumberOnPublishPaymentUrl_1.fixTransactionNumberOnPublishPaymentUrl)({
|
|
64
62
|
object: params.object,
|
|
@@ -7,9 +7,9 @@ const acceptCOAOffer_1 = require("../../repo/action/acceptCOAOffer");
|
|
|
7
7
|
const authorizeOffer_1 = require("../../repo/action/authorizeOffer");
|
|
8
8
|
const credentials_1 = require("../../repo/credentials");
|
|
9
9
|
const event_1 = require("../../repo/event");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
// import { OrderInTransactionRepo } from '../../repo/orderInTransaction';
|
|
11
|
+
// import { OrderNumberRepo } from '../../repo/orderNumber';
|
|
12
|
+
// import { ProjectRepo } from '../../repo/project';
|
|
13
13
|
const reserveInterface_1 = require("../../repo/reserveInterface");
|
|
14
14
|
const integration_1 = require("../../repo/setting/integration");
|
|
15
15
|
const placeOrder_1 = require("../../repo/transaction/placeOrder");
|
|
@@ -86,8 +86,8 @@ function call(params) {
|
|
|
86
86
|
action: actionRepo,
|
|
87
87
|
authorizeOfferAction: new authorizeOffer_1.AuthorizeOfferActionRepo(connection),
|
|
88
88
|
event: new event_1.EventRepo(connection),
|
|
89
|
-
orderNumber: new
|
|
90
|
-
project: new
|
|
89
|
+
// orderNumber: new OrderNumberRepo({ connection }),
|
|
90
|
+
// project: new ProjectRepo(connection),
|
|
91
91
|
placeOrder: new placeOrder_1.PlaceOrderRepo(connection),
|
|
92
92
|
reserveService,
|
|
93
93
|
masterService
|
|
@@ -104,9 +104,9 @@ function call(params) {
|
|
|
104
104
|
})({
|
|
105
105
|
action: actionRepo,
|
|
106
106
|
event: new event_1.EventRepo(connection),
|
|
107
|
-
orderInTransaction: new
|
|
108
|
-
orderNumber: new
|
|
109
|
-
project: new
|
|
107
|
+
// orderInTransaction: new OrderInTransactionRepo(connection),
|
|
108
|
+
// orderNumber: new OrderNumberRepo({ connection }),
|
|
109
|
+
// project: new ProjectRepo(connection),
|
|
110
110
|
placeOrder: new placeOrder_1.PlaceOrderRepo(connection),
|
|
111
111
|
reserveService,
|
|
112
112
|
masterService
|
|
@@ -9,11 +9,11 @@ const authorization_1 = require("../../repo/authorization");
|
|
|
9
9
|
const event_1 = require("../../repo/event");
|
|
10
10
|
const eventSeries_1 = require("../../repo/eventSeries");
|
|
11
11
|
const issuer_1 = require("../../repo/issuer");
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
// import { OrderInTransactionRepo } from '../../repo/orderInTransaction';
|
|
13
|
+
// import { OrderNumberRepo } from '../../repo/orderNumber';
|
|
14
14
|
const paymentService_1 = require("../../repo/paymentService");
|
|
15
15
|
const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
16
|
-
|
|
16
|
+
// import { ProjectRepo } from '../../repo/project';
|
|
17
17
|
const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
|
|
18
18
|
const integration_1 = require("../../repo/setting/integration");
|
|
19
19
|
const ticket_1 = require("../../repo/ticket");
|
|
@@ -48,12 +48,12 @@ function call(params) {
|
|
|
48
48
|
event: new event_1.EventRepo(connection),
|
|
49
49
|
eventSeries: new eventSeries_1.EventSeriesRepo(connection),
|
|
50
50
|
issuer: new issuer_1.IssuerRepo(connection),
|
|
51
|
-
orderInTransaction: new
|
|
52
|
-
orderNumber: new
|
|
51
|
+
// orderInTransaction: new OrderInTransactionRepo(connection),
|
|
52
|
+
// orderNumber: new OrderNumberRepo({ connection }),
|
|
53
53
|
paymentAccepted: new sellerPaymentAccepted_1.SellerPaymentAcceptedRepo(connection),
|
|
54
54
|
paymentService: new paymentService_1.PaymentServiceRepo(connection),
|
|
55
55
|
paymentServiceProvider: new paymentServiceProvider_1.PaymentServiceProviderRepo(connection),
|
|
56
|
-
project: new
|
|
56
|
+
// project: new ProjectRepo(connection),
|
|
57
57
|
ticket: new ticket_1.TicketRepo(connection),
|
|
58
58
|
placeOrder: new placeOrder_1.PlaceOrderRepo(connection),
|
|
59
59
|
transactionNumber: new transactionNumber_1.TransactionNumberRepo({ connection })
|
|
@@ -19,16 +19,17 @@ const debug = (0, debug_1.default)('chevre-domain:service:transaction');
|
|
|
19
19
|
/**
|
|
20
20
|
* 進行中でない取引を処理する
|
|
21
21
|
*/
|
|
22
|
-
function processTransactionNotInProgress(
|
|
22
|
+
function processTransactionNotInProgress(params) {
|
|
23
23
|
return async (repos) => {
|
|
24
|
+
const { transaction, orderNumber } = params;
|
|
24
25
|
if (transaction.status === factory_1.factory.transactionStatusType.Confirmed) {
|
|
25
26
|
const resultCustomer = await repos.orderInTransaction.findCustomerByOrderNumber({
|
|
26
|
-
orderNumber: { $eq:
|
|
27
|
+
orderNumber: { $eq: orderNumber }
|
|
27
28
|
});
|
|
28
29
|
// if (resultCustomer === undefined) {
|
|
29
30
|
// throw new factory.errors.Internal('resultCustomer undefined'); // impossible process
|
|
30
31
|
// }
|
|
31
|
-
const { confirmationNumber
|
|
32
|
+
const { confirmationNumber } = transaction.object;
|
|
32
33
|
// Confirmedの取引であればobjectには必ず存在するはず
|
|
33
34
|
if (typeof confirmationNumber !== 'string' || typeof orderNumber !== 'string'
|
|
34
35
|
|| confirmationNumber === '' || orderNumber === '') {
|
|
@@ -62,30 +63,30 @@ function confirm(params, options) {
|
|
|
62
63
|
object: { orderDate: params.result.order.orderDate }
|
|
63
64
|
})(repos);
|
|
64
65
|
const transaction = await repos.placeOrder.findPlaceOrderById({ typeOf: factory_1.factory.transactionType.PlaceOrder, id: params.id }, ['typeOf', 'project', 'status', 'agent', 'seller', 'object', 'result']);
|
|
65
|
-
|
|
66
|
+
// 注文ドキュメントから注文番号を参照(取引開始時に発行済の前提)(2026-06-26~)
|
|
67
|
+
const orderNumber = await repos.orderInTransaction.findOrderNumberByIdentifier({
|
|
68
|
+
identifier: params.id,
|
|
69
|
+
project: { id: transaction.project.id }
|
|
70
|
+
}, { onlyPlaceOrder: false } // すでに取引確定済かもしれないのでfalse
|
|
71
|
+
);
|
|
72
|
+
const confirmResult = await processTransactionNotInProgress({ transaction, orderNumber })(repos);
|
|
66
73
|
if (confirmResult !== undefined) {
|
|
67
74
|
return confirmResult;
|
|
68
75
|
}
|
|
69
76
|
if (typeof params.agent?.id === 'string' && transaction.agent.id !== params.agent.id) {
|
|
70
77
|
throw new factory_1.factory.errors.Forbidden('Transaction not yours');
|
|
71
78
|
}
|
|
72
|
-
// 注文番号は興行オファー承認時に発行済のはず(2026-06-16~)
|
|
73
|
-
const orderNumber = transaction.object.orderNumber;
|
|
74
|
-
if (typeof orderNumber !== 'string' || orderNumber === '') {
|
|
75
|
-
|
|
76
|
-
}
|
|
79
|
+
// // 注文番号は興行オファー承認時に発行済のはず(2026-06-16~)
|
|
80
|
+
// const orderNumber = transaction.object.orderNumber;
|
|
81
|
+
// if (typeof orderNumber !== 'string' || orderNumber === '') {
|
|
82
|
+
// throw new factory.errors.Argument('transactionId', 'orderNumber not issued');
|
|
83
|
+
// }
|
|
77
84
|
// 取引に対する全ての承認アクションをマージ
|
|
78
85
|
const completedAuthorizeActions = await searchAuthorizeActions(params)(repos);
|
|
79
86
|
let acceptPayActions = [];
|
|
80
87
|
if (typeof transaction.object.paymentMethods?.paymentMethodId === 'string') {
|
|
81
88
|
acceptPayActions = await searchAcceptPayActions(params)(repos);
|
|
82
89
|
}
|
|
83
|
-
// 注文番号は興行オファー承認時に発行済のはずなので、ここは不要(承認オファーなしの注文は存在しえない)(2026-06-16~)
|
|
84
|
-
// const orderNumber = await issueOrderNumberIfNotExist({
|
|
85
|
-
// project: { id: transaction.project.id },
|
|
86
|
-
// id: transaction.id,
|
|
87
|
-
// object: { orderDate: params.result.order.orderDate }
|
|
88
|
-
// })(repos);
|
|
89
90
|
// 必要あらば注文コード発行(2024-02-05~)
|
|
90
91
|
let code;
|
|
91
92
|
const publishCodeExpiresInSeconds = options.publishCodeExpiresInSeconds;
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.issueOrderNumberIfNotExist = issueOrderNumberIfNotExist;
|
|
4
4
|
const factory_1 = require("../../../factory");
|
|
5
|
-
const USE_LEGACY_ISSUE_ORDER_NUMBER = process.env.USE_LEGACY_ISSUE_ORDER_NUMBER === '1';
|
|
5
|
+
// const USE_LEGACY_ISSUE_ORDER_NUMBER = process.env.USE_LEGACY_ISSUE_ORDER_NUMBER === '1';
|
|
6
6
|
/**
|
|
7
7
|
* 未発行であれば、注文番号を発行して取引に保管する
|
|
8
8
|
*/
|
|
9
|
-
function issueOrderNumberIfNotExist(params
|
|
9
|
+
function issueOrderNumberIfNotExist(params) {
|
|
10
10
|
return async (repos) => {
|
|
11
|
-
// issueForceオプションあるいは、廃止予定の発行オプションの場合、注文番号を新たに発行する
|
|
12
|
-
const issueOrderNumber = options?.issueForce === true || USE_LEGACY_ISSUE_ORDER_NUMBER;
|
|
13
|
-
if (!issueOrderNumber) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
11
|
+
// // issueForceオプションあるいは、廃止予定の発行オプションの場合、注文番号を新たに発行する
|
|
12
|
+
// const issueOrderNumber = options?.issueForce === true || USE_LEGACY_ISSUE_ORDER_NUMBER;
|
|
13
|
+
// if (!issueOrderNumber) {
|
|
14
|
+
// // 注文ドキュメントを参照(2026-06-24~)
|
|
15
|
+
// return repos.orderInTransaction.findOrderNumberByIdentifier({
|
|
16
|
+
// identifier: params.id,
|
|
17
|
+
// project: { id: params.project.id }
|
|
18
|
+
// })
|
|
19
|
+
// }
|
|
20
20
|
// 1. 最初のチェック
|
|
21
21
|
let orderNumber = await repos.placeOrder.findInProgressOrderNumberById({ id: params.id });
|
|
22
22
|
// すでに発行済であれば何もしない
|
|
@@ -54,27 +54,25 @@ function start(params, options) {
|
|
|
54
54
|
transaction = await repos.placeOrder.startPlaceOrder(startParams);
|
|
55
55
|
}
|
|
56
56
|
// support createOrderDocument(2026-06-23~)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
// console.log('createPlaceOrderResult:', createPlaceOrderResult);
|
|
77
|
-
}
|
|
57
|
+
const orderNumber = await (0, issueOrderNumberIfNotExist_1.issueOrderNumberIfNotExist)({
|
|
58
|
+
project: { id: params.project.id },
|
|
59
|
+
id: transaction.id,
|
|
60
|
+
object: { orderDate: new Date() }
|
|
61
|
+
})(repos);
|
|
62
|
+
await repos.orderInTransaction.createPlaceOrderIfNotExists({
|
|
63
|
+
orderNumber,
|
|
64
|
+
project: { id: params.project.id, typeOf: factory_1.factory.organizationType.Project },
|
|
65
|
+
identifier: transaction.id,
|
|
66
|
+
seller: {
|
|
67
|
+
id: seller.id,
|
|
68
|
+
name: (typeof seller.name === 'string') ? seller.name : String(seller.name?.ja),
|
|
69
|
+
typeOf: seller.typeOf,
|
|
70
|
+
additionalProperty: (Array.isArray(seller.additionalProperty)) ? seller.additionalProperty : [] // 追加特性を追加(2023-08-08~)
|
|
71
|
+
},
|
|
72
|
+
...((typeof params.object.customer?.typeOf === 'string') && { customer: params.object.customer }),
|
|
73
|
+
...((typeof params.broker?.typeOf === 'string') && { broker: params.broker })
|
|
74
|
+
});
|
|
75
|
+
// console.log('createPlaceOrderResult:', createPlaceOrderResult);
|
|
78
76
|
return transaction;
|
|
79
77
|
};
|
|
80
78
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { factory } from '../../../factory';
|
|
2
2
|
import type { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
|
|
3
|
-
import type { OrderNumberRepo } from '../../../repo/orderNumber';
|
|
4
|
-
import type { ProjectRepo } from '../../../repo/project';
|
|
5
3
|
import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
6
4
|
/**
|
|
7
5
|
* 取引人プロフィール更新
|
|
@@ -17,7 +15,5 @@ export declare function updateAgent(params: {
|
|
|
17
15
|
};
|
|
18
16
|
}): (repos: {
|
|
19
17
|
orderInTransaction: OrderInTransactionRepo;
|
|
20
|
-
orderNumber: OrderNumberRepo;
|
|
21
|
-
project: ProjectRepo;
|
|
22
18
|
placeOrder: PlaceOrderRepo;
|
|
23
19
|
}) => Promise<void>;
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.updateAgent = updateAgent;
|
|
4
4
|
const google_libphonenumber_1 = require("google-libphonenumber");
|
|
5
5
|
const factory_1 = require("../../../factory");
|
|
6
|
-
const issueOrderNumberIfNotExist_1 = require("./issueOrderNumberIfNotExist");
|
|
7
6
|
function fixCustomer(params) {
|
|
8
7
|
return async (repos) => {
|
|
9
8
|
let formattedTelephone;
|
|
@@ -74,11 +73,11 @@ function updateAgent(params) {
|
|
|
74
73
|
const { customer, transaction } = await fixCustomer(params)(repos);
|
|
75
74
|
// also save in orderInTransaction(2024-06-20~)
|
|
76
75
|
if (customer !== undefined) {
|
|
77
|
-
|
|
76
|
+
// 注文ドキュメントを参照(2026-06-24~)
|
|
77
|
+
const orderNumber = await repos.orderInTransaction.findOrderNumberByIdentifier({
|
|
78
|
+
identifier: params.id,
|
|
78
79
|
project: { id: transaction.project.id },
|
|
79
|
-
|
|
80
|
-
object: { orderDate: new Date() }
|
|
81
|
-
}, { issueForce: false })(repos);
|
|
80
|
+
}, { onlyPlaceOrder: true });
|
|
82
81
|
const customerName = (typeof customer.name === 'string' && customer.name !== '')
|
|
83
82
|
? customer.name
|
|
84
83
|
: (typeof customer.givenName === 'string' && typeof customer.familyName === 'string'
|
package/package.json
CHANGED