@chevre/domain 25.0.0-alpha.14 → 25.0.0-alpha.16
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 +15 -2
- package/lib/chevre/repo/orderInTransaction.js +25 -24
- package/lib/chevre/service/offer/any.d.ts +0 -1
- package/lib/chevre/service/offer/any.js +1 -2
- package/lib/chevre/service/offer/event/authorize.js +1 -2
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +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/placeOrder/factory.d.ts +1 -1
- package/lib/chevre/service/order/placeOrder/factory.js +5 -5
- package/lib/chevre/service/order/placeOrder.js +3 -3
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrder/start/factory.d.ts +3 -1
- package/lib/chevre/service/transaction/placeOrder/start/factory.js +15 -8
- package/lib/chevre/service/transaction/placeOrder/start.d.ts +1 -0
- package/lib/chevre/service/transaction/placeOrder/start.js +2 -1
- package/lib/chevre/service/transaction/placeOrder/updateAgent.js +13 -14
- package/package.json +1 -1
|
@@ -12,7 +12,7 @@ const schemaDefinition = {
|
|
|
12
12
|
project: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
13
13
|
typeOf: { type: String, required: true },
|
|
14
14
|
name: String,
|
|
15
|
-
seller: mongoose_1.SchemaTypes.Mixed,
|
|
15
|
+
seller: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
16
16
|
customer: mongoose_1.SchemaTypes.Mixed,
|
|
17
17
|
returner: mongoose_1.SchemaTypes.Mixed,
|
|
18
18
|
confirmationNumber: String,
|
|
@@ -15,7 +15,7 @@ type IOrderInTransaction = Pick<factory.order.IOrder, 'orderNumber' | 'project'
|
|
|
15
15
|
/**
|
|
16
16
|
* typeOf: Orderへドキュメント変換時の編集フィールド
|
|
17
17
|
*/
|
|
18
|
-
export type IPlacingOrder = Pick<factory.order.IOrder, 'confirmationNumber' | 'orderDate' | 'orderNumber' | 'orderStatus' | 'orderedItem' | 'paymentMethods' | 'price' | 'priceCurrency' | '
|
|
18
|
+
export type IPlacingOrder = Pick<factory.order.IOrder, 'confirmationNumber' | 'orderDate' | 'orderNumber' | 'orderStatus' | 'orderedItem' | 'paymentMethods' | 'price' | 'priceCurrency' | 'typeOf'> & {
|
|
19
19
|
url?: never;
|
|
20
20
|
identifier?: never;
|
|
21
21
|
name?: never;
|
|
@@ -31,6 +31,10 @@ export type IPlacingOrder = Pick<factory.order.IOrder, 'confirmationNumber' | 'o
|
|
|
31
31
|
* 上書きしてはいけない
|
|
32
32
|
*/
|
|
33
33
|
broker?: never;
|
|
34
|
+
/**
|
|
35
|
+
* 上書きしてはいけない
|
|
36
|
+
*/
|
|
37
|
+
seller?: never;
|
|
34
38
|
};
|
|
35
39
|
export type IMinimizedReservationFor = Pick<factory.order.IEventAsReservationFor, 'endDate' | 'id' | 'startDate' | 'typeOf'> & {
|
|
36
40
|
location: Pick<factory.order.IEventAsReservationFor['location'], 'branchCode' | 'typeOf'>;
|
|
@@ -69,6 +73,16 @@ export declare class OrderInTransactionRepo extends AcceptedOfferInReserveRepo {
|
|
|
69
73
|
id: string;
|
|
70
74
|
};
|
|
71
75
|
}): Promise<string>;
|
|
76
|
+
/**
|
|
77
|
+
* 注文取引からcustomerを参照する
|
|
78
|
+
* 存在しなければNotFoundError
|
|
79
|
+
*/
|
|
80
|
+
findCustomerByIdentifier(params: {
|
|
81
|
+
identifier: string;
|
|
82
|
+
project: {
|
|
83
|
+
id: string;
|
|
84
|
+
};
|
|
85
|
+
}): Promise<Pick<IOrderInTransaction, 'customer'>>;
|
|
72
86
|
/**
|
|
73
87
|
* 取引進行中の注文からacceptedOffersを検索する
|
|
74
88
|
* 予約取引から予約ごとの価格仕様も参照する
|
|
@@ -92,7 +106,6 @@ export declare class OrderInTransactionRepo extends AcceptedOfferInReserveRepo {
|
|
|
92
106
|
*/
|
|
93
107
|
acceptOffer(params: Pick<IOrderInTransaction, 'orderNumber' | 'project' | 'identifier'> & {
|
|
94
108
|
acceptedOffers: IMinimizedAcceptedOffer[] | factory.order.ICOAAcceptedOffer[];
|
|
95
|
-
broker?: factory.order.IBroker;
|
|
96
109
|
}): Promise<import("mongoose").UpdateWriteOpResult | undefined>;
|
|
97
110
|
/**
|
|
98
111
|
* serialNumberからオファーを除外する
|
|
@@ -61,12 +61,32 @@ class OrderInTransactionRepo extends acceptedOfferInReserve_1.AcceptedOfferInRes
|
|
|
61
61
|
})
|
|
62
62
|
.lean()
|
|
63
63
|
.exec();
|
|
64
|
-
console.log('findOrderNumberByIdentifier:', JSON.stringify(doc));
|
|
65
64
|
if (doc === null) {
|
|
66
65
|
throw new factory_1.factory.errors.NotFound('orderInTransaction');
|
|
67
66
|
}
|
|
68
67
|
return doc.orderNumber;
|
|
69
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* 注文取引からcustomerを参照する
|
|
71
|
+
* 存在しなければNotFoundError
|
|
72
|
+
*/
|
|
73
|
+
async findCustomerByIdentifier(params) {
|
|
74
|
+
const { project, identifier } = params;
|
|
75
|
+
const doc = await this.orderModel.findOne({
|
|
76
|
+
identifier: { $eq: identifier },
|
|
77
|
+
typeOf: { $eq: factory_1.factory.transactionType.PlaceOrder },
|
|
78
|
+
'project.id': { $eq: project.id }
|
|
79
|
+
}, {
|
|
80
|
+
_id: 0,
|
|
81
|
+
customer: 1
|
|
82
|
+
})
|
|
83
|
+
.lean()
|
|
84
|
+
.exec();
|
|
85
|
+
if (doc === null) {
|
|
86
|
+
throw new factory_1.factory.errors.NotFound('orderInTransaction');
|
|
87
|
+
}
|
|
88
|
+
return doc;
|
|
89
|
+
}
|
|
70
90
|
/**
|
|
71
91
|
* 取引進行中の注文からacceptedOffersを検索する
|
|
72
92
|
* 予約取引から予約ごとの価格仕様も参照する
|
|
@@ -137,15 +157,8 @@ class OrderInTransactionRepo extends acceptedOfferInReserve_1.AcceptedOfferInRes
|
|
|
137
157
|
if (!Array.isArray(params.acceptedOffers) || params.acceptedOffers.length === 0) {
|
|
138
158
|
return;
|
|
139
159
|
}
|
|
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
|
-
// };
|
|
160
|
+
// const { orderNumber, project, identifier } = params;
|
|
161
|
+
// await this.createPlaceOrderIfNotExists({ orderNumber, project, identifier }); // 取引開始時に完全移行(2026-06-25~)
|
|
149
162
|
const result = await this.orderModel.updateOne({
|
|
150
163
|
typeOf: { $eq: factory_1.factory.transactionType.PlaceOrder },
|
|
151
164
|
orderNumber: { $eq: params.orderNumber },
|
|
@@ -158,11 +171,6 @@ class OrderInTransactionRepo extends acceptedOfferInReserve_1.AcceptedOfferInRes
|
|
|
158
171
|
acceptedOffers: {
|
|
159
172
|
$each: params.acceptedOffers
|
|
160
173
|
}
|
|
161
|
-
},
|
|
162
|
-
$set: {
|
|
163
|
-
...((params.broker !== undefined) && {
|
|
164
|
-
broker: { id: params.broker.id, typeOf: params.broker.typeOf }
|
|
165
|
-
}) // set broker(2026-06-21~)
|
|
166
174
|
}
|
|
167
175
|
}, {
|
|
168
176
|
// upsert: true // createPlaceOrderIfNotExistsへ移行(2026-06-24~)
|
|
@@ -212,7 +220,7 @@ class OrderInTransactionRepo extends acceptedOfferInReserve_1.AcceptedOfferInRes
|
|
|
212
220
|
}
|
|
213
221
|
}
|
|
214
222
|
async setCustomer(params) {
|
|
215
|
-
const { customer, orderNumber, project
|
|
223
|
+
const { customer, orderNumber, project } = params;
|
|
216
224
|
const filter = {
|
|
217
225
|
typeOf: { $eq: factory_1.factory.transactionType.PlaceOrder },
|
|
218
226
|
orderNumber: { $eq: orderNumber },
|
|
@@ -220,14 +228,7 @@ class OrderInTransactionRepo extends acceptedOfferInReserve_1.AcceptedOfferInRes
|
|
|
220
228
|
// 万が一異なるプロジェクトで同じ注文番号でオファーを受け入れようとしても、DBにインデックスによってDuplicateKey
|
|
221
229
|
'project.id': { $eq: project.id }
|
|
222
230
|
};
|
|
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
|
-
// };
|
|
231
|
+
// await this.createPlaceOrderIfNotExists({ orderNumber, project, identifier }); // 取引開始時に完全移行(2026-06-25~)
|
|
231
232
|
const setKeys = { customer };
|
|
232
233
|
const result = await this.orderModel.updateOne(filter, {
|
|
233
234
|
// $setOnInsert: setOnInsert, // createPlaceOrderIfNotExistsへ移行(2026-06-24~)
|
|
@@ -12,7 +12,6 @@ export declare function acceptOffer(params: {
|
|
|
12
12
|
};
|
|
13
13
|
placeOrderId: string;
|
|
14
14
|
acceptedOffers: IMinimizedAcceptedOffer[] | factory.order.ICOAAcceptedOffer[];
|
|
15
|
-
broker?: factory.order.IBroker;
|
|
16
15
|
}): IAcceptOfferOperation<void>;
|
|
17
16
|
export declare function voidAcceptedOffer(params: {
|
|
18
17
|
/**
|
|
@@ -14,8 +14,7 @@ function acceptOffer(params) {
|
|
|
14
14
|
orderNumber: params.orderNumber,
|
|
15
15
|
project: { id: params.project.id, typeOf: factory_1.factory.organizationType.Project },
|
|
16
16
|
identifier: params.placeOrderId,
|
|
17
|
-
acceptedOffers: params.acceptedOffers
|
|
18
|
-
...((params.broker !== undefined) && { broker: params.broker })
|
|
17
|
+
acceptedOffers: params.acceptedOffers
|
|
19
18
|
});
|
|
20
19
|
};
|
|
21
20
|
}
|
|
@@ -67,8 +67,7 @@ function authorize(params, options) {
|
|
|
67
67
|
orderNumber,
|
|
68
68
|
project: transaction.project,
|
|
69
69
|
placeOrderId: transaction.id,
|
|
70
|
-
acceptedOffers: minimizedAcceptedOffers
|
|
71
|
-
...((typeof params.object.broker?.typeOf === 'string') && { broker: params.object.broker })
|
|
70
|
+
acceptedOffers: minimizedAcceptedOffers
|
|
72
71
|
})(repos);
|
|
73
72
|
}
|
|
74
73
|
}
|
|
@@ -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[];
|
|
@@ -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
|
|
@@ -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
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 注文決済時処理
|
|
3
|
+
*/
|
|
1
4
|
import type { TaskRepo } from '../../../repo/task';
|
|
2
5
|
import { factory } from '../../../factory';
|
|
3
6
|
declare function onOrderPaymentDue(params: {
|
|
4
|
-
order: Pick<factory.order.IOrder, 'paymentMethods' | 'project' | 'orderNumber' | 'confirmationNumber' | 'orderDate' | '
|
|
7
|
+
order: Pick<factory.order.IOrder, 'paymentMethods' | 'project' | 'orderNumber' | 'confirmationNumber' | 'orderDate' | 'typeOf'> & {
|
|
5
8
|
orderStatus: factory.orderStatus.OrderPaymentDue;
|
|
6
9
|
};
|
|
7
10
|
}): (repos: {
|
|
@@ -1,32 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.onOrderPaymentDue = onOrderPaymentDue;
|
|
7
|
-
/**
|
|
8
|
-
* 注文決済時処理
|
|
9
|
-
*/
|
|
10
|
-
const debug_1 = __importDefault(require("debug"));
|
|
11
4
|
const factory_1 = require("../../../factory");
|
|
12
|
-
// import { createMaskedCustomer } from '../../../factory/order';
|
|
13
|
-
const debug = (0, debug_1.default)('chevre-domain:service:order');
|
|
14
5
|
function onOrderPaymentDue(params) {
|
|
15
6
|
return async (repos) => {
|
|
16
|
-
debug('onOrderStatusChanged called.', params.order.orderNumber, params.order.orderStatus, params.order.orderDate);
|
|
17
7
|
let tasks;
|
|
18
|
-
// const maskedCustomer = createMaskedCustomer(params.order, { noProfile: true });
|
|
19
8
|
const simpleOrder = {
|
|
20
9
|
typeOf: params.order.typeOf,
|
|
21
|
-
// seller: {
|
|
22
|
-
// id: params.order.seller.id,
|
|
23
|
-
// typeOf: params.order.seller.typeOf,
|
|
24
|
-
// name: params.order.seller.name
|
|
25
|
-
// }, // 廃止(2024-03-06~)
|
|
26
|
-
// customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id }, // 廃止(2024-03-06~)
|
|
27
10
|
orderNumber: params.order.orderNumber,
|
|
28
|
-
// price: params.order.price,
|
|
29
|
-
// priceCurrency: params.order.priceCurrency,
|
|
30
11
|
orderDate: params.order.orderDate
|
|
31
12
|
};
|
|
32
13
|
switch (params.order.orderStatus) {
|
|
@@ -62,12 +43,7 @@ function createConfirmPayTransactionTasks(order, simpleOrder) {
|
|
|
62
43
|
object: { transactionNumber: { $eq: invoice.paymentMethodId } },
|
|
63
44
|
purpose: { orderNumber: { $eq: order.orderNumber } }
|
|
64
45
|
}
|
|
65
|
-
}, ['id']
|
|
66
|
-
// {
|
|
67
|
-
// data: 0, executionResults: 0, name: 0, numberOfTried: 0,
|
|
68
|
-
// remainingNumberOfTries: 0, runsAt: 0, status: 0
|
|
69
|
-
// }
|
|
70
|
-
);
|
|
46
|
+
}, ['id']);
|
|
71
47
|
if (existingTasks.length === 0) {
|
|
72
48
|
const data = {
|
|
73
49
|
project: order.project,
|
|
@@ -114,7 +90,6 @@ function createCreateAccountingReportTask(order) {
|
|
|
114
90
|
executionResults: [],
|
|
115
91
|
data: {
|
|
116
92
|
object: { mainEntity: { orderNumber: order.orderNumber } }
|
|
117
|
-
// project: { id: order.project.id }
|
|
118
93
|
}
|
|
119
94
|
};
|
|
120
95
|
return [task];
|
|
@@ -10,7 +10,7 @@ declare function createPaymentMethods(params: {
|
|
|
10
10
|
};
|
|
11
11
|
declare function createSeller(params: {
|
|
12
12
|
transaction: Pick<factory.transaction.placeOrder.ITransaction, 'seller'>;
|
|
13
|
-
}): factory.order.ISeller
|
|
13
|
+
}): Pick<factory.order.ISeller, 'id' | 'name' | 'typeOf'>;
|
|
14
14
|
declare function createPlacingOrder(params: {
|
|
15
15
|
transaction: IPlaceOrderTransaction;
|
|
16
16
|
authorizePaymentActions: Pick<factory.action.authorize.paymentMethod.any.IAction, 'result'>[];
|
|
@@ -61,9 +61,9 @@ function createSeller(params) {
|
|
|
61
61
|
return {
|
|
62
62
|
id: seller.id,
|
|
63
63
|
name: (typeof seller.name === 'string') ? seller.name : String(seller.name?.ja),
|
|
64
|
-
typeOf: seller.typeOf
|
|
65
|
-
// 追加特性を追加(2023-08-08~)
|
|
66
|
-
additionalProperty: (Array.isArray(seller.additionalProperty)) ? seller.additionalProperty : []
|
|
64
|
+
typeOf: seller.typeOf
|
|
65
|
+
// // 追加特性を追加(2023-08-08~)
|
|
66
|
+
// additionalProperty: (Array.isArray(seller.additionalProperty)) ? seller.additionalProperty : []
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
69
|
function createPlacingOrder(params) {
|
|
@@ -91,7 +91,7 @@ function createPlacingOrder(params) {
|
|
|
91
91
|
// if (orderByTransaction === undefined) {
|
|
92
92
|
// throw new factory.errors.NotFound('transaction.result.order');
|
|
93
93
|
// }
|
|
94
|
-
const seller = createSeller({ transaction });
|
|
94
|
+
// const seller = createSeller({ transaction });
|
|
95
95
|
// discontinue(2026-06-11~)
|
|
96
96
|
// const name: string | undefined =
|
|
97
97
|
// (typeof transaction.object.name === 'string') ? transaction.object.name : undefined;
|
|
@@ -119,7 +119,7 @@ function createPlacingOrder(params) {
|
|
|
119
119
|
orderNumber,
|
|
120
120
|
typeOf: factory_1.factory.order.OrderType.Order, // 取引保管を廃止するためにここで指定(2026-06-14~)
|
|
121
121
|
orderStatus: factory_1.factory.orderStatus.OrderPaymentDue, // 取引保管を廃止するためにここで指定(2026-06-14~)
|
|
122
|
-
seller, //
|
|
122
|
+
// seller, // 取引開始時の注文ドキュメント作成へ移行(2026-06-25~)
|
|
123
123
|
paymentMethods, // 2024-06-17~
|
|
124
124
|
price, // 2024-06-17~
|
|
125
125
|
priceCurrency: factory_1.factory.priceCurrency.JPY, // 取引保管を廃止するためにここで指定(2026-06-14~)
|
|
@@ -89,10 +89,10 @@ function placeOrder(params) {
|
|
|
89
89
|
orderNumber: order.orderNumber,
|
|
90
90
|
confirmationNumber: order.confirmationNumber,
|
|
91
91
|
orderDate: order.orderDate,
|
|
92
|
-
seller: order.seller,
|
|
92
|
+
// seller: order.seller,
|
|
93
93
|
typeOf: order.typeOf,
|
|
94
|
-
price: order.price,
|
|
95
|
-
priceCurrency: order.priceCurrency,
|
|
94
|
+
// price: order.price,
|
|
95
|
+
// priceCurrency: order.priceCurrency,
|
|
96
96
|
orderStatus: order.orderStatus
|
|
97
97
|
}
|
|
98
98
|
})({
|
package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare function createSendEmailMessageActions(params: {
|
|
|
9
9
|
typeOf: factory.order.OrderType;
|
|
10
10
|
};
|
|
11
11
|
customer: factory.order.ICustomer;
|
|
12
|
-
seller: factory.order.ISeller
|
|
12
|
+
seller: Pick<factory.order.ISeller, 'name' | 'typeOf'>;
|
|
13
13
|
paymentMethods: factory.order.IReferencedInvoice[];
|
|
14
14
|
potentialActions?: factory.transaction.placeOrder.IPotentialActionsParams;
|
|
15
15
|
}, setting: Pick<ISetting, 'defaultSenderEmail'>): Promise<{
|
|
@@ -12,7 +12,7 @@ export declare function createPotentialActions(params: {
|
|
|
12
12
|
typeOf: factory.order.OrderType;
|
|
13
13
|
};
|
|
14
14
|
customer: factory.order.ICustomer;
|
|
15
|
-
seller: factory.order.ISeller
|
|
15
|
+
seller: Pick<factory.order.ISeller, 'name' | 'typeOf'>;
|
|
16
16
|
paymentMethods: factory.order.IReferencedInvoice[];
|
|
17
17
|
potentialActions?: factory.transaction.placeOrder.IPotentialActionsParams;
|
|
18
18
|
}, setting: Pick<ISetting, 'defaultSenderEmail'>): Promise<{
|
|
@@ -18,5 +18,7 @@ type IStartPlaceOrderParams = factory.transaction.placeOrder.IStartParamsWithout
|
|
|
18
18
|
*/
|
|
19
19
|
broker?: factory.order.IBroker;
|
|
20
20
|
};
|
|
21
|
-
declare function createStartParams(params: IStartPlaceOrderParams, expiresInSeconds: number, passport: IVerifiedPassport | undefined, seller: Pick<factory.seller.ISeller, 'id' | 'name' | 'typeOf' | 'project' | 'additionalProperty'>,
|
|
21
|
+
declare function createStartParams(params: IStartPlaceOrderParams, expiresInSeconds: number, passport: IVerifiedPassport | undefined, seller: Pick<factory.seller.ISeller, 'id' | 'name' | 'typeOf' | 'project' | 'additionalProperty'>, options: {
|
|
22
|
+
minimizeStartPlaceOrderParams: boolean;
|
|
23
|
+
}, customerType?: string): factory.transaction.placeOrder.IStartParams;
|
|
22
24
|
export { AGENT_IDENTIFIER_NAME_PASSPORT, createStartParams, IStartPlaceOrderParams };
|
|
@@ -5,7 +5,8 @@ exports.createStartParams = createStartParams;
|
|
|
5
5
|
const factory_1 = require("../../../../factory");
|
|
6
6
|
const AGENT_IDENTIFIER_NAME_PASSPORT = 'passport';
|
|
7
7
|
exports.AGENT_IDENTIFIER_NAME_PASSPORT = AGENT_IDENTIFIER_NAME_PASSPORT;
|
|
8
|
-
function createStartParams(params, expiresInSeconds, passport, seller, customerType) {
|
|
8
|
+
function createStartParams(params, expiresInSeconds, passport, seller, options, customerType) {
|
|
9
|
+
const { minimizeStartPlaceOrderParams } = options;
|
|
9
10
|
// const { broker } = params;
|
|
10
11
|
// let clientUser: Omit<factory.clientUser.IClientUser, 'scope' | 'scopes'> | undefined;
|
|
11
12
|
let instrument;
|
|
@@ -20,7 +21,7 @@ function createStartParams(params, expiresInSeconds, passport, seller, customerT
|
|
|
20
21
|
// ...(typeof clientUser?.client_id === 'string') ? { clientUser } : undefined, // discontinue(2026-06-10~)
|
|
21
22
|
// ...(typeof params.object?.name === 'string') ? { name: params.object?.name } : undefined, // discontinue(2026-06-11~)
|
|
22
23
|
// ...(typeof broker?.typeOf === 'string') ? { broker: broker } : undefined, // discontinue(2026-06-22~)
|
|
23
|
-
...(typeof params.object.customer?.typeOf === 'string') ? { customer: params.object.customer } : undefined,
|
|
24
|
+
...(!minimizeStartPlaceOrderParams && typeof params.object.customer?.typeOf === 'string') ? { customer: params.object.customer } : undefined,
|
|
24
25
|
...(typeof customerType === 'string') ? { customerType } : undefined
|
|
25
26
|
};
|
|
26
27
|
if (typeof seller.id !== 'string') {
|
|
@@ -43,12 +44,18 @@ function createStartParams(params, expiresInSeconds, passport, seller, customerT
|
|
|
43
44
|
project: { typeOf: seller.project.typeOf, id: seller.project.id },
|
|
44
45
|
typeOf: factory_1.factory.transactionType.PlaceOrder,
|
|
45
46
|
agent,
|
|
46
|
-
seller:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
seller: (minimizeStartPlaceOrderParams)
|
|
48
|
+
? {
|
|
49
|
+
id: seller.id,
|
|
50
|
+
name: { ja: String(seller.name.ja) },
|
|
51
|
+
typeOf: seller.typeOf
|
|
52
|
+
}
|
|
53
|
+
: {
|
|
54
|
+
id: seller.id,
|
|
55
|
+
name: seller.name,
|
|
56
|
+
typeOf: seller.typeOf,
|
|
57
|
+
additionalProperty: (Array.isArray(seller.additionalProperty)) ? seller.additionalProperty : [] // 追加特性を追加(2023-08-08~)
|
|
58
|
+
},
|
|
52
59
|
object: transactionObject,
|
|
53
60
|
expiresInSeconds,
|
|
54
61
|
...(typeof instrument?.id === 'string') ? { instrument } : undefined
|
|
@@ -23,7 +23,8 @@ function start(params, options) {
|
|
|
23
23
|
throw new factory_1.factory.errors.NotFound('eligibleTransactionDuration.maxValue');
|
|
24
24
|
}
|
|
25
25
|
// 取引ファクトリーで新しい進行中取引オブジェクトを作成
|
|
26
|
-
const
|
|
26
|
+
const { minimizeStartPlaceOrderParams } = options;
|
|
27
|
+
const startParams = (0, factory_2.createStartParams)(params, expiresInSeconds, passport, seller, { minimizeStartPlaceOrderParams }, customerType);
|
|
27
28
|
let transaction;
|
|
28
29
|
// lock passport(2024-07-05~)
|
|
29
30
|
if (passport !== undefined) {
|
|
@@ -4,7 +4,6 @@ exports.updateAgent = updateAgent;
|
|
|
4
4
|
const google_libphonenumber_1 = require("google-libphonenumber");
|
|
5
5
|
const factory_1 = require("../../../factory");
|
|
6
6
|
const issueOrderNumberIfNotExist_1 = require("./issueOrderNumberIfNotExist");
|
|
7
|
-
// export type ITransactionOperation<T> = (repos: { transaction: TransactionRepo }) => Promise<T>;
|
|
8
7
|
function fixCustomer(params) {
|
|
9
8
|
return async (repos) => {
|
|
10
9
|
let formattedTelephone;
|
|
@@ -20,7 +19,7 @@ function fixCustomer(params) {
|
|
|
20
19
|
throw new factory_1.factory.errors.Argument('telephone', (error instanceof Error) ? error.message : String(error));
|
|
21
20
|
}
|
|
22
21
|
const transaction = await repos.placeOrder.findPlaceOrderInProgressById({
|
|
23
|
-
typeOf:
|
|
22
|
+
typeOf: factory_1.factory.transactionType.PlaceOrder,
|
|
24
23
|
id: params.id
|
|
25
24
|
}, ['agent', 'object', 'typeOf', 'project']);
|
|
26
25
|
if (transaction.agent.id !== params.agent.id) {
|
|
@@ -29,20 +28,20 @@ function fixCustomer(params) {
|
|
|
29
28
|
// 注文取引の場合、object.customerにも適用
|
|
30
29
|
let customer;
|
|
31
30
|
if (transaction.typeOf === factory_1.factory.transactionType.PlaceOrder) {
|
|
32
|
-
//
|
|
33
|
-
const
|
|
34
|
-
|
|
31
|
+
// orderInTransaction.customer?.typeOfは取引開始時にセットされている前提で再実装(2026-06-24~)
|
|
32
|
+
const { customer: customerByTransaction } = await repos.orderInTransaction.findCustomerByIdentifier({
|
|
33
|
+
identifier: params.id,
|
|
34
|
+
project: { id: transaction.project.id }
|
|
35
|
+
});
|
|
36
|
+
// // いったんtransaction.object.customer?.typeOfは取引開始時にセットされている前提
|
|
37
|
+
// const customerByTransaction = transaction.object.customer;
|
|
38
|
+
if (typeof customerByTransaction?.typeOf === 'string') {
|
|
35
39
|
customer = {
|
|
36
|
-
typeOf:
|
|
37
|
-
id:
|
|
38
|
-
...(Array.isArray(
|
|
39
|
-
? { identifier:
|
|
40
|
+
typeOf: customerByTransaction.typeOf,
|
|
41
|
+
id: customerByTransaction.id,
|
|
42
|
+
...(Array.isArray(customerByTransaction.identifier))
|
|
43
|
+
? { identifier: customerByTransaction.identifier }
|
|
40
44
|
: /* istanbul ignore next */ undefined,
|
|
41
|
-
// discontinue(2024-05-16~)
|
|
42
|
-
// ...(transaction.object.customer.typeOf === factory.personType.Person
|
|
43
|
-
// && typeof transaction.object.customer.memberOf?.typeOf === 'string')
|
|
44
|
-
// ? { memberOf: transaction.object.customer.memberOf }
|
|
45
|
-
// : undefined,
|
|
46
45
|
...(Array.isArray(params.agent.additionalProperty))
|
|
47
46
|
? { additionalProperty: params.agent.additionalProperty }
|
|
48
47
|
: /* istanbul ignore next */ undefined,
|
package/package.json
CHANGED