@chevre/domain 25.0.0-alpha.1 → 25.0.0-alpha.11
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/emailMessageBuilder.d.ts +10 -4
- package/lib/chevre/emailMessageBuilder.js +48 -73
- package/lib/chevre/repo/acceptedOffer.d.ts +1 -5
- package/lib/chevre/repo/acceptedOffer.js +5 -5
- package/lib/chevre/repo/acceptedOfferInReserve.d.ts +1 -5
- package/lib/chevre/repo/acceptedOfferInReserve.js +4 -4
- package/lib/chevre/repo/emailMessage.d.ts +18 -9
- package/lib/chevre/repo/emailMessage.js +26 -36
- package/lib/chevre/repo/factory/acceptedOffer/reserveTransaction2itemOffered.d.ts +1 -3
- package/lib/chevre/repo/factory/acceptedOffer/reserveTransaction2itemOffered.js +2 -3
- package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +9 -1
- package/lib/chevre/repo/mongoose/schemas/emailMessages.js +5 -20
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +4 -0
- package/lib/chevre/repo/mongoose/schemas/order.js +10 -109
- package/lib/chevre/repo/mongoose/schemas/setting.d.ts +0 -6
- package/lib/chevre/repo/order.d.ts +9 -6
- package/lib/chevre/repo/order.js +45 -26
- package/lib/chevre/repo/orderInTransaction.d.ts +15 -16
- package/lib/chevre/repo/orderInTransaction.js +38 -23
- package/lib/chevre/repo/orderNumber.d.ts +4 -0
- package/lib/chevre/repo/orderNumber.js +32 -60
- package/lib/chevre/repo/transaction.d.ts +5 -1
- package/lib/chevre/repo/transaction.js +4 -0
- package/lib/chevre/service/offer/any.d.ts +3 -6
- package/lib/chevre/service/offer/any.js +3 -1
- package/lib/chevre/service/offer/event/authorize.js +3 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +1 -0
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +1 -0
- package/lib/chevre/service/order/deleteOrder.js +1 -1
- package/lib/chevre/service/order/placeOrder/factory.js +4 -2
- package/lib/chevre/service/order.d.ts +1 -2
- package/lib/chevre/service/order.js +1 -5
- package/lib/chevre/service/reserve/findByCode.js +1 -1
- package/lib/chevre/service/reserve/searchByOrder.js +1 -1
- package/lib/chevre/service/task/confirmReserveTransaction.js +1 -1
- package/lib/chevre/service/task/payment/payByTask.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.d.ts +0 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.js +8 -23
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.d.ts +0 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.js +1 -6
- package/lib/chevre/service/transaction/placeOrder/confirm.d.ts +1 -3
- package/lib/chevre/service/transaction/placeOrder/confirm.js +17 -14
- package/lib/chevre/service/transaction/placeOrder/start/factory.d.ts +0 -1
- package/lib/chevre/service/transaction/placeOrder/start/factory.js +3 -5
- package/lib/chevre/service/transaction/placeOrder/updateAgent.js +1 -0
- package/lib/chevre/service/transaction/placeOrder.d.ts +2 -2
- package/lib/chevre/service/transaction/placeOrder.js +3 -3
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +2 -37
- package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.d.ts +2 -2
- package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +3 -18
- package/lib/chevre/service/transaction/returnOrder/potentialActions.d.ts +0 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions.js +0 -4
- package/lib/chevre/service/transaction/returnOrder/preStart.js +1 -1
- package/lib/chevre/service/transaction/returnOrder.d.ts +0 -2
- package/lib/chevre/service/transaction/returnOrder.js +13 -12
- package/lib/chevre/service/validation/validateOrder.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
|
@@ -3,9 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createReturnPaymentMethodActions = createReturnPaymentMethodActions;
|
|
4
4
|
const emailMessageBuilder_1 = require("../../../../emailMessageBuilder");
|
|
5
5
|
const factory_1 = require("../../../../factory");
|
|
6
|
-
async function createReturnInvoicePotentialActions(params,
|
|
7
|
-
// settings: Settings
|
|
8
|
-
setting) {
|
|
6
|
+
async function createReturnInvoicePotentialActions(params, setting) {
|
|
9
7
|
const order = params.order;
|
|
10
8
|
const emailMessagesOnReturnEachPaymentMethodId = [];
|
|
11
9
|
const sendEmailMessageOnRefund = [];
|
|
@@ -32,21 +30,10 @@ setting) {
|
|
|
32
30
|
}, setting);
|
|
33
31
|
emailMessagesOnReturnEachPaymentMethodId.push(emailMessage);
|
|
34
32
|
sendEmailMessageOnRefund.push({
|
|
35
|
-
// project: order.project, // discontinue(2024-06-26~)
|
|
36
|
-
// typeOf: factory.actionType.SendAction, // discontinue(2024-06-26~)
|
|
37
|
-
// standardize object(2024-06-27~)
|
|
38
|
-
// object: emailMessage
|
|
39
33
|
object: {
|
|
40
34
|
identifier: emailMessage.identifier,
|
|
41
35
|
typeOf: factory_1.factory.creativeWorkType.EmailMessage
|
|
42
36
|
}
|
|
43
|
-
// agent: order.project, // discontinue(2024-06-26~)
|
|
44
|
-
// recipient: { // discontinue(2024-06-26~)
|
|
45
|
-
// typeOf: order.customer.typeOf,
|
|
46
|
-
// id: order.customer.id
|
|
47
|
-
// },
|
|
48
|
-
// potentialActions: {}, // discontinue(2024-06-25~)
|
|
49
|
-
// purpose: sendActionPurpose // discontinue(2024-06-26~)
|
|
50
37
|
});
|
|
51
38
|
}
|
|
52
39
|
return {
|
|
@@ -56,18 +43,9 @@ setting) {
|
|
|
56
43
|
}
|
|
57
44
|
};
|
|
58
45
|
}
|
|
59
|
-
async function createReturnPaymentMethodActions(params,
|
|
60
|
-
// settings: Settings
|
|
61
|
-
setting) {
|
|
46
|
+
async function createReturnPaymentMethodActions(params, setting) {
|
|
62
47
|
const emailMessagesOnReturnInvoice = [];
|
|
63
48
|
const potentialReturnInvoiceActions = [];
|
|
64
|
-
// const returnPaymentMethodPurpose: factory.order.ISimpleOrder = {
|
|
65
|
-
// typeOf: order.typeOf,
|
|
66
|
-
// orderNumber: order.orderNumber,
|
|
67
|
-
// price: order.price,
|
|
68
|
-
// priceCurrency: order.priceCurrency,
|
|
69
|
-
// orderDate: order.orderDate
|
|
70
|
-
// };
|
|
71
49
|
// MovieTicket決済以外について返品ポリシーのreturnFeesを適用する(2022-08-10~)
|
|
72
50
|
const returnFees = params.transaction.object.returnPolicy.returnFees;
|
|
73
51
|
// ReturnFeesCustomerResponsibilityであれば返金はなし、それ以外は返金する
|
|
@@ -95,19 +73,6 @@ setting) {
|
|
|
95
73
|
};
|
|
96
74
|
// optimize(2024-06-19~)
|
|
97
75
|
return { object, potentialActions: potentialActionsOnRefund };
|
|
98
|
-
// return {
|
|
99
|
-
// project: order.project,
|
|
100
|
-
// typeOf: factory.actionType.ReturnAction,
|
|
101
|
-
// object,
|
|
102
|
-
// agent: order.project,
|
|
103
|
-
// recipient: {
|
|
104
|
-
// typeOf: order.customer.typeOf,
|
|
105
|
-
// id: order.customer.id,
|
|
106
|
-
// name: String(order.customer.name)
|
|
107
|
-
// },
|
|
108
|
-
// purpose: returnPaymentMethodPurpose,
|
|
109
|
-
// potentialActions: potentialActionsOnRefund
|
|
110
|
-
// };
|
|
111
76
|
})));
|
|
112
77
|
}
|
|
113
78
|
// 決済カード決済について
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { IOrderAsCreateEmailParams } from '../../../../emailMessageBuilder';
|
|
1
2
|
import { factory } from '../../../../factory';
|
|
2
3
|
import type { ISetting } from '../../../../repo/setting';
|
|
3
4
|
type IPotentialSendEmailMessageAction = factory.action.transfer.returnAction.order.IPotentialSendEmailMessageAction;
|
|
4
5
|
export declare function createSendEmailMessaegActionsOnReturn(params: {
|
|
5
|
-
order:
|
|
6
|
+
order: IOrderAsCreateEmailParams;
|
|
6
7
|
returnOrderActionParams?: factory.transaction.returnOrder.IReturnOrderActionParams;
|
|
7
|
-
emailMessageOnOrderReturned?: factory.creativeWork.message.email.ICreativeWork;
|
|
8
8
|
}, setting: Pick<ISetting, 'defaultSenderEmail'>): Promise<{
|
|
9
9
|
emailMessagesOnReturn: factory.action.transfer.send.message.email.IObjectAsEmailMessage[];
|
|
10
10
|
sendEmailMessaegActionsOnReturn: IPotentialSendEmailMessageAction[];
|
|
@@ -7,13 +7,6 @@ async function createSendEmailMessaegActionsOnReturn(params,
|
|
|
7
7
|
// settings: Settings
|
|
8
8
|
setting) {
|
|
9
9
|
const order = params.order;
|
|
10
|
-
// const sendActionPurpose: factory.action.transfer.send.message.email.IPurpose = {
|
|
11
|
-
// typeOf: order.typeOf,
|
|
12
|
-
// orderNumber: order.orderNumber,
|
|
13
|
-
// price: order.price,
|
|
14
|
-
// priceCurrency: order.priceCurrency,
|
|
15
|
-
// orderDate: order.orderDate
|
|
16
|
-
// };
|
|
17
10
|
// 返品後のEメール送信アクション
|
|
18
11
|
const emailMessagesOnReturn = [];
|
|
19
12
|
const sendEmailMessaegActionsOnReturn = [];
|
|
@@ -24,24 +17,16 @@ setting) {
|
|
|
24
17
|
order,
|
|
25
18
|
index,
|
|
26
19
|
...(sendEmailMessageParams.object !== undefined) ? { email: sendEmailMessageParams.object } : undefined,
|
|
27
|
-
...(params.emailMessageOnOrderReturned !== undefined)
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
// ...(params.emailMessageOnOrderReturned !== undefined)
|
|
21
|
+
// ? { emailMessage: params.emailMessageOnOrderReturned }
|
|
22
|
+
// : undefined
|
|
30
23
|
}, setting);
|
|
31
24
|
emailMessagesOnReturn.push(emailMessage);
|
|
32
25
|
return {
|
|
33
|
-
// project: order.project, // optimize(2024-06-25~)
|
|
34
|
-
// typeOf: factory.actionType.SendAction, // optimize(2024-06-25~)
|
|
35
|
-
// standardize object(2024-06-27~)
|
|
36
|
-
// object: emailMessage
|
|
37
26
|
object: {
|
|
38
27
|
identifier: emailMessage.identifier,
|
|
39
28
|
typeOf: factory_1.factory.creativeWorkType.EmailMessage
|
|
40
29
|
}
|
|
41
|
-
// agent: order.project, // optimize(2024-06-25~)
|
|
42
|
-
// recipient: { typeOf: order.customer.typeOf, id: order.customer.id }, // optimize(2024-06-25~)
|
|
43
|
-
// potentialActions: {} // optimize(2024-06-25~)
|
|
44
|
-
// purpose: sendActionPurpose // optimize(2024-06-25~)
|
|
45
30
|
};
|
|
46
31
|
})));
|
|
47
32
|
}
|
|
@@ -6,7 +6,6 @@ declare function createPotentialActions(params: {
|
|
|
6
6
|
orders: IReturningOrder4potentialActions[];
|
|
7
7
|
potentialActions?: factory.transaction.returnOrder.IPotentialActionsParams;
|
|
8
8
|
transaction: Pick<factory.transaction.returnOrder.ITransaction, 'agent' | 'object'>;
|
|
9
|
-
emailMessageOnOrderReturned?: factory.creativeWork.message.email.ICreativeWork;
|
|
10
9
|
}, setting: Pick<ISetting, 'defaultSenderEmail'>): Promise<{
|
|
11
10
|
emailMessages: factory.action.transfer.send.message.email.IObjectAsEmailMessage[];
|
|
12
11
|
potentialActions: factory.transaction.returnOrder.IPotentialActions;
|
|
@@ -22,9 +22,6 @@ setting) {
|
|
|
22
22
|
...(returnOrderActionParams !== undefined) ? { returnOrderActionParams } : undefined
|
|
23
23
|
}, setting);
|
|
24
24
|
emailMessages.push(...emailMessagesOnReturnInvoice);
|
|
25
|
-
// discontinue(2026-04-18~)
|
|
26
|
-
// // ポイント特典の数だけ、返却アクションを作成
|
|
27
|
-
// const returnPointAwardActions = await createReturnPointAwardActions({ ...params, order });
|
|
28
25
|
// 返品後のEメール送信アクション
|
|
29
26
|
const { emailMessagesOnReturn, sendEmailMessaegActionsOnReturn } = await (0, sendEmailMessage_1.createSendEmailMessaegActionsOnReturn)({
|
|
30
27
|
...params,
|
|
@@ -34,7 +31,6 @@ setting) {
|
|
|
34
31
|
emailMessages.push(...emailMessagesOnReturn);
|
|
35
32
|
const potentialActionsOnReturnOrder = {
|
|
36
33
|
returnPaymentMethod: returnPaymentMethodActions,
|
|
37
|
-
// returnPointAward: returnPointAwardActions, // discontinue(2026-04-18~)
|
|
38
34
|
sendEmailMessage: sendEmailMessaegActionsOnReturn
|
|
39
35
|
};
|
|
40
36
|
const returnOrderObject = {
|
|
@@ -144,7 +144,7 @@ function fixOrders(params) {
|
|
|
144
144
|
const acceptedOffers = await repos.acceptedOffer.searchAcceptedOffersByOrderNumber({
|
|
145
145
|
orderNumber: { $eq: params.object.order[0].orderNumber },
|
|
146
146
|
project: { id: { $eq: params.project.id } }
|
|
147
|
-
}
|
|
147
|
+
});
|
|
148
148
|
return { acceptedOffers, eventIds, offerIds, orders };
|
|
149
149
|
};
|
|
150
150
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { factory } from '../../factory';
|
|
2
2
|
import type { AcceptedOfferRepo } from '../../repo/acceptedOffer';
|
|
3
|
-
import type { EmailMessageRepo } from '../../repo/emailMessage';
|
|
4
3
|
import type { EventRepo } from '../../repo/event';
|
|
5
4
|
import type { MerchantReturnPolicyRepo } from '../../repo/merchantReturnPolicy';
|
|
6
5
|
import type { MessageRepo } from '../../repo/message';
|
|
@@ -41,7 +40,6 @@ type ITaskAndTransactionOperation<T> = (repos: IExportTasksByIdRepos) => Promise
|
|
|
41
40
|
declare function start(params: factory.transaction.returnOrder.IStartParamsWithoutDetail): IStartOperation<IStartedTransaction>;
|
|
42
41
|
interface IConfirmRepos {
|
|
43
42
|
acceptedOffer: AcceptedOfferRepo;
|
|
44
|
-
emailMessage?: EmailMessageRepo;
|
|
45
43
|
message: MessageRepo;
|
|
46
44
|
order: OrderRepo;
|
|
47
45
|
setting: SettingRepo;
|
|
@@ -112,17 +112,18 @@ function confirm(params) {
|
|
|
112
112
|
'orderedItem', 'paymentMethods', 'price', 'priceCurrency', 'project', 'seller', 'typeOf'
|
|
113
113
|
]
|
|
114
114
|
});
|
|
115
|
-
//
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
115
|
+
// discontinue emailMessageRepo
|
|
116
|
+
// // デフォルトEメールメッセージを検索
|
|
117
|
+
// let emailMessageOnOrderReturned: factory.creativeWork.message.email.ICreativeWork | undefined;
|
|
118
|
+
// if (repos.emailMessage !== undefined) {
|
|
119
|
+
// const searchEmailMessagesResult = await repos.emailMessage.search({
|
|
120
|
+
// limit: 1,
|
|
121
|
+
// page: 1,
|
|
122
|
+
// project: { id: { $eq: transaction.project.id } },
|
|
123
|
+
// about: { identifier: { $eq: factory.creativeWork.message.email.AboutIdentifier.OnOrderReturned } }
|
|
124
|
+
// });
|
|
125
|
+
// emailMessageOnOrderReturned = searchEmailMessagesResult.shift();
|
|
126
|
+
// }
|
|
126
127
|
const setting = await repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['defaultSenderEmail']);
|
|
127
128
|
if (typeof setting?.defaultSenderEmail !== 'string') {
|
|
128
129
|
throw new factory_1.factory.errors.NotFound('setting.defaultSenderEmail');
|
|
@@ -133,7 +134,7 @@ function confirm(params) {
|
|
|
133
134
|
orders: returningOrders,
|
|
134
135
|
transaction: transaction,
|
|
135
136
|
...(params.potentialActions !== undefined) ? { potentialActions: params.potentialActions } : undefined,
|
|
136
|
-
...(emailMessageOnOrderReturned !== undefined) ? { emailMessageOnOrderReturned } : undefined
|
|
137
|
+
// ...(emailMessageOnOrderReturned !== undefined) ? { emailMessageOnOrderReturned } : undefined
|
|
137
138
|
},
|
|
138
139
|
// settings
|
|
139
140
|
setting);
|
|
@@ -22,7 +22,7 @@ function validateOrder(params) {
|
|
|
22
22
|
const acceptedOffers = await repos.acceptedOffer.searchAcceptedOffersByOrderNumber({
|
|
23
23
|
orderNumber: { $eq: params.orderNumber },
|
|
24
24
|
project: { id: { $eq: params.project.id } }
|
|
25
|
-
}
|
|
25
|
+
});
|
|
26
26
|
let payTransactions = [];
|
|
27
27
|
if (order.paymentMethods.length > 0) {
|
|
28
28
|
payTransactions = await repos.assetTransaction.search({
|
package/lib/chevre/service.d.ts
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as AccountTransactionIdentifierFactory from './factory/accountTransactionIdentifier';
|
|
5
5
|
import * as EventFactory from './factory/event';
|
|
6
|
-
import * as OrderFactory from './factory/order';
|
|
7
6
|
import * as ReservedAgentIdentifireNamesFactory from './factory/reservedAgentIdentifireNames';
|
|
8
7
|
import * as TaskIdentifierFactory from './factory/taskIdentifier';
|
|
9
8
|
import * as TransactionFactory from './factory/transaction';
|
|
@@ -60,7 +59,6 @@ export declare namespace transaction {
|
|
|
60
59
|
export declare namespace factory {
|
|
61
60
|
export import accountTransactionIdentifier = AccountTransactionIdentifierFactory;
|
|
62
61
|
export import event = EventFactory;
|
|
63
|
-
export import order = OrderFactory;
|
|
64
62
|
export import reservedAgentIdentifireNames = ReservedAgentIdentifireNamesFactory;
|
|
65
63
|
export import taskIdentifier = TaskIdentifierFactory;
|
|
66
64
|
export import transaction = TransactionFactory;
|
package/lib/chevre/service.js
CHANGED
|
@@ -40,7 +40,6 @@ exports.factory = exports.transaction = exports.task = exports.reserve = exports
|
|
|
40
40
|
*/
|
|
41
41
|
const AccountTransactionIdentifierFactory = __importStar(require("./factory/accountTransactionIdentifier"));
|
|
42
42
|
const EventFactory = __importStar(require("./factory/event"));
|
|
43
|
-
const OrderFactory = __importStar(require("./factory/order"));
|
|
44
43
|
const ReservedAgentIdentifireNamesFactory = __importStar(require("./factory/reservedAgentIdentifireNames"));
|
|
45
44
|
const TaskIdentifierFactory = __importStar(require("./factory/taskIdentifier"));
|
|
46
45
|
const TransactionFactory = __importStar(require("./factory/transaction"));
|
|
@@ -183,7 +182,6 @@ var factory;
|
|
|
183
182
|
(function (factory) {
|
|
184
183
|
factory.accountTransactionIdentifier = AccountTransactionIdentifierFactory;
|
|
185
184
|
factory.event = EventFactory;
|
|
186
|
-
factory.order = OrderFactory;
|
|
187
185
|
factory.reservedAgentIdentifireNames = ReservedAgentIdentifireNamesFactory;
|
|
188
186
|
factory.taskIdentifier = TaskIdentifierFactory;
|
|
189
187
|
factory.transaction = TransactionFactory;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.600.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.600.0",
|
|
14
|
-
"@chevre/factory": "9.0.0-alpha.
|
|
14
|
+
"@chevre/factory": "9.0.0-alpha.3",
|
|
15
15
|
"@motionpicture/coa-service": "10.0.0",
|
|
16
16
|
"@motionpicture/gmo-service": "6.1.0-alpha.0",
|
|
17
17
|
"@sendgrid/client": "8.1.4",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"postversion": "git push origin --tags",
|
|
92
92
|
"prepublishOnly": "npm run clean && npm run build"
|
|
93
93
|
},
|
|
94
|
-
"version": "25.0.0-alpha.
|
|
94
|
+
"version": "25.0.0-alpha.11"
|
|
95
95
|
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AWARD_ACCOUNTS_IDENTIFIER_NAME = exports.POINT_AWARD_IDENTIFIER_NAME = void 0;
|
|
4
|
-
exports.POINT_AWARD_IDENTIFIER_NAME = 'pointAwardIdentifiers';
|
|
5
|
-
exports.AWARD_ACCOUNTS_IDENTIFIER_NAME = 'awardAccounts';
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { AccountingReportRepo } from '../../repo/accountingReport';
|
|
2
|
-
import type { ActionRepo } from '../../repo/action';
|
|
3
|
-
import type { OrderRepo } from '../../repo/order';
|
|
4
|
-
import type { TaskRepo } from '../../repo/task';
|
|
5
|
-
import { factory } from '../../factory';
|
|
6
|
-
import { IExternalOrder } from './onOrderStatusChanged';
|
|
7
|
-
/**
|
|
8
|
-
* 注文取引なしに注文を作成する
|
|
9
|
-
*/
|
|
10
|
-
declare function placeOrderWithoutTransaction(params: {
|
|
11
|
-
agent?: factory.action.trade.order.IAgent;
|
|
12
|
-
project: {
|
|
13
|
-
id: string;
|
|
14
|
-
};
|
|
15
|
-
object: IExternalOrder;
|
|
16
|
-
}): (repos: {
|
|
17
|
-
accountingReport: AccountingReportRepo;
|
|
18
|
-
action: ActionRepo;
|
|
19
|
-
order: OrderRepo;
|
|
20
|
-
task: TaskRepo;
|
|
21
|
-
}) => Promise<void>;
|
|
22
|
-
export { placeOrderWithoutTransaction };
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.placeOrderWithoutTransaction = placeOrderWithoutTransaction;
|
|
4
|
-
const factory_1 = require("../../factory");
|
|
5
|
-
/**
|
|
6
|
-
* 注文取引なしに注文を作成する
|
|
7
|
-
*/
|
|
8
|
-
function placeOrderWithoutTransaction(params) {
|
|
9
|
-
return async (repos) => {
|
|
10
|
-
const order = params.object;
|
|
11
|
-
const simpleOrder = {
|
|
12
|
-
typeOf: order.typeOf,
|
|
13
|
-
// seller: {
|
|
14
|
-
// id: order.seller.id,
|
|
15
|
-
// typeOf: order.seller.typeOf,
|
|
16
|
-
// name: order.seller.name
|
|
17
|
-
// }, // 廃止(2024-03-06~)
|
|
18
|
-
// customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id }, // 廃止(2024-03-06~)
|
|
19
|
-
orderNumber: order.orderNumber,
|
|
20
|
-
// price: order.price,
|
|
21
|
-
// priceCurrency: order.priceCurrency,
|
|
22
|
-
orderDate: order.orderDate
|
|
23
|
-
};
|
|
24
|
-
const orderActionAttributes = {
|
|
25
|
-
agent: (typeof params.agent?.typeOf === 'string') ? params.agent : order.project,
|
|
26
|
-
object: simpleOrder,
|
|
27
|
-
// potentialActions: {}, // discontinue(2024-06-28~)
|
|
28
|
-
project: order.project,
|
|
29
|
-
// purpose: { typeOf: placeOrderTransaction.typeOf, id: placeOrderTransaction.id },
|
|
30
|
-
typeOf: factory_1.factory.actionType.OrderAction
|
|
31
|
-
};
|
|
32
|
-
const action = await repos.action.start(orderActionAttributes);
|
|
33
|
-
try {
|
|
34
|
-
await repos.order.createIfNotExist({
|
|
35
|
-
...order,
|
|
36
|
-
// discounts: [], // 廃止(2024-04-16~)
|
|
37
|
-
acceptedOffers: []
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
try {
|
|
42
|
-
await repos.action.giveUp({ typeOf: orderActionAttributes.typeOf, id: action.id, error });
|
|
43
|
-
}
|
|
44
|
-
catch (__) {
|
|
45
|
-
// 失敗したら仕方ない
|
|
46
|
-
}
|
|
47
|
-
throw error;
|
|
48
|
-
}
|
|
49
|
-
await repos.action.completeWithVoid({ typeOf: orderActionAttributes.typeOf, id: action.id, result: {} });
|
|
50
|
-
};
|
|
51
|
-
}
|