@chevre/domain 24.0.0-alpha.2 → 24.0.0-alpha.21
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/acceptCOAOffer.d.ts +23 -0
- package/lib/chevre/repo/action/acceptCOAOffer.js +64 -0
- package/lib/chevre/repo/action/acceptPay.d.ts +8 -0
- package/lib/chevre/repo/action/acceptPay.js +13 -0
- package/lib/chevre/repo/action/actionProcess.d.ts +115 -0
- package/lib/chevre/repo/action/actionProcess.js +293 -0
- package/lib/chevre/repo/action/authorizeOffer.d.ts +21 -0
- package/lib/chevre/repo/action/authorizeOffer.js +85 -0
- package/lib/chevre/repo/action/checkMovieTicket.d.ts +111 -0
- package/lib/chevre/repo/action/checkMovieTicket.js +200 -0
- package/lib/chevre/repo/action/checkThing.d.ts +8 -0
- package/lib/chevre/repo/action/checkThing.js +13 -0
- package/lib/chevre/repo/action.d.ts +9 -249
- package/lib/chevre/repo/action.js +308 -708
- package/lib/chevre/repo/aggregateAction.d.ts +102 -0
- package/lib/chevre/repo/aggregateAction.js +379 -0
- package/lib/chevre/repo/mongoose/schemas/transaction.js +31 -0
- package/lib/chevre/repo/orderInTransaction.d.ts +8 -0
- package/lib/chevre/repo/orderInTransaction.js +16 -2
- package/lib/chevre/repo/orderNumber.d.ts +3 -2
- package/lib/chevre/repo/orderNumber.js +23 -28
- package/lib/chevre/repo/transaction/moneyTransfer.d.ts +61 -0
- package/lib/chevre/repo/transaction/moneyTransfer.js +379 -0
- package/lib/chevre/repo/transaction/placeOrder.d.ts +140 -0
- package/lib/chevre/repo/transaction/placeOrder.js +528 -0
- package/lib/chevre/repo/transaction/returnOrder.d.ts +45 -0
- package/lib/chevre/repo/transaction/returnOrder.js +341 -0
- package/lib/chevre/repo/transaction.d.ts +1 -125
- package/lib/chevre/repo/transaction.js +726 -632
- package/lib/chevre/repository.d.ts +49 -0
- package/lib/chevre/repository.js +107 -2
- package/lib/chevre/service/aggregation/system.d.ts +10 -10
- package/lib/chevre/service/aggregation/system.js +9 -9
- package/lib/chevre/service/assetTransaction/pay/check.d.ts +5 -4
- package/lib/chevre/service/assetTransaction/pay/publishPaymentUrl.d.ts +5 -2
- package/lib/chevre/service/assetTransaction/pay/publishPaymentUrl.js +3 -3
- package/lib/chevre/service/assetTransaction/pay/start/factory.d.ts +51 -3
- package/lib/chevre/service/assetTransaction/pay/start/factory.js +58 -21
- package/lib/chevre/service/assetTransaction/pay/start/preStart/fixPaymentService.d.ts +10 -0
- package/lib/chevre/service/assetTransaction/pay/start/preStart/fixPaymentService.js +88 -0
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorize.d.ts +55 -0
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorize.js +56 -0
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeMovieTicket.d.ts +3 -1
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeMovieTicket.js +1 -11
- package/lib/chevre/service/assetTransaction/pay/start.d.ts +2 -0
- package/lib/chevre/service/assetTransaction/pay/start.js +8 -132
- package/lib/chevre/service/notification/triggerWebhook.d.ts +7 -6
- package/lib/chevre/service/offer/event/authorize.d.ts +2 -2
- package/lib/chevre/service/offer/event/authorize.js +3 -3
- package/lib/chevre/service/offer/event/issueEventOfferTicket.d.ts +2 -2
- package/lib/chevre/service/offer/event/issueEventOfferTicket.js +1 -1
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.d.ts +0 -2
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.js +1 -0
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -2
- package/lib/chevre/service/offer/event/voidTransaction.js +2 -2
- package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +3 -3
- package/lib/chevre/service/offer/event/voidTransactionByActionId.js +2 -2
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.d.ts +16 -5
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +7 -7
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +6 -4
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +3 -10
- package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.js +21 -13
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +19 -10
- package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.d.ts +2 -2
- package/lib/chevre/service/offer/moneyTransfer/authorize.d.ts +2 -2
- package/lib/chevre/service/offer/moneyTransfer/authorize.js +6 -3
- package/lib/chevre/service/offer/moneyTransfer/voidTransaction.d.ts +2 -2
- package/lib/chevre/service/offer/moneyTransfer/voidTransaction.js +4 -1
- package/lib/chevre/service/offer/product.d.ts +3 -3
- package/lib/chevre/service/offer/product.js +4 -4
- package/lib/chevre/service/order/confirmPayTransaction.d.ts +0 -2
- package/lib/chevre/service/order/confirmPayTransaction.js +1 -0
- package/lib/chevre/service/order/findPlaceOrderTransaction.d.ts +2 -2
- package/lib/chevre/service/order/findPlaceOrderTransaction.js +1 -1
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/isDeliverable.d.ts +16 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/isDeliverable.js +97 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionCanceled.d.ts +21 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionCanceled.js +86 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.d.ts +22 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.js +112 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onReserveTransactionConfirmed.d.ts +22 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onReserveTransactionConfirmed.js +74 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.d.ts +25 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.js +111 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/processing2inTransit.d.ts +16 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/processing2inTransit.js +74 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +8 -30
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +37 -348
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.d.ts +6 -7
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.d.ts +6 -5
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.d.ts +7 -6
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +1 -1
- package/lib/chevre/service/order/payOrder.d.ts +2 -2
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.d.ts +2 -2
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +1 -1
- package/lib/chevre/service/order/placeOrder.d.ts +13 -12
- package/lib/chevre/service/order/returnOrder.d.ts +2 -2
- package/lib/chevre/service/order/returnOrder.js +1 -1
- package/lib/chevre/service/order/sendOrder.d.ts +6 -6
- package/lib/chevre/service/order/sendOrder.js +10 -8
- package/lib/chevre/service/order.d.ts +3 -6
- package/lib/chevre/service/order.js +3 -9
- package/lib/chevre/service/payment/any/{fixOrderAsNeeded.d.ts → authorize/fixOrderAsNeeded.d.ts} +6 -6
- package/lib/chevre/service/payment/any/{fixOrderAsNeeded.js → authorize/fixOrderAsNeeded.js} +5 -8
- package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.d.ts +3 -3
- package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts +3 -3
- package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.js +1 -1
- package/lib/chevre/service/payment/any/authorize.d.ts +92 -0
- package/lib/chevre/service/payment/any/authorize.js +225 -0
- package/lib/chevre/service/payment/any/findAcceptAction.d.ts +43 -0
- package/lib/chevre/service/payment/any/findAcceptAction.js +94 -0
- package/lib/chevre/service/payment/any/findAuthorizeAction.d.ts +41 -0
- package/lib/chevre/service/payment/any/findAuthorizeAction.js +83 -0
- package/lib/chevre/service/payment/any/findCheckAction.d.ts +45 -0
- package/lib/chevre/service/payment/any/findCheckAction.js +89 -0
- package/lib/chevre/service/payment/any/invalidatePaymentUrl.d.ts +28 -0
- package/lib/chevre/service/payment/any/invalidatePaymentUrl.js +185 -0
- package/lib/chevre/service/payment/any/onPayActionCompleted.d.ts +7 -3
- package/lib/chevre/service/payment/any/onPayActionCompleted.js +3 -0
- package/lib/chevre/service/payment/any/processVoidPayTransaction.d.ts +29 -0
- package/lib/chevre/service/payment/any/processVoidPayTransaction.js +125 -0
- package/lib/chevre/service/payment/any/publishPaymentUrl/fixTransactionNumberOnPublishPaymentUrl.d.ts +2 -2
- package/lib/chevre/service/payment/any/publishPaymentUrl.d.ts +66 -0
- package/lib/chevre/service/payment/any/publishPaymentUrl.js +133 -0
- package/lib/chevre/service/payment/any/voidPayTransaction.d.ts +31 -0
- package/lib/chevre/service/payment/any/voidPayTransaction.js +38 -0
- package/lib/chevre/service/payment/any.d.ts +8 -305
- package/lib/chevre/service/payment/any.js +17 -857
- package/lib/chevre/service/payment/movieTicket/authorize.d.ts +2 -0
- package/lib/chevre/service/payment/movieTicket/checkMovieTicket.d.ts +3 -3
- package/lib/chevre/service/payment/movieTicket/checkMovieTicket.js +3 -3
- package/lib/chevre/service/payment/movieTicket/validation.d.ts +11 -10
- package/lib/chevre/service/payment/movieTicket/validation.js +19 -15
- package/lib/chevre/service/report/telemetry.d.ts +4 -0
- package/lib/chevre/service/report/telemetry.js +7 -12
- package/lib/chevre/service/task/acceptCOAOffer.js +11 -6
- package/lib/chevre/service/task/authorizePayment.js +6 -2
- package/lib/chevre/service/task/checkMovieTicket.js +3 -3
- package/lib/chevre/service/task/checkResource.js +2 -2
- package/lib/chevre/service/task/confirmPayTransaction.js +2 -2
- package/lib/chevre/service/task/deleteTransaction.js +7 -1
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +4 -2
- package/lib/chevre/service/task/onOrderPaymentCompleted.js +2 -2
- package/lib/chevre/service/task/payment/payByTask.d.ts +14 -12
- package/lib/chevre/service/task/placeOrder.js +6 -4
- package/lib/chevre/service/task/publishPaymentUrl.js +8 -4
- package/lib/chevre/service/task/returnOrder.js +4 -4
- package/lib/chevre/service/task/returnPayTransaction.js +4 -3
- package/lib/chevre/service/task/sendOrder.js +4 -4
- package/lib/chevre/service/task/voidMoneyTransferTransaction.js +6 -3
- package/lib/chevre/service/task/voidPayTransaction.js +4 -2
- package/lib/chevre/service/task/voidRegisterServiceTransaction.js +3 -3
- package/lib/chevre/service/task/voidReserveTransaction.js +4 -3
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +6 -0
- package/lib/chevre/service/transaction/deleteTransaction.js +56 -14
- package/lib/chevre/service/transaction/moneyTransfer.d.ts +5 -5
- package/lib/chevre/service/transaction/moneyTransfer.js +5 -5
- package/lib/chevre/service/transaction/placeOrder/confirm.d.ts +2 -2
- package/lib/chevre/service/transaction/placeOrder/confirm.js +10 -9
- package/lib/chevre/service/transaction/placeOrder/exportTasksById.d.ts +7 -6
- package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/{publishOrderNumberIfNotExist.d.ts → issueOrderNumberIfNotExist.d.ts} +4 -4
- package/lib/chevre/service/transaction/placeOrder/{publishOrderNumberIfNotExist.js → issueOrderNumberIfNotExist.js} +21 -13
- package/lib/chevre/service/transaction/placeOrder/publishConfirmationNumberIfNotExist.d.ts +2 -2
- package/lib/chevre/service/transaction/placeOrder/publishConfirmationNumberIfNotExist.js +3 -3
- package/lib/chevre/service/transaction/placeOrder/start.d.ts +3 -3
- package/lib/chevre/service/transaction/placeOrder/start.js +2 -2
- package/lib/chevre/service/transaction/placeOrder/updateAgent.d.ts +23 -0
- package/lib/chevre/service/transaction/placeOrder/updateAgent.js +126 -0
- package/lib/chevre/service/transaction/placeOrder.d.ts +2 -1
- package/lib/chevre/service/transaction/placeOrder.js +3 -1
- package/lib/chevre/service/transaction/returnOrder/preStart.d.ts +1 -1
- package/lib/chevre/service/transaction/returnOrder.d.ts +16 -14
- package/lib/chevre/service/transaction/returnOrder.js +4 -4
- package/lib/chevre/service/transaction.d.ts +9 -21
- package/lib/chevre/service/transaction.js +5 -111
- package/package.json +4 -8
|
@@ -4,18 +4,18 @@ import type { OrderRepo } from '../../repo/order';
|
|
|
4
4
|
import type { OwnershipInfoRepo } from '../../repo/ownershipInfo';
|
|
5
5
|
import type { SettingRepo } from '../../repo/setting';
|
|
6
6
|
import type { TaskRepo } from '../../repo/task';
|
|
7
|
-
import type {
|
|
7
|
+
import type { PlaceOrderRepo } from '../../repo/transaction/placeOrder';
|
|
8
8
|
import * as factory from '../../factory';
|
|
9
|
-
|
|
10
|
-
type ISendOperation<T> = (repos: {
|
|
9
|
+
interface ISendOrderRepos {
|
|
11
10
|
acceptedOffer: AcceptedOfferRepo;
|
|
12
11
|
action: ActionRepo;
|
|
13
12
|
order: OrderRepo;
|
|
14
13
|
ownershipInfo: OwnershipInfoRepo;
|
|
15
14
|
setting: SettingRepo;
|
|
16
15
|
task: TaskRepo;
|
|
17
|
-
|
|
18
|
-
}
|
|
16
|
+
placeOrder: PlaceOrderRepo;
|
|
17
|
+
}
|
|
18
|
+
type ISendOperation<T> = (repos: ISendOrderRepos) => Promise<T>;
|
|
19
19
|
/**
|
|
20
20
|
* 注文を配送する
|
|
21
21
|
*/
|
|
@@ -35,4 +35,4 @@ declare function sendOrder(params: {
|
|
|
35
35
|
};
|
|
36
36
|
useOnOrderStatusChanged: boolean;
|
|
37
37
|
}): ISendOperation<void>;
|
|
38
|
-
export { sendOrder };
|
|
38
|
+
export { ISendOrderRepos, sendOrder };
|
|
@@ -30,9 +30,10 @@ exports.sendOrder = sendOrder;
|
|
|
30
30
|
const debug_1 = __importDefault(require("debug"));
|
|
31
31
|
// import { createMaskedCustomer } from '../../factory/order';
|
|
32
32
|
const factory_1 = require("../delivery/factory");
|
|
33
|
-
|
|
33
|
+
// import { findPlaceOrderTransaction } from './findPlaceOrderTransaction';
|
|
34
34
|
const onOrderStatusChanged_1 = require("./onOrderStatusChanged");
|
|
35
35
|
const factory = __importStar(require("../../factory"));
|
|
36
|
+
// import { Settings } from '../../settings';
|
|
36
37
|
const debug = (0, debug_1.default)('chevre-domain:service:order');
|
|
37
38
|
/**
|
|
38
39
|
* 注文を配送する
|
|
@@ -59,11 +60,11 @@ function sendOrder(params) {
|
|
|
59
60
|
try {
|
|
60
61
|
const orderNumber = params.object.orderNumber;
|
|
61
62
|
const confirmationNumber = params.object.confirmationNumber;
|
|
62
|
-
const placeOrderTransaction = await
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
})(
|
|
63
|
+
// const placeOrderTransaction = await findPlaceOrderTransaction({
|
|
64
|
+
// project: { id: params.project.id },
|
|
65
|
+
// confirmationNumber,
|
|
66
|
+
// orderNumber
|
|
67
|
+
// })(repos);
|
|
67
68
|
// 注文取得
|
|
68
69
|
let order = await repos.order.projectFieldsByOrderNumber({
|
|
69
70
|
orderNumber,
|
|
@@ -127,6 +128,7 @@ function sendOrder(params) {
|
|
|
127
128
|
});
|
|
128
129
|
acceptedOffers = searchSlicedAcceptedOffersResult.acceptedOffers;
|
|
129
130
|
debug('delivering...', order.orderNumber, acceptedOffers.map((offer) => `${offer.itemOffered.id}`), params.object.acceptedOffers, 'offerIndexBase:', offerIndexBase);
|
|
131
|
+
console.log('createOwnerships:', createOwnerships);
|
|
130
132
|
// 所有権作成
|
|
131
133
|
if (createOwnerships) {
|
|
132
134
|
creatingOwnershipInfos = (0, factory_1.createOwnershipInfosFromOrder)({
|
|
@@ -180,8 +182,8 @@ function sendOrder(params) {
|
|
|
180
182
|
orderStatus: factory.orderStatus.OrderDelivered,
|
|
181
183
|
price: order.price,
|
|
182
184
|
priceCurrency: order.priceCurrency
|
|
183
|
-
}
|
|
184
|
-
placeOrderTransaction
|
|
185
|
+
}
|
|
186
|
+
// placeOrderTransaction
|
|
185
187
|
})(repos);
|
|
186
188
|
}
|
|
187
189
|
else {
|
|
@@ -2,12 +2,9 @@
|
|
|
2
2
|
* 注文サービス
|
|
3
3
|
*/
|
|
4
4
|
import { confirmPayTransaction } from './order/confirmPayTransaction';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { onOrderProcessing, processOrder } from './order/onOrderStatusChanged';
|
|
5
|
+
import { paymentDue2Processing } from './order/onAssetTransactionStatusChanged';
|
|
6
|
+
import { processOrder } from './order/onOrderStatusChanged';
|
|
8
7
|
import { onOrderUpdated } from './order/onOrderUpdated';
|
|
9
|
-
import { payOrder } from './order/payOrder';
|
|
10
8
|
import { placeOrder } from './order/placeOrder';
|
|
11
9
|
import { placeOrderWithoutTransaction } from './order/placeOrderWithoutTransaction';
|
|
12
|
-
|
|
13
|
-
export { confirmPayTransaction, deleteOrder, onAssetTransactionStatusChanged, onOrderProcessing, onOrderUpdated, paymentDue2Processing, payOrder, placeOrder, placeOrderWithoutTransaction, processOrder, sendOrder };
|
|
10
|
+
export { confirmPayTransaction, onOrderUpdated, paymentDue2Processing, placeOrder, placeOrderWithoutTransaction, processOrder, };
|
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.processOrder = exports.placeOrderWithoutTransaction = exports.placeOrder = exports.paymentDue2Processing = exports.onOrderUpdated = exports.confirmPayTransaction = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* 注文サービス
|
|
6
6
|
*/
|
|
7
7
|
const confirmPayTransaction_1 = require("./order/confirmPayTransaction");
|
|
8
8
|
Object.defineProperty(exports, "confirmPayTransaction", { enumerable: true, get: function () { return confirmPayTransaction_1.confirmPayTransaction; } });
|
|
9
|
-
|
|
10
|
-
Object.defineProperty(exports, "deleteOrder", { enumerable: true, get: function () { return deleteOrder_1.deleteOrder; } });
|
|
9
|
+
// import { deleteOrder } from './order/deleteOrder';
|
|
11
10
|
const onAssetTransactionStatusChanged_1 = require("./order/onAssetTransactionStatusChanged");
|
|
12
|
-
Object.defineProperty(exports, "onAssetTransactionStatusChanged", { enumerable: true, get: function () { return onAssetTransactionStatusChanged_1.onAssetTransactionStatusChanged; } });
|
|
13
11
|
Object.defineProperty(exports, "paymentDue2Processing", { enumerable: true, get: function () { return onAssetTransactionStatusChanged_1.paymentDue2Processing; } });
|
|
14
12
|
const onOrderStatusChanged_1 = require("./order/onOrderStatusChanged");
|
|
15
|
-
Object.defineProperty(exports, "onOrderProcessing", { enumerable: true, get: function () { return onOrderStatusChanged_1.onOrderProcessing; } });
|
|
16
13
|
Object.defineProperty(exports, "processOrder", { enumerable: true, get: function () { return onOrderStatusChanged_1.processOrder; } });
|
|
17
14
|
const onOrderUpdated_1 = require("./order/onOrderUpdated");
|
|
18
15
|
Object.defineProperty(exports, "onOrderUpdated", { enumerable: true, get: function () { return onOrderUpdated_1.onOrderUpdated; } });
|
|
19
|
-
|
|
20
|
-
Object.defineProperty(exports, "payOrder", { enumerable: true, get: function () { return payOrder_1.payOrder; } });
|
|
16
|
+
// import { payOrder } from './order/payOrder';
|
|
21
17
|
const placeOrder_1 = require("./order/placeOrder");
|
|
22
18
|
Object.defineProperty(exports, "placeOrder", { enumerable: true, get: function () { return placeOrder_1.placeOrder; } });
|
|
23
19
|
const placeOrderWithoutTransaction_1 = require("./order/placeOrderWithoutTransaction");
|
|
24
20
|
Object.defineProperty(exports, "placeOrderWithoutTransaction", { enumerable: true, get: function () { return placeOrderWithoutTransaction_1.placeOrderWithoutTransaction; } });
|
|
25
|
-
const sendOrder_1 = require("./order/sendOrder");
|
|
26
|
-
Object.defineProperty(exports, "sendOrder", { enumerable: true, get: function () { return sendOrder_1.sendOrder; } });
|
package/lib/chevre/service/payment/any/{fixOrderAsNeeded.d.ts → authorize/fixOrderAsNeeded.d.ts}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as factory from '
|
|
2
|
-
import type { ConfirmationNumberRepo } from '
|
|
3
|
-
import type { OrderNumberRepo } from '
|
|
4
|
-
import type { ProjectRepo } from '
|
|
5
|
-
import type {
|
|
1
|
+
import * as factory from '../../../../factory';
|
|
2
|
+
import type { ConfirmationNumberRepo } from '../../../../repo/confirmationNumber';
|
|
3
|
+
import type { OrderNumberRepo } from '../../../../repo/orderNumber';
|
|
4
|
+
import type { ProjectRepo } from '../../../../repo/project';
|
|
5
|
+
import type { PlaceOrderRepo } from '../../../../repo/transaction/placeOrder';
|
|
6
6
|
declare function fixOrderAsNeeded(params: {
|
|
7
7
|
project: {
|
|
8
8
|
id: string;
|
|
@@ -10,7 +10,7 @@ declare function fixOrderAsNeeded(params: {
|
|
|
10
10
|
purpose: factory.action.authorize.paymentMethod.any.IPurpose;
|
|
11
11
|
}): (repos: {
|
|
12
12
|
project: ProjectRepo;
|
|
13
|
-
|
|
13
|
+
placeOrder: PlaceOrderRepo;
|
|
14
14
|
confirmationNumber: ConfirmationNumberRepo;
|
|
15
15
|
orderNumber: OrderNumberRepo;
|
|
16
16
|
}) => Promise<{
|
package/lib/chevre/service/payment/any/{fixOrderAsNeeded.js → authorize/fixOrderAsNeeded.js}
RENAMED
|
@@ -24,9 +24,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.fixOrderAsNeeded = fixOrderAsNeeded;
|
|
27
|
-
const factory = __importStar(require("
|
|
28
|
-
const publishConfirmationNumberIfNotExist_1 = require("
|
|
29
|
-
const
|
|
27
|
+
const factory = __importStar(require("../../../../factory"));
|
|
28
|
+
const publishConfirmationNumberIfNotExist_1 = require("../../../transaction/placeOrder/publishConfirmationNumberIfNotExist");
|
|
29
|
+
const issueOrderNumberIfNotExist_1 = require("../../../transaction/placeOrder/issueOrderNumberIfNotExist");
|
|
30
30
|
function fixOrderAsNeeded(params) {
|
|
31
31
|
return async (repos) => {
|
|
32
32
|
const orderDate = new Date();
|
|
@@ -38,13 +38,10 @@ function fixOrderAsNeeded(params) {
|
|
|
38
38
|
id: params.purpose.id,
|
|
39
39
|
status: { $in: [factory.transactionStatusType.InProgress] },
|
|
40
40
|
object: { orderDate }
|
|
41
|
-
})(
|
|
42
|
-
confirmationNumber: repos.confirmationNumber,
|
|
43
|
-
transaction: repos.transaction
|
|
44
|
-
});
|
|
41
|
+
})(repos);
|
|
45
42
|
// }
|
|
46
43
|
// publish orderNumber(2025-02-14~)
|
|
47
|
-
const orderNumber = await (0,
|
|
44
|
+
const orderNumber = await (0, issueOrderNumberIfNotExist_1.issueOrderNumberIfNotExist)({
|
|
48
45
|
project: { id: params.project.id },
|
|
49
46
|
id: params.purpose.id,
|
|
50
47
|
object: { orderDate }
|
|
@@ -2,7 +2,7 @@ import * as factory from '../../../../factory';
|
|
|
2
2
|
import type { ActionRepo } from '../../../../repo/action';
|
|
3
3
|
import type { AuthorizationRepo } from '../../../../repo/authorization';
|
|
4
4
|
import type { TicketRepo } from '../../../../repo/ticket';
|
|
5
|
-
import type { ITransactionInProgress,
|
|
5
|
+
import type { ITransactionInProgress, PlaceOrderRepo } from '../../../../repo/transaction/placeOrder';
|
|
6
6
|
import type { TransactionNumberRepo } from '../../../../repo/transactionNumber';
|
|
7
7
|
import * as PayTransactionService from '../../../assetTransaction/pay';
|
|
8
8
|
import { IInvoiceByTicketToken } from '../factory';
|
|
@@ -10,7 +10,7 @@ interface IFixTransactionNumberRepos {
|
|
|
10
10
|
action: ActionRepo;
|
|
11
11
|
authorization: AuthorizationRepo;
|
|
12
12
|
ticket: TicketRepo;
|
|
13
|
-
|
|
13
|
+
placeOrder: PlaceOrderRepo;
|
|
14
14
|
transactionNumber: TransactionNumberRepo;
|
|
15
15
|
}
|
|
16
16
|
type IFixTransactionNumberOperation<T> = (repos: IFixTransactionNumberRepos) => Promise<T>;
|
|
@@ -22,7 +22,7 @@ type IObjectWithoutDetail = factory.action.authorize.paymentMethod.any.IObjectWi
|
|
|
22
22
|
*/
|
|
23
23
|
declare function fixTransactionNumber(params: {
|
|
24
24
|
object: IObjectWithoutDetail;
|
|
25
|
-
transaction: Pick<ITransactionInProgress
|
|
25
|
+
transaction: Pick<ITransactionInProgress, 'agent' | 'expires' | 'id' | 'typeOf' | 'project' | 'seller'>;
|
|
26
26
|
paymentServiceType: factory.service.paymentService.PaymentServiceType;
|
|
27
27
|
}): IFixTransactionNumberOperation<{
|
|
28
28
|
transactionNumber: string;
|
package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as factory from '../../../../factory';
|
|
|
2
2
|
import type { ActionRepo } from '../../../../repo/action';
|
|
3
3
|
import type { AuthorizationRepo } from '../../../../repo/authorization';
|
|
4
4
|
import type { TicketRepo } from '../../../../repo/ticket';
|
|
5
|
-
import type { ITransactionInProgress,
|
|
5
|
+
import type { ITransactionInProgress, PlaceOrderRepo } from '../../../../repo/transaction/placeOrder';
|
|
6
6
|
import * as PayTransactionService from '../../../assetTransaction/pay';
|
|
7
7
|
import type { IInvoiceByTicketToken } from '../factory';
|
|
8
8
|
type IObjectWithoutDetail = factory.action.authorize.paymentMethod.any.IObjectWithoutDetail;
|
|
@@ -16,12 +16,12 @@ interface IAcceptAction2ticketResult {
|
|
|
16
16
|
declare function handlePrePublishedPaymentMethodIdOnAuthorizing(params: {
|
|
17
17
|
object: Pick<IObjectWithoutDetail, 'amount' | 'issuedThrough' | 'paymentMethod' | 'referencesOrder'>;
|
|
18
18
|
prePublishedPaymentMethodId: string;
|
|
19
|
-
transaction: Pick<ITransactionInProgress
|
|
19
|
+
transaction: Pick<ITransactionInProgress, 'agent' | 'expires' | 'id' | 'typeOf' | 'project' | 'seller'>;
|
|
20
20
|
}): (repos: {
|
|
21
21
|
action: ActionRepo;
|
|
22
22
|
authorization: AuthorizationRepo;
|
|
23
23
|
ticket: TicketRepo;
|
|
24
|
-
|
|
24
|
+
placeOrder: PlaceOrderRepo;
|
|
25
25
|
}) => Promise<{
|
|
26
26
|
authorizeParams?: {
|
|
27
27
|
creditCard: factory.action.authorize.paymentMethod.any.ICreditCard;
|
package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.js
CHANGED
|
@@ -122,7 +122,7 @@ function handlePrePublishedPaymentMethodIdOnAuthorizing(params) {
|
|
|
122
122
|
let acceptPayAction;
|
|
123
123
|
// transaction.objectへのアクセス回避(2024-05-30~)
|
|
124
124
|
// const paymentMethodByTransaction = transaction.object.paymentMethods;
|
|
125
|
-
const paymentMethodByTransaction = await repos.
|
|
125
|
+
const paymentMethodByTransaction = await repos.placeOrder.findInProgressPaymentMethodId({ id: params.transaction.id });
|
|
126
126
|
if (params.prePublishedPaymentMethodId === paymentMethodByTransaction?.paymentMethodId) {
|
|
127
127
|
// check existence of acceptAction when authorizing payment(2024-06-01~)
|
|
128
128
|
acceptPayAction = (await repos.action.search({
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as factory from '../../../factory';
|
|
2
|
+
import { Settings } from '../../../settings';
|
|
3
|
+
import type { AcceptedPaymentMethodRepo } from '../../../repo/acceptedPaymentMethod';
|
|
4
|
+
import type { AccountingReportRepo } from '../../../repo/accountingReport';
|
|
5
|
+
import type { ActionRepo } from '../../../repo/action';
|
|
6
|
+
import type { CheckMovieTicketActionRepo } from '../../../repo/action/checkMovieTicket';
|
|
7
|
+
import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
|
|
8
|
+
import type { AuthorizationRepo } from '../../../repo/authorization';
|
|
9
|
+
import type { ConfirmationNumberRepo } from '../../../repo/confirmationNumber';
|
|
10
|
+
import type { CredentialsRepo } from '../../../repo/credentials';
|
|
11
|
+
import type { EventRepo } from '../../../repo/event';
|
|
12
|
+
import type { EventSeriesRepo } from '../../../repo/eventSeries';
|
|
13
|
+
import type { OrderNumberRepo } from '../../../repo/orderNumber';
|
|
14
|
+
import type { PaymentServiceRepo } from '../../../repo/paymentService';
|
|
15
|
+
import type { PaymentServiceProviderRepo } from '../../../repo/paymentServiceProvider';
|
|
16
|
+
import type { PotentialActionRepo } from '../../../repo/potentialAction';
|
|
17
|
+
import type { ProductRepo } from '../../../repo/product';
|
|
18
|
+
import type { ProjectRepo } from '../../../repo/project';
|
|
19
|
+
import type { SellerPaymentAcceptedRepo } from '../../../repo/sellerPaymentAccepted';
|
|
20
|
+
import type { TaskRepo } from '../../../repo/task';
|
|
21
|
+
import type { TicketRepo } from '../../../repo/ticket';
|
|
22
|
+
import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
23
|
+
import type { TransactionNumberRepo } from '../../../repo/transactionNumber';
|
|
24
|
+
interface IAuthorizeRepos {
|
|
25
|
+
acceptedPaymentMethod: AcceptedPaymentMethodRepo;
|
|
26
|
+
accountingReport: AccountingReportRepo;
|
|
27
|
+
action: ActionRepo;
|
|
28
|
+
checkMovieTicketAction: CheckMovieTicketActionRepo;
|
|
29
|
+
assetTransaction: AssetTransactionRepo;
|
|
30
|
+
authorization: AuthorizationRepo;
|
|
31
|
+
confirmationNumber: ConfirmationNumberRepo;
|
|
32
|
+
credentials: CredentialsRepo;
|
|
33
|
+
event: EventRepo;
|
|
34
|
+
eventSeries: EventSeriesRepo;
|
|
35
|
+
orderNumber: OrderNumberRepo;
|
|
36
|
+
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
37
|
+
paymentService: PaymentServiceRepo;
|
|
38
|
+
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
39
|
+
potentialAction: PotentialActionRepo;
|
|
40
|
+
product: ProductRepo;
|
|
41
|
+
project: ProjectRepo;
|
|
42
|
+
task: TaskRepo;
|
|
43
|
+
ticket: TicketRepo;
|
|
44
|
+
placeOrder: PlaceOrderRepo;
|
|
45
|
+
transactionNumber: TransactionNumberRepo;
|
|
46
|
+
}
|
|
47
|
+
type IAuthorizeOperation<T> = (repos: IAuthorizeRepos, settings: Settings) => Promise<T>;
|
|
48
|
+
type IObjectWithoutDetail = factory.action.authorize.paymentMethod.any.IObjectWithoutDetail & {
|
|
49
|
+
ticketToken?: string;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* 決済承認
|
|
53
|
+
* CreditCard,MovieTicket -> 決済承認タスクから呼ばれる
|
|
54
|
+
* FaceToFace,PaymentCard -> apiから呼ばれる
|
|
55
|
+
*/
|
|
56
|
+
declare function authorize(params: {
|
|
57
|
+
project: {
|
|
58
|
+
id: string;
|
|
59
|
+
};
|
|
60
|
+
agent: {
|
|
61
|
+
id: string;
|
|
62
|
+
};
|
|
63
|
+
object: IObjectWithoutDetail;
|
|
64
|
+
purpose: factory.action.authorize.paymentMethod.any.IPurpose;
|
|
65
|
+
paymentServiceType: factory.service.paymentService.PaymentServiceType;
|
|
66
|
+
location?: factory.action.trade.pay.ILocation;
|
|
67
|
+
options: {
|
|
68
|
+
/**
|
|
69
|
+
* アクション失敗時に即時に決済取引を中止するかどうか
|
|
70
|
+
*/
|
|
71
|
+
useCancelPayTransactionOnFailed: boolean;
|
|
72
|
+
checkedAction: {
|
|
73
|
+
id: string;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
sameAs?: {
|
|
77
|
+
/**
|
|
78
|
+
* 実行元タスクID
|
|
79
|
+
*/
|
|
80
|
+
id: string;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* ツールとしての対応決済方法オファー
|
|
84
|
+
*/
|
|
85
|
+
instrument: factory.action.trade.pay.IAcceptedPaymentMethodOfferAsInstrument[];
|
|
86
|
+
}): IAuthorizeOperation<{
|
|
87
|
+
/**
|
|
88
|
+
* 承認アクションID
|
|
89
|
+
*/
|
|
90
|
+
id: string;
|
|
91
|
+
}>;
|
|
92
|
+
export { authorize, IAuthorizeRepos };
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.authorize = authorize;
|
|
27
|
+
const util = __importStar(require("util"));
|
|
28
|
+
const factory = __importStar(require("../../../factory"));
|
|
29
|
+
const PayTransactionService = __importStar(require("../../assetTransaction/pay"));
|
|
30
|
+
const fixTransactionNumber_1 = require("./authorize/fixTransactionNumber");
|
|
31
|
+
const factory_1 = require("./factory");
|
|
32
|
+
const fixOrderAsNeeded_1 = require("./authorize/fixOrderAsNeeded");
|
|
33
|
+
const processVoidPayTransaction_1 = require("./processVoidPayTransaction");
|
|
34
|
+
/**
|
|
35
|
+
* 承認アクションオブジェクトから冗長な属性を排除する
|
|
36
|
+
*/
|
|
37
|
+
function minimizeObjectIncludingPaymentMethodDetails(authorizeObjectIncludingPaymentMethodDetails) {
|
|
38
|
+
const { accountId, paymentMethodId, typeOf } = authorizeObjectIncludingPaymentMethodDetails;
|
|
39
|
+
return { authorizeObject: { accountId, paymentMethodId, typeOf } }; // optimize(2024-06-26~)
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* 決済承認
|
|
43
|
+
* CreditCard,MovieTicket -> 決済承認タスクから呼ばれる
|
|
44
|
+
* FaceToFace,PaymentCard -> apiから呼ばれる
|
|
45
|
+
*/
|
|
46
|
+
function authorize(params) {
|
|
47
|
+
return async (repos, settings) => {
|
|
48
|
+
const { paymentServiceType, purpose, project } = params;
|
|
49
|
+
if (purpose.typeOf !== factory.transactionType.PlaceOrder) {
|
|
50
|
+
throw new factory.errors.NotImplemented(`purpose.typeOf '${purpose.typeOf} not implemented'`);
|
|
51
|
+
}
|
|
52
|
+
const transaction = await repos.placeOrder.findPlaceOrderInProgressById({ typeOf: purpose.typeOf, id: purpose.id }, ['agent', 'expires', 'typeOf', 'project', 'seller']);
|
|
53
|
+
if (project.id !== transaction.project.id) {
|
|
54
|
+
throw new factory.errors.NotFound(factory.transactionType.PlaceOrder);
|
|
55
|
+
}
|
|
56
|
+
const { confirmationNumber, orderNumber } = await (0, fixOrderAsNeeded_1.fixOrderAsNeeded)({
|
|
57
|
+
project: { id: transaction.project.id },
|
|
58
|
+
purpose
|
|
59
|
+
// paymentServiceType
|
|
60
|
+
})(repos);
|
|
61
|
+
// 取引番号生成
|
|
62
|
+
const fixTransactionNumberResult = await (0, fixTransactionNumber_1.fixTransactionNumber)({
|
|
63
|
+
object: params.object,
|
|
64
|
+
transaction,
|
|
65
|
+
paymentServiceType
|
|
66
|
+
})(repos);
|
|
67
|
+
if (typeof fixTransactionNumberResult.id === 'string') {
|
|
68
|
+
return { id: fixTransactionNumberResult.id };
|
|
69
|
+
}
|
|
70
|
+
const { transactionNumber, pendingPaymentAgencyTransaction, creditCard, invoiceByTicketToken, ticketToken } = fixTransactionNumberResult;
|
|
71
|
+
const movieTickets = (Array.isArray(params.object.movieTickets)) ? params.object.movieTickets.map(factory_1.createMovieTicket) : undefined;
|
|
72
|
+
const { accountId } = await fixAccountIdIfPossible({
|
|
73
|
+
object: params.object, project: { id: transaction.project.id }
|
|
74
|
+
})();
|
|
75
|
+
const authorizeObjectIncludingPaymentMethodDetails = {
|
|
76
|
+
...params.object,
|
|
77
|
+
accountId,
|
|
78
|
+
paymentMethodId: transactionNumber,
|
|
79
|
+
typeOf: factory.action.authorize.paymentMethod.any.ResultType.Payment,
|
|
80
|
+
// support referencesOrder(2025-11-24~)
|
|
81
|
+
referencesOrder: (params.object.referencesOrder?.typeOf === factory.order.OrderType.Order)
|
|
82
|
+
? params.object.referencesOrder
|
|
83
|
+
: { typeOf: factory.order.OrderType.Order },
|
|
84
|
+
...(creditCard !== undefined) ? { creditCard } : undefined,
|
|
85
|
+
...(Array.isArray(movieTickets)) ? { movieTickets } : undefined
|
|
86
|
+
};
|
|
87
|
+
const { authorizeObject } = minimizeObjectIncludingPaymentMethodDetails(authorizeObjectIncludingPaymentMethodDetails);
|
|
88
|
+
// 承認アクションを開始する
|
|
89
|
+
const taskId = params.sameAs?.id;
|
|
90
|
+
const uniqueActionIdentifier = util.format(`%s:%s:%s`, factory.actionType.AuthorizeAction, factory.action.authorize.paymentMethod.any.ResultType.Payment, authorizeObject.paymentMethodId);
|
|
91
|
+
const actionAttributes = {
|
|
92
|
+
project: transaction.project,
|
|
93
|
+
typeOf: factory.actionType.AuthorizeAction,
|
|
94
|
+
object: authorizeObject,
|
|
95
|
+
agent: {
|
|
96
|
+
typeOf: transaction.agent.typeOf,
|
|
97
|
+
id: transaction.agent.id
|
|
98
|
+
},
|
|
99
|
+
instrument: {
|
|
100
|
+
typeOf: factory.assetTransactionType.Pay, // 資産取引化(2024-03-11~)
|
|
101
|
+
identifier: factory.action.authorize.paymentMethod.any.ServiceIdentifier.Chevre,
|
|
102
|
+
transactionNumber
|
|
103
|
+
},
|
|
104
|
+
recipient: {
|
|
105
|
+
typeOf: transaction.seller.typeOf,
|
|
106
|
+
id: transaction.seller.id,
|
|
107
|
+
name: (typeof transaction.seller.name === 'string')
|
|
108
|
+
? transaction.seller.name
|
|
109
|
+
: String(transaction.seller.name?.ja)
|
|
110
|
+
},
|
|
111
|
+
purpose: { typeOf: transaction.typeOf, id: transaction.id },
|
|
112
|
+
identifier: uniqueActionIdentifier, // add unique identifier(2025-02-25~)
|
|
113
|
+
...(typeof taskId === 'string') ? { sameAs: { id: taskId, typeOf: 'Task' } } : undefined // タスク関連付け(2024-04-22~)
|
|
114
|
+
};
|
|
115
|
+
const action = await repos.action.start(actionAttributes);
|
|
116
|
+
let payTransaction;
|
|
117
|
+
try {
|
|
118
|
+
const startParams = (0, factory_1.creatPayTransactionStartParams)({
|
|
119
|
+
accountId,
|
|
120
|
+
object: authorizeObjectIncludingPaymentMethodDetails,
|
|
121
|
+
paymentServiceType,
|
|
122
|
+
transaction: transaction,
|
|
123
|
+
transactionNumber: transactionNumber,
|
|
124
|
+
location: params.location,
|
|
125
|
+
// confirmationNumber required(2025-02-12~)
|
|
126
|
+
// orderNumber required(2025-02-14~)
|
|
127
|
+
order: { confirmationNumber, orderNumber },
|
|
128
|
+
action: { id: action.id, typeOf: action.typeOf },
|
|
129
|
+
ticketToken,
|
|
130
|
+
instrument: params.instrument
|
|
131
|
+
});
|
|
132
|
+
payTransaction = await PayTransactionService.start(startParams, {
|
|
133
|
+
// useCheckByIdentifierIfNotYet: params.options.useCheckByIdentifierIfNotYet,
|
|
134
|
+
executor: (typeof taskId === 'string') ? { id: taskId } : {}, // タスク関連付け(2024-05-18~)
|
|
135
|
+
purpose: { id: transaction.id },
|
|
136
|
+
checkedAction: params.options.checkedAction,
|
|
137
|
+
...(pendingPaymentAgencyTransaction !== undefined) ? { pendingPaymentAgencyTransaction } : undefined
|
|
138
|
+
})(repos, settings);
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
try {
|
|
142
|
+
await repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
143
|
+
}
|
|
144
|
+
catch (__) {
|
|
145
|
+
// no op
|
|
146
|
+
}
|
|
147
|
+
// 即時に決済取引を中止するか?(2023-02-03~)
|
|
148
|
+
if (params.options.useCancelPayTransactionOnFailed) {
|
|
149
|
+
// abortエラーの場合は状態不明なので即時中止しない(2023-06-01~)
|
|
150
|
+
// {
|
|
151
|
+
// "type": "aborted",
|
|
152
|
+
// "message": "The user aborted a request.",
|
|
153
|
+
// "name": "AbortError"
|
|
154
|
+
// }
|
|
155
|
+
const rawError = Array.isArray(error) ? error[1] : undefined;
|
|
156
|
+
if (rawError !== undefined && rawError.name !== 'AbortError') {
|
|
157
|
+
await (0, processVoidPayTransaction_1.processVoidPayTransaction)({
|
|
158
|
+
project: actionAttributes.project,
|
|
159
|
+
id: action.id,
|
|
160
|
+
purpose: actionAttributes.purpose
|
|
161
|
+
})(repos);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
// 複数対応(決済代行IFの場合、0:ChevreError,1:rawError)(2024-03-27~)
|
|
165
|
+
if (Array.isArray(error)) {
|
|
166
|
+
throw error[0];
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
throw error;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
const result = (0, factory_1.createAuthorizeResult)({
|
|
173
|
+
payTransaction,
|
|
174
|
+
object: authorizeObjectIncludingPaymentMethodDetails,
|
|
175
|
+
invoiceByTicketToken
|
|
176
|
+
});
|
|
177
|
+
await repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: result });
|
|
178
|
+
return { id: action.id };
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* 承認しようとしているobjectからaccountIdを決定する
|
|
183
|
+
*/
|
|
184
|
+
function fixAccountIdIfPossible(params) {
|
|
185
|
+
return async (
|
|
186
|
+
// repos: {
|
|
187
|
+
// action: ActionRepo;
|
|
188
|
+
// authorization: AuthorizationRepo;
|
|
189
|
+
// ticket: TicketRepo;
|
|
190
|
+
// }
|
|
191
|
+
// credentials: {
|
|
192
|
+
// jwt: JWTCredentials;
|
|
193
|
+
// }
|
|
194
|
+
) => {
|
|
195
|
+
let accountId = '';
|
|
196
|
+
const fromLocation = params.object?.fromLocation;
|
|
197
|
+
const movieTickets = params.object?.movieTickets;
|
|
198
|
+
// discontinue token as fromLocation(ticketTokenへ移行するべき)(2024-12-18~)
|
|
199
|
+
if (typeof fromLocation === 'string') {
|
|
200
|
+
throw new factory.errors.NotImplemented('object.fromLocation as string not implemented');
|
|
201
|
+
// トークン化されたペイメントカード情報でリクエストされた場合、実ペイメントカード情報へ変換する
|
|
202
|
+
// const { authorizedObject } = await verifyToken({
|
|
203
|
+
// project: { id: params.project.id },
|
|
204
|
+
// agent: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
205
|
+
// token: fromLocation
|
|
206
|
+
// })(repos);
|
|
207
|
+
// const paymentCardOwnershipInfo = authorizedObject;
|
|
208
|
+
// if (Array.isArray(paymentCardOwnershipInfo)) {
|
|
209
|
+
// throw new factory.errors.NotImplemented('fromLocation as an array not implemented');
|
|
210
|
+
// }
|
|
211
|
+
// if (paymentCardOwnershipInfo.typeOf !== 'OwnershipInfo') {
|
|
212
|
+
// throw new factory.errors.Argument('fromLocation', 'must be OwnershipInfo');
|
|
213
|
+
// }
|
|
214
|
+
// if (paymentCardOwnershipInfo.typeOfGood.typeOf !== factory.permit.PermitType.Permit) {
|
|
215
|
+
// throw new factory.errors.Argument('fromLocation', 'must be Permit');
|
|
216
|
+
// }
|
|
217
|
+
// accountId = paymentCardOwnershipInfo.typeOfGood.identifier;
|
|
218
|
+
}
|
|
219
|
+
// 購入番号管理番号をaccountIdにセット(2024-03-24~)
|
|
220
|
+
if (Array.isArray(movieTickets) && movieTickets.length > 0) {
|
|
221
|
+
accountId = movieTickets[0].identifier; // 決済カードidentifierは1つのみ許可の前提
|
|
222
|
+
}
|
|
223
|
+
return { accountId };
|
|
224
|
+
};
|
|
225
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as factory from '../../../factory';
|
|
2
|
+
import type { AcceptPayActionRepo } from '../../../repo/action/acceptPay';
|
|
3
|
+
import type { TaskRepo } from '../../../repo/task';
|
|
4
|
+
interface IFindAcceptActionResult {
|
|
5
|
+
/**
|
|
6
|
+
* アクションID
|
|
7
|
+
*/
|
|
8
|
+
id?: string;
|
|
9
|
+
/**
|
|
10
|
+
* アクションスタータス
|
|
11
|
+
*/
|
|
12
|
+
actionStatus: factory.actionStatusType;
|
|
13
|
+
object?: Pick<factory.action.accept.pay.IObject, 'transactionNumber'>;
|
|
14
|
+
/**
|
|
15
|
+
* エラー
|
|
16
|
+
*/
|
|
17
|
+
error?: {
|
|
18
|
+
name?: string;
|
|
19
|
+
message?: string;
|
|
20
|
+
};
|
|
21
|
+
result?: factory.action.accept.pay.IResult;
|
|
22
|
+
}
|
|
23
|
+
declare function findAcceptAction(params: {
|
|
24
|
+
project: {
|
|
25
|
+
id: string;
|
|
26
|
+
};
|
|
27
|
+
sameAs: {
|
|
28
|
+
/**
|
|
29
|
+
* task ID
|
|
30
|
+
*/
|
|
31
|
+
id: string;
|
|
32
|
+
};
|
|
33
|
+
purpose: {
|
|
34
|
+
/**
|
|
35
|
+
* transaction ID
|
|
36
|
+
*/
|
|
37
|
+
id: string;
|
|
38
|
+
};
|
|
39
|
+
}): (repos: {
|
|
40
|
+
acceptPayAction: AcceptPayActionRepo;
|
|
41
|
+
task: TaskRepo;
|
|
42
|
+
}) => Promise<IFindAcceptActionResult>;
|
|
43
|
+
export { findAcceptAction, };
|