@chevre/domain 21.20.0-alpha.2 → 21.20.0-alpha.22
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/onAssetTransactionStatusChanged.ts +36 -0
- package/example/src/chevre/retryTasks.ts +39 -0
- 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/processAcceptOffer.ts +48 -0
- package/example/src/chevre/transaction/processPlaceOrder.ts +82 -53
- package/lib/chevre/repo/acceptedOffer.d.ts +21 -1
- package/lib/chevre/repo/acceptedOffer.js +32 -2
- package/lib/chevre/repo/action.d.ts +13 -7
- package/lib/chevre/repo/action.js +33 -11
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/order.js +20 -11
- package/lib/chevre/repo/order.js +28 -9
- package/lib/chevre/repo/orderInTransaction.d.ts +27 -0
- package/lib/chevre/repo/orderInTransaction.js +77 -0
- package/lib/chevre/repo/task.d.ts +0 -2
- package/lib/chevre/repo/task.js +56 -46
- package/lib/chevre/repo/transaction.d.ts +1 -1
- package/lib/chevre/repository.d.ts +5 -0
- package/lib/chevre/repository.js +15 -2
- package/lib/chevre/service/assetTransaction/pay.d.ts +0 -10
- package/lib/chevre/service/assetTransaction/pay.js +4 -4
- 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 +2 -2
- package/lib/chevre/service/moneyTransfer.js +1 -1
- package/lib/chevre/service/notification.js +2 -5
- package/lib/chevre/service/offer/any.d.ts +29 -0
- package/lib/chevre/service/offer/any.js +55 -0
- package/lib/chevre/service/offer/event/authorize.d.ts +7 -0
- package/lib/chevre/service/offer/event/authorize.js +11 -0
- package/lib/chevre/service/offer/event/cancel.d.ts +2 -0
- package/lib/chevre/service/offer/event/cancel.js +12 -1
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -0
- package/lib/chevre/service/offer/event/voidTransaction.js +12 -5
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +48 -0
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +133 -0
- package/lib/chevre/service/offer/eventServiceByCOA/cancel.d.ts +39 -0
- package/lib/chevre/service/offer/eventServiceByCOA/cancel.js +58 -0
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.d.ts +25 -0
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +156 -0
- 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 +6 -1
- package/lib/chevre/service/offer/moneyTransfer/authorize.js +2 -1
- package/lib/chevre/service/offer/moneyTransfer/returnMoneyTransfer.js +1 -1
- package/lib/chevre/service/offer/moneyTransfer/settleTransaction.js +1 -1
- package/lib/chevre/service/offer/moneyTransfer/voidTransaction.js +1 -1
- package/lib/chevre/service/offer/product.js +1 -1
- package/lib/chevre/service/order/confirmPayTransaction.js +3 -3
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +11 -1
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +113 -5
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.js +18 -19
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +38 -25
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +11 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.js +45 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.d.ts +14 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.js +37 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.d.ts +10 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +86 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +51 -36
- 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 +2 -0
- package/lib/chevre/service/order/placeOrder.js +28 -29
- 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 +68 -30
- package/lib/chevre/service/payment/any.d.ts +6 -8
- package/lib/chevre/service/payment/any.js +46 -10
- package/lib/chevre/service/payment/creditCard.d.ts +9 -8
- package/lib/chevre/service/payment/creditCard.js +102 -133
- package/lib/chevre/service/payment/faceToFace.d.ts +0 -4
- 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 +0 -6
- package/lib/chevre/service/payment/movieTicket.js +1 -1
- package/lib/chevre/service/payment/paymentCard.d.ts +0 -2
- package/lib/chevre/service/payment/paymentCard.js +6 -6
- package/lib/chevre/service/payment.js +1 -1
- package/lib/chevre/service/product.js +1 -1
- package/lib/chevre/service/reserve/cancelReservation.js +2 -2
- package/lib/chevre/service/reserve/confirmReservation.js +1 -1
- 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/useReservation.d.ts +1 -2
- package/lib/chevre/service/reserve/useReservation.js +4 -4
- package/lib/chevre/service/reserve/verifyToken4reservation.js +2 -0
- package/lib/chevre/service/task/confirmRegisterServiceTransaction.js +1 -1
- package/lib/chevre/service/task/confirmReserveTransaction.d.ts +4 -1
- package/lib/chevre/service/task/confirmReserveTransaction.js +42 -3
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +7 -7
- 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 +1 -1
- package/lib/chevre/service/task/sendOrder.js +8 -4
- package/lib/chevre/service/task/voidPayTransaction.js +2 -2
- package/lib/chevre/service/task/voidReserveTransaction.js +8 -12
- package/lib/chevre/service/transaction/deleteTransaction.js +1 -1
- package/lib/chevre/service/transaction/moneyTransfer.js +1 -5
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.js +18 -13
- package/lib/chevre/service/transaction/placeOrderInProgress.js +2 -2
- package/lib/chevre/service/transaction/returnOrder/preStart.d.ts +32 -0
- package/lib/chevre/service/transaction/returnOrder/preStart.js +632 -0
- package/lib/chevre/service/transaction/returnOrder.d.ts +8 -6
- package/lib/chevre/service/transaction/returnOrder.js +4 -616
- package/lib/chevre/settings.d.ts +3 -1
- package/lib/chevre/settings.js +7 -2
- package/package.json +3 -3
|
@@ -0,0 +1,156 @@
|
|
|
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.changeOffers = exports.WebAPIIdentifier = void 0;
|
|
13
|
+
const moment = require("moment");
|
|
14
|
+
const any_1 = require("../any");
|
|
15
|
+
const factory_1 = require("./factory");
|
|
16
|
+
const validateAcceptedOffers_1 = require("./validateAcceptedOffers");
|
|
17
|
+
const factory = require("../../../factory");
|
|
18
|
+
exports.WebAPIIdentifier = factory.service.webAPI.Identifier;
|
|
19
|
+
/**
|
|
20
|
+
* COA興行オファー承認のオファーを変更
|
|
21
|
+
*/
|
|
22
|
+
function changeOffers(params) {
|
|
23
|
+
// tslint:disable-next-line:max-func-body-length
|
|
24
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
var _a;
|
|
26
|
+
const transaction = yield repos.transaction.findInProgressById({
|
|
27
|
+
typeOf: factory.transactionType.PlaceOrder,
|
|
28
|
+
id: params.transaction.id
|
|
29
|
+
});
|
|
30
|
+
if (transaction.agent.id !== params.agent.id) {
|
|
31
|
+
throw new factory.errors.Forbidden('Transaction not yours');
|
|
32
|
+
}
|
|
33
|
+
// 取引内のアクションかどうか確認
|
|
34
|
+
const authorizeAction = yield repos.action.findById({ typeOf: factory.actionType.AuthorizeAction, id: params.id });
|
|
35
|
+
if (authorizeAction.purpose.typeOf !== transaction.typeOf || authorizeAction.purpose.id !== transaction.id) {
|
|
36
|
+
throw new factory.errors.Argument('Transaction', 'Action not found in the transaction');
|
|
37
|
+
}
|
|
38
|
+
validate4changeOffer({ action: authorizeAction, object: params.object });
|
|
39
|
+
// 座席情報に関しては元のacceptedOffersで自動補完する(リクエストでは正しく指定されないので注意)(2023-03-20~)
|
|
40
|
+
params.object.acceptedOffer = params.object.acceptedOffer.map((offer) => {
|
|
41
|
+
const originalAcceptedOfferBySeatNumber = authorizeAction.object.acceptedOffer.find((originalOffer) => {
|
|
42
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
43
|
+
return ((_d = (_c = (_b = (_a = originalOffer.itemOffered) === null || _a === void 0 ? void 0 : _a.serviceOutput) === null || _b === void 0 ? void 0 : _b.reservedTicket) === null || _c === void 0 ? void 0 : _c.ticketedSeat) === null || _d === void 0 ? void 0 : _d.seatSection)
|
|
44
|
+
=== ((_g = (_f = (_e = offer.itemOffered.serviceOutput) === null || _e === void 0 ? void 0 : _e.reservedTicket) === null || _f === void 0 ? void 0 : _f.ticketedSeat) === null || _g === void 0 ? void 0 : _g.seatSection)
|
|
45
|
+
&& ((_k = (_j = (_h = originalOffer.itemOffered.serviceOutput) === null || _h === void 0 ? void 0 : _h.reservedTicket) === null || _j === void 0 ? void 0 : _j.ticketedSeat) === null || _k === void 0 ? void 0 : _k.seatNumber)
|
|
46
|
+
=== ((_o = (_m = (_l = offer.itemOffered.serviceOutput) === null || _l === void 0 ? void 0 : _l.reservedTicket) === null || _m === void 0 ? void 0 : _m.ticketedSeat) === null || _o === void 0 ? void 0 : _o.seatNumber);
|
|
47
|
+
});
|
|
48
|
+
if (originalAcceptedOfferBySeatNumber === undefined) {
|
|
49
|
+
throw new factory.errors.Argument('offers', 'seatSection or seatNumber not matched.');
|
|
50
|
+
}
|
|
51
|
+
return Object.assign(Object.assign({}, offer), { ticketInfo: Object.assign(Object.assign({}, offer.ticketInfo), { spseatAdd1: originalAcceptedOfferBySeatNumber.ticketInfo.spseatAdd1, spseatAdd2: originalAcceptedOfferBySeatNumber.ticketInfo.spseatAdd2, spseatKbn: originalAcceptedOfferBySeatNumber.ticketInfo.spseatKbn }) });
|
|
52
|
+
});
|
|
53
|
+
// イベント取得属性最適化(2023-01-23~)
|
|
54
|
+
const screeningEvent = yield repos.event.findMinimizedIndividualEventById({
|
|
55
|
+
id: params.object.event.id
|
|
56
|
+
});
|
|
57
|
+
const availablePaymentMethodTypes = yield repos.categoryCode.search({
|
|
58
|
+
project: { id: { $eq: transaction.project.id } },
|
|
59
|
+
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.PaymentMethodType } }
|
|
60
|
+
}, [], []);
|
|
61
|
+
const seatingTypes = yield repos.categoryCode.search({
|
|
62
|
+
project: { id: { $eq: transaction.project.id } },
|
|
63
|
+
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
|
|
64
|
+
}, [], []);
|
|
65
|
+
const videoFormatTypes = yield repos.categoryCode.search({
|
|
66
|
+
project: { id: { $eq: transaction.project.id } },
|
|
67
|
+
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.VideoFormatType } }
|
|
68
|
+
}, [], []);
|
|
69
|
+
// COA仮予約後にリクエストが来る前提
|
|
70
|
+
const { acceptedOffers } = yield (0, validateAcceptedOffers_1.validateAcceptedOffers)({
|
|
71
|
+
object: params.object,
|
|
72
|
+
project: { id: transaction.project.id },
|
|
73
|
+
screeningEvent,
|
|
74
|
+
availablePaymentMethodTypes,
|
|
75
|
+
seatingTypes,
|
|
76
|
+
videoFormatTypes
|
|
77
|
+
})(repos);
|
|
78
|
+
// 供給情報と価格を変更してからDB更新
|
|
79
|
+
authorizeAction.object.acceptedOffer = acceptedOffers;
|
|
80
|
+
const updTmpReserveSeatResult = (_a = authorizeAction.result) === null || _a === void 0 ? void 0 : _a.responseBody;
|
|
81
|
+
if (updTmpReserveSeatResult === undefined) {
|
|
82
|
+
throw new factory.errors.NotFound('action.result.responseBody');
|
|
83
|
+
}
|
|
84
|
+
const { price, eligibleMonetaryAmount } = (0, factory_1.offers2resultPrice)(acceptedOffers);
|
|
85
|
+
const acceptedOffers4result = (0, factory_1.responseBody2acceptedOffers4result)({
|
|
86
|
+
responseBody: updTmpReserveSeatResult,
|
|
87
|
+
object: authorizeAction.object,
|
|
88
|
+
event: screeningEvent,
|
|
89
|
+
seller: transaction.seller,
|
|
90
|
+
bookingTime: moment(authorizeAction.startDate)
|
|
91
|
+
.toDate(),
|
|
92
|
+
totalPrice: price
|
|
93
|
+
});
|
|
94
|
+
const actionResult = Object.assign(Object.assign({}, authorizeAction.result), { price: price, amount: eligibleMonetaryAmount, acceptedOffers: acceptedOffers4result });
|
|
95
|
+
// ActiveActionStatus->CompletedActionStatusで再実装(2024-01-15~)
|
|
96
|
+
yield repos.action.reStart({ id: authorizeAction.id });
|
|
97
|
+
try {
|
|
98
|
+
// add orderInTransaction(2024-01-15~)
|
|
99
|
+
if (params.options.useCreateOrderOnOfferAccepted) {
|
|
100
|
+
yield (0, any_1.acceptOffer)({
|
|
101
|
+
project: transaction.project,
|
|
102
|
+
purpose: { id: transaction.id },
|
|
103
|
+
acceptedOffers: acceptedOffers4result
|
|
104
|
+
})(repos);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
try {
|
|
109
|
+
yield repos.action.giveUp({ typeOf: authorizeAction.typeOf, id: authorizeAction.id, error });
|
|
110
|
+
}
|
|
111
|
+
catch (__) {
|
|
112
|
+
// no op
|
|
113
|
+
}
|
|
114
|
+
throw error;
|
|
115
|
+
}
|
|
116
|
+
// 座席予約承認アクションの供給情報を変更する
|
|
117
|
+
return repos.action.updateAuthorizeEventOfferAction({
|
|
118
|
+
id: params.id,
|
|
119
|
+
object: authorizeAction.object,
|
|
120
|
+
result: actionResult
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
exports.changeOffers = changeOffers;
|
|
125
|
+
function validate4changeOffer(params) {
|
|
126
|
+
// アクション中のイベント識別子と座席リストが合っているかどうか確認
|
|
127
|
+
const authorizeAction = params.action;
|
|
128
|
+
// 完了ステータスのアクションのみ更新可能
|
|
129
|
+
if (authorizeAction.actionStatus !== factory.actionStatusType.CompletedActionStatus) {
|
|
130
|
+
throw new factory.errors.NotFound('authorizeAction');
|
|
131
|
+
}
|
|
132
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
133
|
+
/* istanbul ignore if */
|
|
134
|
+
if (authorizeAction.object.event === undefined) {
|
|
135
|
+
throw new factory.errors.NotFound('authorizeAction.object.event');
|
|
136
|
+
}
|
|
137
|
+
// イベントが一致しているかどうか
|
|
138
|
+
if (authorizeAction.object.event.id !== params.object.event.id) {
|
|
139
|
+
throw new factory.errors.Argument('Event', 'Event ID not matched.');
|
|
140
|
+
}
|
|
141
|
+
// 座席セクションと座席番号が一致しているかどうか
|
|
142
|
+
const acceptedOfferParams = (Array.isArray(params.object.acceptedOffer)) ? params.object.acceptedOffer : [];
|
|
143
|
+
const allSeatsExisted = authorizeAction.object.acceptedOffer.every((originalAcceptedOffer) => {
|
|
144
|
+
return acceptedOfferParams.some((o) => {
|
|
145
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
146
|
+
const newSeatSection = (_c = (_b = (_a = o.itemOffered.serviceOutput) === null || _a === void 0 ? void 0 : _a.reservedTicket) === null || _b === void 0 ? void 0 : _b.ticketedSeat) === null || _c === void 0 ? void 0 : _c.seatSection;
|
|
147
|
+
const newSeatNumber = (_f = (_e = (_d = o.itemOffered.serviceOutput) === null || _d === void 0 ? void 0 : _d.reservedTicket) === null || _e === void 0 ? void 0 : _e.ticketedSeat) === null || _f === void 0 ? void 0 : _f.seatNumber;
|
|
148
|
+
return ((_k = (_j = (_h = (_g = originalAcceptedOffer.itemOffered) === null || _g === void 0 ? void 0 : _g.serviceOutput) === null || _h === void 0 ? void 0 : _h.reservedTicket) === null || _j === void 0 ? void 0 : _j.ticketedSeat) === null || _k === void 0 ? void 0 : _k.seatSection) === newSeatSection
|
|
149
|
+
&& ((_o = (_m = (_l = originalAcceptedOffer.itemOffered.serviceOutput) === null || _l === void 0 ? void 0 : _l.reservedTicket) === null || _m === void 0 ? void 0 : _m.ticketedSeat) === null || _o === void 0 ? void 0 : _o.seatNumber) === newSeatNumber;
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
const allSeatsMatched = (acceptedOfferParams.length === authorizeAction.object.acceptedOffer.length) && allSeatsExisted;
|
|
153
|
+
if (!allSeatsMatched) {
|
|
154
|
+
throw new factory.errors.Argument('offers', 'seatSection or seatNumber not matched.');
|
|
155
|
+
}
|
|
156
|
+
}
|
|
@@ -1,89 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import type { MongoRepository as TransactionRepo } from '../../repo/transaction';
|
|
6
|
-
import { IAcceptedOfferBeforeAuthorize4COA } from './eventServiceByCOA/validateAcceptedOffers';
|
|
7
|
-
import * as factory from '../../factory';
|
|
8
|
-
export import WebAPIIdentifier = factory.service.webAPI.Identifier;
|
|
9
|
-
interface IAuthorizeRepos {
|
|
10
|
-
action: ActionRepo;
|
|
11
|
-
categoryCode: CategoryCodeRepo;
|
|
12
|
-
event: EventRepo;
|
|
13
|
-
offer: OfferRepo;
|
|
14
|
-
transaction: TransactionRepo;
|
|
15
|
-
}
|
|
16
|
-
export type IAuthorizeOperation<T> = (repos: IAuthorizeRepos) => Promise<T>;
|
|
17
|
-
export type IAuthorizeOfferAction = factory.action.authorize.offer.eventService.IAction<WebAPIIdentifier.COA>;
|
|
18
|
-
/**
|
|
19
|
-
* COA興行オファー承認
|
|
20
|
-
*/
|
|
21
|
-
export declare function authorize(params: {
|
|
22
|
-
object: {
|
|
23
|
-
acceptedOffer: IAcceptedOfferBeforeAuthorize4COA[];
|
|
24
|
-
event: {
|
|
25
|
-
id: string;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
agent: {
|
|
29
|
-
id: string;
|
|
30
|
-
};
|
|
31
|
-
transaction: {
|
|
32
|
-
id: string;
|
|
33
|
-
};
|
|
34
|
-
result: {
|
|
35
|
-
requestBody: factory.action.authorize.offer.eventService.IRequestBody<WebAPIIdentifier.COA>;
|
|
36
|
-
responseBody: factory.action.authorize.offer.eventService.IResponseBody<WebAPIIdentifier.COA>;
|
|
37
|
-
};
|
|
38
|
-
}): IAuthorizeOperation<IAuthorizeOfferAction>;
|
|
39
|
-
interface ICancelResult {
|
|
40
|
-
theaterCode: string;
|
|
41
|
-
dateJouei: string;
|
|
42
|
-
titleCode: string;
|
|
43
|
-
titleBranchNum: string;
|
|
44
|
-
timeBegin: string;
|
|
45
|
-
tmpReserveNum: string;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* COA興行オファー承認取消
|
|
49
|
-
*/
|
|
50
|
-
export declare function cancel(params: {
|
|
51
|
-
/**
|
|
52
|
-
* 承認アクションID
|
|
53
|
-
*/
|
|
54
|
-
id: string;
|
|
55
|
-
/**
|
|
56
|
-
* 取引進行者
|
|
57
|
-
*/
|
|
58
|
-
agent: {
|
|
59
|
-
id: string;
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* 取引
|
|
63
|
-
*/
|
|
64
|
-
transaction: {
|
|
65
|
-
id: string;
|
|
66
|
-
};
|
|
67
|
-
}): (repos: {
|
|
68
|
-
action: ActionRepo;
|
|
69
|
-
transaction: TransactionRepo;
|
|
70
|
-
}) => Promise<ICancelResult | undefined>;
|
|
71
|
-
/**
|
|
72
|
-
* COA興行オファー承認のオファーを変更
|
|
73
|
-
*/
|
|
74
|
-
export declare function changeOffers(params: {
|
|
75
|
-
id: string;
|
|
76
|
-
object: {
|
|
77
|
-
acceptedOffer: IAcceptedOfferBeforeAuthorize4COA[];
|
|
78
|
-
event: {
|
|
79
|
-
id: string;
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
agent: {
|
|
83
|
-
id: string;
|
|
84
|
-
};
|
|
85
|
-
transaction: {
|
|
86
|
-
id: string;
|
|
87
|
-
};
|
|
88
|
-
}): IAuthorizeOperation<IAuthorizeOfferAction>;
|
|
89
|
-
export {};
|
|
1
|
+
import { authorize } from './eventServiceByCOA/authorize';
|
|
2
|
+
import { cancel } from './eventServiceByCOA/cancel';
|
|
3
|
+
import { changeOffers } from './eventServiceByCOA/changeOffers';
|
|
4
|
+
export { authorize, cancel, changeOffers };
|
|
@@ -1,294 +1,9 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.changeOffers = exports.cancel = exports.authorize =
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
* COA興行オファー承認
|
|
20
|
-
*/
|
|
21
|
-
function authorize(params) {
|
|
22
|
-
// tslint:disable-next-line:max-func-body-length
|
|
23
|
-
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
const transaction = yield repos.transaction.findInProgressById({
|
|
25
|
-
typeOf: factory.transactionType.PlaceOrder,
|
|
26
|
-
id: params.transaction.id
|
|
27
|
-
});
|
|
28
|
-
if (transaction.agent.id !== params.agent.id) {
|
|
29
|
-
throw new factory.errors.Forbidden('Transaction not yours');
|
|
30
|
-
}
|
|
31
|
-
let screeningEvent;
|
|
32
|
-
let acceptedOffers;
|
|
33
|
-
const pendingTransaction = {
|
|
34
|
-
theaterCode: params.result.requestBody.theaterCode,
|
|
35
|
-
dateJouei: params.result.requestBody.dateJouei,
|
|
36
|
-
titleCode: params.result.requestBody.titleCode,
|
|
37
|
-
titleBranchNum: params.result.requestBody.titleBranchNum,
|
|
38
|
-
timeBegin: params.result.requestBody.timeBegin,
|
|
39
|
-
tmpReserveNum: params.result.responseBody.tmpReserveNum,
|
|
40
|
-
transactionNumber: params.result.responseBody.tmpReserveNum,
|
|
41
|
-
typeOf: 'COAReserveTransaction'
|
|
42
|
-
};
|
|
43
|
-
try {
|
|
44
|
-
// イベント取得属性最適化(2023-01-23~)
|
|
45
|
-
screeningEvent =
|
|
46
|
-
yield repos.event.findMinimizedIndividualEventById({ id: params.object.event.id });
|
|
47
|
-
const availablePaymentMethodTypes = yield repos.categoryCode.search({
|
|
48
|
-
project: { id: { $eq: transaction.project.id } },
|
|
49
|
-
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.PaymentMethodType } }
|
|
50
|
-
}, [], []);
|
|
51
|
-
const seatingTypes = yield repos.categoryCode.search({
|
|
52
|
-
project: { id: { $eq: transaction.project.id } },
|
|
53
|
-
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
|
|
54
|
-
}, [], []);
|
|
55
|
-
const videoFormatTypes = yield repos.categoryCode.search({
|
|
56
|
-
project: { id: { $eq: transaction.project.id } },
|
|
57
|
-
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.VideoFormatType } }
|
|
58
|
-
}, [], []);
|
|
59
|
-
// COA仮予約後にリクエストが来る前提
|
|
60
|
-
const validateAcceptedOffersResult = yield (0, validateAcceptedOffers_1.validateAcceptedOffers)({
|
|
61
|
-
object: params.object,
|
|
62
|
-
project: { id: transaction.project.id },
|
|
63
|
-
screeningEvent,
|
|
64
|
-
availablePaymentMethodTypes,
|
|
65
|
-
seatingTypes,
|
|
66
|
-
videoFormatTypes
|
|
67
|
-
})(repos);
|
|
68
|
-
acceptedOffers = validateAcceptedOffersResult.acceptedOffers;
|
|
69
|
-
}
|
|
70
|
-
catch (error) {
|
|
71
|
-
// アクション開始前に例外がthrowされてもCOA仮予約を取り消す機会をつくるためにFailedアクションを作成する(2023-09-12~)
|
|
72
|
-
const failedActionAttributes = (0, factory_1.createAuthorizeSeatReservationActionAttributes)({
|
|
73
|
-
acceptedOffers: [],
|
|
74
|
-
event: { id: params.object.event.id, typeOf: factory.eventType.ScreeningEvent },
|
|
75
|
-
transaction,
|
|
76
|
-
pendingTransaction
|
|
77
|
-
});
|
|
78
|
-
const failedAction = yield repos.action.start(failedActionAttributes);
|
|
79
|
-
yield repos.action.giveUp({ typeOf: failedAction.typeOf, id: failedAction.id, error });
|
|
80
|
-
throw error;
|
|
81
|
-
}
|
|
82
|
-
// 承認アクションを開始
|
|
83
|
-
const actionAttributes = (0, factory_1.createAuthorizeSeatReservationActionAttributes)({
|
|
84
|
-
acceptedOffers,
|
|
85
|
-
event: screeningEvent,
|
|
86
|
-
transaction,
|
|
87
|
-
pendingTransaction
|
|
88
|
-
});
|
|
89
|
-
const action = yield repos.action.start(actionAttributes);
|
|
90
|
-
try {
|
|
91
|
-
// no op
|
|
92
|
-
}
|
|
93
|
-
catch (error) {
|
|
94
|
-
try {
|
|
95
|
-
yield repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
96
|
-
}
|
|
97
|
-
catch (__) {
|
|
98
|
-
// no op
|
|
99
|
-
}
|
|
100
|
-
throw error;
|
|
101
|
-
}
|
|
102
|
-
// 座席仮予約からオファー情報を生成する
|
|
103
|
-
const { price, eligibleMonetaryAmount } = (0, factory_1.offers2resultPrice)(acceptedOffers);
|
|
104
|
-
const acceptedOffers4result = (0, factory_1.responseBody2acceptedOffers4result)({
|
|
105
|
-
responseBody: params.result.responseBody,
|
|
106
|
-
object: action.object,
|
|
107
|
-
event: screeningEvent,
|
|
108
|
-
seller: transaction.seller,
|
|
109
|
-
bookingTime: moment(action.startDate)
|
|
110
|
-
.toDate(),
|
|
111
|
-
totalPrice: price
|
|
112
|
-
});
|
|
113
|
-
const result = {
|
|
114
|
-
price: price,
|
|
115
|
-
priceCurrency: factory.priceCurrency.JPY,
|
|
116
|
-
// eligibleMonetaryAmountを使用(2023-03-08~)
|
|
117
|
-
// amount: (requiredPoint > 0)
|
|
118
|
-
// ? [{
|
|
119
|
-
// typeOf: 'MonetaryAmount',
|
|
120
|
-
// currency: 'Point',
|
|
121
|
-
// value: requiredPoint
|
|
122
|
-
// }]
|
|
123
|
-
// : [],
|
|
124
|
-
amount: eligibleMonetaryAmount,
|
|
125
|
-
requestBody: params.result.requestBody,
|
|
126
|
-
responseBody: params.result.responseBody,
|
|
127
|
-
acceptedOffers: acceptedOffers4result
|
|
128
|
-
};
|
|
129
|
-
return yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: result });
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
exports.authorize = authorize;
|
|
133
|
-
/**
|
|
134
|
-
* COA興行オファー承認取消
|
|
135
|
-
*/
|
|
136
|
-
function cancel(params) {
|
|
137
|
-
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
138
|
-
const transaction = yield repos.transaction.findInProgressById({
|
|
139
|
-
typeOf: factory.transactionType.PlaceOrder,
|
|
140
|
-
id: params.transaction.id
|
|
141
|
-
});
|
|
142
|
-
if (transaction.agent.id !== params.agent.id) {
|
|
143
|
-
throw new factory.errors.Forbidden('Transaction not yours');
|
|
144
|
-
}
|
|
145
|
-
// 取引内のアクションかどうか確認
|
|
146
|
-
let action = yield repos.action.findById({ typeOf: factory.actionType.AuthorizeAction, id: params.id });
|
|
147
|
-
if (action.purpose.typeOf !== transaction.typeOf || action.purpose.id !== transaction.id) {
|
|
148
|
-
throw new factory.errors.Argument('Transaction', 'Action not found in the transaction');
|
|
149
|
-
}
|
|
150
|
-
// MongoDBでcompleteステータスであるにも関わらず、COAでは削除されている、というのが最悪の状況
|
|
151
|
-
// それだけは回避するためにMongoDBを先に変更
|
|
152
|
-
action = yield repos.action.cancel({ typeOf: factory.actionType.AuthorizeAction, id: params.id });
|
|
153
|
-
let cancelResult;
|
|
154
|
-
const actionResult = action.result;
|
|
155
|
-
if ((actionResult === null || actionResult === void 0 ? void 0 : actionResult.requestBody) !== undefined && actionResult.responseBody !== undefined) {
|
|
156
|
-
cancelResult = {
|
|
157
|
-
theaterCode: actionResult.requestBody.theaterCode,
|
|
158
|
-
dateJouei: actionResult.requestBody.dateJouei,
|
|
159
|
-
titleCode: actionResult.requestBody.titleCode,
|
|
160
|
-
titleBranchNum: actionResult.requestBody.titleBranchNum,
|
|
161
|
-
timeBegin: actionResult.requestBody.timeBegin,
|
|
162
|
-
tmpReserveNum: actionResult.responseBody.tmpReserveNum
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
return cancelResult;
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
exports.cancel = cancel;
|
|
169
|
-
/**
|
|
170
|
-
* COA興行オファー承認のオファーを変更
|
|
171
|
-
*/
|
|
172
|
-
function changeOffers(params) {
|
|
173
|
-
// tslint:disable-next-line:max-func-body-length
|
|
174
|
-
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
175
|
-
var _a;
|
|
176
|
-
const transaction = yield repos.transaction.findInProgressById({
|
|
177
|
-
typeOf: factory.transactionType.PlaceOrder,
|
|
178
|
-
id: params.transaction.id
|
|
179
|
-
});
|
|
180
|
-
if (transaction.agent.id !== params.agent.id) {
|
|
181
|
-
throw new factory.errors.Forbidden('Transaction not yours');
|
|
182
|
-
}
|
|
183
|
-
// 取引内のアクションかどうか確認
|
|
184
|
-
const authorizeAction = yield repos.action.findById({ typeOf: factory.actionType.AuthorizeAction, id: params.id });
|
|
185
|
-
if (authorizeAction.purpose.typeOf !== transaction.typeOf || authorizeAction.purpose.id !== transaction.id) {
|
|
186
|
-
throw new factory.errors.Argument('Transaction', 'Action not found in the transaction');
|
|
187
|
-
}
|
|
188
|
-
validate4changeOffer({ action: authorizeAction, object: params.object });
|
|
189
|
-
// 座席情報に関しては元のacceptedOffersで自動補完する(リクエストでは正しく指定されないので注意)(2023-03-20~)
|
|
190
|
-
params.object.acceptedOffer = params.object.acceptedOffer.map((offer) => {
|
|
191
|
-
const originalAcceptedOfferBySeatNumber = authorizeAction.object.acceptedOffer.find((originalOffer) => {
|
|
192
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
193
|
-
return ((_d = (_c = (_b = (_a = originalOffer.itemOffered) === null || _a === void 0 ? void 0 : _a.serviceOutput) === null || _b === void 0 ? void 0 : _b.reservedTicket) === null || _c === void 0 ? void 0 : _c.ticketedSeat) === null || _d === void 0 ? void 0 : _d.seatSection)
|
|
194
|
-
=== ((_g = (_f = (_e = offer.itemOffered.serviceOutput) === null || _e === void 0 ? void 0 : _e.reservedTicket) === null || _f === void 0 ? void 0 : _f.ticketedSeat) === null || _g === void 0 ? void 0 : _g.seatSection)
|
|
195
|
-
&& ((_k = (_j = (_h = originalOffer.itemOffered.serviceOutput) === null || _h === void 0 ? void 0 : _h.reservedTicket) === null || _j === void 0 ? void 0 : _j.ticketedSeat) === null || _k === void 0 ? void 0 : _k.seatNumber)
|
|
196
|
-
=== ((_o = (_m = (_l = offer.itemOffered.serviceOutput) === null || _l === void 0 ? void 0 : _l.reservedTicket) === null || _m === void 0 ? void 0 : _m.ticketedSeat) === null || _o === void 0 ? void 0 : _o.seatNumber);
|
|
197
|
-
});
|
|
198
|
-
if (originalAcceptedOfferBySeatNumber === undefined) {
|
|
199
|
-
throw new factory.errors.Argument('offers', 'seatSection or seatNumber not matched.');
|
|
200
|
-
}
|
|
201
|
-
return Object.assign(Object.assign({}, offer), { ticketInfo: Object.assign(Object.assign({}, offer.ticketInfo), { spseatAdd1: originalAcceptedOfferBySeatNumber.ticketInfo.spseatAdd1, spseatAdd2: originalAcceptedOfferBySeatNumber.ticketInfo.spseatAdd2, spseatKbn: originalAcceptedOfferBySeatNumber.ticketInfo.spseatKbn }) });
|
|
202
|
-
});
|
|
203
|
-
// イベント取得属性最適化(2023-01-23~)
|
|
204
|
-
const screeningEvent = yield repos.event.findMinimizedIndividualEventById({
|
|
205
|
-
id: params.object.event.id
|
|
206
|
-
});
|
|
207
|
-
const availablePaymentMethodTypes = yield repos.categoryCode.search({
|
|
208
|
-
project: { id: { $eq: transaction.project.id } },
|
|
209
|
-
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.PaymentMethodType } }
|
|
210
|
-
}, [], []);
|
|
211
|
-
const seatingTypes = yield repos.categoryCode.search({
|
|
212
|
-
project: { id: { $eq: transaction.project.id } },
|
|
213
|
-
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
|
|
214
|
-
}, [], []);
|
|
215
|
-
const videoFormatTypes = yield repos.categoryCode.search({
|
|
216
|
-
project: { id: { $eq: transaction.project.id } },
|
|
217
|
-
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.VideoFormatType } }
|
|
218
|
-
}, [], []);
|
|
219
|
-
// COA仮予約後にリクエストが来る前提
|
|
220
|
-
const { acceptedOffers } = yield (0, validateAcceptedOffers_1.validateAcceptedOffers)({
|
|
221
|
-
object: params.object,
|
|
222
|
-
project: { id: transaction.project.id },
|
|
223
|
-
screeningEvent,
|
|
224
|
-
availablePaymentMethodTypes,
|
|
225
|
-
seatingTypes,
|
|
226
|
-
videoFormatTypes
|
|
227
|
-
})(repos);
|
|
228
|
-
// 供給情報と価格を変更してからDB更新
|
|
229
|
-
authorizeAction.object.acceptedOffer = acceptedOffers;
|
|
230
|
-
const updTmpReserveSeatResult = (_a = authorizeAction.result) === null || _a === void 0 ? void 0 : _a.responseBody;
|
|
231
|
-
if (updTmpReserveSeatResult === undefined) {
|
|
232
|
-
throw new factory.errors.NotFound('action.result.responseBody');
|
|
233
|
-
}
|
|
234
|
-
const { price, eligibleMonetaryAmount } = (0, factory_1.offers2resultPrice)(acceptedOffers);
|
|
235
|
-
const acceptedOffers4result = (0, factory_1.responseBody2acceptedOffers4result)({
|
|
236
|
-
responseBody: updTmpReserveSeatResult,
|
|
237
|
-
object: authorizeAction.object,
|
|
238
|
-
event: screeningEvent,
|
|
239
|
-
seller: transaction.seller,
|
|
240
|
-
bookingTime: moment(authorizeAction.startDate)
|
|
241
|
-
.toDate(),
|
|
242
|
-
totalPrice: price
|
|
243
|
-
});
|
|
244
|
-
const actionResult = Object.assign(Object.assign({}, authorizeAction.result), { price: price,
|
|
245
|
-
// eligibleMonetaryAmountを使用(2023-03-08~)
|
|
246
|
-
// amount: (requiredPoint > 0)
|
|
247
|
-
// ? [{
|
|
248
|
-
// typeOf: 'MonetaryAmount',
|
|
249
|
-
// currency: 'Point',
|
|
250
|
-
// value: requiredPoint
|
|
251
|
-
// }]
|
|
252
|
-
// : [],
|
|
253
|
-
amount: eligibleMonetaryAmount, acceptedOffers: acceptedOffers4result });
|
|
254
|
-
// 座席予約承認アクションの供給情報を変更する
|
|
255
|
-
return repos.action.updateAuthorizeEventOfferAction({
|
|
256
|
-
id: params.id,
|
|
257
|
-
object: authorizeAction.object,
|
|
258
|
-
result: actionResult
|
|
259
|
-
});
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
exports.changeOffers = changeOffers;
|
|
263
|
-
function validate4changeOffer(params) {
|
|
264
|
-
// アクション中のイベント識別子と座席リストが合っているかどうか確認
|
|
265
|
-
const authorizeAction = params.action;
|
|
266
|
-
// 完了ステータスのアクションのみ更新可能
|
|
267
|
-
if (authorizeAction.actionStatus !== factory.actionStatusType.CompletedActionStatus) {
|
|
268
|
-
throw new factory.errors.NotFound('authorizeAction');
|
|
269
|
-
}
|
|
270
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
271
|
-
/* istanbul ignore if */
|
|
272
|
-
if (authorizeAction.object.event === undefined) {
|
|
273
|
-
throw new factory.errors.NotFound('authorizeAction.object.event');
|
|
274
|
-
}
|
|
275
|
-
// イベントが一致しているかどうか
|
|
276
|
-
if (authorizeAction.object.event.id !== params.object.event.id) {
|
|
277
|
-
throw new factory.errors.Argument('Event', 'Event ID not matched.');
|
|
278
|
-
}
|
|
279
|
-
// 座席セクションと座席番号が一致しているかどうか
|
|
280
|
-
const acceptedOfferParams = (Array.isArray(params.object.acceptedOffer)) ? params.object.acceptedOffer : [];
|
|
281
|
-
const allSeatsExisted = authorizeAction.object.acceptedOffer.every((originalAcceptedOffer) => {
|
|
282
|
-
return acceptedOfferParams.some((o) => {
|
|
283
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
284
|
-
const newSeatSection = (_c = (_b = (_a = o.itemOffered.serviceOutput) === null || _a === void 0 ? void 0 : _a.reservedTicket) === null || _b === void 0 ? void 0 : _b.ticketedSeat) === null || _c === void 0 ? void 0 : _c.seatSection;
|
|
285
|
-
const newSeatNumber = (_f = (_e = (_d = o.itemOffered.serviceOutput) === null || _d === void 0 ? void 0 : _d.reservedTicket) === null || _e === void 0 ? void 0 : _e.ticketedSeat) === null || _f === void 0 ? void 0 : _f.seatNumber;
|
|
286
|
-
return ((_k = (_j = (_h = (_g = originalAcceptedOffer.itemOffered) === null || _g === void 0 ? void 0 : _g.serviceOutput) === null || _h === void 0 ? void 0 : _h.reservedTicket) === null || _j === void 0 ? void 0 : _j.ticketedSeat) === null || _k === void 0 ? void 0 : _k.seatSection) === newSeatSection
|
|
287
|
-
&& ((_o = (_m = (_l = originalAcceptedOffer.itemOffered.serviceOutput) === null || _l === void 0 ? void 0 : _l.reservedTicket) === null || _m === void 0 ? void 0 : _m.ticketedSeat) === null || _o === void 0 ? void 0 : _o.seatNumber) === newSeatNumber;
|
|
288
|
-
});
|
|
289
|
-
});
|
|
290
|
-
const allSeatsMatched = (acceptedOfferParams.length === authorizeAction.object.acceptedOffer.length) && allSeatsExisted;
|
|
291
|
-
if (!allSeatsMatched) {
|
|
292
|
-
throw new factory.errors.Argument('offers', 'seatSection or seatNumber not matched.');
|
|
293
|
-
}
|
|
294
|
-
}
|
|
3
|
+
exports.changeOffers = exports.cancel = exports.authorize = void 0;
|
|
4
|
+
const authorize_1 = require("./eventServiceByCOA/authorize");
|
|
5
|
+
Object.defineProperty(exports, "authorize", { enumerable: true, get: function () { return authorize_1.authorize; } });
|
|
6
|
+
const cancel_1 = require("./eventServiceByCOA/cancel");
|
|
7
|
+
Object.defineProperty(exports, "cancel", { enumerable: true, get: function () { return cancel_1.cancel; } });
|
|
8
|
+
const changeOffers_1 = require("./eventServiceByCOA/changeOffers");
|
|
9
|
+
Object.defineProperty(exports, "changeOffers", { enumerable: true, get: function () { return changeOffers_1.changeOffers; } });
|
|
@@ -24,5 +24,10 @@ export declare function authorize(params: {
|
|
|
24
24
|
};
|
|
25
25
|
object: factory.action.authorize.offer.moneyTransfer.IObject;
|
|
26
26
|
purpose: factory.action.authorize.offer.moneyTransfer.IPurpose;
|
|
27
|
-
}): IAuthorizeOperation<
|
|
27
|
+
}): IAuthorizeOperation<{
|
|
28
|
+
/**
|
|
29
|
+
* 承認アクションID
|
|
30
|
+
*/
|
|
31
|
+
id: string;
|
|
32
|
+
}>;
|
|
28
33
|
export {};
|
|
@@ -64,7 +64,8 @@ function authorize(params) {
|
|
|
64
64
|
requestBody: requestBody,
|
|
65
65
|
responseBody: responseBody
|
|
66
66
|
};
|
|
67
|
-
|
|
67
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: result });
|
|
68
|
+
return { id: action.id };
|
|
68
69
|
});
|
|
69
70
|
}
|
|
70
71
|
exports.authorize = authorize;
|
|
@@ -74,7 +74,7 @@ function returnMoneyTransfer(params) {
|
|
|
74
74
|
throw error;
|
|
75
75
|
}
|
|
76
76
|
const actionResult = {};
|
|
77
|
-
yield repos.action.
|
|
77
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
exports.returnMoneyTransfer = returnMoneyTransfer;
|
|
@@ -27,7 +27,7 @@ function settleTransaction(params) {
|
|
|
27
27
|
throw error;
|
|
28
28
|
}
|
|
29
29
|
const actionResult = {};
|
|
30
|
-
yield repos.action.
|
|
30
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
exports.settleTransaction = settleTransaction;
|
|
@@ -45,7 +45,7 @@ function voidTransaction(params) {
|
|
|
45
45
|
}
|
|
46
46
|
yield Promise.all(authorizeActions.map((action) => __awaiter(this, void 0, void 0, function* () {
|
|
47
47
|
var _a, _b;
|
|
48
|
-
yield repos.action.
|
|
48
|
+
yield repos.action.cancelWithVoid({ typeOf: action.typeOf, id: action.id });
|
|
49
49
|
const pendingTransactionTransactionNumber = (_b = (_a = action.object.itemOffered.object) === null || _a === void 0 ? void 0 : _a.pendingTransaction) === null || _b === void 0 ? void 0 : _b.transactionNumber;
|
|
50
50
|
if (typeof pendingTransactionTransactionNumber === 'string') {
|
|
51
51
|
// 取引が存在すれば中止
|
|
@@ -247,7 +247,7 @@ function voidTransaction(params) {
|
|
|
247
247
|
// purpose: params.purpose
|
|
248
248
|
// })(repos);
|
|
249
249
|
}
|
|
250
|
-
yield repos.action.
|
|
250
|
+
yield repos.action.cancelWithVoid({ typeOf: action.typeOf, id: action.id });
|
|
251
251
|
yield processVoidRegisterServiceTransaction({
|
|
252
252
|
action,
|
|
253
253
|
project: params.project
|
|
@@ -36,7 +36,7 @@ function confirmPayTransaction(data) {
|
|
|
36
36
|
assetTransaction: repos.assetTransaction,
|
|
37
37
|
event: repos.event,
|
|
38
38
|
order: repos.order,
|
|
39
|
-
project: repos.project,
|
|
39
|
+
// project: repos.project,
|
|
40
40
|
task: repos.task
|
|
41
41
|
});
|
|
42
42
|
}
|
|
@@ -52,7 +52,7 @@ function confirmPayTransaction(data) {
|
|
|
52
52
|
}
|
|
53
53
|
// アクション完了
|
|
54
54
|
const actionResult = {};
|
|
55
|
-
yield repos.action.
|
|
55
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
56
56
|
// processOrder連携(2023-08-23~)
|
|
57
57
|
yield onConfirmed(data)({
|
|
58
58
|
task: repos.task
|
|
@@ -74,7 +74,7 @@ function onConfirmed(params) {
|
|
|
74
74
|
purpose: {
|
|
75
75
|
confirmationNumber: params.purpose.confirmationNumber,
|
|
76
76
|
orderNumber: params.purpose.orderNumber,
|
|
77
|
-
typeOf:
|
|
77
|
+
typeOf: factory.order.OrderType.Order
|
|
78
78
|
},
|
|
79
79
|
useOnOrderStatusChanged: params.useOnOrderStatusChanged === true
|
|
80
80
|
};
|
|
@@ -24,4 +24,14 @@ declare function paymentDue2Processing(params: {
|
|
|
24
24
|
task: TaskRepo;
|
|
25
25
|
transaction: TransactionRepo;
|
|
26
26
|
}) => Promise<void>;
|
|
27
|
-
|
|
27
|
+
declare function processing2inTransit(params: {
|
|
28
|
+
project: {
|
|
29
|
+
id: string;
|
|
30
|
+
};
|
|
31
|
+
orderNumber: string;
|
|
32
|
+
useOnOrderStatusChanged: boolean;
|
|
33
|
+
}): (repos: {
|
|
34
|
+
order: OrderRepo;
|
|
35
|
+
task: TaskRepo;
|
|
36
|
+
}) => Promise<void>;
|
|
37
|
+
export { onAssetTransactionStatusChanged, paymentDue2Processing, processing2inTransit };
|