@chevre/domain 21.20.0-alpha.8 → 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 -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 -6
- 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 +5 -5
- 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 -68
- package/lib/chevre/service/payment/faceToFace.d.ts +1 -5
- package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +0 -2
- package/lib/chevre/service/payment/movieTicket/checkByIdentifier.js +1 -0
- package/lib/chevre/service/payment/movieTicket/validation.d.ts +0 -2
- package/lib/chevre/service/payment/movieTicket.d.ts +1 -7
- package/lib/chevre/service/payment/movieTicket.js +1 -1
- package/lib/chevre/service/payment/paymentCard.d.ts +1 -3
- package/lib/chevre/service/payment/paymentCard.js +6 -6
- 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
|
@@ -10,25 +10,30 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.confirmReserveTransaction = exports.call = void 0;
|
|
13
|
-
const
|
|
13
|
+
const createDebug = require("debug");
|
|
14
|
+
const google_libphonenumber_1 = require("google-libphonenumber");
|
|
15
|
+
const util_1 = require("util");
|
|
14
16
|
const factory = require("../../factory");
|
|
17
|
+
// import { USE_OPTIMIZED_CONFIRM_RESERVE_COA_TASK_VERIFY } from '../../settings';
|
|
18
|
+
const acceptedOffer_1 = require("../../repo/acceptedOffer");
|
|
15
19
|
const action_1 = require("../../repo/action");
|
|
16
20
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
17
21
|
const order_1 = require("../../repo/order");
|
|
18
22
|
const reservation_1 = require("../../repo/reservation");
|
|
19
23
|
const task_1 = require("../../repo/task");
|
|
20
24
|
const ReserveTransactionService = require("../assetTransaction/reserve");
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
endpoint: credentials_1.credentials.coa.endpoint,
|
|
24
|
-
refreshToken: credentials_1.credentials.coa.refreshToken
|
|
25
|
-
});
|
|
25
|
+
const COAReserveService = require("../assetTransaction/reserveCOA");
|
|
26
|
+
const debug = createDebug('chevre-domain:service:task');
|
|
26
27
|
/**
|
|
27
28
|
* タスク実行関数
|
|
28
29
|
*/
|
|
29
30
|
function call(data) {
|
|
30
31
|
return (settings) => __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
yield confirmReserveTransaction(data
|
|
32
|
+
yield confirmReserveTransaction(data, {
|
|
33
|
+
sendOrder: true,
|
|
34
|
+
useOnOrderStatusChanged: true
|
|
35
|
+
})({
|
|
36
|
+
acceptedOffer: new acceptedOffer_1.MongoRepository(settings.connection),
|
|
32
37
|
action: new action_1.MongoRepository(settings.connection),
|
|
33
38
|
assetTransaction: new assetTransaction_1.MongoRepository(settings.connection),
|
|
34
39
|
order: new order_1.MongoRepository(settings.connection),
|
|
@@ -38,39 +43,145 @@ function call(data) {
|
|
|
38
43
|
});
|
|
39
44
|
}
|
|
40
45
|
exports.call = call;
|
|
46
|
+
function createConfirmObject4COAByOrder(params) {
|
|
47
|
+
// COA予約のみ
|
|
48
|
+
const coaReservationOffers = params.order.acceptedOffers.filter((o) => {
|
|
49
|
+
var _a;
|
|
50
|
+
return o.itemOffered.typeOf === factory.reservationType.EventReservation
|
|
51
|
+
&& ((_a = o.offeredThrough) === null || _a === void 0 ? void 0 : _a.identifier) === factory.service.webAPI.Identifier.COA;
|
|
52
|
+
});
|
|
53
|
+
const customer = params.order.customer;
|
|
54
|
+
// 電話番号のフォーマットを日本人にリーダブルに調整(COAではこのフォーマットで扱うので)
|
|
55
|
+
const phoneUtil = google_libphonenumber_1.PhoneNumberUtil.getInstance();
|
|
56
|
+
const phoneNumber = phoneUtil.parse(customer.telephone, 'JP');
|
|
57
|
+
let telNum = phoneUtil.format(phoneNumber, google_libphonenumber_1.PhoneNumberFormat.NATIONAL);
|
|
58
|
+
// COAでは数字のみ受け付けるので数字以外を除去
|
|
59
|
+
telNum = telNum.replace(/[^\d]/g, '');
|
|
60
|
+
const mailAddr = customer.email;
|
|
61
|
+
if (mailAddr === undefined) {
|
|
62
|
+
throw new factory.errors.Argument('order', 'order.customer.email undefined');
|
|
63
|
+
}
|
|
64
|
+
const coaReservations = coaReservationOffers
|
|
65
|
+
.filter((o) => o.itemOffered.reservationNumber === params.reservationNumber)
|
|
66
|
+
.map((o) => {
|
|
67
|
+
return o.itemOffered;
|
|
68
|
+
});
|
|
69
|
+
const coaReservation = coaReservations[0];
|
|
70
|
+
const reservationForCOAInfo = coaReservation.reservationFor.coaInfo;
|
|
71
|
+
if (reservationForCOAInfo === undefined) {
|
|
72
|
+
throw new factory.errors.NotFound('reservationFor.coaInfo');
|
|
73
|
+
}
|
|
74
|
+
const totalPrice = coaReservation.reservedTicket.coaReserveAmount;
|
|
75
|
+
if (totalPrice === undefined) {
|
|
76
|
+
throw new factory.errors.NotFound('reservedTicket.coaReserveAmount');
|
|
77
|
+
}
|
|
78
|
+
const listTicket = coaReservations.map((r) => {
|
|
79
|
+
var _a;
|
|
80
|
+
if (typeof ((_a = r.reservedTicket.coaTicketInfo) === null || _a === void 0 ? void 0 : _a.ticketCode) !== 'string') {
|
|
81
|
+
throw new factory.errors.NotFound('reservedTicket.coaTicketInfo');
|
|
82
|
+
}
|
|
83
|
+
// 冗長な属性を排除(2023-03-20~)
|
|
84
|
+
const { ticketCode, stdPrice, addPrice, spseatAdd1, spseatAdd2, disPrice, salePrice, mvtkAppPrice, ticketCount, spseatKbn, seatNum, addGlasses, kbnEisyahousiki, mvtkNum, mvtkKbnDenshiken, mvtkKbnMaeuriken, mvtkKbnKensyu, mvtkSalesPrice, kbnMgtk } = r.reservedTicket.coaTicketInfo;
|
|
85
|
+
return {
|
|
86
|
+
ticketCode, stdPrice, addPrice, spseatAdd1, spseatAdd2,
|
|
87
|
+
disPrice, salePrice, mvtkAppPrice, ticketCount, spseatKbn,
|
|
88
|
+
seatNum, addGlasses, kbnEisyahousiki, mvtkNum, mvtkKbnDenshiken,
|
|
89
|
+
mvtkKbnMaeuriken, mvtkKbnKensyu, mvtkSalesPrice, kbnMgtk
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
return {
|
|
93
|
+
theaterCode: reservationForCOAInfo.theaterCode,
|
|
94
|
+
dateJouei: reservationForCOAInfo.dateJouei,
|
|
95
|
+
titleCode: reservationForCOAInfo.titleCode,
|
|
96
|
+
titleBranchNum: reservationForCOAInfo.titleBranchNum,
|
|
97
|
+
timeBegin: reservationForCOAInfo.timeBegin,
|
|
98
|
+
tmpReserveNum: params.reservationNumber,
|
|
99
|
+
// tslint:disable-next-line:no-irregular-whitespace
|
|
100
|
+
reserveName: (0, util_1.format)('%s %s', customer.familyName, customer.givenName),
|
|
101
|
+
// tslint:disable-next-line:no-irregular-whitespace
|
|
102
|
+
reserveNameJkana: (0, util_1.format)('%s %s', customer.familyName, customer.givenName),
|
|
103
|
+
telNum: telNum,
|
|
104
|
+
mailAddr: mailAddr,
|
|
105
|
+
reserveAmount: totalPrice,
|
|
106
|
+
listTicket
|
|
107
|
+
// transactionNumber: reservationNumber,
|
|
108
|
+
// typeOf: 'COAReserveTransaction'
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function fixOrderAsPurpose(params) {
|
|
112
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
113
|
+
let order;
|
|
114
|
+
const purposeOrderNumber = params.purpose.orderNumber;
|
|
115
|
+
const orders = yield repos.order.search({
|
|
116
|
+
limit: 1,
|
|
117
|
+
page: 1,
|
|
118
|
+
project: { id: { $eq: params.project.id } },
|
|
119
|
+
// confirmationNumbers: [payPurposeConfirmationNumber],
|
|
120
|
+
orderNumbers: [purposeOrderNumber]
|
|
121
|
+
}, { customer: 1, orderNumber: 1, typeOf: 1 });
|
|
122
|
+
order = orders.shift();
|
|
123
|
+
if (order === undefined) {
|
|
124
|
+
throw new factory.errors.NotFound('Order as purpose');
|
|
125
|
+
}
|
|
126
|
+
const acceptedOffers = yield repos.acceptedOffer.searchAcceptedOffersByOrderNumber({
|
|
127
|
+
orderNumber: { $eq: order.orderNumber },
|
|
128
|
+
project: { id: { $eq: params.project.id } }
|
|
129
|
+
}, ['itemOffered', 'offeredThrough']);
|
|
130
|
+
return Object.assign(Object.assign({}, order), { acceptedOffers });
|
|
131
|
+
});
|
|
132
|
+
}
|
|
41
133
|
/**
|
|
42
134
|
* 予約を確定する
|
|
43
135
|
*/
|
|
44
|
-
function confirmReserveTransaction(params) {
|
|
136
|
+
function confirmReserveTransaction(params, options) {
|
|
45
137
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
138
|
+
let confirmActionObject;
|
|
139
|
+
switch (params.instrument.identifier) {
|
|
140
|
+
case factory.service.webAPI.Identifier.COA:
|
|
141
|
+
// 最適化されたタスクに対応するため、ここでIObject4COAを注文から生成する(2024-01-24~)
|
|
142
|
+
const order = yield fixOrderAsPurpose({
|
|
143
|
+
project: { id: params.project.id },
|
|
144
|
+
purpose: params.purpose
|
|
145
|
+
})(repos);
|
|
146
|
+
const updReserveArgs = createConfirmObject4COAByOrder({ order, reservationNumber: params.object.transactionNumber });
|
|
147
|
+
debug('confirming coa reserve transaction...', order, updReserveArgs);
|
|
148
|
+
const object4coa = Object.assign(Object.assign({}, updReserveArgs), { transactionNumber: params.object.transactionNumber, typeOf: 'COAReserveTransaction' });
|
|
149
|
+
// if (USE_OPTIMIZED_CONFIRM_RESERVE_COA_TASK_VERIFY) {
|
|
150
|
+
// const isValidObject = JSON.stringify(object4coa) === JSON.stringify(params.object);
|
|
151
|
+
// debug('confirmActionObject === params.object?', isValidObject);
|
|
152
|
+
// if (!isValidObject) {
|
|
153
|
+
// throw new factory.errors.Argument('object', 'object4coa !== params.object');
|
|
154
|
+
// }
|
|
155
|
+
// }
|
|
156
|
+
// 上書き
|
|
157
|
+
confirmActionObject = object4coa;
|
|
158
|
+
// if (USE_OPTIMIZED_CONFIRM_RESERVE_COA_TASK) {
|
|
159
|
+
// // 上書き
|
|
160
|
+
// confirmActionObject = object4coa;
|
|
161
|
+
// } else {
|
|
162
|
+
// confirmActionObject = <factory.action.interact.confirm.reservation.IObject4COA>params.object;
|
|
163
|
+
// }
|
|
164
|
+
break;
|
|
165
|
+
default:
|
|
166
|
+
confirmActionObject = params.object;
|
|
167
|
+
}
|
|
46
168
|
// アクション開始
|
|
47
|
-
const confirmActionAttributes = params;
|
|
169
|
+
const confirmActionAttributes = Object.assign(Object.assign({}, params), { object: confirmActionObject });
|
|
48
170
|
const action = yield repos.action.start(confirmActionAttributes);
|
|
171
|
+
let updReserveResult;
|
|
49
172
|
try {
|
|
50
|
-
|
|
173
|
+
const object = confirmActionAttributes.object;
|
|
51
174
|
switch (params.instrument.identifier) {
|
|
52
175
|
case factory.service.webAPI.Identifier.COA:
|
|
53
176
|
// COA本予約
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
endpoint: credentials_1.credentials.coa.endpoint,
|
|
60
|
-
auth: coaAuthClient
|
|
61
|
-
}, { timeout: credentials_1.credentials.coa.timeout });
|
|
62
|
-
const stateReserveResult = yield reserveService.stateReserve({
|
|
63
|
-
theaterCode: object.theaterCode,
|
|
64
|
-
reserveNum: object.tmpReserveNum,
|
|
65
|
-
telNum: object.telNum
|
|
66
|
-
});
|
|
67
|
-
if (stateReserveResult === null) {
|
|
68
|
-
yield reserveService.updReserve(object);
|
|
69
|
-
}
|
|
177
|
+
updReserveResult = yield COAReserveService.confirm({
|
|
178
|
+
project: { id: confirmActionAttributes.project.id },
|
|
179
|
+
object: object,
|
|
180
|
+
purpose: confirmActionAttributes.purpose
|
|
181
|
+
})({});
|
|
70
182
|
break;
|
|
71
183
|
default:
|
|
72
184
|
// 予約取引確定
|
|
73
|
-
object = object;
|
|
74
185
|
yield ReserveTransactionService.confirm({
|
|
75
186
|
transactionNumber: object.transactionNumber,
|
|
76
187
|
potentialActions: object.potentialActions
|
|
@@ -87,8 +198,44 @@ function confirmReserveTransaction(params) {
|
|
|
87
198
|
throw error;
|
|
88
199
|
}
|
|
89
200
|
// アクション完了
|
|
90
|
-
const result = {};
|
|
91
|
-
yield repos.action.
|
|
201
|
+
const result = { updReserveResult };
|
|
202
|
+
yield repos.action.completeWithVoid({ typeOf: confirmActionAttributes.typeOf, id: action.id, result: result });
|
|
203
|
+
// sendOrder連携(2024-01-11~)
|
|
204
|
+
yield onConfirmed(confirmActionAttributes, options)({
|
|
205
|
+
task: repos.task
|
|
206
|
+
});
|
|
92
207
|
});
|
|
93
208
|
}
|
|
94
209
|
exports.confirmReserveTransaction = confirmReserveTransaction;
|
|
210
|
+
function onConfirmed(params, options) {
|
|
211
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
212
|
+
if (options.sendOrder === true) {
|
|
213
|
+
// タスク冪等作成
|
|
214
|
+
const onAssetTransactionStatusChangedTaskData = {
|
|
215
|
+
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
216
|
+
object: {
|
|
217
|
+
typeOf: params.object.typeOf,
|
|
218
|
+
transactionNumber: params.object.transactionNumber,
|
|
219
|
+
status: factory.transactionStatusType.Confirmed
|
|
220
|
+
},
|
|
221
|
+
purpose: {
|
|
222
|
+
confirmationNumber: '',
|
|
223
|
+
orderNumber: params.purpose.orderNumber,
|
|
224
|
+
typeOf: factory.order.OrderType.Order
|
|
225
|
+
},
|
|
226
|
+
useOnOrderStatusChanged: options.useOnOrderStatusChanged === true
|
|
227
|
+
};
|
|
228
|
+
const onAssetTransactionStatusChangedTask = {
|
|
229
|
+
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
230
|
+
name: factory.taskName.OnAssetTransactionStatusChanged,
|
|
231
|
+
status: factory.taskStatus.Ready,
|
|
232
|
+
runsAt: new Date(),
|
|
233
|
+
remainingNumberOfTries: 10,
|
|
234
|
+
numberOfTried: 0,
|
|
235
|
+
executionResults: [],
|
|
236
|
+
data: onAssetTransactionStatusChangedTaskData
|
|
237
|
+
};
|
|
238
|
+
yield repos.task.createOnAssetTransactionStatusChangedTaskIfNotExist(onAssetTransactionStatusChangedTask, { emitImmediately: true });
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.call = void 0;
|
|
13
|
+
const factory = require("../../factory");
|
|
14
|
+
const acceptedOffer_1 = require("../../repo/acceptedOffer");
|
|
15
|
+
const accountingReport_1 = require("../../repo/accountingReport");
|
|
16
|
+
const action_1 = require("../../repo/action");
|
|
17
|
+
const order_1 = require("../../repo/order");
|
|
18
|
+
const createAccountingReportIfNotExist_1 = require("../order/createAccountingReportIfNotExist");
|
|
19
|
+
/**
|
|
20
|
+
* タスク実行関数
|
|
21
|
+
*/
|
|
22
|
+
function call(data) {
|
|
23
|
+
return ({ connection }) => __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
yield createAccountingReport(data)({
|
|
25
|
+
acceptedOffer: new acceptedOffer_1.MongoRepository(connection),
|
|
26
|
+
accountingReport: new accountingReport_1.MongoRepository(connection),
|
|
27
|
+
action: new action_1.MongoRepository(connection),
|
|
28
|
+
order: new order_1.MongoRepository(connection)
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
exports.call = call;
|
|
33
|
+
function createAccountingReport(params) {
|
|
34
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const order = yield repos.order.findByOrderNumber({
|
|
36
|
+
orderNumber: params.object.mainEntity.orderNumber,
|
|
37
|
+
project: { id: params.project.id },
|
|
38
|
+
inclusion: [],
|
|
39
|
+
exclusion: []
|
|
40
|
+
});
|
|
41
|
+
const simpleOrder = {
|
|
42
|
+
typeOf: order.typeOf,
|
|
43
|
+
seller: {
|
|
44
|
+
id: order.seller.id,
|
|
45
|
+
typeOf: order.seller.typeOf,
|
|
46
|
+
name: order.seller.name
|
|
47
|
+
},
|
|
48
|
+
customer: { typeOf: order.customer.typeOf, id: order.customer.id },
|
|
49
|
+
orderNumber: order.orderNumber,
|
|
50
|
+
price: order.price,
|
|
51
|
+
priceCurrency: order.priceCurrency,
|
|
52
|
+
orderDate: order.orderDate
|
|
53
|
+
};
|
|
54
|
+
const actionAttributes = {
|
|
55
|
+
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
56
|
+
typeOf: factory.actionType.CreateAction,
|
|
57
|
+
agent: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
58
|
+
object: Object.assign(Object.assign({}, params), { typeOf: 'Report' }),
|
|
59
|
+
purpose: simpleOrder
|
|
60
|
+
};
|
|
61
|
+
const action = yield repos.action.start(actionAttributes);
|
|
62
|
+
try {
|
|
63
|
+
const acceptedOffers = yield repos.acceptedOffer.searchAcceptedOffersByOrderNumber({
|
|
64
|
+
orderNumber: { $eq: params.object.mainEntity.orderNumber },
|
|
65
|
+
project: { id: { $eq: params.project.id } }
|
|
66
|
+
});
|
|
67
|
+
yield (0, createAccountingReportIfNotExist_1.createAccountingReportIfNotExist)(Object.assign(Object.assign({}, order), { acceptedOffers }))(repos);
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
try {
|
|
71
|
+
yield repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
72
|
+
}
|
|
73
|
+
catch (__) {
|
|
74
|
+
// 失敗したら仕方ない
|
|
75
|
+
}
|
|
76
|
+
throw error;
|
|
77
|
+
}
|
|
78
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: {} });
|
|
79
|
+
});
|
|
80
|
+
}
|
|
@@ -18,7 +18,8 @@ const credentials_1 = require("../../credentials");
|
|
|
18
18
|
const OfferService = require("../offer");
|
|
19
19
|
const coaAuthClient = new COA.auth.RefreshToken({
|
|
20
20
|
endpoint: credentials_1.credentials.coa.endpoint,
|
|
21
|
-
refreshToken: credentials_1.credentials.coa.refreshToken
|
|
21
|
+
refreshToken: credentials_1.credentials.coa.refreshToken,
|
|
22
|
+
useFetch: credentials_1.credentials.coa.useFetch
|
|
22
23
|
});
|
|
23
24
|
/**
|
|
24
25
|
* タスク実行関数
|
|
@@ -128,7 +128,7 @@ function deleteResourcesByScreeningEventSeries(params) {
|
|
|
128
128
|
}
|
|
129
129
|
throw error;
|
|
130
130
|
}
|
|
131
|
-
yield repos.action.
|
|
131
|
+
yield repos.action.completeWithVoid({ typeOf: deleteActionAttributes.typeOf, id: action.id, result: deleteResult });
|
|
132
132
|
}
|
|
133
133
|
});
|
|
134
134
|
}
|
|
@@ -162,7 +162,7 @@ function deleteResourcesByScreeningRoom(params) {
|
|
|
162
162
|
}
|
|
163
163
|
throw error;
|
|
164
164
|
}
|
|
165
|
-
yield repos.action.
|
|
165
|
+
yield repos.action.completeWithVoid({ typeOf: deleteActionAttributes.typeOf, id: action.id, result: deleteResult });
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
168
|
function deleteResourcesByMovieTheater(params) {
|
|
@@ -206,7 +206,7 @@ function deleteResourcesByMovieTheater(params) {
|
|
|
206
206
|
}
|
|
207
207
|
throw error;
|
|
208
208
|
}
|
|
209
|
-
yield repos.action.
|
|
209
|
+
yield repos.action.completeWithVoid({ typeOf: deleteActionAttributes.typeOf, id: action.id, result: deleteResult });
|
|
210
210
|
}
|
|
211
211
|
});
|
|
212
212
|
}
|
|
@@ -269,7 +269,7 @@ function deleteResourcesBySeller(params) {
|
|
|
269
269
|
}
|
|
270
270
|
throw error;
|
|
271
271
|
}
|
|
272
|
-
yield repos.action.
|
|
272
|
+
yield repos.action.completeWithVoid({ typeOf: deleteActionAttributes.typeOf, id: action.id, result: deleteResult });
|
|
273
273
|
}
|
|
274
274
|
});
|
|
275
275
|
}
|
|
@@ -309,7 +309,7 @@ function deleteResourcesByAggregateOffer(params) {
|
|
|
309
309
|
}
|
|
310
310
|
throw error;
|
|
311
311
|
}
|
|
312
|
-
yield repos.action.
|
|
312
|
+
yield repos.action.completeWithVoid({ typeOf: deleteActionAttributes.typeOf, id: action.id, result: deleteResult });
|
|
313
313
|
}
|
|
314
314
|
});
|
|
315
315
|
}
|
|
@@ -369,7 +369,7 @@ function deleteResourcesByOfferCatalog(params) {
|
|
|
369
369
|
}
|
|
370
370
|
throw error;
|
|
371
371
|
}
|
|
372
|
-
yield repos.action.
|
|
372
|
+
yield repos.action.completeWithVoid({ typeOf: deleteActionAttributes.typeOf, id: action.id, result: deleteResult });
|
|
373
373
|
}
|
|
374
374
|
});
|
|
375
375
|
}
|
|
@@ -411,7 +411,7 @@ function deleteResourcesByProduct(params) {
|
|
|
411
411
|
}
|
|
412
412
|
throw error;
|
|
413
413
|
}
|
|
414
|
-
yield repos.action.
|
|
414
|
+
yield repos.action.completeWithVoid({ typeOf: deleteActionAttributes.typeOf, id: action.id, result: deleteResult });
|
|
415
415
|
}
|
|
416
416
|
});
|
|
417
417
|
}
|
|
@@ -10,9 +10,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.call = void 0;
|
|
13
|
+
const acceptedOffer_1 = require("../../repo/acceptedOffer");
|
|
13
14
|
const accountingReport_1 = require("../../repo/accountingReport");
|
|
14
15
|
const action_1 = require("../../repo/action");
|
|
16
|
+
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
15
17
|
const event_1 = require("../../repo/event");
|
|
18
|
+
const order_1 = require("../../repo/order");
|
|
16
19
|
const paymentService_1 = require("../../repo/paymentService");
|
|
17
20
|
const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
18
21
|
const product_1 = require("../../repo/product");
|
|
@@ -26,9 +29,12 @@ const PaymentService = require("../payment");
|
|
|
26
29
|
function call(data) {
|
|
27
30
|
return (settings) => __awaiter(this, void 0, void 0, function* () {
|
|
28
31
|
yield PaymentService.pay(data)({
|
|
32
|
+
acceptedOffer: new acceptedOffer_1.MongoRepository(settings.connection),
|
|
29
33
|
accountingReport: new accountingReport_1.MongoRepository(settings.connection),
|
|
30
34
|
action: new action_1.MongoRepository(settings.connection),
|
|
35
|
+
assetTransaction: new assetTransaction_1.MongoRepository(settings.connection),
|
|
31
36
|
event: new event_1.MongoRepository(settings.connection),
|
|
37
|
+
order: new order_1.MongoRepository(settings.connection),
|
|
32
38
|
paymentAccepted: new sellerPaymentAccepted_1.MongoRepository(settings.connection),
|
|
33
39
|
paymentService: new paymentService_1.MongoRepository(settings.connection),
|
|
34
40
|
paymentServiceProvider: new paymentServiceProvider_1.MongoRepository(settings.connection),
|
|
@@ -14,6 +14,7 @@ const acceptedOffer_1 = require("../../repo/acceptedOffer");
|
|
|
14
14
|
const accountingReport_1 = require("../../repo/accountingReport");
|
|
15
15
|
const action_1 = require("../../repo/action");
|
|
16
16
|
const order_1 = require("../../repo/order");
|
|
17
|
+
const orderInTransaction_1 = require("../../repo/orderInTransaction");
|
|
17
18
|
const task_1 = require("../../repo/task");
|
|
18
19
|
const transaction_1 = require("../../repo/transaction");
|
|
19
20
|
const OrderService = require("../order");
|
|
@@ -21,17 +22,15 @@ const OrderService = require("../order");
|
|
|
21
22
|
* タスク実行関数
|
|
22
23
|
*/
|
|
23
24
|
function call(data) {
|
|
24
|
-
return (
|
|
25
|
-
// if (settings.redisClient === undefined) {
|
|
26
|
-
// throw new factory.errors.Argument('settings', 'redisClient required');
|
|
27
|
-
// }
|
|
25
|
+
return ({ connection }) => __awaiter(this, void 0, void 0, function* () {
|
|
28
26
|
yield OrderService.placeOrder(Object.assign(Object.assign({}, data), { useOnOrderStatusChanged: true }))({
|
|
29
|
-
acceptedOffer: new acceptedOffer_1.MongoRepository(
|
|
30
|
-
accountingReport: new accountingReport_1.MongoRepository(
|
|
31
|
-
action: new action_1.MongoRepository(
|
|
32
|
-
order: new order_1.MongoRepository(
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
acceptedOffer: new acceptedOffer_1.MongoRepository(connection),
|
|
28
|
+
accountingReport: new accountingReport_1.MongoRepository(connection),
|
|
29
|
+
action: new action_1.MongoRepository(connection),
|
|
30
|
+
order: new order_1.MongoRepository(connection),
|
|
31
|
+
orderInTransaction: new orderInTransaction_1.MongoRepository(connection),
|
|
32
|
+
task: new task_1.MongoRepository(connection),
|
|
33
|
+
transaction: new transaction_1.MongoRepository(connection)
|
|
35
34
|
});
|
|
36
35
|
});
|
|
37
36
|
}
|
|
@@ -22,9 +22,6 @@ const returnOrder_1 = require("../order/returnOrder");
|
|
|
22
22
|
*/
|
|
23
23
|
function call(data) {
|
|
24
24
|
return (settings) => __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
// if (settings.redisClient === undefined) {
|
|
26
|
-
// throw new factory.errors.Argument('settings', 'redisClient required');
|
|
27
|
-
// }
|
|
28
25
|
yield (0, returnOrder_1.returnOrder)(Object.assign(Object.assign({}, data), { useOnOrderStatusChanged: true }))({
|
|
29
26
|
acceptedOffer: new acceptedOffer_1.MongoRepository(settings.connection),
|
|
30
27
|
action: new action_1.MongoRepository(settings.connection),
|
|
@@ -111,7 +111,7 @@ function returnPayTransaction(params) {
|
|
|
111
111
|
throw error;
|
|
112
112
|
}
|
|
113
113
|
const result = { refundTransaction };
|
|
114
|
-
yield repos.action.
|
|
114
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: result });
|
|
115
115
|
// 潜在アクション
|
|
116
116
|
yield onRefund(refundActionAttributes)({ task: repos.task });
|
|
117
117
|
});
|
|
@@ -22,7 +22,8 @@ const CancelReservationTransactionService = require("../assetTransaction/cancelR
|
|
|
22
22
|
const credentials_1 = require("../../credentials");
|
|
23
23
|
const coaAuthClient = new COA.auth.RefreshToken({
|
|
24
24
|
endpoint: credentials_1.credentials.coa.endpoint,
|
|
25
|
-
refreshToken: credentials_1.credentials.coa.refreshToken
|
|
25
|
+
refreshToken: credentials_1.credentials.coa.refreshToken,
|
|
26
|
+
useFetch: credentials_1.credentials.coa.useFetch
|
|
26
27
|
});
|
|
27
28
|
/**
|
|
28
29
|
* タスク実行関数
|
|
@@ -68,7 +69,7 @@ function cancelReservation(params) {
|
|
|
68
69
|
}
|
|
69
70
|
throw error;
|
|
70
71
|
}
|
|
71
|
-
yield repos.action.
|
|
72
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: {} });
|
|
72
73
|
});
|
|
73
74
|
}
|
|
74
75
|
function processCancelReservation4coa(params) {
|
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.call = void 0;
|
|
13
|
+
const factory = require("../../factory");
|
|
13
14
|
const acceptedOffer_1 = require("../../repo/acceptedOffer");
|
|
14
15
|
const action_1 = require("../../repo/action");
|
|
15
16
|
const order_1 = require("../../repo/order");
|
|
@@ -22,10 +23,13 @@ const OrderService = require("../order");
|
|
|
22
23
|
*/
|
|
23
24
|
function call(data) {
|
|
24
25
|
return (settings) => __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
var _a;
|
|
27
|
+
yield OrderService.sendOrder(Object.assign(Object.assign({}, data), { object: Object.assign(Object.assign({}, data.object), { previousOrderStatus: (typeof data.object.previousOrderStatus === 'string')
|
|
28
|
+
? data.object.previousOrderStatus
|
|
29
|
+
: factory.orderStatus.OrderInTransit, acceptedOffers: (typeof ((_a = data.object.acceptedOffers) === null || _a === void 0 ? void 0 : _a.limit) === 'number')
|
|
30
|
+
? data.object.acceptedOffers
|
|
31
|
+
: { limit: 50, page: 1 } // 互換性維持対応として指定がない場合に対応
|
|
32
|
+
}), useOnOrderStatusChanged: true }))({
|
|
29
33
|
acceptedOffer: new acceptedOffer_1.MongoRepository(settings.connection),
|
|
30
34
|
action: new action_1.MongoRepository(settings.connection),
|
|
31
35
|
order: new order_1.MongoRepository(settings.connection),
|
|
@@ -24,7 +24,7 @@ function call(data) {
|
|
|
24
24
|
var _a, _b;
|
|
25
25
|
yield (0, reserve_1.useReservation)(Object.assign(Object.assign({ project: data.project, agent: data.agent, object: data.object,
|
|
26
26
|
// タスク作成前に検証済なので検証不要
|
|
27
|
-
verifyToken: false
|
|
27
|
+
verifyToken: false }, (typeof ((_a = data.instrument) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { instrument: data.instrument } : undefined), (typeof ((_b = data.location) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string') ? { location: data.location } : undefined))({
|
|
28
28
|
action: new action_1.MongoRepository(settings.connection),
|
|
29
29
|
assetTransaction: new assetTransaction_1.MongoRepository(settings.connection),
|
|
30
30
|
order: new order_1.MongoRepository(settings.connection),
|
|
@@ -13,6 +13,7 @@ exports.call = void 0;
|
|
|
13
13
|
const factory = require("../../factory");
|
|
14
14
|
const action_1 = require("../../repo/action");
|
|
15
15
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
16
|
+
const orderInTransaction_1 = require("../../repo/orderInTransaction");
|
|
16
17
|
const offer_1 = require("../../repo/rateLimit/offer");
|
|
17
18
|
const reservation_1 = require("../../repo/reservation");
|
|
18
19
|
const stockHolder_1 = require("../../repo/stockHolder");
|
|
@@ -27,19 +28,14 @@ function call(data) {
|
|
|
27
28
|
if (settings.redisClient === undefined) {
|
|
28
29
|
throw new factory.errors.Argument('settings', 'redisClient required');
|
|
29
30
|
}
|
|
30
|
-
const actionRepo = new action_1.MongoRepository(settings.connection);
|
|
31
|
-
const assetTransactionRepo = new assetTransaction_1.MongoRepository(settings.connection);
|
|
32
|
-
const stockHolderRepo = new stockHolder_1.StockHolderRepository(settings.redisClient, settings.connection);
|
|
33
|
-
const offerRateLimitRepo = new offer_1.RedisRepository(settings.redisClient);
|
|
34
|
-
const reservationRepo = new reservation_1.MongoRepository(settings.connection);
|
|
35
|
-
const taskRepo = new task_1.MongoRepository(settings.connection);
|
|
36
31
|
yield EventOfferService.voidTransaction(data)({
|
|
37
|
-
action:
|
|
38
|
-
assetTransaction:
|
|
39
|
-
stockHolder:
|
|
40
|
-
offerRateLimit:
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
action: new action_1.MongoRepository(settings.connection),
|
|
33
|
+
assetTransaction: new assetTransaction_1.MongoRepository(settings.connection),
|
|
34
|
+
stockHolder: new stockHolder_1.StockHolderRepository(settings.redisClient, settings.connection),
|
|
35
|
+
offerRateLimit: new offer_1.RedisRepository(settings.redisClient),
|
|
36
|
+
orderInTransaction: new orderInTransaction_1.MongoRepository(settings.connection),
|
|
37
|
+
reservation: new reservation_1.MongoRepository(settings.connection),
|
|
38
|
+
task: new task_1.MongoRepository(settings.connection),
|
|
43
39
|
transaction: new transaction_1.MongoRepository(settings.connection)
|
|
44
40
|
});
|
|
45
41
|
});
|
|
@@ -261,7 +261,7 @@ function deleteTransactionById(params) {
|
|
|
261
261
|
deletedReservationNumbers,
|
|
262
262
|
deleteActionResult
|
|
263
263
|
};
|
|
264
|
-
yield repos.action.
|
|
264
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
265
265
|
});
|
|
266
266
|
}
|
|
267
267
|
function deleteReservationsByPlaceOrder(params) {
|
|
@@ -20,33 +20,17 @@ function createMoneyTransferActions(params) {
|
|
|
20
20
|
var _a;
|
|
21
21
|
const actionResult = a.result;
|
|
22
22
|
const pendingTransaction = (_a = a.object.itemOffered.object) === null || _a === void 0 ? void 0 : _a.pendingTransaction;
|
|
23
|
-
// const fromLocation = params.transaction.object.fromLocation;
|
|
24
23
|
if (actionResult !== undefined && pendingTransaction !== undefined) {
|
|
25
24
|
moneyTransferActions.push({
|
|
26
25
|
project: params.transaction.project,
|
|
27
26
|
typeOf: factory.actionType.ConfirmAction,
|
|
28
27
|
object: {
|
|
29
|
-
pendingTransaction: { id: actionResult.responseBody.id },
|
|
28
|
+
// pendingTransaction: { id: actionResult.responseBody.id },
|
|
30
29
|
transactionNumber: pendingTransaction.transactionNumber,
|
|
31
30
|
typeOf: factory.assetTransactionType.MoneyTransfer
|
|
32
31
|
},
|
|
33
|
-
// agent: Projectに統一(2022-05-16~)
|
|
34
32
|
agent: params.transaction.project,
|
|
35
|
-
|
|
36
|
-
// ↓recipient廃止(2022-05-16~)
|
|
37
|
-
// recipient: a.recipient,
|
|
38
|
-
// amount: {
|
|
39
|
-
// typeOf: 'MonetaryAmount',
|
|
40
|
-
// value: a.object.itemOffered.amount.value,
|
|
41
|
-
// currency: a.object.itemOffered.amount.currency
|
|
42
|
-
// },
|
|
43
|
-
// fromLocation: fromLocation,
|
|
44
|
-
// toLocation: params.transaction.object.toLocation,
|
|
45
|
-
purpose: {
|
|
46
|
-
typeOf: params.transaction.typeOf,
|
|
47
|
-
id: params.transaction.id
|
|
48
|
-
}
|
|
49
|
-
// ...(typeof a.object.description === 'string') ? { description: a.object.description } : {}
|
|
33
|
+
purpose: { typeOf: params.transaction.typeOf, id: params.transaction.id }
|
|
50
34
|
});
|
|
51
35
|
}
|
|
52
36
|
});
|