@chevre/domain 25.0.0-alpha.12 → 25.0.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/chevre/repo/mongoose/schemas/order.js +1 -1
- package/lib/chevre/repo/orderInTransaction.d.ts +10 -0
- package/lib/chevre/repo/orderInTransaction.js +60 -21
- package/lib/chevre/service/offer/event/authorize.js +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.d.ts +2 -0
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +1 -1
- package/lib/chevre/service/payment/any/authorize/fixOrderAsNeeded.d.ts +2 -0
- package/lib/chevre/service/payment/any/authorize/fixOrderAsNeeded.js +1 -1
- package/lib/chevre/service/payment/any/authorize.d.ts +2 -0
- package/lib/chevre/service/payment/any/publishPaymentUrl.d.ts +2 -0
- package/lib/chevre/service/payment/any/publishPaymentUrl.js +1 -2
- package/lib/chevre/service/task/acceptCOAOffer.js +2 -4
- package/lib/chevre/service/task/authorizePayment.js +2 -6
- package/lib/chevre/service/task/publishPaymentUrl.js +2 -5
- package/lib/chevre/service/transaction/placeOrder/issueOrderNumberIfNotExist.d.ts +4 -0
- package/lib/chevre/service/transaction/placeOrder/issueOrderNumberIfNotExist.js +11 -1
- package/lib/chevre/service/transaction/placeOrder/start.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/updateAgent.js +1 -1
- package/package.json +1 -1
|
@@ -26,7 +26,7 @@ const schemaDefinition = {
|
|
|
26
26
|
orderDate: { type: Date, required: true },
|
|
27
27
|
dateReturned: Date,
|
|
28
28
|
orderedItem: [mongoose_1.SchemaTypes.Mixed],
|
|
29
|
-
identifier: String, // 注文取引IDとして再定義(2026-06-22~)
|
|
29
|
+
identifier: { type: String, required: true }, // 注文取引IDとして再定義(2026-06-22~)
|
|
30
30
|
// 以下廃止(2026-06-13~)
|
|
31
31
|
// identifier: SchemaTypes.Mixed, // 廃止するためにMixed化(2026-06-12~)
|
|
32
32
|
// isGift: Boolean,
|
|
@@ -59,6 +59,16 @@ export declare class OrderInTransactionRepo extends AcceptedOfferInReserveRepo {
|
|
|
59
59
|
private readonly orderModel;
|
|
60
60
|
constructor(connection: Connection);
|
|
61
61
|
createPlaceOrderIfNotExists(params: Pick<IOrderInTransaction, 'orderNumber' | 'project' | 'identifier' | 'broker' | 'seller' | 'customer'>): Promise<import("mongoose").UpdateWriteOpResult | undefined>;
|
|
62
|
+
/**
|
|
63
|
+
* 注文取引から注文番号を参照する
|
|
64
|
+
* 存在しなければNotFoundError
|
|
65
|
+
*/
|
|
66
|
+
findOrderNumberByIdentifier(params: {
|
|
67
|
+
identifier: string;
|
|
68
|
+
project: {
|
|
69
|
+
id: string;
|
|
70
|
+
};
|
|
71
|
+
}): Promise<string>;
|
|
62
72
|
/**
|
|
63
73
|
* 取引進行中の注文からacceptedOffersを検索する
|
|
64
74
|
* 予約取引から予約ごとの価格仕様も参照する
|
|
@@ -45,6 +45,28 @@ class OrderInTransactionRepo extends acceptedOfferInReserve_1.AcceptedOfferInRes
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* 注文取引から注文番号を参照する
|
|
50
|
+
* 存在しなければNotFoundError
|
|
51
|
+
*/
|
|
52
|
+
async findOrderNumberByIdentifier(params) {
|
|
53
|
+
const { project, identifier } = params;
|
|
54
|
+
const doc = await this.orderModel.findOne({
|
|
55
|
+
identifier: { $eq: identifier },
|
|
56
|
+
typeOf: { $eq: factory_1.factory.transactionType.PlaceOrder },
|
|
57
|
+
'project.id': { $eq: project.id }
|
|
58
|
+
}, {
|
|
59
|
+
_id: 0,
|
|
60
|
+
orderNumber: 1
|
|
61
|
+
})
|
|
62
|
+
.lean()
|
|
63
|
+
.exec();
|
|
64
|
+
console.log('findOrderNumberByIdentifier:', JSON.stringify(doc));
|
|
65
|
+
if (doc === null) {
|
|
66
|
+
throw new factory_1.factory.errors.NotFound('orderInTransaction');
|
|
67
|
+
}
|
|
68
|
+
return doc.orderNumber;
|
|
69
|
+
}
|
|
48
70
|
/**
|
|
49
71
|
* 取引進行中の注文からacceptedOffersを検索する
|
|
50
72
|
* 予約取引から予約ごとの価格仕様も参照する
|
|
@@ -115,21 +137,23 @@ class OrderInTransactionRepo extends acceptedOfferInReserve_1.AcceptedOfferInRes
|
|
|
115
137
|
if (!Array.isArray(params.acceptedOffers) || params.acceptedOffers.length === 0) {
|
|
116
138
|
return;
|
|
117
139
|
}
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
140
|
+
const { orderNumber, project, identifier } = params;
|
|
141
|
+
await this.createPlaceOrderIfNotExists({ orderNumber, project, identifier });
|
|
142
|
+
// const setOnInsert: IInitalOrderInTransaction = {
|
|
143
|
+
// typeOf: factory.transactionType.PlaceOrder,
|
|
144
|
+
// orderDate: new Date(), // orderDate required(2024-12-09~)
|
|
145
|
+
// orderNumber: params.orderNumber,
|
|
146
|
+
// project: params.project,
|
|
147
|
+
// identifier: params.identifier // 取引ID(2026-06-22~)
|
|
148
|
+
// };
|
|
149
|
+
const result = await this.orderModel.updateOne({
|
|
126
150
|
typeOf: { $eq: factory_1.factory.transactionType.PlaceOrder },
|
|
127
151
|
orderNumber: { $eq: params.orderNumber },
|
|
128
152
|
// プロジェクトでもフィルター(注文番号重複バグがあったため)(2026-02-21~)
|
|
129
153
|
// 万が一異なるプロジェクトで同じ注文番号でオファーを受け入れようとしても、DBにインデックスによってDuplicateKey
|
|
130
154
|
'project.id': { $eq: params.project.id }
|
|
131
155
|
}, {
|
|
132
|
-
$setOnInsert: setOnInsert,
|
|
156
|
+
// $setOnInsert: setOnInsert, // createPlaceOrderIfNotExistsへ移行(2026-06-24~)
|
|
133
157
|
$push: {
|
|
134
158
|
acceptedOffers: {
|
|
135
159
|
$each: params.acceptedOffers
|
|
@@ -140,8 +164,15 @@ class OrderInTransactionRepo extends acceptedOfferInReserve_1.AcceptedOfferInRes
|
|
|
140
164
|
broker: { id: params.broker.id, typeOf: params.broker.typeOf }
|
|
141
165
|
}) // set broker(2026-06-21~)
|
|
142
166
|
}
|
|
143
|
-
}, {
|
|
167
|
+
}, {
|
|
168
|
+
// upsert: true // createPlaceOrderIfNotExistsへ移行(2026-06-24~)
|
|
169
|
+
})
|
|
144
170
|
.exec();
|
|
171
|
+
if (result.matchedCount !== 1) {
|
|
172
|
+
console.error(params, result);
|
|
173
|
+
throw new factory_1.factory.errors.Internal(`orderInTransaction not found`);
|
|
174
|
+
}
|
|
175
|
+
return result;
|
|
145
176
|
}
|
|
146
177
|
/**
|
|
147
178
|
* serialNumberからオファーを除外する
|
|
@@ -181,7 +212,7 @@ class OrderInTransactionRepo extends acceptedOfferInReserve_1.AcceptedOfferInRes
|
|
|
181
212
|
}
|
|
182
213
|
}
|
|
183
214
|
async setCustomer(params) {
|
|
184
|
-
const { customer, orderNumber, project } = params;
|
|
215
|
+
const { customer, orderNumber, project, identifier } = params;
|
|
185
216
|
const filter = {
|
|
186
217
|
typeOf: { $eq: factory_1.factory.transactionType.PlaceOrder },
|
|
187
218
|
orderNumber: { $eq: orderNumber },
|
|
@@ -189,19 +220,27 @@ class OrderInTransactionRepo extends acceptedOfferInReserve_1.AcceptedOfferInRes
|
|
|
189
220
|
// 万が一異なるプロジェクトで同じ注文番号でオファーを受け入れようとしても、DBにインデックスによってDuplicateKey
|
|
190
221
|
'project.id': { $eq: project.id }
|
|
191
222
|
};
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
223
|
+
await this.createPlaceOrderIfNotExists({ orderNumber, project, identifier });
|
|
224
|
+
// const setOnInsert: IInitalOrderInTransaction = {
|
|
225
|
+
// typeOf: factory.transactionType.PlaceOrder,
|
|
226
|
+
// orderDate: new Date(), // orderDate required(2024-12-09~)
|
|
227
|
+
// orderNumber,
|
|
228
|
+
// project,
|
|
229
|
+
// identifier: params.identifier // 取引ID(2026-06-22~)
|
|
230
|
+
// };
|
|
199
231
|
const setKeys = { customer };
|
|
200
|
-
|
|
201
|
-
$setOnInsert: setOnInsert,
|
|
232
|
+
const result = await this.orderModel.updateOne(filter, {
|
|
233
|
+
// $setOnInsert: setOnInsert, // createPlaceOrderIfNotExistsへ移行(2026-06-24~)
|
|
202
234
|
$set: setKeys
|
|
203
|
-
}, {
|
|
235
|
+
}, {
|
|
236
|
+
// upsert: true // createPlaceOrderIfNotExistsへ移行(2026-06-24~)
|
|
237
|
+
})
|
|
204
238
|
.exec();
|
|
239
|
+
if (result.matchedCount !== 1) {
|
|
240
|
+
console.error(params, result);
|
|
241
|
+
throw new factory_1.factory.errors.Internal(`orderInTransaction not found`);
|
|
242
|
+
}
|
|
243
|
+
return result;
|
|
205
244
|
}
|
|
206
245
|
/**
|
|
207
246
|
* 注文ドキュメントからcustomer属性を参照する
|
|
@@ -29,7 +29,7 @@ function authorize(params, options) {
|
|
|
29
29
|
project: { id: params.project.id },
|
|
30
30
|
id: transaction.id,
|
|
31
31
|
object: { orderDate: now }
|
|
32
|
-
})(repos);
|
|
32
|
+
}, { issueForce: false })(repos);
|
|
33
33
|
// まず取引番号発行
|
|
34
34
|
const { transactionNumber } = await repos.transactionNumber.publishByTimestamp({ startDate: now });
|
|
35
35
|
const actionAttributes = (0, factory_2.createAuthorizeSeatReservationActionAttributes)({
|
|
@@ -2,6 +2,7 @@ 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';
|
|
5
6
|
import type { OrderNumberRepo } from '../../../repo/orderNumber';
|
|
6
7
|
import type { ProjectRepo } from '../../../repo/project';
|
|
7
8
|
import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
@@ -9,6 +10,7 @@ import { factory } from '../../../factory';
|
|
|
9
10
|
interface IAcceptRepos {
|
|
10
11
|
action: AcceptCOAOfferActionRepo;
|
|
11
12
|
event: EventRepo;
|
|
13
|
+
orderInTransaction: OrderInTransactionRepo;
|
|
12
14
|
orderNumber: OrderNumberRepo;
|
|
13
15
|
project: ProjectRepo;
|
|
14
16
|
placeOrder: PlaceOrderRepo;
|
|
@@ -44,7 +44,7 @@ function acceptOffer(params) {
|
|
|
44
44
|
project: { id: transaction.project.id },
|
|
45
45
|
id: transaction.id,
|
|
46
46
|
object: { orderDate: new Date() }
|
|
47
|
-
})(repos);
|
|
47
|
+
}, { issueForce: false })(repos);
|
|
48
48
|
const coaInfo = await findCOAInfo({ id: params.object.event.id, project: { id: transaction.project.id } })(repos);
|
|
49
49
|
const updTmpReserveSeatArgs = (0, factory_2.createUpdTmpReserveSeatArgs)({ object: params.object, coaInfo });
|
|
50
50
|
let updTmpReserveSeatResult;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { factory } from '../../../../factory';
|
|
2
2
|
import type { ConfirmationNumberRepo } from '../../../../repo/confirmationNumber';
|
|
3
|
+
import type { OrderInTransactionRepo } from '../../../../repo/orderInTransaction';
|
|
3
4
|
import type { OrderNumberRepo } from '../../../../repo/orderNumber';
|
|
4
5
|
import type { ProjectRepo } from '../../../../repo/project';
|
|
5
6
|
import type { PlaceOrderRepo } from '../../../../repo/transaction/placeOrder';
|
|
@@ -12,6 +13,7 @@ declare function fixOrderAsNeeded(params: {
|
|
|
12
13
|
project: ProjectRepo;
|
|
13
14
|
placeOrder: PlaceOrderRepo;
|
|
14
15
|
confirmationNumber: ConfirmationNumberRepo;
|
|
16
|
+
orderInTransaction: OrderInTransactionRepo;
|
|
15
17
|
orderNumber: OrderNumberRepo;
|
|
16
18
|
}) => Promise<{
|
|
17
19
|
confirmationNumber: string;
|
|
@@ -14,6 +14,7 @@ import type { CredentialsRepo } from '../../../repo/credentials';
|
|
|
14
14
|
import type { EventRepo } from '../../../repo/event';
|
|
15
15
|
import type { EventSeriesRepo } from '../../../repo/eventSeries';
|
|
16
16
|
import type { IssuerRepo } from '../../../repo/issuer';
|
|
17
|
+
import type { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
|
|
17
18
|
import type { OrderNumberRepo } from '../../../repo/orderNumber';
|
|
18
19
|
import type { PaymentServiceRepo } from '../../../repo/paymentService';
|
|
19
20
|
import type { PaymentServiceProviderRepo } from '../../../repo/paymentServiceProvider';
|
|
@@ -43,6 +44,7 @@ interface IAuthorizeRepos {
|
|
|
43
44
|
event: EventRepo;
|
|
44
45
|
eventSeries: EventSeriesRepo;
|
|
45
46
|
issuer: IssuerRepo;
|
|
47
|
+
orderInTransaction: OrderInTransactionRepo;
|
|
46
48
|
orderNumber: OrderNumberRepo;
|
|
47
49
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
48
50
|
paymentService: PaymentServiceRepo;
|
|
@@ -7,6 +7,7 @@ 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';
|
|
10
11
|
import type { OrderNumberRepo } from '../../../repo/orderNumber';
|
|
11
12
|
import type { PaymentServiceRepo } from '../../../repo/paymentService';
|
|
12
13
|
import type { PaymentServiceProviderRepo } from '../../../repo/paymentServiceProvider';
|
|
@@ -24,6 +25,7 @@ interface IPublishPaymentUrlRepos {
|
|
|
24
25
|
event: EventRepo;
|
|
25
26
|
eventSeries: EventSeriesRepo;
|
|
26
27
|
issuer: IssuerRepo;
|
|
28
|
+
orderInTransaction: OrderInTransactionRepo;
|
|
27
29
|
orderNumber: OrderNumberRepo;
|
|
28
30
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
29
31
|
paymentService: PaymentServiceRepo;
|
|
@@ -35,7 +35,6 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.publishPaymentUrl = publishPaymentUrl;
|
|
37
37
|
const factory_1 = require("../../../factory");
|
|
38
|
-
// import type { TransactionProcessRepo } from '../../repo/transactionProcess';
|
|
39
38
|
const PayTransactionService = __importStar(require("../../assetTransaction/pay"));
|
|
40
39
|
const issueOrderNumberIfNotExist_1 = require("../../transaction/placeOrder/issueOrderNumberIfNotExist");
|
|
41
40
|
const fixTransactionNumberOnPublishPaymentUrl_1 = require("./publishPaymentUrl/fixTransactionNumberOnPublishPaymentUrl");
|
|
@@ -59,7 +58,7 @@ function publishPaymentUrl(params) {
|
|
|
59
58
|
project: { id: transaction.project.id },
|
|
60
59
|
id: transaction.id,
|
|
61
60
|
object: { orderDate: new Date() }
|
|
62
|
-
})(repos);
|
|
61
|
+
}, { issueForce: false })(repos);
|
|
63
62
|
// 取引番号生成
|
|
64
63
|
const { transactionNumber, ticketToken } = await (0, fixTransactionNumberOnPublishPaymentUrl_1.fixTransactionNumberOnPublishPaymentUrl)({
|
|
65
64
|
object: params.object,
|
|
@@ -3,16 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.call = call;
|
|
4
4
|
const coa_service_1 = require("@motionpicture/coa-service");
|
|
5
5
|
const factory_1 = require("../../factory");
|
|
6
|
-
// import { ActionRepo } from '../../repo/action';
|
|
7
6
|
const acceptCOAOffer_1 = require("../../repo/action/acceptCOAOffer");
|
|
8
7
|
const authorizeOffer_1 = require("../../repo/action/authorizeOffer");
|
|
9
8
|
const credentials_1 = require("../../repo/credentials");
|
|
10
9
|
const event_1 = require("../../repo/event");
|
|
10
|
+
const orderInTransaction_1 = require("../../repo/orderInTransaction");
|
|
11
11
|
const orderNumber_1 = require("../../repo/orderNumber");
|
|
12
12
|
const project_1 = require("../../repo/project");
|
|
13
13
|
const reserveInterface_1 = require("../../repo/reserveInterface");
|
|
14
14
|
const integration_1 = require("../../repo/setting/integration");
|
|
15
|
-
// import { TransactionRepo } from '../../repo/transaction';
|
|
16
15
|
const placeOrder_1 = require("../../repo/transaction/placeOrder");
|
|
17
16
|
const acceptOffer_1 = require("../offer/eventServiceByCOA/acceptOffer");
|
|
18
17
|
let coaAuthClient;
|
|
@@ -90,7 +89,6 @@ function call(params) {
|
|
|
90
89
|
orderNumber: new orderNumber_1.OrderNumberRepo({ connection }),
|
|
91
90
|
project: new project_1.ProjectRepo(connection),
|
|
92
91
|
placeOrder: new placeOrder_1.PlaceOrderRepo(connection),
|
|
93
|
-
// transaction: new TransactionRepo(connection),
|
|
94
92
|
reserveService,
|
|
95
93
|
masterService
|
|
96
94
|
});
|
|
@@ -106,10 +104,10 @@ function call(params) {
|
|
|
106
104
|
})({
|
|
107
105
|
action: actionRepo,
|
|
108
106
|
event: new event_1.EventRepo(connection),
|
|
107
|
+
orderInTransaction: new orderInTransaction_1.OrderInTransactionRepo(connection),
|
|
109
108
|
orderNumber: new orderNumber_1.OrderNumberRepo({ connection }),
|
|
110
109
|
project: new project_1.ProjectRepo(connection),
|
|
111
110
|
placeOrder: new placeOrder_1.PlaceOrderRepo(connection),
|
|
112
|
-
// transaction: new TransactionRepo(connection),
|
|
113
111
|
reserveService,
|
|
114
112
|
masterService
|
|
115
113
|
});
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.call = call;
|
|
4
4
|
const factory_1 = require("../../factory");
|
|
5
5
|
const accountingReport_1 = require("../../repo/accountingReport");
|
|
6
|
-
// import { ActionRepo } from '../../repo/action';
|
|
7
6
|
const pay_1 = require("../../repo/action/pay");
|
|
8
7
|
const refund_1 = require("../../repo/action/refund");
|
|
9
8
|
const checkMovieTicket_1 = require("../../repo/action/checkMovieTicket");
|
|
@@ -17,6 +16,7 @@ const credentials_1 = require("../../repo/credentials");
|
|
|
17
16
|
const event_1 = require("../../repo/event");
|
|
18
17
|
const eventSeries_1 = require("../../repo/eventSeries");
|
|
19
18
|
const issuer_1 = require("../../repo/issuer");
|
|
19
|
+
const orderInTransaction_1 = require("../../repo/orderInTransaction");
|
|
20
20
|
const orderNumber_1 = require("../../repo/orderNumber");
|
|
21
21
|
const paymentService_1 = require("../../repo/paymentService");
|
|
22
22
|
const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
@@ -27,10 +27,8 @@ const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
|
|
|
27
27
|
const integration_1 = require("../../repo/setting/integration");
|
|
28
28
|
const task_1 = require("../../repo/task");
|
|
29
29
|
const ticket_1 = require("../../repo/ticket");
|
|
30
|
-
// import { TransactionRepo } from '../../repo/transaction';
|
|
31
30
|
const placeOrder_1 = require("../../repo/transaction/placeOrder");
|
|
32
31
|
const transactionNumber_1 = require("../../repo/transactionNumber");
|
|
33
|
-
// import { TransactionProcessRepo } from '../../repo/transactionProcess';
|
|
34
32
|
const any_1 = require("../payment/any");
|
|
35
33
|
/**
|
|
36
34
|
* タスク実行関数
|
|
@@ -60,7 +58,6 @@ function call(params) {
|
|
|
60
58
|
sameAs: { id: params.id } // タスクIDを関連付け(2024-04-20~)
|
|
61
59
|
})({
|
|
62
60
|
accountingReport: new accountingReport_1.AccountingReportRepo(connection),
|
|
63
|
-
// action: new ActionRepo(connection),
|
|
64
61
|
actions: {
|
|
65
62
|
pay: new pay_1.PayActionRepo(connection),
|
|
66
63
|
refund: new refund_1.RefundActionRepo(connection),
|
|
@@ -79,6 +76,7 @@ function call(params) {
|
|
|
79
76
|
event: new event_1.EventRepo(connection),
|
|
80
77
|
eventSeries: new eventSeries_1.EventSeriesRepo(connection),
|
|
81
78
|
issuer: new issuer_1.IssuerRepo(connection),
|
|
79
|
+
orderInTransaction: new orderInTransaction_1.OrderInTransactionRepo(connection),
|
|
82
80
|
orderNumber: new orderNumber_1.OrderNumberRepo({ connection }),
|
|
83
81
|
paymentAccepted: new sellerPaymentAccepted_1.SellerPaymentAcceptedRepo(connection),
|
|
84
82
|
paymentService: new paymentService_1.PaymentServiceRepo(connection),
|
|
@@ -89,9 +87,7 @@ function call(params) {
|
|
|
89
87
|
task: new task_1.TaskRepo(connection),
|
|
90
88
|
ticket: new ticket_1.TicketRepo(connection),
|
|
91
89
|
placeOrder: new placeOrder_1.PlaceOrderRepo(connection),
|
|
92
|
-
// transaction: new TransactionRepo(connection),
|
|
93
90
|
transactionNumber: new transactionNumber_1.TransactionNumberRepo({ connection })
|
|
94
|
-
// transactionProcess: transactionProcessRepo
|
|
95
91
|
}, settings);
|
|
96
92
|
}
|
|
97
93
|
catch (error) {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.call = call;
|
|
4
4
|
const factory_1 = require("../../factory");
|
|
5
|
-
// import { ActionRepo } from '../../repo/action';
|
|
6
5
|
const acceptPay_1 = require("../../repo/action/acceptPay");
|
|
7
6
|
const authorizeInvoice_1 = require("../../repo/action/authorizeInvoice");
|
|
8
7
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
@@ -10,6 +9,7 @@ const authorization_1 = require("../../repo/authorization");
|
|
|
10
9
|
const event_1 = require("../../repo/event");
|
|
11
10
|
const eventSeries_1 = require("../../repo/eventSeries");
|
|
12
11
|
const issuer_1 = require("../../repo/issuer");
|
|
12
|
+
const orderInTransaction_1 = require("../../repo/orderInTransaction");
|
|
13
13
|
const orderNumber_1 = require("../../repo/orderNumber");
|
|
14
14
|
const paymentService_1 = require("../../repo/paymentService");
|
|
15
15
|
const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
@@ -17,10 +17,8 @@ const project_1 = require("../../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");
|
|
20
|
-
// import { TransactionRepo } from '../../repo/transaction';
|
|
21
20
|
const placeOrder_1 = require("../../repo/transaction/placeOrder");
|
|
22
21
|
const transactionNumber_1 = require("../../repo/transactionNumber");
|
|
23
|
-
// import { TransactionProcessRepo } from '../../repo/transactionProcess';
|
|
24
22
|
const any_1 = require("../payment/any");
|
|
25
23
|
/**
|
|
26
24
|
* タスク実行関数
|
|
@@ -43,7 +41,6 @@ function call(params) {
|
|
|
43
41
|
instrument: (Array.isArray(params.data.instrument)) ? params.data.instrument : [],
|
|
44
42
|
sameAs: { id: params.id }
|
|
45
43
|
})({
|
|
46
|
-
// action: new ActionRepo(connection),
|
|
47
44
|
acceptPayAction: actionRepo,
|
|
48
45
|
authorizeInvoiceAction: new authorizeInvoice_1.AuthorizeInvoiceActionRepo(connection),
|
|
49
46
|
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
@@ -51,6 +48,7 @@ function call(params) {
|
|
|
51
48
|
event: new event_1.EventRepo(connection),
|
|
52
49
|
eventSeries: new eventSeries_1.EventSeriesRepo(connection),
|
|
53
50
|
issuer: new issuer_1.IssuerRepo(connection),
|
|
51
|
+
orderInTransaction: new orderInTransaction_1.OrderInTransactionRepo(connection),
|
|
54
52
|
orderNumber: new orderNumber_1.OrderNumberRepo({ connection }),
|
|
55
53
|
paymentAccepted: new sellerPaymentAccepted_1.SellerPaymentAcceptedRepo(connection),
|
|
56
54
|
paymentService: new paymentService_1.PaymentServiceRepo(connection),
|
|
@@ -58,7 +56,6 @@ function call(params) {
|
|
|
58
56
|
project: new project_1.ProjectRepo(connection),
|
|
59
57
|
ticket: new ticket_1.TicketRepo(connection),
|
|
60
58
|
placeOrder: new placeOrder_1.PlaceOrderRepo(connection),
|
|
61
|
-
// transaction: new TransactionRepo(connection),
|
|
62
59
|
transactionNumber: new transactionNumber_1.TransactionNumberRepo({ connection })
|
|
63
60
|
}, settings);
|
|
64
61
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
|
|
1
2
|
import type { OrderNumberRepo } from '../../../repo/orderNumber';
|
|
2
3
|
import type { ProjectRepo } from '../../../repo/project';
|
|
3
4
|
import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
@@ -15,9 +16,12 @@ declare function issueOrderNumberIfNotExist(params: {
|
|
|
15
16
|
object: {
|
|
16
17
|
orderDate: Date;
|
|
17
18
|
};
|
|
19
|
+
}, options: {
|
|
20
|
+
issueForce: boolean;
|
|
18
21
|
}): (repos: {
|
|
19
22
|
project: ProjectRepo;
|
|
20
23
|
placeOrder: PlaceOrderRepo;
|
|
24
|
+
orderInTransaction: OrderInTransactionRepo;
|
|
21
25
|
orderNumber: OrderNumberRepo;
|
|
22
26
|
}) => Promise<string>;
|
|
23
27
|
export { issueOrderNumberIfNotExist };
|
|
@@ -2,11 +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
6
|
/**
|
|
6
7
|
* 未発行であれば、注文番号を発行して取引に保管する
|
|
7
8
|
*/
|
|
8
|
-
function issueOrderNumberIfNotExist(params) {
|
|
9
|
+
function issueOrderNumberIfNotExist(params, options) {
|
|
9
10
|
return async (repos) => {
|
|
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
|
+
}
|
|
10
20
|
// 1. 最初のチェック
|
|
11
21
|
let orderNumber = await repos.placeOrder.findInProgressOrderNumberById({ id: params.id });
|
|
12
22
|
// すでに発行済であれば何もしない
|
|
@@ -58,7 +58,7 @@ function start(params, options) {
|
|
|
58
58
|
project: { id: params.project.id },
|
|
59
59
|
id: transaction.id,
|
|
60
60
|
object: { orderDate: new Date() }
|
|
61
|
-
})(repos);
|
|
61
|
+
}, { issueForce: true })(repos);
|
|
62
62
|
await repos.orderInTransaction.createPlaceOrderIfNotExists({
|
|
63
63
|
orderNumber,
|
|
64
64
|
project: { id: params.project.id, typeOf: factory_1.factory.organizationType.Project },
|
|
@@ -79,7 +79,7 @@ function updateAgent(params) {
|
|
|
79
79
|
project: { id: transaction.project.id },
|
|
80
80
|
id: params.id,
|
|
81
81
|
object: { orderDate: new Date() }
|
|
82
|
-
})(repos);
|
|
82
|
+
}, { issueForce: false })(repos);
|
|
83
83
|
const customerName = (typeof customer.name === 'string' && customer.name !== '')
|
|
84
84
|
? customer.name
|
|
85
85
|
: (typeof customer.givenName === 'string' && typeof customer.familyName === 'string'
|
package/package.json
CHANGED