@chevre/domain 21.20.0-alpha.9 → 21.20.1
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/example/src/chevre/findTransactionById.ts +21 -0
- package/example/src/chevre/importCategoryCodesFromCOA.ts +2 -1
- package/example/src/chevre/importOffersFromCOA.ts +2 -1
- package/example/src/chevre/migrateActionInstrumentTransactionNumber.ts +93 -0
- package/example/src/chevre/migrateDeleteTransactionTasks.ts +119 -0
- package/example/src/chevre/migrateEventMakesOfferAvailableAtOrFrom.ts +87 -0
- package/example/src/chevre/migrateIAMMemberPOSRoles.ts +3 -2
- package/example/src/chevre/migrateOfferAvailableAtOrFrom.ts +63 -0
- package/example/src/chevre/{migrateOrderPaymentMethodIdentifier.ts → migrateOrderAcceptedOfferSerialNumber.ts} +18 -19
- package/example/src/chevre/onAssetTransactionStatusChanged.ts +36 -0
- package/example/src/chevre/retryTasks.ts +39 -0
- package/example/src/chevre/searchActions.ts +13 -7
- package/example/src/chevre/searchOrderAcceptedOffers.ts +13 -3
- package/example/src/chevre/searchOrders.ts +13 -15
- package/example/src/chevre/searchSlicedAcceptedOffersByOrderNumber.ts +28 -0
- package/example/src/chevre/sendOrder.ts +37 -0
- package/example/src/chevre/transaction/processPlaceOrder.ts +2 -3
- package/example/src/verifyToken.ts +44 -0
- package/lib/chevre/credentials.d.ts +2 -0
- package/lib/chevre/credentials.js +4 -2
- package/lib/chevre/errorHandler.js +3 -0
- package/lib/chevre/factory/order.d.ts +1 -0
- package/lib/chevre/factory/order.js +2 -1
- package/lib/chevre/factory/reservedAgentIdentifireNames.js +2 -1
- package/lib/chevre/factory/transaction.d.ts +10 -1
- package/lib/chevre/repo/acceptedOffer.d.ts +58 -2
- package/lib/chevre/repo/acceptedOffer.js +100 -4
- package/lib/chevre/repo/accountingReport.d.ts +33 -7
- package/lib/chevre/repo/accountingReport.js +157 -5
- package/lib/chevre/repo/action.d.ts +32 -8
- package/lib/chevre/repo/action.js +114 -54
- package/lib/chevre/repo/event.d.ts +20 -0
- package/lib/chevre/repo/event.js +22 -0
- package/lib/chevre/repo/member.d.ts +8 -1
- package/lib/chevre/repo/member.js +7 -1
- package/lib/chevre/repo/mongoose/schemas/accountingReport.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/action.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/action.js +25 -11
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/order.js +38 -11
- package/lib/chevre/repo/offer.d.ts +42 -0
- package/lib/chevre/repo/offer.js +35 -0
- package/lib/chevre/repo/order.js +43 -20
- package/lib/chevre/repo/orderInTransaction.d.ts +44 -0
- package/lib/chevre/repo/orderInTransaction.js +164 -0
- package/lib/chevre/repo/paymentServiceProvider.js +2 -1
- package/lib/chevre/repo/person.js +1 -4
- package/lib/chevre/repo/task.d.ts +26 -3
- package/lib/chevre/repo/task.js +61 -46
- package/lib/chevre/repo/transaction.d.ts +2 -2
- package/lib/chevre/repo/transaction.js +13 -36
- package/lib/chevre/repository.d.ts +5 -0
- package/lib/chevre/repository.js +15 -2
- package/lib/chevre/service/aggregation/event/importFromCOA.js +5 -5
- package/lib/chevre/service/assetTransaction/pay/factory.js +1 -6
- package/lib/chevre/service/assetTransaction/pay/potentialActions/createPayObjectServiceOutput.d.ts +9 -0
- package/lib/chevre/service/assetTransaction/pay/potentialActions/createPayObjectServiceOutput.js +143 -0
- package/lib/chevre/service/assetTransaction/pay/potentialActions.d.ts +11 -3
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +4 -165
- package/lib/chevre/service/assetTransaction/pay.d.ts +21 -4
- package/lib/chevre/service/assetTransaction/pay.js +64 -23
- package/lib/chevre/service/assetTransaction/reserve/factory.js +11 -14
- package/lib/chevre/service/assetTransaction/reserveCOA.d.ts +19 -0
- package/lib/chevre/service/assetTransaction/reserveCOA.js +46 -0
- package/lib/chevre/service/code.js +1 -1
- package/lib/chevre/service/delivery.js +2 -2
- package/lib/chevre/service/event/createEvent.js +1 -1
- package/lib/chevre/service/event.js +16 -24
- package/lib/chevre/service/moneyTransfer.js +1 -1
- package/lib/chevre/service/notification.js +71 -66
- package/lib/chevre/service/offer/any.d.ts +35 -0
- package/lib/chevre/service/offer/any.js +67 -0
- package/lib/chevre/service/offer/event/authorize.d.ts +7 -0
- package/lib/chevre/service/offer/event/authorize.js +27 -17
- package/lib/chevre/service/offer/event/cancel.d.ts +2 -0
- package/lib/chevre/service/offer/event/cancel.js +13 -1
- package/lib/chevre/service/offer/event/factory.d.ts +1 -1
- package/lib/chevre/service/offer/event/factory.js +11 -22
- package/lib/chevre/service/offer/event/importFromCOA.js +6 -8
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -0
- package/lib/chevre/service/offer/event/voidTransaction.js +24 -7
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +54 -0
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +138 -0
- package/lib/chevre/service/offer/eventServiceByCOA/cancel.d.ts +39 -0
- package/lib/chevre/service/offer/eventServiceByCOA/cancel.js +59 -0
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.d.ts +25 -0
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +165 -0
- package/lib/chevre/service/offer/eventServiceByCOA/factory.js +10 -23
- package/lib/chevre/service/offer/eventServiceByCOA.d.ts +4 -89
- package/lib/chevre/service/offer/eventServiceByCOA.js +7 -292
- package/lib/chevre/service/offer/moneyTransfer/authorize.d.ts +10 -1
- package/lib/chevre/service/offer/moneyTransfer/authorize.js +49 -3
- package/lib/chevre/service/offer/moneyTransfer/returnMoneyTransfer.js +1 -1
- package/lib/chevre/service/offer/moneyTransfer/settleTransaction.d.ts +2 -0
- package/lib/chevre/service/offer/moneyTransfer/settleTransaction.js +47 -2
- package/lib/chevre/service/offer/moneyTransfer/voidTransaction.js +1 -1
- package/lib/chevre/service/offer/product/factory.js +2 -5
- package/lib/chevre/service/offer/product.d.ts +2 -0
- package/lib/chevre/service/offer/product.js +11 -23
- package/lib/chevre/service/order/confirmPayTransaction.d.ts +3 -1
- package/lib/chevre/service/order/confirmPayTransaction.js +4 -4
- package/lib/chevre/service/order/createAccountingReportIfNotExist.js +1 -1
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +12 -1
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +206 -7
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.js +51 -53
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +10 -25
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +16 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.js +91 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.d.ts +8 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.js +37 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.d.ts +12 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +115 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +19 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.d.ts +8 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.js +41 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.d.ts +6 -10
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +116 -92
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +4 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +81 -84
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +18 -15
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +62 -1
- package/lib/chevre/service/order/onOrderStatusChanged.d.ts +3 -1
- package/lib/chevre/service/order/onOrderStatusChanged.js +5 -1
- package/lib/chevre/service/order/placeOrder.d.ts +3 -1
- package/lib/chevre/service/order/placeOrder.js +157 -50
- package/lib/chevre/service/order/returnOrder.js +25 -16
- package/lib/chevre/service/order/sendOrder.d.ts +5 -0
- package/lib/chevre/service/order/sendOrder.js +67 -33
- package/lib/chevre/service/payment/any/onPaid.js +1 -1
- package/lib/chevre/service/payment/any/onPaymentStatusChanged/onPaid.d.ts +3 -1
- package/lib/chevre/service/payment/any/onPaymentStatusChanged/onPaid.js +15 -9
- package/lib/chevre/service/payment/any/onPaymentStatusChanged/onRefunded.d.ts +3 -1
- package/lib/chevre/service/payment/any/onPaymentStatusChanged/onRefunded.js +8 -5
- package/lib/chevre/service/payment/any/onPaymentStatusChanged.js +2 -2
- package/lib/chevre/service/payment/any/onRefund.js +1 -1
- package/lib/chevre/service/payment/any.d.ts +6 -5
- package/lib/chevre/service/payment/any.js +3 -2
- package/lib/chevre/service/payment/creditCard.d.ts +1 -1
- package/lib/chevre/service/payment/creditCard.js +62 -74
- package/lib/chevre/service/payment/faceToFace.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket.js +1 -1
- package/lib/chevre/service/payment/paymentCard.d.ts +1 -1
- package/lib/chevre/service/payment.d.ts +5 -0
- package/lib/chevre/service/payment.js +40 -5
- package/lib/chevre/service/product.js +1 -1
- package/lib/chevre/service/reserve/cancelReservation.js +2 -2
- package/lib/chevre/service/reserve/checkInReservation.d.ts +1 -3
- package/lib/chevre/service/reserve/checkInReservation.js +6 -5
- package/lib/chevre/service/reserve/confirmReservation.js +1 -1
- package/lib/chevre/service/reserve/factory.js +0 -8
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.d.ts +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +4 -4
- package/lib/chevre/service/reserve/searchByOrder.js +2 -1
- package/lib/chevre/service/reserve/useReservation.d.ts +1 -3
- package/lib/chevre/service/reserve/useReservation.js +10 -9
- package/lib/chevre/service/reserve/verifyToken4reservation.js +2 -0
- package/lib/chevre/service/task/confirmMoneyTransfer.js +4 -4
- package/lib/chevre/service/task/confirmPayTransaction.js +2 -1
- package/lib/chevre/service/task/confirmRegisterServiceTransaction.d.ts +1 -1
- package/lib/chevre/service/task/confirmRegisterServiceTransaction.js +30 -8
- package/lib/chevre/service/task/confirmReserveTransaction.d.ts +6 -1
- package/lib/chevre/service/task/confirmReserveTransaction.js +176 -29
- package/lib/chevre/service/task/createAccountingReport.d.ts +6 -0
- package/lib/chevre/service/task/createAccountingReport.js +80 -0
- package/lib/chevre/service/task/importOffersFromCOA.js +2 -1
- package/lib/chevre/service/task/onAuthorizationCreated.js +0 -1
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +7 -7
- package/lib/chevre/service/task/pay.js +6 -0
- package/lib/chevre/service/task/placeOrder.js +9 -10
- package/lib/chevre/service/task/returnOrder.js +0 -3
- package/lib/chevre/service/task/returnPayTransaction.js +1 -1
- package/lib/chevre/service/task/returnReserveTransaction.js +3 -2
- package/lib/chevre/service/task/sendOrder.js +8 -4
- package/lib/chevre/service/task/useReservation.js +1 -1
- package/lib/chevre/service/task/voidReserveTransaction.js +8 -12
- package/lib/chevre/service/transaction/deleteTransaction.js +1 -1
- package/lib/chevre/service/transaction/moneyTransfer/potentialActions.js +2 -18
- package/lib/chevre/service/transaction/moneyTransfer.js +7 -6
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +2 -2
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +17 -20
- package/lib/chevre/service/transaction/placeOrder.js +2 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/confirm.d.ts +51 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/confirm.js +268 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/factory.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +3 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.js +22 -44
- package/lib/chevre/service/transaction/placeOrderInProgress/publishCode.d.ts +14 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/publishCode.js +41 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/publishConfirmationNumberIfNotExist.d.ts +18 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/publishConfirmationNumberIfNotExist.js +42 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/publishOrderNumberIfNotExist.d.ts +23 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/publishOrderNumberIfNotExist.js +46 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +34 -37
- package/lib/chevre/service/transaction/placeOrderInProgress/result.d.ts +3 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/result.js +13 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/start.d.ts +19 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/start.js +46 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateStartRequest.d.ts +26 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateStartRequest.js +109 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +10 -23
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +20 -1
- package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +11 -73
- package/lib/chevre/service/transaction/placeOrderInProgress.js +13 -286
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.js +1 -2
- package/lib/chevre/service/transaction/returnOrder/potentialActions.d.ts +0 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions.js +8 -3
- package/lib/chevre/service/transaction/returnOrder/preStart.js +78 -50
- package/lib/chevre/service/transaction/returnOrder.js +3 -10
- package/lib/chevre/service.js +0 -10
- package/lib/chevre/settings.d.ts +7 -3
- package/lib/chevre/settings.js +13 -4
- package/package.json +5 -9
- package/example/src/chevre/cleanAccountingReports.ts +0 -57
- package/example/src/chevre/migratePayTransactionPaymentMethodIdentifier.ts +0 -78
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.d.ts +0 -11
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.js +0 -30
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.d.ts +0 -7
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.js +0 -82
- package/lib/chevre/service/util.d.ts +0 -19
- package/lib/chevre/service/util.js +0 -126
|
@@ -15,23 +15,23 @@ exports.onPaid = void 0;
|
|
|
15
15
|
*/
|
|
16
16
|
const moment = require("moment-timezone");
|
|
17
17
|
const factory = require("../../../../factory");
|
|
18
|
-
function onPaid(params) {
|
|
18
|
+
function onPaid(params, project) {
|
|
19
19
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
20
20
|
switch (params.purpose.typeOf) {
|
|
21
21
|
// 返品手数料決済であれば
|
|
22
22
|
case factory.actionType.ReturnAction:
|
|
23
|
-
yield onReturnFeePaid(params)(repos);
|
|
23
|
+
yield onReturnFeePaid(params, project)(repos);
|
|
24
24
|
break;
|
|
25
25
|
// 注文決済であれば
|
|
26
26
|
case factory.order.OrderType.Order:
|
|
27
|
-
yield onOrderPaid(params)(repos);
|
|
27
|
+
yield onOrderPaid(params, project)(repos);
|
|
28
28
|
break;
|
|
29
29
|
default:
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
exports.onPaid = onPaid;
|
|
34
|
-
function onReturnFeePaid(params) {
|
|
34
|
+
function onReturnFeePaid(params, project) {
|
|
35
35
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
36
36
|
var _a, _b;
|
|
37
37
|
const orderNumber = (_b = (_a = params.purpose) === null || _a === void 0 ? void 0 : _a.object) === null || _b === void 0 ? void 0 : _b.orderNumber;
|
|
@@ -47,11 +47,14 @@ function onReturnFeePaid(params) {
|
|
|
47
47
|
}
|
|
48
48
|
: undefined);
|
|
49
49
|
const childReport = { typeOf: 'Report', mainEntity: action4save };
|
|
50
|
-
yield repos.accountingReport.
|
|
51
|
-
.
|
|
50
|
+
yield repos.accountingReport.addChildReport({
|
|
51
|
+
project: { id: project.id },
|
|
52
|
+
mainEntity: { orderNumber },
|
|
53
|
+
hasPart: childReport
|
|
54
|
+
});
|
|
52
55
|
});
|
|
53
56
|
}
|
|
54
|
-
function onOrderPaid(params) {
|
|
57
|
+
function onOrderPaid(params, project) {
|
|
55
58
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
56
59
|
var _a;
|
|
57
60
|
const orderNumber = (_a = params.purpose) === null || _a === void 0 ? void 0 : _a.orderNumber;
|
|
@@ -67,7 +70,10 @@ function onOrderPaid(params) {
|
|
|
67
70
|
}
|
|
68
71
|
: undefined);
|
|
69
72
|
const childReport = { typeOf: 'Report', mainEntity: action4save };
|
|
70
|
-
yield repos.accountingReport.
|
|
71
|
-
.
|
|
73
|
+
yield repos.accountingReport.addChildReport({
|
|
74
|
+
project: { id: project.id },
|
|
75
|
+
mainEntity: { orderNumber },
|
|
76
|
+
hasPart: childReport
|
|
77
|
+
});
|
|
72
78
|
});
|
|
73
79
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { MongoRepository as AccountingReportRepo } from '../../../../repo/accountingReport';
|
|
2
2
|
import * as factory from '../../../../factory';
|
|
3
3
|
export type IOptimizedRefundAction = factory.report.accountingReport.IOptimizedRefundAction;
|
|
4
|
-
export declare function onRefunded(params: IOptimizedRefundAction
|
|
4
|
+
export declare function onRefunded(params: IOptimizedRefundAction, project: {
|
|
5
|
+
id: string;
|
|
6
|
+
}): (repos: {
|
|
5
7
|
accountingReport: AccountingReportRepo;
|
|
6
8
|
}) => Promise<void>;
|
|
@@ -15,19 +15,19 @@ exports.onRefunded = void 0;
|
|
|
15
15
|
*/
|
|
16
16
|
const moment = require("moment-timezone");
|
|
17
17
|
const factory = require("../../../../factory");
|
|
18
|
-
function onRefunded(params) {
|
|
18
|
+
function onRefunded(params, project) {
|
|
19
19
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
20
20
|
switch (params.purpose.typeOf) {
|
|
21
21
|
// 返品手数料決済であれば
|
|
22
22
|
case factory.actionType.ReturnAction:
|
|
23
|
-
yield onOrderRefunded(params)(repos);
|
|
23
|
+
yield onOrderRefunded(params, project)(repos);
|
|
24
24
|
break;
|
|
25
25
|
default:
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
exports.onRefunded = onRefunded;
|
|
30
|
-
function onOrderRefunded(params) {
|
|
30
|
+
function onOrderRefunded(params, project) {
|
|
31
31
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
32
32
|
var _a, _b;
|
|
33
33
|
const orderNumber = (_b = (_a = params.purpose) === null || _a === void 0 ? void 0 : _a.object) === null || _b === void 0 ? void 0 : _b.orderNumber;
|
|
@@ -43,7 +43,10 @@ function onOrderRefunded(params) {
|
|
|
43
43
|
}
|
|
44
44
|
: undefined);
|
|
45
45
|
const childReport = { typeOf: 'Report', mainEntity: action4save };
|
|
46
|
-
yield repos.accountingReport.
|
|
47
|
-
.
|
|
46
|
+
yield repos.accountingReport.addChildReport({
|
|
47
|
+
project: { id: project.id },
|
|
48
|
+
mainEntity: { orderNumber },
|
|
49
|
+
hasPart: childReport
|
|
50
|
+
});
|
|
48
51
|
});
|
|
49
52
|
}
|
|
@@ -24,10 +24,10 @@ function onPaymentStatusChanged(params) {
|
|
|
24
24
|
const optimizedAction = optimizeAction4report(action);
|
|
25
25
|
switch (optimizedAction.typeOf) {
|
|
26
26
|
case factory.actionType.PayAction:
|
|
27
|
-
yield (0, onPaid_1.onPaid)(optimizedAction)(repos);
|
|
27
|
+
yield (0, onPaid_1.onPaid)(optimizedAction, { id: action.project.id })(repos);
|
|
28
28
|
break;
|
|
29
29
|
case factory.actionType.RefundAction:
|
|
30
|
-
yield (0, onRefunded_1.onRefunded)(optimizedAction)(repos);
|
|
30
|
+
yield (0, onRefunded_1.onRefunded)(optimizedAction, { id: action.project.id })(repos);
|
|
31
31
|
break;
|
|
32
32
|
default:
|
|
33
33
|
// no op
|
|
@@ -88,7 +88,7 @@ function onRefund(refundAction) {
|
|
|
88
88
|
name: factory.taskName.TriggerWebhook,
|
|
89
89
|
status: factory.taskStatus.Ready,
|
|
90
90
|
runsAt: now,
|
|
91
|
-
remainingNumberOfTries:
|
|
91
|
+
remainingNumberOfTries: 30,
|
|
92
92
|
numberOfTried: 0,
|
|
93
93
|
executionResults: [],
|
|
94
94
|
data: Object.assign(Object.assign({}, a), { object: aciton4inform })
|
|
@@ -8,7 +8,6 @@ import type { MongoRepository as AssetTransactionRepo } from '../../repo/assetTr
|
|
|
8
8
|
import type { MongoRepository as EventRepo } from '../../repo/event';
|
|
9
9
|
import type { MongoRepository as PaymentServiceRepo } from '../../repo/paymentService';
|
|
10
10
|
import type { MongoRepository as PaymentServiceProviderRepo } from '../../repo/paymentServiceProvider';
|
|
11
|
-
import type { CognitoRepository as PersonRepo } from '../../repo/person';
|
|
12
11
|
import type { MongoRepository as ProductRepo } from '../../repo/product';
|
|
13
12
|
import type { MongoRepository as PaymentAcceptedRepo } from '../../repo/sellerPaymentAccepted';
|
|
14
13
|
import type { MongoRepository as TaskRepo } from '../../repo/task';
|
|
@@ -17,7 +16,6 @@ import type { RedisRepository as TransactionNumberRepo } from '../../repo/transa
|
|
|
17
16
|
import * as PayTransactionService from '../assetTransaction/pay';
|
|
18
17
|
import { onPaymentStatusChanged } from './any/onPaymentStatusChanged';
|
|
19
18
|
import { person2username } from './any/person2username';
|
|
20
|
-
type IAuthorizePaymentAction = factory.action.authorize.paymentMethod.any.IAction;
|
|
21
19
|
/**
|
|
22
20
|
* 決済承認中止
|
|
23
21
|
* タスクから決済承認を取り消す
|
|
@@ -61,7 +59,6 @@ interface IAuthorizeRepos {
|
|
|
61
59
|
paymentAccepted: PaymentAcceptedRepo;
|
|
62
60
|
paymentService: PaymentServiceRepo;
|
|
63
61
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
64
|
-
person: PersonRepo;
|
|
65
62
|
product: ProductRepo;
|
|
66
63
|
task: TaskRepo;
|
|
67
64
|
transaction: TransactionRepo;
|
|
@@ -73,7 +70,6 @@ interface IPublishPaymentUrlRepos {
|
|
|
73
70
|
paymentAccepted: PaymentAcceptedRepo;
|
|
74
71
|
paymentService: PaymentServiceRepo;
|
|
75
72
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
76
|
-
person: PersonRepo;
|
|
77
73
|
transaction: TransactionRepo;
|
|
78
74
|
transactionNumber: TransactionNumberRepo;
|
|
79
75
|
}
|
|
@@ -116,5 +112,10 @@ declare function authorize(params: {
|
|
|
116
112
|
useCheckByIdentifierIfNotYet: boolean;
|
|
117
113
|
useSearchTrade4accountId: boolean;
|
|
118
114
|
};
|
|
119
|
-
}): IAuthorizeOperation<
|
|
115
|
+
}): IAuthorizeOperation<{
|
|
116
|
+
/**
|
|
117
|
+
* 承認アクションID
|
|
118
|
+
*/
|
|
119
|
+
id: string;
|
|
120
|
+
}>;
|
|
120
121
|
export { onPaymentStatusChanged, authorize, invalidatePaymentUrl, voidPayTransaction, person2username, processVoidPayTransaction, publishPaymentUrl };
|
|
@@ -197,7 +197,7 @@ function processVoidPayTransaction(params) {
|
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
|
-
yield repos.action.
|
|
200
|
+
yield repos.action.cancelWithVoid({ typeOf: action.typeOf, id: action.id });
|
|
201
201
|
}
|
|
202
202
|
catch (error) {
|
|
203
203
|
errors.push(error);
|
|
@@ -378,7 +378,8 @@ function authorize(params) {
|
|
|
378
378
|
}
|
|
379
379
|
// アクションを完了
|
|
380
380
|
const result = (0, factory_1.createAuthorizeResult)({ payTransaction, object: authorizeObject });
|
|
381
|
-
|
|
381
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: result });
|
|
382
|
+
return { id: action.id };
|
|
382
383
|
});
|
|
383
384
|
}
|
|
384
385
|
exports.authorize = authorize;
|
|
@@ -46,7 +46,7 @@ declare function voidTransaction(params: factory.task.voidPayment.IData): (repos
|
|
|
46
46
|
/**
|
|
47
47
|
* クレジットカード決済
|
|
48
48
|
*/
|
|
49
|
-
declare function payCreditCard(params: factory.task.pay.
|
|
49
|
+
declare function payCreditCard(params: factory.task.pay.IPayActionData): (repos: {
|
|
50
50
|
action: ActionRepo;
|
|
51
51
|
accountingReport: AccountingReportRepo;
|
|
52
52
|
paymentAccepted: PaymentAcceptedRepo;
|
|
@@ -20,7 +20,6 @@ const credentials_1 = require("../../credentials");
|
|
|
20
20
|
const factory = require("../../factory");
|
|
21
21
|
const onPaid_1 = require("./any/onPaid");
|
|
22
22
|
const onRefund_1 = require("./any/onRefund");
|
|
23
|
-
// import { person2username } from './any/person2username';
|
|
24
23
|
const debug = createDebug('chevre-domain:service:payment');
|
|
25
24
|
/**
|
|
26
25
|
* クレジットカード決済承認
|
|
@@ -28,11 +27,6 @@ const debug = createDebug('chevre-domain:service:payment');
|
|
|
28
27
|
function authorize(params, paymentServiceId, options) {
|
|
29
28
|
// tslint:disable-next-line:max-func-body-length
|
|
30
29
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
// const project = <Pick<factory.project.IProject, 'settings'>>await repos.project.findById({
|
|
32
|
-
// id: params.project.id,
|
|
33
|
-
// inclusion: ['settings'],
|
|
34
|
-
// exclusion: []
|
|
35
|
-
// });
|
|
36
30
|
var _a, _b, _c, _d, _e;
|
|
37
31
|
// CreditCard系統の決済方法タイプは動的
|
|
38
32
|
const paymentMethodType = (_a = params.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.identifier;
|
|
@@ -87,7 +81,10 @@ function authorize(params, paymentServiceId, options) {
|
|
|
87
81
|
const searchTrade4accountId = (options === null || options === void 0 ? void 0 : options.searchTrade4accountId) === true;
|
|
88
82
|
if (searchTrade4accountId) {
|
|
89
83
|
try {
|
|
90
|
-
const creditCardService = new GMO.service.Credit({
|
|
84
|
+
const creditCardService = new GMO.service.Credit({
|
|
85
|
+
endpoint: String(availableChannel.serviceUrl),
|
|
86
|
+
useFetch: credentials_1.credentials.gmo.useFetch
|
|
87
|
+
}, { timeout: credentials_1.credentials.gmo.timeout });
|
|
91
88
|
// ベストエフォートでクレジットカード詳細情報を取得
|
|
92
89
|
const startSearchTradeDate = Date.now();
|
|
93
90
|
debug('searchTrade processing...orderId:', orderId, startSearchTradeDate);
|
|
@@ -110,7 +107,7 @@ function authorize(params, paymentServiceId, options) {
|
|
|
110
107
|
}
|
|
111
108
|
exports.authorize = authorize;
|
|
112
109
|
function processAuthorizeCreditCard(params) {
|
|
113
|
-
// tslint:disable-next-line:max-func-body-length
|
|
110
|
+
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
114
111
|
return () => __awaiter(this, void 0, void 0, function* () {
|
|
115
112
|
var _a, _b, _c, _d, _e, _f;
|
|
116
113
|
// GMOオーソリ取得
|
|
@@ -118,24 +115,17 @@ function processAuthorizeCreditCard(params) {
|
|
|
118
115
|
let entryTranResult;
|
|
119
116
|
let execTranArgs;
|
|
120
117
|
let execTranResult;
|
|
121
|
-
const creditCardService = new GMO.service.Credit({
|
|
118
|
+
const creditCardService = new GMO.service.Credit({
|
|
119
|
+
endpoint: String(params.availableChannel.serviceUrl),
|
|
120
|
+
useFetch: credentials_1.credentials.gmo.useFetch
|
|
121
|
+
}, { timeout: credentials_1.credentials.gmo.timeout });
|
|
122
122
|
const creditCard = params.object.creditCard;
|
|
123
|
-
const memberId = creditCard
|
|
124
|
-
const cardSeq = creditCard.cardSeq;
|
|
123
|
+
const { cardSeq, memberId } = creditCard;
|
|
125
124
|
if (typeof memberId === 'string' && memberId.length > 0 && typeof cardSeq === 'number') {
|
|
126
125
|
// 決済承認時のuseUsernameAsGMOMemberId判定を廃止(2024-01-04~)
|
|
127
|
-
// 特殊なプロジェクトのみユーザーネームに自動変換(新旧会員互換性維持対応)
|
|
128
|
-
// memberIdはPersonIDが指定されてくる想定
|
|
129
|
-
// const useUsernameAsGMOMemberId = params.projectSettings?.useUsernameAsGMOMemberId === true;
|
|
130
|
-
// if (useUsernameAsGMOMemberId) {
|
|
131
|
-
// try {
|
|
132
|
-
// const customer = await repos.person.findById({ userId: memberId });
|
|
133
|
-
// memberId = await person2username(customer);
|
|
134
|
-
// } catch (error) {
|
|
135
|
-
// throw error;
|
|
136
|
-
// }
|
|
137
|
-
// }
|
|
138
126
|
}
|
|
127
|
+
const { cardNo, cardPass, expire } = creditCard;
|
|
128
|
+
const { token } = creditCard;
|
|
139
129
|
const retUrl = creditCard === null || creditCard === void 0 ? void 0 : creditCard.retUrl;
|
|
140
130
|
// 3DS拡張(2024-01-02~)
|
|
141
131
|
if (params.processPublishPaymentUrl === true && typeof retUrl === 'string' && retUrl.length > 0) {
|
|
@@ -165,23 +155,7 @@ function processAuthorizeCreditCard(params) {
|
|
|
165
155
|
tds2Type: GMO.utils.util.Tds2Type.Error
|
|
166
156
|
};
|
|
167
157
|
entryTranResult = yield creditCardService.entryTran(entryTranArgs);
|
|
168
|
-
execTranArgs = {
|
|
169
|
-
accessId: entryTranResult.accessId,
|
|
170
|
-
accessPass: entryTranResult.accessPass,
|
|
171
|
-
orderId: params.orderId,
|
|
172
|
-
method: params.object.method,
|
|
173
|
-
siteId: (_a = params.availableChannel.credentials) === null || _a === void 0 ? void 0 : _a.siteId,
|
|
174
|
-
sitePass: (_b = params.availableChannel.credentials) === null || _b === void 0 ? void 0 : _b.sitePass,
|
|
175
|
-
cardNo: creditCard.cardNo,
|
|
176
|
-
cardPass: creditCard.cardPass,
|
|
177
|
-
expire: creditCard.expire,
|
|
178
|
-
token: creditCard.token,
|
|
179
|
-
memberId: memberId,
|
|
180
|
-
cardSeq: cardSeq,
|
|
181
|
-
seqMode: GMO.utils.util.SeqMode.Physics,
|
|
182
|
-
retUrl,
|
|
183
|
-
callbackType: (params.callbackType3ds === 'GET') ? GMO.utils.util.CallbackType.Get : GMO.utils.util.CallbackType.Post
|
|
184
|
-
};
|
|
158
|
+
execTranArgs = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ accessId: entryTranResult.accessId, accessPass: entryTranResult.accessPass, orderId: params.orderId, method: params.object.method, siteId: (_a = params.availableChannel.credentials) === null || _a === void 0 ? void 0 : _a.siteId, sitePass: (_b = params.availableChannel.credentials) === null || _b === void 0 ? void 0 : _b.sitePass, seqMode: GMO.utils.util.SeqMode.Physics, retUrl, callbackType: (params.callbackType3ds === 'GET') ? GMO.utils.util.CallbackType.Get : GMO.utils.util.CallbackType.Post }, (typeof cardNo === 'string') ? { cardNo } : undefined), (typeof cardPass === 'string') ? { cardPass } : undefined), (typeof expire === 'string') ? { expire } : undefined), (typeof token === 'string') ? { token } : undefined), (typeof memberId === 'string') ? { memberId } : undefined), (typeof cardSeq === 'number') ? { cardSeq } : undefined);
|
|
185
159
|
execTranResult = yield creditCardService.execTran3ds(execTranArgs);
|
|
186
160
|
}
|
|
187
161
|
else {
|
|
@@ -197,21 +171,7 @@ function processAuthorizeCreditCard(params) {
|
|
|
197
171
|
sitePass: (_d = params.availableChannel.credentials) === null || _d === void 0 ? void 0 : _d.sitePass
|
|
198
172
|
};
|
|
199
173
|
entryTranResult = yield creditCardService.entryTran(entryTranArgs);
|
|
200
|
-
execTranArgs = {
|
|
201
|
-
accessId: entryTranResult.accessId,
|
|
202
|
-
accessPass: entryTranResult.accessPass,
|
|
203
|
-
orderId: params.orderId,
|
|
204
|
-
method: params.object.method,
|
|
205
|
-
siteId: (_e = params.availableChannel.credentials) === null || _e === void 0 ? void 0 : _e.siteId,
|
|
206
|
-
sitePass: (_f = params.availableChannel.credentials) === null || _f === void 0 ? void 0 : _f.sitePass,
|
|
207
|
-
cardNo: creditCard.cardNo,
|
|
208
|
-
cardPass: creditCard.cardPass,
|
|
209
|
-
expire: creditCard.expire,
|
|
210
|
-
token: creditCard.token,
|
|
211
|
-
memberId: memberId,
|
|
212
|
-
cardSeq: cardSeq,
|
|
213
|
-
seqMode: GMO.utils.util.SeqMode.Physics
|
|
214
|
-
};
|
|
174
|
+
execTranArgs = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ accessId: entryTranResult.accessId, accessPass: entryTranResult.accessPass, orderId: params.orderId, method: params.object.method, siteId: (_e = params.availableChannel.credentials) === null || _e === void 0 ? void 0 : _e.siteId, sitePass: (_f = params.availableChannel.credentials) === null || _f === void 0 ? void 0 : _f.sitePass, seqMode: GMO.utils.util.SeqMode.Physics }, (typeof cardNo === 'string') ? { cardNo } : undefined), (typeof cardPass === 'string') ? { cardPass } : undefined), (typeof expire === 'string') ? { expire } : undefined), (typeof token === 'string') ? { token } : undefined), (typeof memberId === 'string') ? { memberId } : undefined), (typeof cardSeq === 'number') ? { cardSeq } : undefined);
|
|
215
175
|
execTranResult = yield creditCardService.execTran(execTranArgs);
|
|
216
176
|
}
|
|
217
177
|
return { entryTranArgs, entryTranResult, execTranArgs, execTranResult };
|
|
@@ -219,7 +179,10 @@ function processAuthorizeCreditCard(params) {
|
|
|
219
179
|
}
|
|
220
180
|
function processAuthorizeCreditCard3ds(params) {
|
|
221
181
|
return () => __awaiter(this, void 0, void 0, function* () {
|
|
222
|
-
const creditCardService = new GMO.service.Credit({
|
|
182
|
+
const creditCardService = new GMO.service.Credit({
|
|
183
|
+
endpoint: String(params.availableChannel.serviceUrl),
|
|
184
|
+
useFetch: credentials_1.credentials.gmo.useFetch
|
|
185
|
+
}, { timeout: credentials_1.credentials.gmo.timeout });
|
|
223
186
|
const { entryTranArgs, entryTranResult, execTranArgs, execTranResult } = params.pendingPaymentAgencyTransaction;
|
|
224
187
|
const { accessId, accessPass } = entryTranResult;
|
|
225
188
|
const secureTran2Result = yield creditCardService.secureTran2({ accessId, accessPass });
|
|
@@ -291,23 +254,39 @@ function voidTransaction(params) {
|
|
|
291
254
|
throw new factory.errors.ArgumentNull('object.recipient.id');
|
|
292
255
|
}
|
|
293
256
|
const { shopId, shopPass } = yield getGMOInfoFromSeller({ paymentMethodType, seller: { id: sellerId }, paymentServiceId })(repos);
|
|
294
|
-
const creditCardService = new GMO.service.Credit({
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
257
|
+
const creditCardService = new GMO.service.Credit({
|
|
258
|
+
endpoint: String(availableChannel.serviceUrl),
|
|
259
|
+
useFetch: credentials_1.credentials.gmo.useFetch
|
|
260
|
+
}, { timeout: credentials_1.credentials.gmo.timeout });
|
|
261
|
+
let searchTradeResult;
|
|
262
|
+
try {
|
|
263
|
+
searchTradeResult = yield creditCardService.searchTrade({
|
|
264
|
+
shopId: shopId,
|
|
265
|
+
shopPass: shopPass,
|
|
266
|
+
orderId: paymentMethodId,
|
|
267
|
+
siteId: (_c = availableChannel.credentials) === null || _c === void 0 ? void 0 : _c.siteId,
|
|
268
|
+
sitePass: (_d = availableChannel.credentials) === null || _d === void 0 ? void 0 : _d.sitePass
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
catch (error) {
|
|
272
|
+
// searchTradeでのエラーをハンドリング(2024-01-27~)
|
|
273
|
+
let throwsError = true;
|
|
274
|
+
if (error.name === 'GMOServiceBadRequestError') {
|
|
275
|
+
if (Array.isArray(error.errors) && error.errors.length > 0) {
|
|
276
|
+
const gmoErrors = error.errors;
|
|
277
|
+
// 指定されたIDとパスワードの取引が存在しません。
|
|
278
|
+
const notFoundErrorExists = gmoErrors.some(({ info }) => info === 'E01110002');
|
|
279
|
+
if (notFoundErrorExists) {
|
|
280
|
+
throwsError = false;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
if (throwsError) {
|
|
285
|
+
throw error;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
309
288
|
// 仮売上であれば取消
|
|
310
|
-
if (searchTradeResult.status === GMO.utils.util.JobCd.Auth) {
|
|
289
|
+
if ((searchTradeResult === null || searchTradeResult === void 0 ? void 0 : searchTradeResult.status) === GMO.utils.util.JobCd.Auth) {
|
|
311
290
|
yield creditCardService.alterTran({
|
|
312
291
|
shopId: shopId,
|
|
313
292
|
shopPass: shopPass,
|
|
@@ -348,7 +327,10 @@ function payCreditCard(params) {
|
|
|
348
327
|
let action = yield repos.action.start(params);
|
|
349
328
|
const alterTranResults = [];
|
|
350
329
|
try {
|
|
351
|
-
const creditCardService = new GMO.service.Credit({
|
|
330
|
+
const creditCardService = new GMO.service.Credit({
|
|
331
|
+
endpoint: String(availableChannel.serviceUrl),
|
|
332
|
+
useFetch: credentials_1.credentials.gmo.useFetch
|
|
333
|
+
}, { timeout: credentials_1.credentials.gmo.timeout });
|
|
352
334
|
yield Promise.all(payObject.map((paymentMethod) => __awaiter(this, void 0, void 0, function* () {
|
|
353
335
|
alterTranResults.push(...yield processAlterTran({ shopId, shopPass, availableChannel, paymentMethod })({ creditCardService }));
|
|
354
336
|
})));
|
|
@@ -500,7 +482,10 @@ function processChangeTransaction(params) {
|
|
|
500
482
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
501
483
|
return __awaiter(this, void 0, void 0, function* () {
|
|
502
484
|
const alterTranResult = [];
|
|
503
|
-
const creditCardService = new GMO.service.Credit({
|
|
485
|
+
const creditCardService = new GMO.service.Credit({
|
|
486
|
+
endpoint: String(params.availableChannel.serviceUrl),
|
|
487
|
+
useFetch: credentials_1.credentials.gmo.useFetch
|
|
488
|
+
}, { timeout: credentials_1.credentials.gmo.timeout });
|
|
504
489
|
// 取引状態参照
|
|
505
490
|
const searchTradeResult = yield creditCardService.searchTrade({
|
|
506
491
|
shopId: params.shopId,
|
|
@@ -604,7 +589,10 @@ exports.getGMOInfoFromSeller = getGMOInfoFromSeller;
|
|
|
604
589
|
function searchGMOTrade(params) {
|
|
605
590
|
var _a, _b;
|
|
606
591
|
return __awaiter(this, void 0, void 0, function* () {
|
|
607
|
-
const creditCardService = new GMO.service.Credit({
|
|
592
|
+
const creditCardService = new GMO.service.Credit({
|
|
593
|
+
endpoint: String(params.availableChannel.serviceUrl),
|
|
594
|
+
useFetch: credentials_1.credentials.gmo.useFetch
|
|
595
|
+
}, { timeout: credentials_1.credentials.gmo.timeout });
|
|
608
596
|
// 取引状態参照
|
|
609
597
|
debug('searching trade...', params.paymentMethodId);
|
|
610
598
|
const searchTradeResult = yield creditCardService.searchTrade({
|
|
@@ -9,7 +9,7 @@ import type { MongoRepository as TaskRepo } from '../../repo/task';
|
|
|
9
9
|
declare function voidTransaction(__: factory.task.voidPayment.IData): (___: {
|
|
10
10
|
product: ProductRepo;
|
|
11
11
|
}) => Promise<void>;
|
|
12
|
-
declare function payFaceToFace(params: factory.task.pay.
|
|
12
|
+
declare function payFaceToFace(params: factory.task.pay.IPayActionData): (repos: {
|
|
13
13
|
action: ActionRepo;
|
|
14
14
|
accountingReport: AccountingReportRepo;
|
|
15
15
|
product: ProductRepo;
|
|
@@ -66,7 +66,7 @@ type IPayAction = factory.action.trade.pay.IAction;
|
|
|
66
66
|
/**
|
|
67
67
|
* MovieTicket着券
|
|
68
68
|
*/
|
|
69
|
-
declare function payMovieTicket(params: factory.task.pay.
|
|
69
|
+
declare function payMovieTicket(params: factory.task.pay.IPayActionData): IPayOperation<IPayAction>;
|
|
70
70
|
/**
|
|
71
71
|
* MovieTicket着券取消
|
|
72
72
|
*/
|
|
@@ -85,7 +85,7 @@ function checkMovieTicket(params) {
|
|
|
85
85
|
// action.resultへの保管を廃止(2023-03-24~)
|
|
86
86
|
// movieTickets: []
|
|
87
87
|
};
|
|
88
|
-
yield repos.action.
|
|
88
|
+
yield repos.action.completeWithVoid({ typeOf: actionAttributes.typeOf, id: action.id, result });
|
|
89
89
|
return {
|
|
90
90
|
result: checkResult
|
|
91
91
|
};
|
|
@@ -16,7 +16,7 @@ declare function authorize(params: factory.assetTransaction.pay.IStartParamsWith
|
|
|
16
16
|
declare function voidTransaction(params: factory.task.voidPayment.IData): (repos: {
|
|
17
17
|
product: ProductRepo;
|
|
18
18
|
}) => Promise<void>;
|
|
19
|
-
declare function payPaymentCard(params: factory.task.pay.
|
|
19
|
+
declare function payPaymentCard(params: factory.task.pay.IPayActionData): (repos: {
|
|
20
20
|
action: ActionRepo;
|
|
21
21
|
accountingReport: AccountingReportRepo;
|
|
22
22
|
product: ProductRepo;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 決済サービス
|
|
3
3
|
*/
|
|
4
|
+
import type { MongoRepository as AcceptedOfferRepo } from '../repo/acceptedOffer';
|
|
4
5
|
import type { MongoRepository as AccountingReportRepo } from '../repo/accountingReport';
|
|
5
6
|
import type { MongoRepository as ActionRepo } from '../repo/action';
|
|
6
7
|
import type { MongoRepository as AssetTransactionRepo } from '../repo/assetTransaction';
|
|
7
8
|
import type { MongoRepository as EventRepo } from '../repo/event';
|
|
9
|
+
import type { MongoRepository as OrderRepo } from '../repo/order';
|
|
8
10
|
import type { MongoRepository as PaymentServiceRepo } from '../repo/paymentService';
|
|
9
11
|
import type { MongoRepository as PaymentServiceProviderRepo } from '../repo/paymentServiceProvider';
|
|
10
12
|
import type { MongoRepository as ProductRepo } from '../repo/product';
|
|
@@ -17,9 +19,12 @@ import * as factory from '../factory';
|
|
|
17
19
|
* 決済確定
|
|
18
20
|
*/
|
|
19
21
|
export declare function pay(params: factory.task.pay.IData): (repos: {
|
|
22
|
+
acceptedOffer: AcceptedOfferRepo;
|
|
20
23
|
action: ActionRepo;
|
|
21
24
|
accountingReport: AccountingReportRepo;
|
|
25
|
+
assetTransaction: AssetTransactionRepo;
|
|
22
26
|
event: EventRepo;
|
|
27
|
+
order: OrderRepo;
|
|
23
28
|
paymentAccepted: PaymentAcceptedRepo;
|
|
24
29
|
paymentService: PaymentServiceRepo;
|
|
25
30
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
@@ -11,29 +11,64 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.refund = exports.voidPayment = exports.pay = void 0;
|
|
13
13
|
const factory = require("../factory");
|
|
14
|
+
const pay_1 = require("./assetTransaction/pay");
|
|
15
|
+
const potentialActions_1 = require("./assetTransaction/pay/potentialActions");
|
|
14
16
|
const CreditCardPaymentService = require("./payment/creditCard");
|
|
15
17
|
const FaceToFacePaymentService = require("./payment/faceToFace");
|
|
16
18
|
const MovieTicketPaymentService = require("./payment/movieTicket");
|
|
17
19
|
const PaymentCardPaymentService = require("./payment/paymentCard");
|
|
20
|
+
function payTask2payActionAttributes(params) {
|
|
21
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
let transaction;
|
|
23
|
+
if (typeof params.object.paymentMethod.paymentMethodId === 'string') {
|
|
24
|
+
transaction = yield repos.assetTransaction.findByTransactionNumber({
|
|
25
|
+
typeOf: factory.assetTransactionType.Pay,
|
|
26
|
+
transactionNumber: params.object.paymentMethod.paymentMethodId
|
|
27
|
+
});
|
|
28
|
+
if (transaction.status !== factory.transactionStatusType.Confirmed) {
|
|
29
|
+
throw new factory.errors.Argument('object.paymentMethod.paymentMethodId', `invalid transaction status: ${transaction.transactionNumber} ${transaction.status}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
throw new factory.errors.ArgumentNull('object.paymentMethod.paymentMethodId');
|
|
34
|
+
}
|
|
35
|
+
const order = yield (0, pay_1.fixOrderAsPurpose)({ potentialActions: { pay: { purpose: params.purpose } } }, transaction)(repos);
|
|
36
|
+
const payActions = (0, potentialActions_1.createPayActions)({
|
|
37
|
+
transaction: transaction,
|
|
38
|
+
potentialActions: { pay: { purpose: params.purpose } },
|
|
39
|
+
order
|
|
40
|
+
});
|
|
41
|
+
return payActions[0];
|
|
42
|
+
});
|
|
43
|
+
}
|
|
18
44
|
/**
|
|
19
45
|
* 決済確定
|
|
20
46
|
*/
|
|
21
47
|
function pay(params) {
|
|
22
48
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
23
49
|
var _a;
|
|
24
|
-
|
|
50
|
+
let payActionAttributes;
|
|
51
|
+
if (params.typeOf === factory.actionType.PayAction) {
|
|
52
|
+
// タスクにPayActionそのものが指定されていればそのまま処理
|
|
53
|
+
payActionAttributes = params;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
// 最適化されたタスクに対応(2024-01-19~)
|
|
57
|
+
payActionAttributes = yield payTask2payActionAttributes(params)(repos);
|
|
58
|
+
}
|
|
59
|
+
const paymentServiceType = (_a = payActionAttributes.object[0]) === null || _a === void 0 ? void 0 : _a.typeOf;
|
|
25
60
|
switch (paymentServiceType) {
|
|
26
61
|
case factory.service.paymentService.PaymentServiceType.FaceToFace:
|
|
27
|
-
yield FaceToFacePaymentService.payFaceToFace(
|
|
62
|
+
yield FaceToFacePaymentService.payFaceToFace(payActionAttributes)(repos);
|
|
28
63
|
break;
|
|
29
64
|
case factory.service.paymentService.PaymentServiceType.PaymentCard:
|
|
30
|
-
yield PaymentCardPaymentService.payPaymentCard(
|
|
65
|
+
yield PaymentCardPaymentService.payPaymentCard(payActionAttributes)(repos);
|
|
31
66
|
break;
|
|
32
67
|
case factory.service.paymentService.PaymentServiceType.CreditCard:
|
|
33
|
-
yield CreditCardPaymentService.payCreditCard(
|
|
68
|
+
yield CreditCardPaymentService.payCreditCard(payActionAttributes)(repos);
|
|
34
69
|
break;
|
|
35
70
|
case factory.service.paymentService.PaymentServiceType.MovieTicket:
|
|
36
|
-
yield MovieTicketPaymentService.payMovieTicket(
|
|
71
|
+
yield MovieTicketPaymentService.payMovieTicket(payActionAttributes)(repos);
|
|
37
72
|
break;
|
|
38
73
|
default:
|
|
39
74
|
throw new factory.errors.NotImplemented(`Payment service '${paymentServiceType}' not implemented`);
|
|
@@ -42,7 +42,7 @@ function registerService(params) {
|
|
|
42
42
|
}
|
|
43
43
|
// アクション完了
|
|
44
44
|
const actionResult = {};
|
|
45
|
-
yield repos.action.
|
|
45
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
46
46
|
yield onRegistered(actionAttributes, serviceOutput)(repos);
|
|
47
47
|
})));
|
|
48
48
|
});
|
|
@@ -148,7 +148,7 @@ function cancelPengindIfNotYet(params, __) {
|
|
|
148
148
|
// } : undefined
|
|
149
149
|
// canceledReservationId: canceledReservation?.id
|
|
150
150
|
};
|
|
151
|
-
yield repos.action.
|
|
151
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
152
152
|
}
|
|
153
153
|
return { reserveTransaction };
|
|
154
154
|
});
|
|
@@ -288,7 +288,7 @@ function cancelReservation(actionAttributesList) {
|
|
|
288
288
|
} : undefined
|
|
289
289
|
// canceledReservationId: canceledReservation?.id
|
|
290
290
|
);
|
|
291
|
-
yield repos.action.
|
|
291
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
292
292
|
let canceledReservations = [];
|
|
293
293
|
if (actionAttributes.object.typeOf === factory.reservationType.ReservationPackage) {
|
|
294
294
|
const reservationNumber = actionAttributes.object.reservationNumber;
|
|
@@ -30,9 +30,7 @@ interface ICheckInReservationParams {
|
|
|
30
30
|
code: string;
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
export declare function checkInReservation(params: ICheckInReservationParams
|
|
34
|
-
reserveIfNotYet: boolean;
|
|
35
|
-
}): (repos: {
|
|
33
|
+
export declare function checkInReservation(params: ICheckInReservationParams): (repos: {
|
|
36
34
|
action: ActionRepo;
|
|
37
35
|
assetTransaction: AssetTransactionRepo;
|
|
38
36
|
event: EventRepo;
|
|
@@ -19,10 +19,7 @@ function checkInReservation(params) {
|
|
|
19
19
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
20
20
|
const now = new Date();
|
|
21
21
|
// confirmReservationが間に合わない可能性を考慮する(2023-06-01~)
|
|
22
|
-
|
|
23
|
-
if (params.reserveIfNotYet === true) {
|
|
24
|
-
yield reserveIfNotYet(params)(repos);
|
|
25
|
-
}
|
|
22
|
+
yield reserveIfNotYet(params)(repos);
|
|
26
23
|
// 発券処理(Array対応)
|
|
27
24
|
let checkedInReservationIds;
|
|
28
25
|
if (Array.isArray(params.object.ids) && params.object.ids.length > 0) {
|
|
@@ -100,7 +97,11 @@ function reserveIfNotYet(params) {
|
|
|
100
97
|
reservationStatus: (typeof reserveTransaction.object.reservationStatus === 'string')
|
|
101
98
|
? reserveTransaction.object.reservationStatus
|
|
102
99
|
: factory.reservationStatusType.ReservationPending,
|
|
103
|
-
reservationFor:
|
|
100
|
+
reservationFor: {
|
|
101
|
+
id: String(reserveTransaction.object.reservationFor.id),
|
|
102
|
+
typeOf: reserveTransaction.object.reservationFor.typeOf,
|
|
103
|
+
optimized: true
|
|
104
|
+
} // optimize(2024-01-24~)
|
|
104
105
|
},
|
|
105
106
|
agent: reserveTransaction.project,
|
|
106
107
|
purpose: { typeOf: reserveTransaction.typeOf, id: reserveTransaction.id }
|
|
@@ -138,7 +138,7 @@ function reserveIfNotYet(params, options) {
|
|
|
138
138
|
}
|
|
139
139
|
// アクション完了
|
|
140
140
|
const actionResult = {};
|
|
141
|
-
yield repos.action.
|
|
141
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
142
142
|
}
|
|
143
143
|
});
|
|
144
144
|
}
|