@chevre/domain 28.1.0-alpha.4 → 28.1.0-alpha.5
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/offerCatalog.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/setting.d.ts +23 -20
- package/lib/chevre/repo/mongoose/schemas/setting.js +7 -4
- package/lib/chevre/repo/setting/integration.d.ts +1 -0
- package/lib/chevre/repo/setting/integration.js +31 -0
- package/lib/chevre/repo/setting.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserve/cancel.d.ts +3 -4
- package/lib/chevre/service/assetTransaction/reserve/cancel.js +1 -3
- package/lib/chevre/service/assetTransaction/reserve/confirm.d.ts +3 -4
- package/lib/chevre/service/assetTransaction/reserve/confirm.js +1 -3
- package/lib/chevre/service/assetTransaction/reserve/start.d.ts +3 -2
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +3 -2
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.js +2 -6
- package/lib/chevre/service/offer/event/authorize.d.ts +3 -2
- package/lib/chevre/service/offer/event/authorize.js +2 -2
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.d.ts +3 -4
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.js +2 -2
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +3 -4
- package/lib/chevre/service/offer/event/voidTransaction.js +3 -3
- package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +3 -4
- package/lib/chevre/service/offer/event/voidTransactionByActionId.js +2 -2
- package/lib/chevre/service/offer/onEventChanged.js +4 -4
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionCanceled.d.ts +0 -2
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.d.ts +3 -4
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.js +2 -2
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onReserveTransactionConfirmed.d.ts +0 -2
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.d.ts +3 -4
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.js +2 -2
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +2 -2
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.js +2 -4
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +3 -4
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +3 -3
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +1 -1
- package/lib/chevre/service/order/onOrderUpdated/factory.d.ts +2 -2
- package/lib/chevre/service/order/onOrderUpdated/factory.js +1 -1
- package/lib/chevre/service/order/onOrderUpdated.d.ts +2 -2
- package/lib/chevre/service/order/onOrderUpdated.js +1 -1
- package/lib/chevre/service/order/payOrder.d.ts +3 -4
- package/lib/chevre/service/order/payOrder.js +2 -2
- package/lib/chevre/service/order/placeOrder.d.ts +3 -4
- package/lib/chevre/service/order/placeOrder.js +2 -2
- package/lib/chevre/service/order/returnOrder.d.ts +2 -2
- package/lib/chevre/service/order/sendOrder.d.ts +2 -2
- package/lib/chevre/service/reserve/cancelReservation.d.ts +3 -3
- package/lib/chevre/service/reserve/checkInReservation.d.ts +2 -2
- package/lib/chevre/service/reserve/confirmReservation.d.ts +2 -2
- package/lib/chevre/service/reserve/potentialActions/onPendingReservationCanceled.d.ts +2 -2
- package/lib/chevre/service/reserve/potentialActions/onPendingReservationCanceled.js +2 -3
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +2 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +2 -3
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.d.ts +2 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +2 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +2 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.d.ts +2 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +2 -3
- package/lib/chevre/service/reserve/potentialActions/onReservationsCreated.d.ts +2 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationsCreated.js +2 -3
- package/lib/chevre/service/reserve/useReservation.d.ts +2 -2
- package/lib/chevre/service/task/cancelPendingReservation.js +3 -4
- package/lib/chevre/service/task/cancelReservation.js +2 -2
- package/lib/chevre/service/task/confirmReserveTransaction.d.ts +3 -4
- package/lib/chevre/service/task/confirmReserveTransaction.js +6 -7
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +3 -4
- package/lib/chevre/service/task/onAuthorizationCreated.js +2 -2
- package/lib/chevre/service/task/onOrderPaymentCompleted.js +2 -4
- package/lib/chevre/service/task/placeOrder.js +2 -4
- package/lib/chevre/service/task/reserve.js +2 -2
- package/lib/chevre/service/task/returnOrder.js +2 -2
- package/lib/chevre/service/task/sendOrder.js +2 -2
- package/lib/chevre/service/task/useReservation.js +2 -2
- package/lib/chevre/service/task/voidReserveTransaction.js +4 -5
- package/lib/chevre/service/taskHandler/onOperationFailed/informTaskIfNeeded.d.ts +2 -2
- package/lib/chevre/service/taskHandler/onOperationFailed/informTaskIfNeeded.js +4 -4
- package/lib/chevre/service/taskHandler/onOperationFailed.d.ts +2 -2
- package/lib/chevre/service/taskHandler.js +2 -2
- package/package.json +1 -1
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import type { AcceptedOfferRepo } from '../../../repo/acceptedOffer';
|
|
2
2
|
import type { MessageRepo } from '../../../repo/message';
|
|
3
3
|
import type { OrderRepo } from '../../../repo/order';
|
|
4
|
-
import type {
|
|
4
|
+
import type { IntegrationSettingRepo } from '../../../repo/setting/integration';
|
|
5
5
|
import type { TaskRepo } from '../../../repo/task';
|
|
6
|
-
import type { IntegrationSettingRepo as Settings } from '../../../repo/setting/integration';
|
|
7
6
|
interface IPaymentDue2ProcessingRepos {
|
|
8
7
|
acceptedOffer: AcceptedOfferRepo;
|
|
9
8
|
message: MessageRepo;
|
|
10
9
|
order: OrderRepo;
|
|
11
|
-
|
|
10
|
+
integrationSetting: IntegrationSettingRepo;
|
|
12
11
|
task: TaskRepo;
|
|
13
12
|
}
|
|
14
13
|
/**
|
|
@@ -21,5 +20,5 @@ declare function paymentDue2Processing(params: {
|
|
|
21
20
|
confirmationNumber: string;
|
|
22
21
|
orderNumber: string;
|
|
23
22
|
useOnOrderStatusChanged: boolean;
|
|
24
|
-
}): (repos: IPaymentDue2ProcessingRepos
|
|
23
|
+
}): (repos: IPaymentDue2ProcessingRepos) => Promise<void>;
|
|
25
24
|
export { IPaymentDue2ProcessingRepos, paymentDue2Processing, };
|
|
@@ -12,7 +12,7 @@ const debug = (0, debug_1.default)('chevre-domain:service:order');
|
|
|
12
12
|
* 全決済取引確定を完了した注文に関して、アイテムを処理する
|
|
13
13
|
*/
|
|
14
14
|
function paymentDue2Processing(params) {
|
|
15
|
-
return async (repos
|
|
15
|
+
return async (repos) => {
|
|
16
16
|
let order;
|
|
17
17
|
try {
|
|
18
18
|
order = await repos.order.changeStatus({
|
|
@@ -69,7 +69,7 @@ function paymentDue2Processing(params) {
|
|
|
69
69
|
orderStatus: factory_1.factory.orderStatus.OrderProcessing // 強制的にOrderProcessingとして処理する
|
|
70
70
|
},
|
|
71
71
|
// placeOrderTransaction
|
|
72
|
-
})(repos
|
|
72
|
+
})(repos);
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
75
|
}
|
|
@@ -2,7 +2,7 @@ import type { AcceptedOfferRepo } from '../../repo/acceptedOffer';
|
|
|
2
2
|
import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
3
3
|
import type { MessageRepo } from '../../repo/message';
|
|
4
4
|
import type { OrderRepo } from '../../repo/order';
|
|
5
|
-
import type {
|
|
5
|
+
import type { IntegrationSettingRepo } from '../../repo/setting/integration';
|
|
6
6
|
import type { TaskRepo } from '../../repo/task';
|
|
7
7
|
import type { PlaceOrderRepo } from '../../repo/transaction/placeOrder';
|
|
8
8
|
import { paymentDue2Processing } from './onAssetTransactionStatusChanged/paymentDue2Processing';
|
|
@@ -14,7 +14,7 @@ interface IOnAssetTransactionStatusChangedRepos {
|
|
|
14
14
|
assetTransaction: AssetTransactionRepo;
|
|
15
15
|
message: MessageRepo;
|
|
16
16
|
order: OrderRepo;
|
|
17
|
-
|
|
17
|
+
integrationSetting: IntegrationSettingRepo;
|
|
18
18
|
task: TaskRepo;
|
|
19
19
|
placeOrder: PlaceOrderRepo;
|
|
20
20
|
}
|
|
@@ -29,7 +29,7 @@ function onAssetTransactionStatusChanged(params) {
|
|
|
29
29
|
...params.object,
|
|
30
30
|
status: params.object.status
|
|
31
31
|
}
|
|
32
|
-
})(repos
|
|
32
|
+
})(repos);
|
|
33
33
|
break;
|
|
34
34
|
case factory_1.factory.assetTransactionType.COAReserveTransaction:
|
|
35
35
|
await (0, onReserveTransactionConfirmed_1.onReserveTransactionConfirmed)({
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { factory } from '../../../../factory';
|
|
2
|
-
import type {
|
|
2
|
+
import type { IIntegrationSettings } from '../../../../repo/setting/integration';
|
|
3
3
|
type IDeliveredOrder = Pick<factory.order.IOrder, 'id' | 'customer' | 'orderNumber' | 'project' | 'typeOf'> & {
|
|
4
4
|
orderStatus: factory.orderStatus.OrderDelivered;
|
|
5
5
|
};
|
|
6
|
-
declare function createInformTasks(order: IDeliveredOrder, setting:
|
|
6
|
+
declare function createInformTasks(order: IDeliveredOrder, setting: IIntegrationSettings['agg']): factory.task.IAttributes<factory.taskName.TriggerWebhook>[];
|
|
7
7
|
/**
|
|
8
8
|
* 注文配送後のアクション
|
|
9
9
|
*/
|
|
@@ -7,7 +7,7 @@ function createInformTasks(order,
|
|
|
7
7
|
setting) {
|
|
8
8
|
const taskRunsAt = new Date();
|
|
9
9
|
// const informOrder = settings.onOrderStatusChanged?.informOrder;
|
|
10
|
-
const informOrder = setting?.
|
|
10
|
+
const informOrder = setting?.informActions;
|
|
11
11
|
const informTasks = [];
|
|
12
12
|
const order4inform = creteOrder4inform(order);
|
|
13
13
|
const informIdentifier = `${factory_1.factory.order.OrderType.Order}:${order4inform.orderNumber}:${order4inform.orderStatus}`;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { factory } from '../../../factory';
|
|
2
|
-
import type {
|
|
2
|
+
import type { IntegrationSettingRepo } from '../../../repo/setting/integration';
|
|
3
3
|
import type { TaskRepo } from '../../../repo/task';
|
|
4
4
|
interface IOnOrderDeliveredRepos {
|
|
5
|
-
|
|
5
|
+
integrationSetting: IntegrationSettingRepo;
|
|
6
6
|
task: TaskRepo;
|
|
7
7
|
}
|
|
8
8
|
declare function onOrderDelivered(params: {
|
|
@@ -15,7 +15,7 @@ function onOrderDelivered(params) {
|
|
|
15
15
|
return async (repos
|
|
16
16
|
// settings: Settings
|
|
17
17
|
) => {
|
|
18
|
-
const setting = await repos.
|
|
18
|
+
const setting = await repos.integrationSetting.getByKey('agg');
|
|
19
19
|
debug('onOrderStatusChanged called.', params.order.orderNumber, params.order.orderStatus, params.order.orderDate);
|
|
20
20
|
let tasks;
|
|
21
21
|
// const sendOrderPotentialActions =
|
package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { factory } from '../../../../factory';
|
|
2
|
-
import type {
|
|
2
|
+
import type { IIntegrationSettings } from '../../../../repo/setting/integration';
|
|
3
3
|
type IInTransitOrder = Pick<factory.order.IOrder, 'confirmationNumber' | 'project' | 'typeOf' | 'seller' | 'orderNumber' | 'price' | 'priceCurrency' | 'orderDate' | 'customer' | 'id'> & {
|
|
4
4
|
/**
|
|
5
5
|
* 何ページ目の配送か
|
|
@@ -13,7 +13,7 @@ type IInTransitOrder = Pick<factory.order.IOrder, 'confirmationNumber' | 'projec
|
|
|
13
13
|
};
|
|
14
14
|
declare function createInformTasks(params: {
|
|
15
15
|
order: IInTransitOrder;
|
|
16
|
-
}, setting:
|
|
16
|
+
}, setting: IIntegrationSettings['agg']): factory.task.IAttributes<factory.taskName.TriggerWebhook>[];
|
|
17
17
|
declare function createNextSendOrderTasks(params: {
|
|
18
18
|
order: IInTransitOrder;
|
|
19
19
|
}): (import("@chevre/factory/lib/chevre/task").ITaskAttributes | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/createAccountingReport").IAttributes | import("@chevre/factory/lib/chevre/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/chevre/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/chevre/task/onEventChanged").IAttributes | import("@chevre/factory/lib/chevre/task/onResourceDeleted").IAttributes | import("@chevre/factory/lib/chevre/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/chevre/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/chevre/task/placeOrder").IAttributes | import("@chevre/factory/lib/chevre/task/returnOrder").IAttributes | import("@chevre/factory/lib/chevre/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/chevre/task/sendOrder").IAttributes | import("@chevre/factory/lib/chevre/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/chevre/task/useReservation").IAttributes | import("@chevre/factory/lib/chevre/task/voidPayTransaction").IAttributes)[];
|
|
@@ -39,7 +39,7 @@ setting) {
|
|
|
39
39
|
const { order } = params;
|
|
40
40
|
const taskRunsAt = new Date();
|
|
41
41
|
// const informOrder = settings.onOrderStatusChanged?.informOrder;
|
|
42
|
-
const informOrder = setting?.
|
|
42
|
+
const informOrder = setting?.informActions;
|
|
43
43
|
const informTasks = [];
|
|
44
44
|
const order4inform = creteOrder4inform(order);
|
|
45
45
|
const informIdentifier = `${factory_1.factory.order.OrderType.Order}:${order4inform.orderNumber}:${order4inform.orderStatus}:${order.acceptedOffers.page}`;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IntegrationSettingRepo } from '../../../repo/setting/integration';
|
|
2
2
|
import type { TaskRepo } from '../../../repo/task';
|
|
3
3
|
import { IInTransitOrder } from './onOrderDeliveredPartially/factory';
|
|
4
4
|
interface IOnOrderDeliveredPartiallyRepos {
|
|
5
|
-
|
|
5
|
+
integrationSetting: IntegrationSettingRepo;
|
|
6
6
|
task: TaskRepo;
|
|
7
7
|
}
|
|
8
8
|
declare function onOrderDeliveredPartially(params: {
|
|
@@ -12,10 +12,8 @@ const factory_1 = require("../../../factory");
|
|
|
12
12
|
const factory_2 = require("./onOrderDeliveredPartially/factory");
|
|
13
13
|
const debug = (0, debug_1.default)('chevre-domain:service:order');
|
|
14
14
|
function onOrderDeliveredPartially(params) {
|
|
15
|
-
return async (repos
|
|
16
|
-
|
|
17
|
-
) => {
|
|
18
|
-
const setting = await repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['onOrderStatusChanged']);
|
|
15
|
+
return async (repos) => {
|
|
16
|
+
const setting = await repos.integrationSetting.getByKey('agg');
|
|
19
17
|
debug('onOrderStatusChanged called.', params.order.orderNumber, params.order.orderStatus, params.order.orderDate);
|
|
20
18
|
let tasks;
|
|
21
19
|
switch (params.order.orderStatus) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { factory } from '../../../../factory';
|
|
2
|
-
import type {
|
|
2
|
+
import type { IIntegrationSettings } from '../../../../repo/setting/integration';
|
|
3
3
|
type IProcessingOrder = Pick<factory.order.IOrder, 'id' | 'orderNumber' | 'broker' | 'confirmationNumber' | 'customer' | 'dateReturned' | 'name' | 'orderDate' | 'orderStatus' | 'orderedItem' | 'paymentMethods' | 'previousOrderStatus' | 'price' | 'priceCurrency' | 'project' | 'returner' | 'seller' | 'typeOf'> & {
|
|
4
4
|
id: string;
|
|
5
5
|
numAcceptedOffers: number;
|
|
@@ -10,7 +10,7 @@ type ICreatingCheckResourceTask = Pick<factory.task.checkResource.IAttributes, '
|
|
|
10
10
|
identifier: string;
|
|
11
11
|
};
|
|
12
12
|
type ICreatingInformProcessingOrderTask = Pick<factory.task.IAttributes<factory.taskName.TriggerWebhook>, 'data' | 'executionResults' | 'name' | 'numberOfTried' | 'project' | 'remainingNumberOfTries' | 'runsAt' | 'status'>;
|
|
13
|
-
declare function createInformProcessingOrderTasks(order: IProcessingOrder, setting:
|
|
13
|
+
declare function createInformProcessingOrderTasks(order: IProcessingOrder, setting: IIntegrationSettings['agg']): ICreatingInformProcessingOrderTask[];
|
|
14
14
|
declare function createConfirmReservationActionObject4ChevreByOrder(params: {
|
|
15
15
|
order: Pick<factory.order.IOrder, 'confirmationNumber' | 'orderNumber'> & {
|
|
16
16
|
serialNumbers: string[];
|
|
@@ -10,7 +10,7 @@ const reservedAgentIdentifireNames_1 = require("../../../../factory/reservedAgen
|
|
|
10
10
|
const ASTERISK_CHARACTER = '*';
|
|
11
11
|
function createInformProcessingOrderTasks(order, setting) {
|
|
12
12
|
const taskRunsAt = new Date();
|
|
13
|
-
const informOrder = setting?.
|
|
13
|
+
const informOrder = setting?.informActions;
|
|
14
14
|
const informTasks = [];
|
|
15
15
|
const order4inform = creteProcessingOrderAsNotification(order);
|
|
16
16
|
const informIdentifier = `${factory_1.factory.order.OrderType.Order}:${order4inform.orderNumber}:${order4inform.orderStatus}`;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { MessageRepo } from '../../../repo/message';
|
|
2
|
-
import type {
|
|
2
|
+
import type { IntegrationSettingRepo } from '../../../repo/setting/integration';
|
|
3
3
|
import type { TaskRepo } from '../../../repo/task';
|
|
4
4
|
import { factory } from '../../../factory';
|
|
5
|
-
import type { IntegrationSettingRepo as Settings } from '../../../repo/setting/integration';
|
|
6
5
|
import { IExternalOrder, IProcessingOrder } from './onOrderProcessing/factory';
|
|
7
6
|
import { processOrder } from './onOrderProcessing/processOrder';
|
|
8
7
|
declare function onOrderProcessing(params: {
|
|
@@ -13,7 +12,7 @@ declare function onOrderProcessing(params: {
|
|
|
13
12
|
};
|
|
14
13
|
}): (repos: {
|
|
15
14
|
message: MessageRepo;
|
|
16
|
-
|
|
15
|
+
integrationSetting: IntegrationSettingRepo;
|
|
17
16
|
task: TaskRepo;
|
|
18
|
-
}
|
|
17
|
+
}) => Promise<void>;
|
|
19
18
|
export { IExternalOrder, onOrderProcessing, processOrder };
|
|
@@ -17,10 +17,10 @@ Object.defineProperty(exports, "processOrder", { enumerable: true, get: function
|
|
|
17
17
|
const debug = (0, debug_1.default)('chevre-domain:service:order');
|
|
18
18
|
// type IPlaceOrderTransaction = Pick<factory.transaction.placeOrder.ITransaction, 'id' | 'typeOf'>;
|
|
19
19
|
function onOrderProcessing(params) {
|
|
20
|
-
return async (repos
|
|
21
|
-
const setting = await repos.
|
|
20
|
+
return async (repos) => {
|
|
21
|
+
const setting = await repos.integrationSetting.getByKey('agg');
|
|
22
22
|
// const { numTryConfirmReserveTransaction } = settings;
|
|
23
|
-
const numTryConfirmReserveTransaction = await
|
|
23
|
+
const numTryConfirmReserveTransaction = await repos.integrationSetting.getByKey('numTryConfirmReserveTransaction');
|
|
24
24
|
debug('onOrderStatusChanged called.', params.order.orderNumber, params.order.orderStatus, params.order.orderDate);
|
|
25
25
|
let tasks;
|
|
26
26
|
let creatingCheckResourceTask;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { factory } from '../../../../factory';
|
|
2
|
-
import type {
|
|
2
|
+
import type { IIntegrationSettings } from '../../../../repo/setting/integration';
|
|
3
3
|
type IReturnedOrder = Pick<factory.order.IOrder, 'project' | 'typeOf' | 'orderNumber' | 'dateReturned' | 'id' | 'customer' | 'returner'>;
|
|
4
4
|
type IReturnAction = factory.action.transfer.returnAction.order.IAttributes & {
|
|
5
5
|
id: string;
|
|
6
6
|
};
|
|
7
|
-
declare function createInformTasks(order: IReturnedOrder, returnOrderAction: IReturnAction, setting:
|
|
7
|
+
declare function createInformTasks(order: IReturnedOrder, returnOrderAction: IReturnAction, setting: IIntegrationSettings['agg']): factory.task.IAttributes<factory.taskName.TriggerWebhook>[];
|
|
8
8
|
/**
|
|
9
9
|
* 注文返品後のアクション
|
|
10
10
|
*/
|
|
@@ -5,7 +5,7 @@ exports.createOnOrderReturnedTasksByTransaction = createOnOrderReturnedTasksByTr
|
|
|
5
5
|
const factory_1 = require("../../../../factory");
|
|
6
6
|
function createInformTasks(order, returnOrderAction, setting) {
|
|
7
7
|
const taskRunsAt = new Date();
|
|
8
|
-
const informOrder = setting?.
|
|
8
|
+
const informOrder = setting?.informActions;
|
|
9
9
|
// const useInformReturnAction = (<any>setting)?.onOrderStatusChanged?.useInformReturnAction === true; // discontinue(2025-07-01~)
|
|
10
10
|
const informTasks = [];
|
|
11
11
|
const informIdentifier = `${factory_1.factory.order.OrderType.Order}:${order.orderNumber}:${factory_1.factory.orderStatus.OrderReturned}`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AcceptedOfferRepo } from '../../../repo/acceptedOffer';
|
|
2
|
-
import type {
|
|
2
|
+
import type { IntegrationSettingRepo } from '../../../repo/setting/integration';
|
|
3
3
|
import type { TaskRepo } from '../../../repo/task';
|
|
4
4
|
import { factory } from '../../../factory';
|
|
5
5
|
import { IReturnAction } from './onOrderReturned/factory';
|
|
@@ -12,7 +12,7 @@ declare function onOrderReturned(params: {
|
|
|
12
12
|
returnOrderAction: IReturnAction;
|
|
13
13
|
}): (repos: {
|
|
14
14
|
acceptedOffer: AcceptedOfferRepo;
|
|
15
|
-
|
|
15
|
+
integrationSetting: IntegrationSettingRepo;
|
|
16
16
|
task: TaskRepo;
|
|
17
17
|
}) => Promise<void>;
|
|
18
18
|
export { onOrderReturned };
|
|
@@ -17,7 +17,7 @@ function onOrderReturned(params) {
|
|
|
17
17
|
return async (repos
|
|
18
18
|
// settings: Settings
|
|
19
19
|
) => {
|
|
20
|
-
const setting = await repos.
|
|
20
|
+
const setting = await repos.integrationSetting.getByKey('agg');
|
|
21
21
|
debug('onOrderStatusChanged called.', params.order.orderNumber, params.order.orderStatus, params.order.orderDate);
|
|
22
22
|
let tasks;
|
|
23
23
|
// const maskedCustomer = createMaskedCustomer(params.order, { noProfile: true });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { factory } from '../../../factory';
|
|
2
|
-
import type {
|
|
3
|
-
declare function createInformTasks(order: factory.notification.order.IUpdatedOrder4inform, setting:
|
|
2
|
+
import type { IIntegrationSettings } from '../../../repo/setting/integration';
|
|
3
|
+
declare function createInformTasks(order: factory.notification.order.IUpdatedOrder4inform, setting: IIntegrationSettings['agg']): factory.task.IAttributes<factory.taskName.TriggerWebhook>[];
|
|
4
4
|
export { createInformTasks };
|
|
@@ -6,7 +6,7 @@ function createInformTasks(order,
|
|
|
6
6
|
// settings: Settings,
|
|
7
7
|
setting) {
|
|
8
8
|
const taskRunsAt = new Date();
|
|
9
|
-
const informOrder = setting?.
|
|
9
|
+
const informOrder = setting?.informActions;
|
|
10
10
|
const informTasks = [];
|
|
11
11
|
const order4inform = creteOrder4inform(order);
|
|
12
12
|
if (Array.isArray(informOrder) && informOrder.length > 0) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 注文変更時処理
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { IntegrationSettingRepo } from '../../repo/setting/integration';
|
|
5
5
|
import type { TaskRepo } from '../../repo/task';
|
|
6
6
|
import { factory } from '../../factory';
|
|
7
7
|
export declare function onOrderUpdated(params: {
|
|
@@ -13,6 +13,6 @@ export declare function onOrderUpdated(params: {
|
|
|
13
13
|
};
|
|
14
14
|
updatedAt: Date;
|
|
15
15
|
}): (repos: {
|
|
16
|
-
|
|
16
|
+
integrationSetting: IntegrationSettingRepo;
|
|
17
17
|
task: TaskRepo;
|
|
18
18
|
}) => Promise<void>;
|
|
@@ -7,7 +7,7 @@ function onOrderUpdated(params) {
|
|
|
7
7
|
return async (repos
|
|
8
8
|
// settings: Settings
|
|
9
9
|
) => {
|
|
10
|
-
const setting = await repos.
|
|
10
|
+
const setting = await repos.integrationSetting.getByKey('agg');
|
|
11
11
|
const tasks = (0, factory_2.createInformTasks)({
|
|
12
12
|
typeOf: factory_1.factory.order.OrderType.Order,
|
|
13
13
|
orderNumber: params.orderNumber,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { AcceptedOfferRepo } from '../../repo/acceptedOffer';
|
|
2
2
|
import type { MessageRepo } from '../../repo/message';
|
|
3
3
|
import type { OrderRepo } from '../../repo/order';
|
|
4
|
-
import type {
|
|
4
|
+
import type { IntegrationSettingRepo } from '../../repo/setting/integration';
|
|
5
5
|
import type { TaskRepo } from '../../repo/task';
|
|
6
6
|
import type { PlaceOrderRepo } from '../../repo/transaction/placeOrder';
|
|
7
7
|
import { factory } from '../../factory';
|
|
8
|
-
import type { IntegrationSettingRepo as Settings } from '../../repo/setting/integration';
|
|
9
8
|
/**
|
|
10
9
|
* 注文を決済する
|
|
11
10
|
*/
|
|
@@ -13,8 +12,8 @@ declare function payOrder(params: factory.task.IData<factory.taskName.OnOrderPay
|
|
|
13
12
|
acceptedOffer: AcceptedOfferRepo;
|
|
14
13
|
message: MessageRepo;
|
|
15
14
|
order: OrderRepo;
|
|
16
|
-
|
|
15
|
+
integrationSetting: IntegrationSettingRepo;
|
|
17
16
|
task: TaskRepo;
|
|
18
17
|
placeOrder: PlaceOrderRepo;
|
|
19
|
-
}
|
|
18
|
+
}) => Promise<void>;
|
|
20
19
|
export { payOrder };
|
|
@@ -7,7 +7,7 @@ const factory_1 = require("../../factory");
|
|
|
7
7
|
* 注文を決済する
|
|
8
8
|
*/
|
|
9
9
|
function payOrder(params) {
|
|
10
|
-
return async (repos
|
|
10
|
+
return async (repos) => {
|
|
11
11
|
if (typeof params.useOnOrderStatusChanged !== 'boolean') {
|
|
12
12
|
throw new factory_1.factory.errors.Argument('useOnOrderStatusChanged', 'must be boolean');
|
|
13
13
|
}
|
|
@@ -18,6 +18,6 @@ function payOrder(params) {
|
|
|
18
18
|
confirmationNumber,
|
|
19
19
|
orderNumber,
|
|
20
20
|
useOnOrderStatusChanged: params.useOnOrderStatusChanged
|
|
21
|
-
})(repos
|
|
21
|
+
})(repos);
|
|
22
22
|
};
|
|
23
23
|
}
|
|
@@ -6,11 +6,10 @@ import type { AuthorizePaymentMethodActionRepo } from '../../repo/action/authori
|
|
|
6
6
|
import type { MessageRepo } from '../../repo/message';
|
|
7
7
|
import type { OrderRepo } from '../../repo/order';
|
|
8
8
|
import type { OrderInTransactionRepo } from '../../repo/orderInTransaction';
|
|
9
|
-
import type {
|
|
9
|
+
import type { IntegrationSettingRepo } from '../../repo/setting/integration';
|
|
10
10
|
import type { TaskRepo } from '../../repo/task';
|
|
11
11
|
import type { PlaceOrderRepo } from '../../repo/transaction/placeOrder';
|
|
12
12
|
import { factory } from '../../factory';
|
|
13
|
-
import type { IntegrationSettingRepo as Settings } from '../../repo/setting/integration';
|
|
14
13
|
interface IPlaceOrderRepos {
|
|
15
14
|
acceptedOffer: AcceptedOfferRepo;
|
|
16
15
|
accountingReport: AccountingReportRepo;
|
|
@@ -22,7 +21,7 @@ interface IPlaceOrderRepos {
|
|
|
22
21
|
message: MessageRepo;
|
|
23
22
|
order: OrderRepo;
|
|
24
23
|
orderInTransaction: OrderInTransactionRepo;
|
|
25
|
-
|
|
24
|
+
integrationSetting: IntegrationSettingRepo;
|
|
26
25
|
task: TaskRepo;
|
|
27
26
|
placeOrder: PlaceOrderRepo;
|
|
28
27
|
}
|
|
@@ -39,5 +38,5 @@ declare function placeOrder(params: {
|
|
|
39
38
|
orderNumber: string;
|
|
40
39
|
};
|
|
41
40
|
useOnOrderStatusChanged: boolean;
|
|
42
|
-
}): (repos: IPlaceOrderRepos
|
|
41
|
+
}): (repos: IPlaceOrderRepos) => Promise<void>;
|
|
43
42
|
export { IPlaceOrderRepos, placeOrder };
|
|
@@ -10,7 +10,7 @@ const voidAcceptedOfferIfNecessary_1 = require("./placeOrder/voidAcceptedOfferIf
|
|
|
10
10
|
* 注文を作成する
|
|
11
11
|
*/
|
|
12
12
|
function placeOrder(params) {
|
|
13
|
-
return async (repos
|
|
13
|
+
return async (repos) => {
|
|
14
14
|
// 注文番号から取引と注文をfixする
|
|
15
15
|
const { orderNumber, confirmationNumber, order, placeOrderTransaction, serialNumbers } = await (0, createPlacingOrderFromExistingTransaction_1.createPlacingOrderFromExistingTransaction)({
|
|
16
16
|
project: { id: params.project.id },
|
|
@@ -91,7 +91,7 @@ function placeOrder(params) {
|
|
|
91
91
|
confirmationNumber,
|
|
92
92
|
orderNumber,
|
|
93
93
|
useOnOrderStatusChanged: params.useOnOrderStatusChanged === true
|
|
94
|
-
})(repos
|
|
94
|
+
})(repos);
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
// return { order };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AcceptedOfferRepo } from '../../repo/acceptedOffer';
|
|
2
2
|
import type { ReturnActionRepo } from '../../repo/action/returnAction';
|
|
3
3
|
import type { OrderRepo } from '../../repo/order';
|
|
4
|
-
import type {
|
|
4
|
+
import type { IntegrationSettingRepo } from '../../repo/setting/integration';
|
|
5
5
|
import type { TaskRepo } from '../../repo/task';
|
|
6
6
|
import { factory } from '../../factory';
|
|
7
7
|
declare function returnOrder(params: {
|
|
@@ -21,7 +21,7 @@ declare function returnOrder(params: {
|
|
|
21
21
|
returnAction: ReturnActionRepo;
|
|
22
22
|
};
|
|
23
23
|
order: OrderRepo;
|
|
24
|
-
|
|
24
|
+
integrationSetting: IntegrationSettingRepo;
|
|
25
25
|
task: TaskRepo;
|
|
26
26
|
}) => Promise<void>;
|
|
27
27
|
export { returnOrder };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AcceptedOfferRepo } from '../../repo/acceptedOffer';
|
|
2
2
|
import type { SendOrderActionRepo } from '../../repo/action/sendOrder';
|
|
3
3
|
import type { OrderRepo } from '../../repo/order';
|
|
4
|
-
import type {
|
|
4
|
+
import type { IntegrationSettingRepo } from '../../repo/setting/integration';
|
|
5
5
|
import type { TaskRepo } from '../../repo/task';
|
|
6
6
|
import { factory } from '../../factory';
|
|
7
7
|
interface ISendOrderRepos {
|
|
@@ -10,7 +10,7 @@ interface ISendOrderRepos {
|
|
|
10
10
|
sendOrder: SendOrderActionRepo;
|
|
11
11
|
};
|
|
12
12
|
order: OrderRepo;
|
|
13
|
-
|
|
13
|
+
integrationSetting: IntegrationSettingRepo;
|
|
14
14
|
task: TaskRepo;
|
|
15
15
|
}
|
|
16
16
|
type ISendOperation<T> = (repos: ISendOrderRepos) => Promise<T>;
|
|
@@ -3,7 +3,7 @@ import type { CancelActionRepo } from '../../repo/action/cancel';
|
|
|
3
3
|
import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
4
4
|
import { OfferRateLimitRepo } from '../../repo/rateLimit/offer';
|
|
5
5
|
import { ReservationRepo } from '../../repo/reservation';
|
|
6
|
-
import type {
|
|
6
|
+
import type { IntegrationSettingRepo } from '../../repo/setting/integration';
|
|
7
7
|
import { StockHolderRepo } from '../../repo/stockHolder';
|
|
8
8
|
import type { TaskRepo } from '../../repo/task';
|
|
9
9
|
/**
|
|
@@ -17,7 +17,7 @@ declare function cancelPendingReservation(actionAttributes: factory.task.cancelP
|
|
|
17
17
|
stockHolder: StockHolderRepo;
|
|
18
18
|
offerRateLimit: OfferRateLimitRepo;
|
|
19
19
|
reservation: ReservationRepo;
|
|
20
|
-
|
|
20
|
+
integrationSetting: IntegrationSettingRepo;
|
|
21
21
|
task: TaskRepo;
|
|
22
22
|
}) => Promise<void>;
|
|
23
23
|
/**
|
|
@@ -30,7 +30,7 @@ declare function cancelReservation(actionAttributesList: factory.action.cancel.r
|
|
|
30
30
|
stockHolder: StockHolderRepo;
|
|
31
31
|
offerRateLimit: OfferRateLimitRepo;
|
|
32
32
|
reservation: ReservationRepo;
|
|
33
|
-
|
|
33
|
+
integrationSetting: IntegrationSettingRepo;
|
|
34
34
|
task: TaskRepo;
|
|
35
35
|
assetTransaction: AssetTransactionRepo;
|
|
36
36
|
}) => Promise<void>;
|
|
@@ -2,7 +2,7 @@ import type { ReserveActionRepo } from '../../repo/action/reserve';
|
|
|
2
2
|
import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
3
3
|
import type { AuthorizationRepo } from '../../repo/authorization';
|
|
4
4
|
import type { ReservationRepo } from '../../repo/reservation';
|
|
5
|
-
import type {
|
|
5
|
+
import type { IntegrationSettingRepo } from '../../repo/setting/integration';
|
|
6
6
|
import type { TaskRepo } from '../../repo/task';
|
|
7
7
|
interface ICheckInReservationParams {
|
|
8
8
|
project: {
|
|
@@ -38,7 +38,7 @@ export declare function checkInReservation(params: ICheckInReservationParams): (
|
|
|
38
38
|
assetTransaction: AssetTransactionRepo;
|
|
39
39
|
code: AuthorizationRepo;
|
|
40
40
|
reservation: ReservationRepo;
|
|
41
|
-
|
|
41
|
+
integrationSetting: IntegrationSettingRepo;
|
|
42
42
|
task: TaskRepo;
|
|
43
43
|
}) => Promise<void>;
|
|
44
44
|
export {};
|
|
@@ -3,7 +3,7 @@ import type { ReserveActionRepo } from '../../repo/action/reserve';
|
|
|
3
3
|
import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
4
4
|
import type { AuthorizationRepo } from '../../repo/authorization';
|
|
5
5
|
import type { ReservationRepo } from '../../repo/reservation';
|
|
6
|
-
import type {
|
|
6
|
+
import type { IntegrationSettingRepo } from '../../repo/setting/integration';
|
|
7
7
|
import type { TaskRepo } from '../../repo/task';
|
|
8
8
|
/**
|
|
9
9
|
* 予約を確定する
|
|
@@ -19,6 +19,6 @@ export declare function confirmReservation(params: {
|
|
|
19
19
|
assetTransaction: AssetTransactionRepo;
|
|
20
20
|
code: AuthorizationRepo;
|
|
21
21
|
reservation: ReservationRepo;
|
|
22
|
-
|
|
22
|
+
integrationSetting: IntegrationSettingRepo;
|
|
23
23
|
task: TaskRepo;
|
|
24
24
|
}) => Promise<void>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 保留予約取消時アクション
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { IntegrationSettingRepo } from '../../../repo/setting/integration';
|
|
5
5
|
import type { TaskRepo } from '../../../repo/task';
|
|
6
6
|
import { factory } from '../../../factory';
|
|
7
7
|
export declare function onPendingReservationCanceled(params: {
|
|
@@ -17,6 +17,6 @@ export declare function onPendingReservationCanceled(params: {
|
|
|
17
17
|
reservationNumber: string;
|
|
18
18
|
cancelAction?: Pick<factory.action.cancel.reservation.IAction, 'id' | 'instrument'>;
|
|
19
19
|
}): (repos: {
|
|
20
|
-
|
|
20
|
+
integrationSetting: IntegrationSettingRepo;
|
|
21
21
|
task: TaskRepo;
|
|
22
22
|
}) => Promise<void>;
|
|
@@ -9,10 +9,9 @@ function onPendingReservationCanceled(params) {
|
|
|
9
9
|
) => {
|
|
10
10
|
const { reservationFor, reservationNumber } = params;
|
|
11
11
|
// create AggregateScreeningEvent task -> migrate to agg(2024-10-29~)
|
|
12
|
-
const setting = await repos.
|
|
12
|
+
const setting = await repos.integrationSetting.getByKey('agg');
|
|
13
13
|
// inform(2024-10-25~)
|
|
14
|
-
|
|
15
|
-
const informReservations = setting?.onReservationStatusChanged?.informReservation;
|
|
14
|
+
const informReservations = setting?.informActions;
|
|
16
15
|
const now = new Date();
|
|
17
16
|
const taskAttributes = [];
|
|
18
17
|
const informObject = {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* 予約取消時アクション
|
|
3
3
|
*/
|
|
4
4
|
import { factory } from '../../../factory';
|
|
5
|
-
import type {
|
|
5
|
+
import type { IntegrationSettingRepo } from '../../../repo/setting/integration';
|
|
6
6
|
import type { TaskRepo } from '../../../repo/task';
|
|
7
7
|
export type ICanceledEventReservation = Pick<factory.reservation.eventReservation.IReservation, 'project' | 'id' | 'typeOf' | 'modifiedTime' | 'reservationNumber'>;
|
|
8
8
|
export declare function onReservationCanceled(
|
|
@@ -19,6 +19,6 @@ reservationFor: {
|
|
|
19
19
|
};
|
|
20
20
|
id: string;
|
|
21
21
|
}, cancelAction: Pick<factory.action.cancel.reservation.IAction, 'instrument'>): (repos: {
|
|
22
|
-
|
|
22
|
+
integrationSetting: IntegrationSettingRepo;
|
|
23
23
|
task: TaskRepo;
|
|
24
24
|
}) => Promise<void>;
|
|
@@ -20,9 +20,8 @@ reservationFor, cancelAction) {
|
|
|
20
20
|
return async (repos
|
|
21
21
|
// settings: Settings
|
|
22
22
|
) => {
|
|
23
|
-
const setting = await repos.
|
|
24
|
-
|
|
25
|
-
const informReservations = setting?.onReservationStatusChanged?.informReservation;
|
|
23
|
+
const setting = await repos.integrationSetting.getByKey('agg');
|
|
24
|
+
const informReservations = setting?.informActions;
|
|
26
25
|
let orderAsAbout;
|
|
27
26
|
if (Array.isArray(cancelAction.instrument)) {
|
|
28
27
|
for (const eachInstrument of cancelAction.instrument) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReservationRepo } from '../../../repo/reservation';
|
|
2
|
-
import type {
|
|
2
|
+
import type { IntegrationSettingRepo } from '../../../repo/setting/integration';
|
|
3
3
|
import type { TaskRepo } from '../../../repo/task';
|
|
4
4
|
export declare function onReservationCheckedIn(params: {
|
|
5
5
|
project: {
|
|
@@ -29,6 +29,6 @@ export declare function onReservationCheckedIn(params: {
|
|
|
29
29
|
};
|
|
30
30
|
}): (repos: {
|
|
31
31
|
reservation: ReservationRepo;
|
|
32
|
-
|
|
32
|
+
integrationSetting: IntegrationSettingRepo;
|
|
33
33
|
task: TaskRepo;
|
|
34
34
|
}) => Promise<void>;
|