@chevre/domain 21.20.0-alpha.9 → 21.20.0
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 -1
- 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 -1
- 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 -2
- 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 -68
- 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 })
|
|
@@ -17,7 +17,6 @@ import type { RedisRepository as TransactionNumberRepo } from '../../repo/transa
|
|
|
17
17
|
import * as PayTransactionService from '../assetTransaction/pay';
|
|
18
18
|
import { onPaymentStatusChanged } from './any/onPaymentStatusChanged';
|
|
19
19
|
import { person2username } from './any/person2username';
|
|
20
|
-
type IAuthorizePaymentAction = factory.action.authorize.paymentMethod.any.IAction;
|
|
21
20
|
/**
|
|
22
21
|
* 決済承認中止
|
|
23
22
|
* タスクから決済承認を取り消す
|
|
@@ -116,5 +115,10 @@ declare function authorize(params: {
|
|
|
116
115
|
useCheckByIdentifierIfNotYet: boolean;
|
|
117
116
|
useSearchTrade4accountId: boolean;
|
|
118
117
|
};
|
|
119
|
-
}): IAuthorizeOperation<
|
|
118
|
+
}): IAuthorizeOperation<{
|
|
119
|
+
/**
|
|
120
|
+
* 承認アクションID
|
|
121
|
+
*/
|
|
122
|
+
id: string;
|
|
123
|
+
}>;
|
|
120
124
|
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;
|
|
@@ -87,7 +87,10 @@ function authorize(params, paymentServiceId, options) {
|
|
|
87
87
|
const searchTrade4accountId = (options === null || options === void 0 ? void 0 : options.searchTrade4accountId) === true;
|
|
88
88
|
if (searchTrade4accountId) {
|
|
89
89
|
try {
|
|
90
|
-
const creditCardService = new GMO.service.Credit({
|
|
90
|
+
const creditCardService = new GMO.service.Credit({
|
|
91
|
+
endpoint: String(availableChannel.serviceUrl),
|
|
92
|
+
useFetch: credentials_1.credentials.gmo.useFetch
|
|
93
|
+
}, { timeout: credentials_1.credentials.gmo.timeout });
|
|
91
94
|
// ベストエフォートでクレジットカード詳細情報を取得
|
|
92
95
|
const startSearchTradeDate = Date.now();
|
|
93
96
|
debug('searchTrade processing...orderId:', orderId, startSearchTradeDate);
|
|
@@ -110,7 +113,7 @@ function authorize(params, paymentServiceId, options) {
|
|
|
110
113
|
}
|
|
111
114
|
exports.authorize = authorize;
|
|
112
115
|
function processAuthorizeCreditCard(params) {
|
|
113
|
-
// tslint:disable-next-line:max-func-body-length
|
|
116
|
+
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
114
117
|
return () => __awaiter(this, void 0, void 0, function* () {
|
|
115
118
|
var _a, _b, _c, _d, _e, _f;
|
|
116
119
|
// GMOオーソリ取得
|
|
@@ -118,24 +121,17 @@ function processAuthorizeCreditCard(params) {
|
|
|
118
121
|
let entryTranResult;
|
|
119
122
|
let execTranArgs;
|
|
120
123
|
let execTranResult;
|
|
121
|
-
const creditCardService = new GMO.service.Credit({
|
|
124
|
+
const creditCardService = new GMO.service.Credit({
|
|
125
|
+
endpoint: String(params.availableChannel.serviceUrl),
|
|
126
|
+
useFetch: credentials_1.credentials.gmo.useFetch
|
|
127
|
+
}, { timeout: credentials_1.credentials.gmo.timeout });
|
|
122
128
|
const creditCard = params.object.creditCard;
|
|
123
|
-
const memberId = creditCard
|
|
124
|
-
const cardSeq = creditCard.cardSeq;
|
|
129
|
+
const { cardSeq, memberId } = creditCard;
|
|
125
130
|
if (typeof memberId === 'string' && memberId.length > 0 && typeof cardSeq === 'number') {
|
|
126
131
|
// 決済承認時の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
132
|
}
|
|
133
|
+
const { cardNo, cardPass, expire } = creditCard;
|
|
134
|
+
const { token } = creditCard;
|
|
139
135
|
const retUrl = creditCard === null || creditCard === void 0 ? void 0 : creditCard.retUrl;
|
|
140
136
|
// 3DS拡張(2024-01-02~)
|
|
141
137
|
if (params.processPublishPaymentUrl === true && typeof retUrl === 'string' && retUrl.length > 0) {
|
|
@@ -165,23 +161,7 @@ function processAuthorizeCreditCard(params) {
|
|
|
165
161
|
tds2Type: GMO.utils.util.Tds2Type.Error
|
|
166
162
|
};
|
|
167
163
|
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
|
-
};
|
|
164
|
+
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
165
|
execTranResult = yield creditCardService.execTran3ds(execTranArgs);
|
|
186
166
|
}
|
|
187
167
|
else {
|
|
@@ -197,21 +177,7 @@ function processAuthorizeCreditCard(params) {
|
|
|
197
177
|
sitePass: (_d = params.availableChannel.credentials) === null || _d === void 0 ? void 0 : _d.sitePass
|
|
198
178
|
};
|
|
199
179
|
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
|
-
};
|
|
180
|
+
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
181
|
execTranResult = yield creditCardService.execTran(execTranArgs);
|
|
216
182
|
}
|
|
217
183
|
return { entryTranArgs, entryTranResult, execTranArgs, execTranResult };
|
|
@@ -219,7 +185,10 @@ function processAuthorizeCreditCard(params) {
|
|
|
219
185
|
}
|
|
220
186
|
function processAuthorizeCreditCard3ds(params) {
|
|
221
187
|
return () => __awaiter(this, void 0, void 0, function* () {
|
|
222
|
-
const creditCardService = new GMO.service.Credit({
|
|
188
|
+
const creditCardService = new GMO.service.Credit({
|
|
189
|
+
endpoint: String(params.availableChannel.serviceUrl),
|
|
190
|
+
useFetch: credentials_1.credentials.gmo.useFetch
|
|
191
|
+
}, { timeout: credentials_1.credentials.gmo.timeout });
|
|
223
192
|
const { entryTranArgs, entryTranResult, execTranArgs, execTranResult } = params.pendingPaymentAgencyTransaction;
|
|
224
193
|
const { accessId, accessPass } = entryTranResult;
|
|
225
194
|
const secureTran2Result = yield creditCardService.secureTran2({ accessId, accessPass });
|
|
@@ -291,23 +260,39 @@ function voidTransaction(params) {
|
|
|
291
260
|
throw new factory.errors.ArgumentNull('object.recipient.id');
|
|
292
261
|
}
|
|
293
262
|
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
|
-
|
|
263
|
+
const creditCardService = new GMO.service.Credit({
|
|
264
|
+
endpoint: String(availableChannel.serviceUrl),
|
|
265
|
+
useFetch: credentials_1.credentials.gmo.useFetch
|
|
266
|
+
}, { timeout: credentials_1.credentials.gmo.timeout });
|
|
267
|
+
let searchTradeResult;
|
|
268
|
+
try {
|
|
269
|
+
searchTradeResult = yield creditCardService.searchTrade({
|
|
270
|
+
shopId: shopId,
|
|
271
|
+
shopPass: shopPass,
|
|
272
|
+
orderId: paymentMethodId,
|
|
273
|
+
siteId: (_c = availableChannel.credentials) === null || _c === void 0 ? void 0 : _c.siteId,
|
|
274
|
+
sitePass: (_d = availableChannel.credentials) === null || _d === void 0 ? void 0 : _d.sitePass
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
catch (error) {
|
|
278
|
+
// searchTradeでのエラーをハンドリング(2024-01-27~)
|
|
279
|
+
let throwsError = true;
|
|
280
|
+
if (error.name === 'GMOServiceBadRequestError') {
|
|
281
|
+
if (Array.isArray(error.errors) && error.errors.length > 0) {
|
|
282
|
+
const gmoErrors = error.errors;
|
|
283
|
+
// 指定されたIDとパスワードの取引が存在しません。
|
|
284
|
+
const notFoundErrorExists = gmoErrors.some(({ info }) => info === 'E01110002');
|
|
285
|
+
if (notFoundErrorExists) {
|
|
286
|
+
throwsError = false;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
if (throwsError) {
|
|
291
|
+
throw error;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
309
294
|
// 仮売上であれば取消
|
|
310
|
-
if (searchTradeResult.status === GMO.utils.util.JobCd.Auth) {
|
|
295
|
+
if ((searchTradeResult === null || searchTradeResult === void 0 ? void 0 : searchTradeResult.status) === GMO.utils.util.JobCd.Auth) {
|
|
311
296
|
yield creditCardService.alterTran({
|
|
312
297
|
shopId: shopId,
|
|
313
298
|
shopPass: shopPass,
|
|
@@ -348,7 +333,10 @@ function payCreditCard(params) {
|
|
|
348
333
|
let action = yield repos.action.start(params);
|
|
349
334
|
const alterTranResults = [];
|
|
350
335
|
try {
|
|
351
|
-
const creditCardService = new GMO.service.Credit({
|
|
336
|
+
const creditCardService = new GMO.service.Credit({
|
|
337
|
+
endpoint: String(availableChannel.serviceUrl),
|
|
338
|
+
useFetch: credentials_1.credentials.gmo.useFetch
|
|
339
|
+
}, { timeout: credentials_1.credentials.gmo.timeout });
|
|
352
340
|
yield Promise.all(payObject.map((paymentMethod) => __awaiter(this, void 0, void 0, function* () {
|
|
353
341
|
alterTranResults.push(...yield processAlterTran({ shopId, shopPass, availableChannel, paymentMethod })({ creditCardService }));
|
|
354
342
|
})));
|
|
@@ -500,7 +488,10 @@ function processChangeTransaction(params) {
|
|
|
500
488
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
501
489
|
return __awaiter(this, void 0, void 0, function* () {
|
|
502
490
|
const alterTranResult = [];
|
|
503
|
-
const creditCardService = new GMO.service.Credit({
|
|
491
|
+
const creditCardService = new GMO.service.Credit({
|
|
492
|
+
endpoint: String(params.availableChannel.serviceUrl),
|
|
493
|
+
useFetch: credentials_1.credentials.gmo.useFetch
|
|
494
|
+
}, { timeout: credentials_1.credentials.gmo.timeout });
|
|
504
495
|
// 取引状態参照
|
|
505
496
|
const searchTradeResult = yield creditCardService.searchTrade({
|
|
506
497
|
shopId: params.shopId,
|
|
@@ -604,7 +595,10 @@ exports.getGMOInfoFromSeller = getGMOInfoFromSeller;
|
|
|
604
595
|
function searchGMOTrade(params) {
|
|
605
596
|
var _a, _b;
|
|
606
597
|
return __awaiter(this, void 0, void 0, function* () {
|
|
607
|
-
const creditCardService = new GMO.service.Credit({
|
|
598
|
+
const creditCardService = new GMO.service.Credit({
|
|
599
|
+
endpoint: String(params.availableChannel.serviceUrl),
|
|
600
|
+
useFetch: credentials_1.credentials.gmo.useFetch
|
|
601
|
+
}, { timeout: credentials_1.credentials.gmo.timeout });
|
|
608
602
|
// 取引状態参照
|
|
609
603
|
debug('searching trade...', params.paymentMethodId);
|
|
610
604
|
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
|
}
|
|
@@ -3,17 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.NUM_TRY_INFORM_RESERVATION = exports.maskUnderName = void 0;
|
|
4
4
|
const MASKED_PROFILE = '****';
|
|
5
5
|
function maskUnderName(reservation) {
|
|
6
|
-
// 予約後を隠蔽(2022-12-24~)
|
|
7
|
-
// const underNameIdentifiers: factory.propertyValue.IPropertyValue<string>[] | undefined =
|
|
8
|
-
// (Array.isArray(reservation.underName?.identifier))
|
|
9
|
-
// ? reservation.underName?.identifier.filter((p) => {
|
|
10
|
-
// return !RESERVED_AGENT_IDENTIFIER_NAMES.includes(p.name);
|
|
11
|
-
// })
|
|
12
|
-
// : undefined;
|
|
13
6
|
var _a;
|
|
14
7
|
const underName = (typeof ((_a = reservation.underName) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
|
|
15
8
|
? Object.assign(Object.assign({}, reservation.underName), { email: MASKED_PROFILE, telephone: MASKED_PROFILE, name: MASKED_PROFILE, familyName: MASKED_PROFILE, givenName: MASKED_PROFILE,
|
|
16
|
-
// ... (Array.isArray(underNameIdentifiers)) ? { identifier: underNameIdentifiers } : undefined,
|
|
17
9
|
// identifierも隠蔽(2022-12-27~)
|
|
18
10
|
identifier: [] }) : undefined;
|
|
19
11
|
return Object.assign(Object.assign({}, reservation), (underName !== undefined) ? { underName } : undefined);
|
|
@@ -8,7 +8,7 @@ export type IUseReservationAction = factory.action.consume.use.reservation.IActi
|
|
|
8
8
|
/**
|
|
9
9
|
* 予約使用
|
|
10
10
|
*/
|
|
11
|
-
export declare function onReservationUsed(
|
|
11
|
+
export declare function onReservationUsed(attendedReservation: IEventReservation): (repos: {
|
|
12
12
|
task: TaskRepo;
|
|
13
13
|
}) => Promise<void>;
|
|
14
14
|
export {};
|