@chevre/domain 26.0.0-alpha.41 → 26.0.0-alpha.42
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/action/cancel.d.ts +25 -0
- package/lib/chevre/repo/action/cancel.js +47 -0
- package/lib/chevre/repo/action/confirm.d.ts +11 -0
- package/lib/chevre/repo/action/confirm.js +16 -0
- package/lib/chevre/repo/action/order.d.ts +21 -0
- package/lib/chevre/repo/action/order.js +35 -0
- package/lib/chevre/repo/action/reserve.d.ts +21 -0
- package/lib/chevre/repo/action/reserve.js +37 -0
- package/lib/chevre/repo/action/returnAction.d.ts +11 -0
- package/lib/chevre/repo/action/returnAction.js +16 -0
- package/lib/chevre/repo/adminAction.d.ts +8 -2
- package/lib/chevre/repo/adminAction.js +6 -0
- package/lib/chevre/repo/mongoose/schemas/setting.d.ts +4 -14
- package/lib/chevre/repository.d.ts +0 -5
- package/lib/chevre/repository.js +2 -13
- package/lib/chevre/service/assetTransaction/pay/confirm.d.ts +0 -10
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorize.d.ts +0 -1
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeMovieTicket.d.ts +0 -1
- package/lib/chevre/service/assetTransaction/pay/start.d.ts +0 -1
- package/lib/chevre/service/assetTransaction/refund.d.ts +0 -1
- package/lib/chevre/service/assetTransaction/reserve/cancel.d.ts +4 -2
- package/lib/chevre/service/assetTransaction/reserve/confirm.d.ts +4 -2
- package/lib/chevre/service/assetTransaction/reserveCOA/cancel.d.ts +7 -3
- package/lib/chevre/service/offer/event/authorize.d.ts +0 -1
- package/lib/chevre/service/offer/event/issueEventOfferTicket.d.ts +0 -1
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.d.ts +4 -2
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4coa.d.ts +7 -3
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +4 -2
- package/lib/chevre/service/offer/event/voidTransaction.js +2 -2
- package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +4 -2
- package/lib/chevre/service/offer/event/voidTransactionByActionId.js +1 -1
- package/lib/chevre/service/order/confirmPayTransaction.d.ts +4 -10
- package/lib/chevre/service/order/confirmPayTransaction.js +3 -10
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.d.ts +4 -2
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +2 -2
- package/lib/chevre/service/order/placeOrder.d.ts +6 -4
- package/lib/chevre/service/order/placeOrder.js +9 -17
- package/lib/chevre/service/order/returnOrder.d.ts +4 -2
- package/lib/chevre/service/order/returnOrder.js +3 -3
- package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.d.ts +0 -1
- package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts +0 -1
- package/lib/chevre/service/payment/any/authorize.d.ts +0 -1
- package/lib/chevre/service/payment/any/invalidatePaymentUrl.d.ts +0 -1
- package/lib/chevre/service/payment/any/onPayActionCompleted.d.ts +0 -1
- package/lib/chevre/service/payment/any/onRefundActionCompletedOrFailed.d.ts +0 -1
- package/lib/chevre/service/payment/any/processVoidPayTransaction.d.ts +0 -1
- package/lib/chevre/service/payment/any/voidPayTransaction.d.ts +0 -1
- package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.d.ts +0 -1
- package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard3ds.d.ts +0 -1
- package/lib/chevre/service/payment/creditCard/authorize.d.ts +0 -1
- package/lib/chevre/service/payment/creditCard/payCreditCard.d.ts +0 -1
- package/lib/chevre/service/payment/creditCard/refundCreditCard.d.ts +0 -1
- package/lib/chevre/service/payment/faceToFace.d.ts +0 -2
- package/lib/chevre/service/payment/movieTicket/authorize.d.ts +0 -1
- package/lib/chevre/service/payment/movieTicket/payMovieTicket.d.ts +0 -1
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket.d.ts +0 -1
- package/lib/chevre/service/reserve/cancelReservation.d.ts +7 -3
- package/lib/chevre/service/reserve/cancelReservation.js +12 -22
- package/lib/chevre/service/reserve/checkInReservation.d.ts +4 -2
- package/lib/chevre/service/reserve/confirmReservation.d.ts +4 -2
- package/lib/chevre/service/reserve/confirmReservation.js +9 -35
- package/lib/chevre/service/reserve/useReservation.d.ts +2 -2
- package/lib/chevre/service/reserveCOA/cancelReservation.d.ts +4 -2
- package/lib/chevre/service/reserveCOA/cancelReservation.js +3 -3
- package/lib/chevre/service/task/cancelPendingReservation.js +3 -3
- package/lib/chevre/service/task/cancelReservation.js +3 -5
- package/lib/chevre/service/task/confirmPayTransaction.js +11 -12
- package/lib/chevre/service/task/confirmReserveTransaction.d.ts +6 -2
- package/lib/chevre/service/task/confirmReserveTransaction.js +9 -5
- package/lib/chevre/service/task/invalidatePaymentUrl.js +0 -1
- package/lib/chevre/service/task/onAuthorizationCreated.js +4 -13
- package/lib/chevre/service/task/onResourceUpdated.js +0 -2
- package/lib/chevre/service/task/pay.js +0 -1
- package/lib/chevre/service/task/payment/invalidatePaymentUrlByTask.d.ts +0 -1
- package/lib/chevre/service/task/payment/payByTask.d.ts +0 -1
- package/lib/chevre/service/task/payment/refundByTask.d.ts +0 -1
- package/lib/chevre/service/task/payment/voidPaymentByTask.d.ts +0 -2
- package/lib/chevre/service/task/placeOrder.js +8 -6
- package/lib/chevre/service/task/refund.js +0 -1
- package/lib/chevre/service/task/reserve.js +3 -6
- package/lib/chevre/service/task/returnOrder.js +2 -3
- package/lib/chevre/service/task/returnPayTransaction.js +7 -14
- package/lib/chevre/service/task/returnReserveTransaction.js +5 -5
- package/lib/chevre/service/task/useReservation.js +3 -3
- package/lib/chevre/service/task/voidPayment.js +0 -2
- package/lib/chevre/service/task/voidReserveTransaction.js +2 -2
- package/package.json +1 -1
- package/lib/chevre/repo/action.d.ts +0 -23
- package/lib/chevre/repo/action.js +0 -22
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { factory } from '../../factory';
|
|
2
|
-
import type {
|
|
3
|
-
import type { AccountingReportRepo } from '../../repo/accountingReport';
|
|
4
|
-
import type { ActionRepo } from '../../repo/action';
|
|
2
|
+
import type { ConfirmActionRepo } from '../../repo/action/confirm';
|
|
5
3
|
import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
6
|
-
import type { EventRepo } from '../../repo/event';
|
|
7
4
|
import type { OrderRepo } from '../../repo/order';
|
|
8
|
-
import type { ProjectRepo } from '../../repo/project';
|
|
9
5
|
import type { TaskRepo } from '../../repo/task';
|
|
10
6
|
declare function confirmPayTransaction(data: factory.task.IData<factory.taskName.ConfirmPayTransaction> & {
|
|
11
7
|
project: {
|
|
@@ -13,13 +9,11 @@ declare function confirmPayTransaction(data: factory.task.IData<factory.taskName
|
|
|
13
9
|
typeOf: factory.organizationType.Project;
|
|
14
10
|
};
|
|
15
11
|
}, options: Record<string, never>): (repos: {
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
actions: {
|
|
13
|
+
confirm: ConfirmActionRepo;
|
|
14
|
+
};
|
|
18
15
|
assetTransaction: AssetTransactionRepo;
|
|
19
16
|
order: OrderRepo;
|
|
20
|
-
accountingReport: AccountingReportRepo;
|
|
21
|
-
event: EventRepo;
|
|
22
|
-
project: ProjectRepo;
|
|
23
17
|
task: TaskRepo;
|
|
24
18
|
}) => Promise<void>;
|
|
25
19
|
export { confirmPayTransaction };
|
|
@@ -36,12 +36,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.confirmPayTransaction = confirmPayTransaction;
|
|
37
37
|
const util_1 = require("util");
|
|
38
38
|
const factory_1 = require("../../factory");
|
|
39
|
-
// import type { TransactionRepo } from '../../repo/transaction';
|
|
40
39
|
const PayTransactionService = __importStar(require("../assetTransaction/pay"));
|
|
41
40
|
function confirmPayTransaction(data, options) {
|
|
42
41
|
return async (repos) => {
|
|
43
42
|
// アクション開始
|
|
44
|
-
const action = await repos.
|
|
43
|
+
const action = await repos.actions.confirm.start(data);
|
|
45
44
|
try {
|
|
46
45
|
for (const confirmingTransaction of data.object) {
|
|
47
46
|
await PayTransactionService.confirm({
|
|
@@ -61,20 +60,14 @@ function confirmPayTransaction(data, options) {
|
|
|
61
60
|
? { object: { paymentMethod: { identifier: confirmingTransaction.object.paymentMethod.identifier } } }
|
|
62
61
|
: undefined
|
|
63
62
|
})({
|
|
64
|
-
acceptedOffer: repos.acceptedOffer,
|
|
65
|
-
action: repos.action,
|
|
66
|
-
accountingReport: repos.accountingReport,
|
|
67
63
|
assetTransaction: repos.assetTransaction,
|
|
68
|
-
event: repos.event,
|
|
69
64
|
order: repos.order,
|
|
70
|
-
// project: repos.project,
|
|
71
|
-
task: repos.task
|
|
72
65
|
});
|
|
73
66
|
}
|
|
74
67
|
}
|
|
75
68
|
catch (error) {
|
|
76
69
|
try {
|
|
77
|
-
await repos.
|
|
70
|
+
await repos.actions.confirm.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
78
71
|
}
|
|
79
72
|
catch (__) {
|
|
80
73
|
// 失敗したら仕方ない
|
|
@@ -83,7 +76,7 @@ function confirmPayTransaction(data, options) {
|
|
|
83
76
|
}
|
|
84
77
|
// アクション完了
|
|
85
78
|
const actionResult = {};
|
|
86
|
-
await repos.
|
|
79
|
+
await repos.actions.confirm.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
87
80
|
// processOrder連携(2023-08-23~)
|
|
88
81
|
await onConfirmed(data)({
|
|
89
82
|
task: repos.task
|
|
@@ -5,8 +5,10 @@ import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
|
5
5
|
import { factory } from '../../../factory';
|
|
6
6
|
type IPlaceOrderTransaction = Pick<factory.transaction.placeOrder.ITransaction, 'id' | 'project' | 'typeOf' | 'result' | 'object' | 'seller'>;
|
|
7
7
|
interface ICreatePlacingOrderFromExistingTransactionRepos {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
actions: {
|
|
9
|
+
authorizeOffer: AuthorizeOfferActionRepo;
|
|
10
|
+
authorizePaymentMethod: AuthorizePaymentMethodActionRepo;
|
|
11
|
+
};
|
|
10
12
|
orderInTransaction: OrderInTransactionRepo;
|
|
11
13
|
placeOrder: PlaceOrderRepo;
|
|
12
14
|
}
|
|
@@ -35,11 +35,11 @@ function createPlacingOrderFromExistingTransaction(params) {
|
|
|
35
35
|
const completedAuthorizeActionIds = authorizeActionsAsResult.map(({ id }) => id);
|
|
36
36
|
/* istanbul ignore else -- @preserve */
|
|
37
37
|
if (completedAuthorizeActionIds.length > 0) {
|
|
38
|
-
authorizePaymentActions = await repos.
|
|
38
|
+
authorizePaymentActions = await repos.actions.authorizePaymentMethod.findAuthorizePaymentMethodResultsById({
|
|
39
39
|
purpose: { id: placeOrderTransactionWithResult.id },
|
|
40
40
|
ids: completedAuthorizeActionIds
|
|
41
41
|
});
|
|
42
|
-
authorizeOfferActionsWithInstrument = await repos.
|
|
42
|
+
authorizeOfferActionsWithInstrument = await repos.actions.authorizeOffer.findAuthorizeOfferInstrumentsByIds({
|
|
43
43
|
purpose: { id: placeOrderTransactionWithResult.id },
|
|
44
44
|
ids: completedAuthorizeActionIds
|
|
45
45
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AcceptedOfferRepo } from '../../repo/acceptedOffer';
|
|
2
2
|
import type { AccountingReportRepo } from '../../repo/accountingReport';
|
|
3
|
-
import type {
|
|
3
|
+
import type { OrderActionRepo } from '../../repo/action/order';
|
|
4
4
|
import type { AuthorizeOfferActionRepo } from '../../repo/action/authorizeOffer';
|
|
5
5
|
import type { AuthorizePaymentMethodActionRepo } from '../../repo/action/authorizePaymentMethod';
|
|
6
6
|
import type { MessageRepo } from '../../repo/message';
|
|
@@ -14,9 +14,11 @@ import type { IntegrationSettingRepo as Settings } from '../../repo/setting/inte
|
|
|
14
14
|
interface IPlaceOrderRepos {
|
|
15
15
|
acceptedOffer: AcceptedOfferRepo;
|
|
16
16
|
accountingReport: AccountingReportRepo;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
actions: {
|
|
18
|
+
order: OrderActionRepo;
|
|
19
|
+
authorizeOffer: AuthorizeOfferActionRepo;
|
|
20
|
+
authorizePaymentMethod: AuthorizePaymentMethodActionRepo;
|
|
21
|
+
};
|
|
20
22
|
message: MessageRepo;
|
|
21
23
|
order: OrderRepo;
|
|
22
24
|
orderInTransaction: OrderInTransactionRepo;
|
|
@@ -17,8 +17,7 @@ function placeOrder(params) {
|
|
|
17
17
|
confirmationNumber: params.object.confirmationNumber,
|
|
18
18
|
orderNumber: params.object.orderNumber
|
|
19
19
|
})({
|
|
20
|
-
|
|
21
|
-
authorizePaymentMethodAction: repos.authorizePaymentMethodAction,
|
|
20
|
+
actions: repos.actions,
|
|
22
21
|
orderInTransaction: repos.orderInTransaction,
|
|
23
22
|
placeOrder: repos.placeOrder,
|
|
24
23
|
});
|
|
@@ -42,19 +41,12 @@ function placeOrder(params) {
|
|
|
42
41
|
typeOf: factory_1.factory.actionType.OrderAction
|
|
43
42
|
};
|
|
44
43
|
// 冪等性を担保(2023-05-31~)
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
purpose: {
|
|
52
|
-
id: { $in: [orderActionPurpose.id] },
|
|
53
|
-
typeOf: { $in: [orderActionPurpose.typeOf] }
|
|
54
|
-
}
|
|
55
|
-
}, ['id']);
|
|
56
|
-
if (completedActions.length === 0) {
|
|
57
|
-
const action = await repos.action.start(orderActionAttributes);
|
|
44
|
+
const completedAction = await repos.actions.order.findCompletedOrderAction({
|
|
45
|
+
object: { orderNumber: orderActionAttributes.object.orderNumber },
|
|
46
|
+
purpose: { id: orderActionPurpose.id }
|
|
47
|
+
});
|
|
48
|
+
if (completedAction === null) {
|
|
49
|
+
const action = await repos.actions.order.start(orderActionAttributes);
|
|
58
50
|
try {
|
|
59
51
|
// 冗長なオファーを除外する(念のため)
|
|
60
52
|
await (0, voidAcceptedOfferIfNecessary_1.voidAcceptedOfferIfNecessary)({
|
|
@@ -65,14 +57,14 @@ function placeOrder(params) {
|
|
|
65
57
|
}
|
|
66
58
|
catch (error) {
|
|
67
59
|
try {
|
|
68
|
-
await repos.
|
|
60
|
+
await repos.actions.order.giveUp({ typeOf: orderActionAttributes.typeOf, id: action.id, error });
|
|
69
61
|
}
|
|
70
62
|
catch (__) {
|
|
71
63
|
// 失敗したら仕方ない
|
|
72
64
|
}
|
|
73
65
|
throw error;
|
|
74
66
|
}
|
|
75
|
-
await repos.
|
|
67
|
+
await repos.actions.order.completeWithVoid({ typeOf: orderActionAttributes.typeOf, id: action.id, result: {} });
|
|
76
68
|
}
|
|
77
69
|
if (params.useOnOrderStatusChanged) {
|
|
78
70
|
// 経理レポートを保管->CreateAccountingReportへ移行(2024-02-02~)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AcceptedOfferRepo } from '../../repo/acceptedOffer';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ReturnActionRepo } from '../../repo/action/returnAction';
|
|
3
3
|
import type { OrderRepo } from '../../repo/order';
|
|
4
4
|
import type { SettingRepo } from '../../repo/setting';
|
|
5
5
|
import type { TaskRepo } from '../../repo/task';
|
|
@@ -17,7 +17,9 @@ declare function returnOrder(params: {
|
|
|
17
17
|
useOnOrderStatusChanged: boolean;
|
|
18
18
|
}): (repos: {
|
|
19
19
|
acceptedOffer: AcceptedOfferRepo;
|
|
20
|
-
|
|
20
|
+
actions: {
|
|
21
|
+
returnAction: ReturnActionRepo;
|
|
22
|
+
};
|
|
21
23
|
order: OrderRepo;
|
|
22
24
|
setting: SettingRepo;
|
|
23
25
|
task: TaskRepo;
|
|
@@ -80,7 +80,7 @@ function returnOrder(params) {
|
|
|
80
80
|
};
|
|
81
81
|
const returnedOwnershipInfos = [];
|
|
82
82
|
let returnedOrder;
|
|
83
|
-
const action = await repos.
|
|
83
|
+
const action = await repos.actions.returnAction.start(returnOrderActionAttributes);
|
|
84
84
|
try {
|
|
85
85
|
// ひとまず所有権管理を廃止するため、所有権返却処理は不要(2026-08-10)
|
|
86
86
|
// returnedOwnershipInfos = await processReturnOrder(order, dateReturned)({
|
|
@@ -98,7 +98,7 @@ function returnOrder(params) {
|
|
|
98
98
|
}
|
|
99
99
|
catch (error) {
|
|
100
100
|
try {
|
|
101
|
-
await repos.
|
|
101
|
+
await repos.actions.returnAction.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
102
102
|
}
|
|
103
103
|
catch (__) {
|
|
104
104
|
// 失敗したら仕方ない
|
|
@@ -106,7 +106,7 @@ function returnOrder(params) {
|
|
|
106
106
|
throw error;
|
|
107
107
|
}
|
|
108
108
|
const result = returnedOwnershipInfos;
|
|
109
|
-
await repos.
|
|
109
|
+
await repos.actions.returnAction.completeWithVoid({ typeOf: action.typeOf, id: action.id, result });
|
|
110
110
|
if (params.useOnOrderStatusChanged) {
|
|
111
111
|
await (0, onOrderStatusChanged_1.onOrderReturned)({
|
|
112
112
|
order: {
|
|
@@ -9,7 +9,6 @@ import type { TransactionNumberRepo } from '../../../../repo/transactionNumber';
|
|
|
9
9
|
import * as PayTransactionService from '../../../assetTransaction/pay';
|
|
10
10
|
import { IInvoiceByTicketToken } from '../factory';
|
|
11
11
|
interface IFixTransactionNumberRepos {
|
|
12
|
-
action?: never;
|
|
13
12
|
acceptPayAction: AcceptPayActionRepo;
|
|
14
13
|
authorizePaymentMethodAction: AuthorizePaymentMethodActionRepo;
|
|
15
14
|
authorization: AuthorizationRepo;
|
package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts
CHANGED
|
@@ -13,7 +13,6 @@ interface IAcceptAction2ticketResult {
|
|
|
13
13
|
ticketToken: string;
|
|
14
14
|
}
|
|
15
15
|
interface IHandlePrePublishedPaymentMethodIdOnAuthorizingRepos {
|
|
16
|
-
action?: never;
|
|
17
16
|
acceptPayAction: AcceptPayActionRepo;
|
|
18
17
|
authorizePaymentMethodAction: AuthorizePaymentMethodActionRepo;
|
|
19
18
|
authorization: AuthorizationRepo;
|
|
@@ -28,7 +28,6 @@ import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
|
28
28
|
import type { TransactionNumberRepo } from '../../../repo/transactionNumber';
|
|
29
29
|
interface IAuthorizeRepos {
|
|
30
30
|
accountingReport: AccountingReportRepo;
|
|
31
|
-
action?: never;
|
|
32
31
|
actions: {
|
|
33
32
|
pay: PayActionRepo;
|
|
34
33
|
refund: RefundActionRepo;
|
|
@@ -10,7 +10,6 @@ import type { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
|
|
|
10
10
|
import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
11
11
|
interface IInvalidatePaymentUrlRepos {
|
|
12
12
|
accountingReport: AccountingReportRepo;
|
|
13
|
-
action?: never;
|
|
14
13
|
acceptPayAction: AcceptPayActionRepo;
|
|
15
14
|
assetTransaction: AssetTransactionRepo;
|
|
16
15
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
@@ -7,7 +7,6 @@ import type { PayActionRepo } from '../../../repo/action/pay';
|
|
|
7
7
|
import type { RefundActionRepo } from '../../../repo/action/refund';
|
|
8
8
|
import type { TaskRepo } from '../../../repo/task';
|
|
9
9
|
interface IOnPayActionCompletedRepos {
|
|
10
|
-
action?: never;
|
|
11
10
|
actions: {
|
|
12
11
|
pay: PayActionRepo;
|
|
13
12
|
refund: RefundActionRepo;
|
|
@@ -4,7 +4,6 @@ import type { PayActionRepo } from '../../../repo/action/pay';
|
|
|
4
4
|
import type { RefundActionRepo } from '../../../repo/action/refund';
|
|
5
5
|
import type { TaskRepo } from '../../../repo/task';
|
|
6
6
|
interface IOnRefundActionCompletedOrFailedRepos {
|
|
7
|
-
action?: never;
|
|
8
7
|
actions: {
|
|
9
8
|
pay: PayActionRepo;
|
|
10
9
|
refund: RefundActionRepo;
|
|
@@ -5,7 +5,6 @@ import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
|
|
|
5
5
|
import type { TaskRepo } from '../../../repo/task';
|
|
6
6
|
import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
7
7
|
interface IProcessVoidPayTransactionRepos {
|
|
8
|
-
action?: never;
|
|
9
8
|
authorizePaymentMethodAction: AuthorizePaymentMethodActionRepo;
|
|
10
9
|
accountingReport: AccountingReportRepo;
|
|
11
10
|
assetTransaction: AssetTransactionRepo;
|
|
@@ -22,7 +22,6 @@ declare function voidPayTransaction(params: factory.task.IData<factory.taskName.
|
|
|
22
22
|
};
|
|
23
23
|
}): (repos: {
|
|
24
24
|
accountingReport: AccountingReportRepo;
|
|
25
|
-
action?: never;
|
|
26
25
|
acceptPayAction: AcceptPayActionRepo;
|
|
27
26
|
authorizePaymentMethodAction: AuthorizePaymentMethodActionRepo;
|
|
28
27
|
assetTransaction: AssetTransactionRepo;
|
|
@@ -9,7 +9,6 @@ interface ICreditCardPaymentAgencyTransaction3ds {
|
|
|
9
9
|
secureTran2Result: GMO.factory.service.credit.ISecureTran2Result;
|
|
10
10
|
}
|
|
11
11
|
interface IProcessAuthorizeCreditCard3dsRepos {
|
|
12
|
-
action?: never;
|
|
13
12
|
authorizeInvoiceAction: AuthorizeInvoiceActionRepo;
|
|
14
13
|
creditCardService: GMO.service.Credit;
|
|
15
14
|
}
|
|
@@ -41,7 +41,6 @@ payTransaction: IPayTransactionAsAuthorizeInvoiceAction, paymentServiceId: strin
|
|
|
41
41
|
id?: string;
|
|
42
42
|
};
|
|
43
43
|
}): (repos: {
|
|
44
|
-
action?: never;
|
|
45
44
|
authorizeInvoiceAction: AuthorizeInvoiceActionRepo;
|
|
46
45
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
47
46
|
paymentService: PaymentServiceRepo;
|
|
@@ -11,7 +11,6 @@ import type { IntegrationSettingRepo as Settings } from '../../../repo/setting/i
|
|
|
11
11
|
* クレジットカード決済
|
|
12
12
|
*/
|
|
13
13
|
declare function payCreditCard(params: factory.action.trade.pay.IAttributes): (repos: {
|
|
14
|
-
action?: never;
|
|
15
14
|
actions: {
|
|
16
15
|
pay: PayActionRepo;
|
|
17
16
|
refund: RefundActionRepo;
|
|
@@ -11,7 +11,6 @@ declare function voidTransaction(__: factory.task.voidPayment.IData): (___: {
|
|
|
11
11
|
product: ProductRepo;
|
|
12
12
|
}) => Promise<void>;
|
|
13
13
|
declare function payFaceToFace(params: factory.action.trade.pay.IAttributes): (repos: {
|
|
14
|
-
action?: never;
|
|
15
14
|
actions: {
|
|
16
15
|
pay: PayActionRepo;
|
|
17
16
|
refund: RefundActionRepo;
|
|
@@ -21,7 +20,6 @@ declare function payFaceToFace(params: factory.action.trade.pay.IAttributes): (r
|
|
|
21
20
|
task: TaskRepo;
|
|
22
21
|
}) => Promise<void>;
|
|
23
22
|
declare function refundFaceToFace(params: factory.task.refund.IData): (repos: {
|
|
24
|
-
action?: never;
|
|
25
23
|
actions: {
|
|
26
24
|
pay: PayActionRepo;
|
|
27
25
|
refund: RefundActionRepo;
|
|
@@ -10,7 +10,6 @@ import type { TaskRepo } from '../../../repo/task';
|
|
|
10
10
|
import { factory } from '../../../factory';
|
|
11
11
|
import type { IntegrationSettingRepo as Settings } from '../../../repo/setting/integration';
|
|
12
12
|
interface IPayOperationRepos {
|
|
13
|
-
action?: never;
|
|
14
13
|
actions: {
|
|
15
14
|
pay: PayActionRepo;
|
|
16
15
|
refund: RefundActionRepo;
|
|
@@ -7,7 +7,6 @@ import type { TaskRepo } from '../../../repo/task';
|
|
|
7
7
|
import { factory } from '../../../factory';
|
|
8
8
|
import type { IntegrationSettingRepo as Settings } from '../../../repo/setting/integration';
|
|
9
9
|
interface IRefundOperationRepos {
|
|
10
|
-
action?: never;
|
|
11
10
|
actions: {
|
|
12
11
|
pay: PayActionRepo;
|
|
13
12
|
refund: RefundActionRepo;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { factory } from '../../factory';
|
|
2
|
-
import type {
|
|
2
|
+
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';
|
|
@@ -10,7 +10,9 @@ import type { TaskRepo } from '../../repo/task';
|
|
|
10
10
|
* 保留予約取消
|
|
11
11
|
*/
|
|
12
12
|
declare function cancelPendingReservation(actionAttributes: factory.task.cancelPendingReservation.IPotentialCancelAction): (repos: {
|
|
13
|
-
|
|
13
|
+
actions: {
|
|
14
|
+
cancel: CancelActionRepo;
|
|
15
|
+
};
|
|
14
16
|
assetTransaction: AssetTransactionRepo;
|
|
15
17
|
stockHolder: StockHolderRepo;
|
|
16
18
|
offerRateLimit: OfferRateLimitRepo;
|
|
@@ -22,7 +24,9 @@ declare function cancelPendingReservation(actionAttributes: factory.task.cancelP
|
|
|
22
24
|
* 予約をキャンセルする
|
|
23
25
|
*/
|
|
24
26
|
declare function cancelReservation(actionAttributesList: factory.action.cancel.reservation.IAttributes[]): (repos: {
|
|
25
|
-
|
|
27
|
+
actions: {
|
|
28
|
+
cancel: CancelActionRepo;
|
|
29
|
+
};
|
|
26
30
|
stockHolder: StockHolderRepo;
|
|
27
31
|
offerRateLimit: OfferRateLimitRepo;
|
|
28
32
|
reservation: ReservationRepo;
|
|
@@ -52,24 +52,14 @@ function cancelPengindIfNotYet(params) {
|
|
|
52
52
|
let actionId;
|
|
53
53
|
const actionAttributes = (0, factory_2.createCancelPendingReservationAction)({ transaction: reserveTransaction });
|
|
54
54
|
// 冪等性を担保(2023-06-05~)
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
object: {
|
|
61
|
-
typeOf: { $eq: factory_1.factory.reservationType.ReservationPackage },
|
|
62
|
-
reservationNumber: { $eq: reserveTransaction.transactionNumber }
|
|
63
|
-
},
|
|
64
|
-
purpose: {
|
|
65
|
-
id: { $in: [params.purpose.id] },
|
|
66
|
-
typeOf: { $in: [params.purpose.typeOf] }
|
|
67
|
-
}
|
|
68
|
-
}, ['id']);
|
|
69
|
-
if (completedActions.length === 0) {
|
|
55
|
+
const completedAction = await repos.actions.cancel.findCompletedCancelAction({
|
|
56
|
+
object: { reservationNumber: reserveTransaction.transactionNumber },
|
|
57
|
+
purpose: { id: params.purpose.id }
|
|
58
|
+
});
|
|
59
|
+
if (completedAction === null) {
|
|
70
60
|
if (actionAttributes !== undefined) {
|
|
71
61
|
// アクション開始
|
|
72
|
-
const action = await repos.
|
|
62
|
+
const action = await repos.actions.cancel.start(actionAttributes);
|
|
73
63
|
actionId = action.id;
|
|
74
64
|
const actionObject = actionAttributes.object;
|
|
75
65
|
// let cancelResult: ICancelResult | undefined;
|
|
@@ -126,7 +116,7 @@ function cancelPengindIfNotYet(params) {
|
|
|
126
116
|
}
|
|
127
117
|
catch (error) {
|
|
128
118
|
try {
|
|
129
|
-
await repos.
|
|
119
|
+
await repos.actions.cancel.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
130
120
|
}
|
|
131
121
|
catch (__) {
|
|
132
122
|
// 失敗したら仕方ない
|
|
@@ -134,11 +124,11 @@ function cancelPengindIfNotYet(params) {
|
|
|
134
124
|
throw error;
|
|
135
125
|
}
|
|
136
126
|
const actionResult = {};
|
|
137
|
-
await repos.
|
|
127
|
+
await repos.actions.cancel.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
138
128
|
}
|
|
139
129
|
}
|
|
140
130
|
else {
|
|
141
|
-
actionId =
|
|
131
|
+
actionId = completedAction.id;
|
|
142
132
|
}
|
|
143
133
|
return {
|
|
144
134
|
reserveTransaction,
|
|
@@ -163,7 +153,7 @@ function cancelReservation(actionAttributesList) {
|
|
|
163
153
|
const now = new Date();
|
|
164
154
|
if (actionAttributesList.length > 0) {
|
|
165
155
|
await Promise.all(actionAttributesList.map(async (actionAttributes) => {
|
|
166
|
-
const action = await repos.
|
|
156
|
+
const action = await repos.actions.cancel.start(actionAttributes);
|
|
167
157
|
let cancelResult;
|
|
168
158
|
let canceledReservationForId;
|
|
169
159
|
try {
|
|
@@ -275,7 +265,7 @@ function cancelReservation(actionAttributesList) {
|
|
|
275
265
|
}
|
|
276
266
|
catch (error) {
|
|
277
267
|
try {
|
|
278
|
-
await repos.
|
|
268
|
+
await repos.actions.cancel.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
279
269
|
}
|
|
280
270
|
catch (__) {
|
|
281
271
|
// 失敗したら仕方ない
|
|
@@ -294,7 +284,7 @@ function cancelReservation(actionAttributesList) {
|
|
|
294
284
|
} : undefined
|
|
295
285
|
// canceledReservationId: canceledReservation?.id
|
|
296
286
|
};
|
|
297
|
-
await repos.
|
|
287
|
+
await repos.actions.cancel.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
298
288
|
let canceledReservations = [];
|
|
299
289
|
if (actionAttributes.object.typeOf === factory_1.factory.reservationType.ReservationPackage) {
|
|
300
290
|
const reservationNumber = actionAttributes.object.reservationNumber;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
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';
|
|
@@ -32,7 +32,9 @@ interface ICheckInReservationParams {
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
export declare function checkInReservation(params: ICheckInReservationParams): (repos: {
|
|
35
|
-
|
|
35
|
+
actions: {
|
|
36
|
+
reserve: ReserveActionRepo;
|
|
37
|
+
};
|
|
36
38
|
assetTransaction: AssetTransactionRepo;
|
|
37
39
|
code: AuthorizationRepo;
|
|
38
40
|
reservation: ReservationRepo;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { factory } from '../../factory';
|
|
2
|
-
import type {
|
|
2
|
+
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';
|
|
@@ -13,7 +13,9 @@ export declare function confirmReservation(params: {
|
|
|
13
13
|
useOnReservationConfirmed: boolean;
|
|
14
14
|
byTask: boolean;
|
|
15
15
|
}): (repos: {
|
|
16
|
-
|
|
16
|
+
actions: {
|
|
17
|
+
reserve: ReserveActionRepo;
|
|
18
|
+
};
|
|
17
19
|
assetTransaction: AssetTransactionRepo;
|
|
18
20
|
code: AuthorizationRepo;
|
|
19
21
|
reservation: ReservationRepo;
|
|
@@ -78,19 +78,6 @@ function reserveTransaction2action(params) {
|
|
|
78
78
|
// if (typeof transaction.object.underName?.typeOf === 'string') {
|
|
79
79
|
// underName = transaction.object.underName;
|
|
80
80
|
// }
|
|
81
|
-
// const moneyTransferActions: factory.action.transfer.moneyTransfer.IAttributes[] = [];
|
|
82
|
-
// const pendingReservations = (Array.isArray(transaction.object.subReservation)) ? transaction.object.subReservation : [];
|
|
83
|
-
// pendingReservations.forEach((reservation) => {
|
|
84
|
-
// const acceptedOffer4reservation = transaction.object.acceptedOffer?.find(
|
|
85
|
-
// (o) => o.itemOffered?.serviceOutput?.id === reservation.id
|
|
86
|
-
// );
|
|
87
|
-
// moneyTransferActions.push(...createMoneyTransferActions({
|
|
88
|
-
// acceptedOffer: acceptedOffer4reservation,
|
|
89
|
-
// reservation,
|
|
90
|
-
// transaction: params.transaction,
|
|
91
|
-
// underName
|
|
92
|
-
// }));
|
|
93
|
-
// });
|
|
94
81
|
const reservationPackage = {
|
|
95
82
|
reservationFor: {
|
|
96
83
|
id: String(reservationFor.id),
|
|
@@ -135,9 +122,7 @@ function createReservationUnderName(params) {
|
|
|
135
122
|
...((typeof telephone === 'string') && { telephone })
|
|
136
123
|
};
|
|
137
124
|
}
|
|
138
|
-
function reserveIfNotYet(
|
|
139
|
-
// params: factory.action.reserve.IAttributes,
|
|
140
|
-
params, options) {
|
|
125
|
+
function reserveIfNotYet(params, options) {
|
|
141
126
|
return async (repos) => {
|
|
142
127
|
const reservationPackage = params.object;
|
|
143
128
|
const reserveTransaction = (await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
@@ -152,23 +137,12 @@ params, options) {
|
|
|
152
137
|
const actionAttributes = reserveTransaction2action({ transaction: reserveTransaction });
|
|
153
138
|
// 冪等性を担保(2023-05-31~)
|
|
154
139
|
debug('searching completed reserveAction... byTask:', options?.byTask, 'reservationNumber:', reservationPackage.reservationNumber);
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
typeOf: { $eq: actionAttributes.object.typeOf }
|
|
162
|
-
// reservationNumber: { $eq: params.object.reservationNumber }
|
|
163
|
-
},
|
|
164
|
-
purpose: {
|
|
165
|
-
id: { $in: [actionAttributes.purpose.id] },
|
|
166
|
-
typeOf: { $in: [actionAttributes.purpose.typeOf] }
|
|
167
|
-
}
|
|
168
|
-
}, ['id']);
|
|
169
|
-
debug(completedActions.length, 'completed reserveAction found. byTask:', options?.byTask, 'reservationNumber:', reservationPackage.reservationNumber);
|
|
170
|
-
if (completedActions.length === 0) {
|
|
171
|
-
const action = await repos.action.start(actionAttributes);
|
|
140
|
+
const completedAction = await repos.actions.reserve.findCompletedReserveAction({
|
|
141
|
+
purpose: { id: actionAttributes.purpose.id }
|
|
142
|
+
});
|
|
143
|
+
debug(completedAction?.id, 'completed reserveAction found. byTask:', options?.byTask, 'reservationNumber:', reservationPackage.reservationNumber);
|
|
144
|
+
if (completedAction === null) {
|
|
145
|
+
const action = await repos.actions.reserve.start(actionAttributes);
|
|
172
146
|
try {
|
|
173
147
|
let underName;
|
|
174
148
|
const underNameByTransaction = reserveTransaction.object.underName;
|
|
@@ -217,7 +191,7 @@ params, options) {
|
|
|
217
191
|
}
|
|
218
192
|
catch (error) {
|
|
219
193
|
try {
|
|
220
|
-
await repos.
|
|
194
|
+
await repos.actions.reserve.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
221
195
|
}
|
|
222
196
|
catch (__) {
|
|
223
197
|
// 失敗したら仕方ない
|
|
@@ -225,7 +199,7 @@ params, options) {
|
|
|
225
199
|
throw error;
|
|
226
200
|
}
|
|
227
201
|
const actionResult = {};
|
|
228
|
-
await repos.
|
|
202
|
+
await repos.actions.reserve.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
229
203
|
}
|
|
230
204
|
return { actionAttributes, reserveTransaction };
|
|
231
205
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { factory } from '../../factory';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ReserveActionRepo } from '../../repo/action/reserve';
|
|
3
3
|
import type { UseActionRepo } from '../../repo/action/use';
|
|
4
4
|
import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
5
5
|
import type { AuthorizationRepo } from '../../repo/authorization';
|
|
@@ -26,9 +26,9 @@ export declare function useReservation(params: {
|
|
|
26
26
|
identifier?: string;
|
|
27
27
|
};
|
|
28
28
|
}): (repos: {
|
|
29
|
-
action: ActionRepo;
|
|
30
29
|
actions: {
|
|
31
30
|
use: UseActionRepo;
|
|
31
|
+
reserve: ReserveActionRepo;
|
|
32
32
|
};
|
|
33
33
|
assetTransaction: AssetTransactionRepo;
|
|
34
34
|
code: AuthorizationRepo;
|