@chevre/domain 21.33.0-alpha.9 → 21.33.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 +8 -5
- package/example/src/chevre/migratePayCreditCardRecipes.ts +104 -0
- package/example/src/chevre/migratePayMovieTicketRecipes.ts +100 -0
- package/example/src/chevre/migrateTransactionObjectPaymentMethods.ts +147 -0
- package/example/src/chevre/reexportTasksByExportAction.ts +37 -0
- package/example/src/chevre/searchActionsBySameAs.ts +2 -1
- package/example/src/chevre/searchCheckMovieTicketResultYkknInfo.ts +26 -6
- package/example/src/chevre/searchTransactions.ts +1 -1
- package/example/src/chevre/unsetUnnecessaryFields.ts +3 -18
- package/lib/chevre/repo/action.d.ts +51 -0
- package/lib/chevre/repo/action.js +122 -2
- package/lib/chevre/repo/assetTransaction.d.ts +9 -2
- package/lib/chevre/repo/assetTransaction.js +48 -3
- package/lib/chevre/repo/mongoose/schemas/actionRecipe.d.ts +5 -0
- package/lib/chevre/repo/mongoose/schemas/actionRecipe.js +89 -0
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +23 -25
- package/lib/chevre/repo/mongoose/schemas/transaction.js +5 -52
- package/lib/chevre/repo/transaction.d.ts +26 -11
- package/lib/chevre/repo/transaction.js +89 -17
- package/lib/chevre/service/assetTransaction/pay.d.ts +6 -2
- package/lib/chevre/service/assetTransaction/pay.js +49 -5
- package/lib/chevre/service/offer/event/voidTransaction.js +4 -6
- package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.js +2 -1
- package/lib/chevre/service/offer/product.js +1 -1
- package/lib/chevre/service/payment/any/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts +23 -0
- package/lib/chevre/service/payment/any/handlePrePublishedPaymentMethodIdOnAuthorizing.js +155 -0
- package/lib/chevre/service/payment/any.d.ts +10 -2
- package/lib/chevre/service/payment/any.js +83 -114
- package/lib/chevre/service/payment/creditCard/authorize.d.ts +41 -0
- package/lib/chevre/service/payment/creditCard/authorize.js +216 -0
- package/lib/chevre/service/payment/creditCard/factory.d.ts +35 -0
- package/lib/chevre/service/payment/creditCard/factory.js +57 -0
- package/lib/chevre/service/payment/creditCard/getGMOInfoFromSeller.d.ts +20 -0
- package/lib/chevre/service/payment/creditCard/getGMOInfoFromSeller.js +47 -0
- package/lib/chevre/service/payment/creditCard/gmoError.d.ts +34 -0
- package/lib/chevre/service/payment/creditCard/gmoError.js +8 -0
- package/lib/chevre/service/payment/creditCard/payCreditCard.d.ts +20 -0
- package/lib/chevre/service/payment/creditCard/payCreditCard.js +151 -0
- package/lib/chevre/service/payment/creditCard/refundCreditCard.d.ts +26 -0
- package/lib/chevre/service/payment/creditCard/refundCreditCard.js +196 -0
- package/lib/chevre/service/payment/creditCard/searchGMOTrade.d.ts +13 -0
- package/lib/chevre/service/payment/creditCard/searchGMOTrade.js +62 -0
- package/lib/chevre/service/payment/creditCard/voidTransaction.d.ts +13 -0
- package/lib/chevre/service/payment/creditCard/voidTransaction.js +90 -0
- package/lib/chevre/service/payment/creditCard.d.ts +7 -106
- package/lib/chevre/service/payment/creditCard.js +12 -638
- package/lib/chevre/service/payment/faceToFace.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket/authorize.d.ts +38 -0
- package/lib/chevre/service/payment/movieTicket/authorize.js +71 -0
- package/lib/chevre/service/payment/movieTicket/checkMovieTicket.d.ts +22 -0
- package/lib/chevre/service/payment/movieTicket/checkMovieTicket.js +109 -0
- package/lib/chevre/service/payment/movieTicket/factory.d.ts +52 -1
- package/lib/chevre/service/payment/movieTicket/factory.js +114 -1
- package/lib/chevre/service/payment/movieTicket/payMovieTicket.d.ts +24 -0
- package/lib/chevre/service/payment/movieTicket/payMovieTicket.js +157 -0
- package/lib/chevre/service/payment/movieTicket/{checkByIdentifier.d.ts → processPurchaseNumberAuth.d.ts} +5 -6
- package/lib/chevre/service/payment/movieTicket/{checkByIdentifier.js → processPurchaseNumberAuth.js} +4 -8
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket.d.ts +21 -0
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +248 -0
- package/lib/chevre/service/payment/movieTicket/validation.js +3 -3
- package/lib/chevre/service/payment/movieTicket/voidTransaction.d.ts +12 -0
- package/lib/chevre/service/payment/movieTicket/voidTransaction.js +74 -0
- package/lib/chevre/service/payment/movieTicket.d.ts +7 -75
- package/lib/chevre/service/payment/movieTicket.js +11 -567
- package/lib/chevre/service/payment/paymentCard.d.ts +1 -1
- package/lib/chevre/service/payment.d.ts +9 -1
- package/lib/chevre/service/payment.js +2 -1
- package/lib/chevre/service/task/acceptCOAOffer.js +2 -1
- package/lib/chevre/service/task/authorizePayment.js +2 -1
- package/lib/chevre/service/task/checkMovieTicket.js +1 -1
- package/lib/chevre/service/task/pay.d.ts +2 -2
- package/lib/chevre/service/task/pay.js +3 -2
- package/lib/chevre/service/task/publishPaymentUrl.js +2 -1
- package/lib/chevre/service/task/voidPayTransaction.d.ts +2 -2
- package/lib/chevre/service/task/voidPayTransaction.js +2 -4
- package/lib/chevre/service/task/voidPayment.js +0 -1
- package/lib/chevre/service/task.js +2 -0
- package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.d.ts +1 -1
- package/lib/chevre/service/transaction/moneyTransfer/potentialActions.d.ts +1 -1
- package/lib/chevre/service/transaction/moneyTransfer.js +2 -2
- package/lib/chevre/service/transaction/placeOrder.js +2 -3
- package/lib/chevre/service/transaction/placeOrderInProgress/confirm.js +3 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.d.ts +0 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/result.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +4 -3
- package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.d.ts +1 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.d.ts +1 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions.d.ts +1 -1
- package/lib/chevre/service/transaction/returnOrder.js +2 -2
- package/lib/chevre/settings.d.ts +1 -0
- package/lib/chevre/settings.js +2 -1
- package/package.json +3 -3
- package/example/src/chevre/migrateOwnershipInfos2newUserPool.ts +0 -152
- package/example/src/chevre/migratePayTransactionReservedTicketIdentifier.ts +0 -95
|
@@ -1,572 +1,16 @@
|
|
|
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
3
|
exports.voidTransaction = exports.refundMovieTicket = exports.payMovieTicket = exports.checkMovieTicket = exports.authorize = void 0;
|
|
13
4
|
/**
|
|
14
|
-
*
|
|
5
|
+
* 決済カード決済サービス
|
|
15
6
|
*/
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
const onRefund_1 = require("./any/onRefund");
|
|
27
|
-
var MovieticketReserveRequestErrorMessage;
|
|
28
|
-
(function (MovieticketReserveRequestErrorMessage) {
|
|
29
|
-
MovieticketReserveRequestErrorMessage["AlreadyPaid"] = "\u65E2\u306B\u5B58\u5728\u3059\u308B\u8208\u884C\u30B7\u30B9\u30C6\u30E0\u5EA7\u5E2D\u4E88\u7D04\u756A\u53F7\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F\u3002";
|
|
30
|
-
MovieticketReserveRequestErrorMessage["NotFound"] = "\u5B58\u5728\u3057\u306A\u3044\u8208\u884C\u4F1A\u793E\u30B7\u30B9\u30C6\u30E0\u5EA7\u5E2D\u4E88\u7D04\u756A\u53F7\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F\u3002";
|
|
31
|
-
MovieticketReserveRequestErrorMessage["ReservationResult19"] = "ReservationResult 19";
|
|
32
|
-
MovieticketReserveRequestErrorMessage["CancellationPeriodPassed"] = "\u5EA7\u5E2D\u4E88\u7D04\u53D6\u6D88\u53EF\u80FD\u671F\u9593\u3092\u904E\u304E\u3066\u3044\u307E\u3059\u3002";
|
|
33
|
-
})(MovieticketReserveRequestErrorMessage || (MovieticketReserveRequestErrorMessage = {}));
|
|
34
|
-
/**
|
|
35
|
-
* MovieTicket認証
|
|
36
|
-
*/
|
|
37
|
-
function checkMovieTicket(params) {
|
|
38
|
-
// tslint:disable-next-line:max-func-body-length
|
|
39
|
-
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
var _a, _b, _c, _d, _e, _f;
|
|
41
|
-
// 不要な属性がリクエストに含まれているのでmovieTicketsを最適化(2024-03-15~)
|
|
42
|
-
let movieTickets = (_a = params.object[0]) === null || _a === void 0 ? void 0 : _a.movieTickets;
|
|
43
|
-
if (!Array.isArray(movieTickets)) {
|
|
44
|
-
throw new factory.errors.Argument('object.movieTickets must be an array');
|
|
45
|
-
}
|
|
46
|
-
movieTickets = movieTickets.map(({ accessCode, category, identifier, serviceOutput }) => {
|
|
47
|
-
return {
|
|
48
|
-
accessCode,
|
|
49
|
-
category,
|
|
50
|
-
identifier,
|
|
51
|
-
serviceOutput: { reservationFor: serviceOutput.reservationFor } // 最適化(2024-03-15~)
|
|
52
|
-
};
|
|
53
|
-
});
|
|
54
|
-
const optimizedCheckObject = params.object.map(({ id, typeOf, paymentMethod, seller }) => {
|
|
55
|
-
return {
|
|
56
|
-
id,
|
|
57
|
-
typeOf,
|
|
58
|
-
paymentMethod: { typeOf: paymentMethod.typeOf },
|
|
59
|
-
seller,
|
|
60
|
-
movieTickets
|
|
61
|
-
};
|
|
62
|
-
});
|
|
63
|
-
const paymentMethodType = (_b = optimizedCheckObject[0]) === null || _b === void 0 ? void 0 : _b.paymentMethod.typeOf; // 決済方法区分
|
|
64
|
-
const paymentServiceId = (_c = optimizedCheckObject[0]) === null || _c === void 0 ? void 0 : _c.id;
|
|
65
|
-
const taskId = (_d = params.sameAs) === null || _d === void 0 ? void 0 : _d.id;
|
|
66
|
-
const actionAttributes = Object.assign(Object.assign({ project: params.project, typeOf: factory.actionType.CheckAction, agent: params.agent, object: optimizedCheckObject }, (typeof ((_e = params.purpose) === null || _e === void 0 ? void 0 : _e.typeOf) === 'string') ? { purpose: params.purpose } : undefined), (typeof taskId === 'string')
|
|
67
|
-
? { sameAs: { id: taskId, typeOf: 'Task' } } // タスク関連付け(2024-05-21~)
|
|
68
|
-
: undefined);
|
|
69
|
-
const action = yield repos.action.start(actionAttributes);
|
|
70
|
-
let checkResult;
|
|
71
|
-
try {
|
|
72
|
-
const eventIds = [...new Set(optimizedCheckObject.reduce((a, b) => [
|
|
73
|
-
...a,
|
|
74
|
-
...(Array.isArray(b.movieTickets)) ? b.movieTickets.map((ticket) => ticket.serviceOutput.reservationFor.id) : []
|
|
75
|
-
], []))];
|
|
76
|
-
if (eventIds.length !== 1) {
|
|
77
|
-
throw new factory.errors.Argument('movieTickets', 'Number of events must be 1');
|
|
78
|
-
}
|
|
79
|
-
// イベント情報取得
|
|
80
|
-
let screeningEvent;
|
|
81
|
-
// イベント取得属性最適化(2023-01-23~)
|
|
82
|
-
screeningEvent = yield repos.event.findMinimizedIndividualEventById({ id: eventIds[0] });
|
|
83
|
-
const sellerId = (_f = optimizedCheckObject[0]) === null || _f === void 0 ? void 0 : _f.seller.id;
|
|
84
|
-
const paymentAccepted = yield repos.paymentAccepted.isAcceptedBySeller({
|
|
85
|
-
seller: { id: sellerId },
|
|
86
|
-
codeValue: paymentMethodType
|
|
87
|
-
});
|
|
88
|
-
if (paymentAccepted !== true) {
|
|
89
|
-
throw new factory.errors.Argument('transactionId', `payment not accepted [${paymentMethodType}]`);
|
|
90
|
-
}
|
|
91
|
-
checkResult = yield (0, checkByIdentifier_1.checkByIdentifier)({
|
|
92
|
-
movieTickets: movieTickets,
|
|
93
|
-
seller: { id: sellerId, project: { id: screeningEvent.project.id, typeOf: factory.organizationType.Project } },
|
|
94
|
-
screeningEvent: screeningEvent,
|
|
95
|
-
paymentServiceId
|
|
96
|
-
})(repos);
|
|
97
|
-
// 一度認証されたMovieTicketをDBに記録する(後で検索しやすいように)→一旦保留
|
|
98
|
-
// await Promise.all(checkResult.movieTickets.map(async (__) => {
|
|
99
|
-
// }));
|
|
100
|
-
}
|
|
101
|
-
catch (error) {
|
|
102
|
-
// アクション保管用のエラーと両方保管(2024-05-22~)
|
|
103
|
-
const errors = [(0, errorHandler_1.handleMvtkReserveError)(error), error];
|
|
104
|
-
try {
|
|
105
|
-
yield repos.action.giveUp({ typeOf: actionAttributes.typeOf, id: action.id, error: errors });
|
|
106
|
-
}
|
|
107
|
-
catch (__) {
|
|
108
|
-
// 失敗したら仕方ない
|
|
109
|
-
}
|
|
110
|
-
throw errors[0];
|
|
111
|
-
}
|
|
112
|
-
const result = {
|
|
113
|
-
purchaseNumberAuthIn: checkResult.purchaseNumberAuthIn,
|
|
114
|
-
purchaseNumberAuthResult: checkResult.purchaseNumberAuthResult
|
|
115
|
-
// action.resultへの保管を廃止(2023-03-24~)
|
|
116
|
-
// movieTickets: []
|
|
117
|
-
};
|
|
118
|
-
yield repos.action.completeWithVoid({ typeOf: actionAttributes.typeOf, id: action.id, result });
|
|
119
|
-
return {
|
|
120
|
-
result: checkResult
|
|
121
|
-
};
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
exports.checkMovieTicket = checkMovieTicket;
|
|
125
|
-
/**
|
|
126
|
-
* MovieTicket承認
|
|
127
|
-
* オーソリサービスが存在するわけではないので、実質着券する
|
|
128
|
-
*/
|
|
129
|
-
function authorize(params, transaction, paymentServiceId, useCheckMovieTicketBeforePay, useCheckByIdentifierIfNotYet) {
|
|
130
|
-
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
131
|
-
var _a;
|
|
132
|
-
let accountId;
|
|
133
|
-
let payAction;
|
|
134
|
-
let accountsReceivablesByServiceType = [];
|
|
135
|
-
try {
|
|
136
|
-
// MovieTicket決済の場合、認証
|
|
137
|
-
const validateMovieTicketResult = yield (0, validation_1.validateMovieTicket)(params, paymentServiceId, useCheckMovieTicketBeforePay, useCheckByIdentifierIfNotYet)(repos);
|
|
138
|
-
accountsReceivablesByServiceType = validateMovieTicketResult.accountsReceivablesByServiceType;
|
|
139
|
-
const paymentMethod = transaction.object.paymentMethod;
|
|
140
|
-
const paymentMethodType = String(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.identifier);
|
|
141
|
-
const additionalProperty = paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.additionalProperty;
|
|
142
|
-
const paymentMethodId = transaction.object.paymentMethodId;
|
|
143
|
-
const paymentMethodName = (typeof (paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.name) === 'string') ? paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.name : paymentMethodType;
|
|
144
|
-
accountId = (Array.isArray(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.movieTickets)) ? (_a = paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.movieTickets[0]) === null || _a === void 0 ? void 0 : _a.identifier : undefined;
|
|
145
|
-
if (typeof accountId !== 'string' || accountId.length === 0) {
|
|
146
|
-
throw new factory.errors.ArgumentNull('object.paymentMethod.movieTickets.identifier');
|
|
147
|
-
}
|
|
148
|
-
const payObject = {
|
|
149
|
-
typeOf: factory.service.paymentService.PaymentServiceType.MovieTicket,
|
|
150
|
-
id: paymentServiceId,
|
|
151
|
-
paymentMethod: Object.assign({ additionalProperty: (Array.isArray(additionalProperty)) ? additionalProperty : [], name: paymentMethodName, paymentMethodId: paymentMethodId, totalPaymentDue: {
|
|
152
|
-
typeOf: 'MonetaryAmount',
|
|
153
|
-
currency: factory.unitCode.C62,
|
|
154
|
-
value: (Array.isArray(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.movieTickets)) ? paymentMethod.movieTickets.length : 0
|
|
155
|
-
}, typeOf: paymentMethodType }, (typeof accountId === 'string') ? { accountId } : undefined),
|
|
156
|
-
movieTickets: paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.movieTickets
|
|
157
|
-
};
|
|
158
|
-
const payActionAttributes = Object.assign({ project: transaction.project, typeOf: factory.actionType.PayAction, object: [payObject], agent: transaction.project, recipient: transaction.recipient }, (params.purpose !== undefined)
|
|
159
|
-
? { purpose: params.purpose }
|
|
160
|
-
: { purpose: { typeOf: transaction.typeOf, transactionNumber: transaction.transactionNumber, id: transaction.id } });
|
|
161
|
-
// 着券させざるをえないが、informPaymentはしない(注文がまだ存在しないため)
|
|
162
|
-
payAction = yield payMovieTicket(payActionAttributes)(repos);
|
|
163
|
-
}
|
|
164
|
-
catch (error) {
|
|
165
|
-
// アクション保管用のエラーと両方throw(2024-05-22~)
|
|
166
|
-
if (Array.isArray(error)) {
|
|
167
|
-
throw error;
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
throw [(0, errorHandler_1.handleMvtkReserveError)(error), error];
|
|
171
|
-
}
|
|
172
|
-
// throw handleMvtkReserveError(error);
|
|
173
|
-
}
|
|
174
|
-
return { accountId, payAction, accountsReceivablesByServiceType };
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
exports.authorize = authorize;
|
|
178
|
-
function voidTransaction(params) {
|
|
179
|
-
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
180
|
-
var _a, _b, _c;
|
|
181
|
-
const transaction = params.object;
|
|
182
|
-
const paymentMethodType = (_a = transaction.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.identifier;
|
|
183
|
-
if (typeof paymentMethodType !== 'string') {
|
|
184
|
-
throw new factory.errors.ArgumentNull('object.paymentMethod.identifier');
|
|
185
|
-
}
|
|
186
|
-
// const paymentMethodId = transaction.object.paymentMethod?.paymentMethodId;
|
|
187
|
-
const paymentMethodId = transaction.object.paymentMethodId;
|
|
188
|
-
if (typeof paymentMethodId !== 'string') {
|
|
189
|
-
throw new factory.errors.ArgumentNull('object.paymentMethodId');
|
|
190
|
-
}
|
|
191
|
-
// 決済開始時に着券していれば、取消
|
|
192
|
-
// 例えばtimeoutが原因でCompletedActionStatusでない場合、外部サービス側では着券済の可能性もあるので、そこを考慮する
|
|
193
|
-
const payAction = yield repos.action.findPayAction({
|
|
194
|
-
project: { id: transaction.project.id },
|
|
195
|
-
paymentMethodId,
|
|
196
|
-
actionStatus: {
|
|
197
|
-
$in: [
|
|
198
|
-
factory.actionStatusType.ActiveActionStatus,
|
|
199
|
-
factory.actionStatusType.CompletedActionStatus,
|
|
200
|
-
factory.actionStatusType.FailedActionStatus
|
|
201
|
-
]
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
if (payAction !== undefined) {
|
|
205
|
-
let refundAction;
|
|
206
|
-
const seller = transaction.recipient;
|
|
207
|
-
if (typeof (seller === null || seller === void 0 ? void 0 : seller.id) !== 'string') {
|
|
208
|
-
throw new factory.errors.NotFound('payTransaction.recipient');
|
|
209
|
-
}
|
|
210
|
-
refundAction = {
|
|
211
|
-
project: transaction.project,
|
|
212
|
-
typeOf: factory.actionType.RefundAction,
|
|
213
|
-
object: [{
|
|
214
|
-
typeOf: transaction.object.typeOf,
|
|
215
|
-
id: (typeof transaction.object.id === 'string') ? transaction.object.id : '',
|
|
216
|
-
paymentMethod: {
|
|
217
|
-
paymentMethodId: paymentMethodId,
|
|
218
|
-
typeOf: paymentMethodType,
|
|
219
|
-
name: (typeof ((_b = transaction.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.name) === 'string')
|
|
220
|
-
? transaction.object.paymentMethod.name
|
|
221
|
-
: paymentMethodType,
|
|
222
|
-
additionalProperty: []
|
|
223
|
-
}
|
|
224
|
-
}],
|
|
225
|
-
agent: {
|
|
226
|
-
id: seller.id,
|
|
227
|
-
name: (typeof seller.name === 'string') ? seller.name : String((_c = seller.name) === null || _c === void 0 ? void 0 : _c.ja),
|
|
228
|
-
typeOf: seller.typeOf
|
|
229
|
-
},
|
|
230
|
-
recipient: transaction.recipient,
|
|
231
|
-
purpose: payAction.purpose
|
|
232
|
-
};
|
|
233
|
-
yield refundMovieTicket(refundAction)(repos);
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
exports.voidTransaction = voidTransaction;
|
|
238
|
-
/**
|
|
239
|
-
* MovieTicket着券
|
|
240
|
-
*/
|
|
241
|
-
function payMovieTicket(params) {
|
|
242
|
-
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
243
|
-
var _a, _b, _c, _d, _e, _f;
|
|
244
|
-
const paymentMethodId = (_a = params.object[0]) === null || _a === void 0 ? void 0 : _a.paymentMethod.paymentMethodId;
|
|
245
|
-
const paymentServiceId = (_b = params.object[0]) === null || _b === void 0 ? void 0 : _b.id;
|
|
246
|
-
const seatInfoSyncIn = yield payActionParams2seatInfoSyncIn(params)(repos);
|
|
247
|
-
const instrument = {
|
|
248
|
-
typeOf: factory.service.paymentService.PaymentServiceType.MovieTicket,
|
|
249
|
-
seatInfoSyncIn
|
|
250
|
-
};
|
|
251
|
-
const startingAction = Object.assign(Object.assign({}, params), { object: params.object.map((o) => {
|
|
252
|
-
const movieTicketsWithMaskedAccessCode = (Array.isArray(o.movieTickets))
|
|
253
|
-
? o.movieTickets.map((movieTicket) => {
|
|
254
|
-
return Object.assign(Object.assign({}, movieTicket), { accessCode: '****' // accessCodeを隠蔽(2023-02-08~)
|
|
255
|
-
});
|
|
256
|
-
})
|
|
257
|
-
: [];
|
|
258
|
-
return Object.assign(Object.assign({}, o), { movieTickets: movieTicketsWithMaskedAccessCode });
|
|
259
|
-
}),
|
|
260
|
-
// アクション開始前にseatInfoSyncInを生成してアクションに保管する
|
|
261
|
-
instrument });
|
|
262
|
-
// アクション開始
|
|
263
|
-
let action = yield repos.action.start(startingAction);
|
|
264
|
-
let seatInfoSyncResult;
|
|
265
|
-
try {
|
|
266
|
-
// 着券済に対する冪等性を確保する必要はあるが、
|
|
267
|
-
// その他のアクションとしての振る舞いは実行される必要もある
|
|
268
|
-
const completedPayAction = yield repos.action.findPayAction({ project: { id: params.project.id }, paymentMethodId });
|
|
269
|
-
// すでに決済済であれば、何もしない(決済開始時の着券)
|
|
270
|
-
if (completedPayAction !== undefined) {
|
|
271
|
-
seatInfoSyncResult = (_c = completedPayAction.result) === null || _c === void 0 ? void 0 : _c.seatInfoSyncResult;
|
|
272
|
-
// return payAction;
|
|
273
|
-
}
|
|
274
|
-
else {
|
|
275
|
-
const availableChannel = yield repos.paymentService.findAvailableChannel({
|
|
276
|
-
project: params.project,
|
|
277
|
-
typeOf: factory.service.paymentService.PaymentServiceType.MovieTicket,
|
|
278
|
-
id: paymentServiceId
|
|
279
|
-
});
|
|
280
|
-
const mvtkReserveAuthClient = new surfrock.auth.ClientCredentials({
|
|
281
|
-
domain: String((_d = availableChannel.credentials) === null || _d === void 0 ? void 0 : _d.authorizeServerDomain),
|
|
282
|
-
clientId: String((_e = availableChannel.credentials) === null || _e === void 0 ? void 0 : _e.clientId),
|
|
283
|
-
clientSecret: String((_f = availableChannel.credentials) === null || _f === void 0 ? void 0 : _f.clientSecret),
|
|
284
|
-
scopes: [],
|
|
285
|
-
state: ''
|
|
286
|
-
});
|
|
287
|
-
const movieTicketSeatService = new surfrock.service.seat.SeatService({ endpoint: String(availableChannel.serviceUrl), auth: mvtkReserveAuthClient }, { timeout: credentials_1.credentials.movieticketReserve.timeout });
|
|
288
|
-
seatInfoSyncResult = yield movieTicketSeatService.seatInfoSync(seatInfoSyncIn);
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
catch (error) {
|
|
292
|
-
let throwsError = true;
|
|
293
|
-
// 「既に存在する興行システム座席予約番号が入力されました」の場合、着券済なのでok
|
|
294
|
-
if (error.name === errorHandler_1.MOVIE_TICKET_RESERVE_REQUEST_ERROR_NAME) {
|
|
295
|
-
if (error.code === http_status_1.BAD_REQUEST && error.message === MovieticketReserveRequestErrorMessage.AlreadyPaid) {
|
|
296
|
-
seatInfoSyncResult = error;
|
|
297
|
-
throwsError = false;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
if (throwsError) {
|
|
301
|
-
// アクション保管用のエラーと両方保管(2024-05-22~)
|
|
302
|
-
const errors = [(0, errorHandler_1.handleMvtkReserveError)(error), error];
|
|
303
|
-
try {
|
|
304
|
-
yield repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error: errors });
|
|
305
|
-
}
|
|
306
|
-
catch (__) {
|
|
307
|
-
// 失敗したら仕方ない
|
|
308
|
-
}
|
|
309
|
-
// error = handleMvtkReserveError(error);
|
|
310
|
-
throw errors;
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
const actionResult = { seatInfoSyncResult };
|
|
314
|
-
action = (yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: actionResult }));
|
|
315
|
-
yield (0, onPaid_1.onPaid)(action)(repos);
|
|
316
|
-
return action;
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
|
-
exports.payMovieTicket = payMovieTicket;
|
|
320
|
-
function payActionParams2seatInfoSyncIn(params) {
|
|
321
|
-
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
322
|
-
var _a, _b, _c, _d;
|
|
323
|
-
const paymentMethodType = (_a = params.object[0]) === null || _a === void 0 ? void 0 : _a.paymentMethod.typeOf;
|
|
324
|
-
const paymentMethodId = (_b = params.object[0]) === null || _b === void 0 ? void 0 : _b.paymentMethod.paymentMethodId;
|
|
325
|
-
const paymentServiceId = (_c = params.object[0]) === null || _c === void 0 ? void 0 : _c.id;
|
|
326
|
-
// イベントがひとつに特定されているかどうか確認
|
|
327
|
-
const eventIds = [...new Set(params.object.reduce((a, b) => [
|
|
328
|
-
...a,
|
|
329
|
-
...(Array.isArray(b.movieTickets)) ? b.movieTickets.map((ticket) => ticket.serviceOutput.reservationFor.id) : []
|
|
330
|
-
], []))];
|
|
331
|
-
if (eventIds.length !== 1) {
|
|
332
|
-
throw new factory.errors.Argument('movieTickets', 'Number of events must be 1');
|
|
333
|
-
}
|
|
334
|
-
// イベント取得属性最適化(2023-01-23~)
|
|
335
|
-
const event = yield repos.event.findMinimizedIndividualEventById({ id: eventIds[0] });
|
|
336
|
-
const sellerId = String((_d = params.recipient) === null || _d === void 0 ? void 0 : _d.id);
|
|
337
|
-
// 全購入管理番号のMovieTicketをマージ
|
|
338
|
-
const movieTickets = params.object.reduce((a, b) => [...a, ...(Array.isArray(b.movieTickets)) ? b.movieTickets : []], []);
|
|
339
|
-
const sellerCredentials = yield (0, getCredentials_1.getCredentials)({
|
|
340
|
-
seller: { id: sellerId, project: { id: event.project.id } },
|
|
341
|
-
paymentServiceId
|
|
342
|
-
})(repos);
|
|
343
|
-
const paymentAccepted = yield repos.paymentAccepted.isAcceptedBySeller({
|
|
344
|
-
seller: { id: sellerId },
|
|
345
|
-
codeValue: paymentMethodType
|
|
346
|
-
});
|
|
347
|
-
if (paymentAccepted !== true) {
|
|
348
|
-
throw new factory.errors.Argument('transactionId', `payment not accepted [${paymentMethodType}]`);
|
|
349
|
-
}
|
|
350
|
-
return (0, factory_1.createSeatInfoSyncIn)({
|
|
351
|
-
paymentMethodType: paymentMethodType,
|
|
352
|
-
paymentMethodId: paymentMethodId,
|
|
353
|
-
movieTickets: movieTickets,
|
|
354
|
-
event: event,
|
|
355
|
-
purpose: params.purpose,
|
|
356
|
-
credentials: sellerCredentials
|
|
357
|
-
});
|
|
358
|
-
});
|
|
359
|
-
}
|
|
360
|
-
/**
|
|
361
|
-
* MovieTicket着券取消
|
|
362
|
-
*/
|
|
363
|
-
function refundMovieTicket(params) {
|
|
364
|
-
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
365
|
-
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
366
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
367
|
-
const paymentMethodId = (_a = params.object[0]) === null || _a === void 0 ? void 0 : _a.paymentMethod.paymentMethodId;
|
|
368
|
-
const paymentServiceId = (_b = params.object[0]) === null || _b === void 0 ? void 0 : _b.id;
|
|
369
|
-
const availableChannel = yield repos.paymentService.findAvailableChannel({
|
|
370
|
-
project: params.project,
|
|
371
|
-
typeOf: factory.service.paymentService.PaymentServiceType.MovieTicket,
|
|
372
|
-
id: paymentServiceId
|
|
373
|
-
});
|
|
374
|
-
const mvtkReserveAuthClient = new surfrock.auth.ClientCredentials({
|
|
375
|
-
domain: String((_c = availableChannel.credentials) === null || _c === void 0 ? void 0 : _c.authorizeServerDomain),
|
|
376
|
-
clientId: String((_d = availableChannel.credentials) === null || _d === void 0 ? void 0 : _d.clientId),
|
|
377
|
-
clientSecret: String((_e = availableChannel.credentials) === null || _e === void 0 ? void 0 : _e.clientSecret),
|
|
378
|
-
scopes: [],
|
|
379
|
-
state: ''
|
|
380
|
-
});
|
|
381
|
-
const movieTicketSeatService = new surfrock.service.seat.SeatService({ endpoint: String(availableChannel.serviceUrl), auth: mvtkReserveAuthClient }, { timeout: credentials_1.credentials.movieticketReserve.timeout });
|
|
382
|
-
let seatInfoSyncCancelIn;
|
|
383
|
-
let seatInfoSyncIn;
|
|
384
|
-
const useSeatInfoSyncCancel = ((_f = availableChannel.credentials) === null || _f === void 0 ? void 0 : _f.useSeatInfoSyncCancel) === true;
|
|
385
|
-
if (useSeatInfoSyncCancel) {
|
|
386
|
-
seatInfoSyncCancelIn = yield createSeatInfoSyncCancelInOnRefund({
|
|
387
|
-
project: { id: params.project.id },
|
|
388
|
-
paymentMethodId
|
|
389
|
-
})({ action: repos.action });
|
|
390
|
-
}
|
|
391
|
-
else {
|
|
392
|
-
seatInfoSyncIn = yield createSeatInfoSyncInOnRefund({
|
|
393
|
-
project: { id: params.project.id },
|
|
394
|
-
paymentMethodId
|
|
395
|
-
})({ action: repos.action });
|
|
396
|
-
}
|
|
397
|
-
// アクション開始
|
|
398
|
-
// instrumentをセット(2024-04-30~)
|
|
399
|
-
const instrument = Object.assign(Object.assign({ typeOf: factory.service.paymentService.PaymentServiceType.MovieTicket }, (seatInfoSyncIn !== undefined) ? { seatInfoSyncIn } : undefined), (seatInfoSyncCancelIn !== undefined) ? { seatInfoSyncCancelIn } : undefined);
|
|
400
|
-
let action = yield repos.action.start(Object.assign(Object.assign(Object.assign({}, params), (typeof ((_g = params.sameAs) === null || _g === void 0 ? void 0 : _g.id) === 'string')
|
|
401
|
-
? { sameAs: { id: params.sameAs.id, typeOf: 'Task' } }
|
|
402
|
-
: undefined), { instrument }));
|
|
403
|
-
let seatInfoSyncCancelResult;
|
|
404
|
-
let seatInfoSyncResult;
|
|
405
|
-
let seatInfoSyncResultAsError;
|
|
406
|
-
if (useSeatInfoSyncCancel) {
|
|
407
|
-
try {
|
|
408
|
-
if (seatInfoSyncCancelIn === undefined) {
|
|
409
|
-
throw new factory.errors.ServiceUnavailable('seatInfoSyncCancelIn must be set');
|
|
410
|
-
}
|
|
411
|
-
seatInfoSyncCancelResult = yield movieTicketSeatService.seatInfoSyncCancel(seatInfoSyncCancelIn);
|
|
412
|
-
}
|
|
413
|
-
catch (error) {
|
|
414
|
-
let throwsError = true;
|
|
415
|
-
if (error.name === errorHandler_1.MOVIE_TICKET_RESERVE_REQUEST_ERROR_NAME) {
|
|
416
|
-
if (error.code === http_status_1.BAD_REQUEST) {
|
|
417
|
-
if (Array.isArray(error.errors) && error.errors.length > 0) {
|
|
418
|
-
const mvtkReserveServiceError = error.errors[0];
|
|
419
|
-
// 興行会社システム座席予約番号存在無の場合、取消済なのでok
|
|
420
|
-
if (mvtkReserveServiceError.status === surfrock.factory.ResultStatus.Success) {
|
|
421
|
-
const cnclResult = (_h = mvtkReserveServiceError.rawResult) === null || _h === void 0 ? void 0 : _h.cnclResult;
|
|
422
|
-
if (cnclResult === surfrock.service.seat.factory.seatInfoSyncCancel.CancelResult.CancelResult02) {
|
|
423
|
-
seatInfoSyncCancelResult = error;
|
|
424
|
-
throwsError = false;
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
if (throwsError) {
|
|
431
|
-
let message = String(error.message);
|
|
432
|
-
// エラー通知先で情報を読み取りやすくするために、messageに情報付加
|
|
433
|
-
message += `決済ID:${paymentMethodId}`;
|
|
434
|
-
try {
|
|
435
|
-
const actionError = Object.assign(Object.assign({}, error), { message: message, name: error.name });
|
|
436
|
-
yield repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error: actionError });
|
|
437
|
-
}
|
|
438
|
-
catch (__) {
|
|
439
|
-
// 失敗したら仕方ない
|
|
440
|
-
}
|
|
441
|
-
error = (0, errorHandler_1.handleMvtkReserveError)(Object.assign(Object.assign({}, error), { message: message }));
|
|
442
|
-
throw error;
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
else {
|
|
447
|
-
try {
|
|
448
|
-
if (seatInfoSyncIn === undefined) {
|
|
449
|
-
throw new factory.errors.ServiceUnavailable('seatInfoSyncIn must be set');
|
|
450
|
-
}
|
|
451
|
-
seatInfoSyncResult = yield movieTicketSeatService.seatInfoSync(seatInfoSyncIn);
|
|
452
|
-
}
|
|
453
|
-
catch (error) {
|
|
454
|
-
let throwsError = true;
|
|
455
|
-
// 「存在しない興行会社システム座席予約番号が入力されました」の場合、取消済なのでok
|
|
456
|
-
if (error.name === errorHandler_1.MOVIE_TICKET_RESERVE_REQUEST_ERROR_NAME) {
|
|
457
|
-
if (error.code === http_status_1.BAD_REQUEST && error.message === MovieticketReserveRequestErrorMessage.NotFound) {
|
|
458
|
-
seatInfoSyncResult = error;
|
|
459
|
-
throwsError = false;
|
|
460
|
-
}
|
|
461
|
-
// ReservationResult 19の内容が不明だがリトライする意味はおそらくないパターン
|
|
462
|
-
if (error.code === http_status_1.BAD_REQUEST && error.message === MovieticketReserveRequestErrorMessage.ReservationResult19) {
|
|
463
|
-
seatInfoSyncResult = error;
|
|
464
|
-
throwsError = false;
|
|
465
|
-
}
|
|
466
|
-
// surfrock: bookingNoが存在しないケースをハンドル(2024-03-13~)
|
|
467
|
-
const expectedMessage4surfrockNotFound = JSON.stringify({ message: `bookingNo:"${paymentMethodId}" が見つかりません。` });
|
|
468
|
-
if (error.code === http_status_1.BAD_REQUEST && error.message === expectedMessage4surfrockNotFound) {
|
|
469
|
-
seatInfoSyncResult = error;
|
|
470
|
-
throwsError = false;
|
|
471
|
-
}
|
|
472
|
-
// 着券取消可能期間超過を認識した上でのあえての返金の場合(注文からしばらく経って返品など)(2024-03-19~)
|
|
473
|
-
if (error.code === http_status_1.BAD_REQUEST && error.message === MovieticketReserveRequestErrorMessage.CancellationPeriodPassed) {
|
|
474
|
-
if (params.purpose.typeOf === factory.actionType.ReturnAction) {
|
|
475
|
-
seatInfoSyncResultAsError = error;
|
|
476
|
-
throwsError = false;
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
if (throwsError) {
|
|
481
|
-
let message = String(error.message);
|
|
482
|
-
// エラー通知先で情報を読み取りやすくするために、messageに情報付加
|
|
483
|
-
message += `決済ID:${paymentMethodId}`;
|
|
484
|
-
try {
|
|
485
|
-
const actionError = Object.assign(Object.assign({}, error), { message: message, name: error.name });
|
|
486
|
-
yield repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error: actionError });
|
|
487
|
-
}
|
|
488
|
-
catch (__) {
|
|
489
|
-
// 失敗したら仕方ない
|
|
490
|
-
}
|
|
491
|
-
error = (0, errorHandler_1.handleMvtkReserveError)(Object.assign(Object.assign({}, error), { message: message }));
|
|
492
|
-
throw error;
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
// アクションとしてはFailedだが後続処理を実行するケースに対応(2024-03-21~)
|
|
497
|
-
if (seatInfoSyncResultAsError !== undefined) {
|
|
498
|
-
action = (yield repos.action.giveUpWithObject({ typeOf: action.typeOf, id: action.id, error: seatInfoSyncResultAsError }));
|
|
499
|
-
}
|
|
500
|
-
else {
|
|
501
|
-
const actionResult = Object.assign(Object.assign({}, (seatInfoSyncResult !== undefined) ? { seatInfoSyncResult } : undefined), (seatInfoSyncCancelResult !== undefined) ? { seatInfoSyncCancelResult } : undefined);
|
|
502
|
-
action = (yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: actionResult }));
|
|
503
|
-
}
|
|
504
|
-
yield (0, onRefund_1.onRefund)(action)(repos);
|
|
505
|
-
});
|
|
506
|
-
}
|
|
507
|
-
exports.refundMovieTicket = refundMovieTicket;
|
|
508
|
-
function createSeatInfoSyncInOnRefund(params) {
|
|
509
|
-
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
510
|
-
var _a;
|
|
511
|
-
// 本アクションに対応するPayActionを取り出す
|
|
512
|
-
// 例えばtimeoutが原因でCompletedActionStatusでない場合、外部サービス側では着券済の可能性もあるので、そこを考慮する
|
|
513
|
-
const payAction = yield repos.action.findPayAction({
|
|
514
|
-
project: { id: params.project.id },
|
|
515
|
-
paymentMethodId: params.paymentMethodId,
|
|
516
|
-
actionStatus: {
|
|
517
|
-
$in: [
|
|
518
|
-
factory.actionStatusType.ActiveActionStatus,
|
|
519
|
-
factory.actionStatusType.CompletedActionStatus,
|
|
520
|
-
factory.actionStatusType.FailedActionStatus
|
|
521
|
-
]
|
|
522
|
-
}
|
|
523
|
-
});
|
|
524
|
-
if (payAction === undefined) {
|
|
525
|
-
throw new factory.errors.NotFound('PayAction');
|
|
526
|
-
}
|
|
527
|
-
const seatInfoSyncInOnPay = (_a = payAction.instrument) === null || _a === void 0 ? void 0 : _a.seatInfoSyncIn;
|
|
528
|
-
if (seatInfoSyncInOnPay === undefined) {
|
|
529
|
-
throw new factory.errors.NotFound('PayAction.instrument?.seatInfoSyncIn');
|
|
530
|
-
}
|
|
531
|
-
let seatInfoSyncIn;
|
|
532
|
-
// 着券時のseatInfoSyncInに対してtrkshFlgだけ変更してリクエストする
|
|
533
|
-
seatInfoSyncIn = Object.assign(Object.assign({}, seatInfoSyncInOnPay), { trkshFlg: surfrock.factory.service.seat.seatInfoSync.DeleteFlag.True // 取消フラグ
|
|
534
|
-
});
|
|
535
|
-
return seatInfoSyncIn;
|
|
536
|
-
});
|
|
537
|
-
}
|
|
538
|
-
function createSeatInfoSyncCancelInOnRefund(params) {
|
|
539
|
-
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
540
|
-
var _a;
|
|
541
|
-
// 本アクションに対応するPayActionを取り出す
|
|
542
|
-
// 例えばtimeoutが原因でCompletedActionStatusでない場合、外部サービス側では着券済の可能性もあるので、そこを考慮する
|
|
543
|
-
const payAction = yield repos.action.findPayAction({
|
|
544
|
-
project: { id: params.project.id },
|
|
545
|
-
paymentMethodId: params.paymentMethodId,
|
|
546
|
-
actionStatus: {
|
|
547
|
-
$in: [
|
|
548
|
-
factory.actionStatusType.ActiveActionStatus,
|
|
549
|
-
factory.actionStatusType.CompletedActionStatus,
|
|
550
|
-
factory.actionStatusType.FailedActionStatus
|
|
551
|
-
]
|
|
552
|
-
}
|
|
553
|
-
});
|
|
554
|
-
if (payAction === undefined) {
|
|
555
|
-
throw new factory.errors.NotFound('PayAction');
|
|
556
|
-
}
|
|
557
|
-
const seatInfoSyncInOnPay = (_a = payAction.instrument) === null || _a === void 0 ? void 0 : _a.seatInfoSyncIn;
|
|
558
|
-
if (seatInfoSyncInOnPay === undefined) {
|
|
559
|
-
throw new factory.errors.NotFound('PayAction.instrument?.seatInfoSyncIn');
|
|
560
|
-
}
|
|
561
|
-
let seatInfoSyncCancelIn;
|
|
562
|
-
seatInfoSyncCancelIn = {
|
|
563
|
-
kgygishCd: seatInfoSyncInOnPay.kgygishCd,
|
|
564
|
-
kgysystmzskyykNo: seatInfoSyncInOnPay.kgygishSstmZskyykNo,
|
|
565
|
-
kgysystmzskyykNoIkktsCnclFlg: '1',
|
|
566
|
-
jyuTyp: surfrock.service.seat.factory.seatInfoSyncCancel.JyuTyp.JyuTyp05,
|
|
567
|
-
jyuTypRmk: ''
|
|
568
|
-
// knyknrNoInfoIn: [],
|
|
569
|
-
};
|
|
570
|
-
return seatInfoSyncCancelIn;
|
|
571
|
-
});
|
|
572
|
-
}
|
|
7
|
+
const authorize_1 = require("./movieTicket/authorize");
|
|
8
|
+
Object.defineProperty(exports, "authorize", { enumerable: true, get: function () { return authorize_1.authorize; } });
|
|
9
|
+
const checkMovieTicket_1 = require("./movieTicket/checkMovieTicket");
|
|
10
|
+
Object.defineProperty(exports, "checkMovieTicket", { enumerable: true, get: function () { return checkMovieTicket_1.checkMovieTicket; } });
|
|
11
|
+
const payMovieTicket_1 = require("./movieTicket/payMovieTicket");
|
|
12
|
+
Object.defineProperty(exports, "payMovieTicket", { enumerable: true, get: function () { return payMovieTicket_1.payMovieTicket; } });
|
|
13
|
+
const refundMovieTicket_1 = require("./movieTicket/refundMovieTicket");
|
|
14
|
+
Object.defineProperty(exports, "refundMovieTicket", { enumerable: true, get: function () { return refundMovieTicket_1.refundMovieTicket; } });
|
|
15
|
+
const voidTransaction_1 = require("./movieTicket/voidTransaction");
|
|
16
|
+
Object.defineProperty(exports, "voidTransaction", { enumerable: true, get: function () { return voidTransaction_1.voidTransaction; } });
|
|
@@ -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.
|
|
19
|
+
declare function payPaymentCard(params: factory.action.trade.pay.IAttributes): (repos: {
|
|
20
20
|
action: ActionRepo;
|
|
21
21
|
accountingReport: AccountingReportRepo;
|
|
22
22
|
product: ProductRepo;
|
|
@@ -18,7 +18,15 @@ import * as factory from '../factory';
|
|
|
18
18
|
/**
|
|
19
19
|
* 決済確定
|
|
20
20
|
*/
|
|
21
|
-
export declare function pay(params: factory.task.pay.IData
|
|
21
|
+
export declare function pay(params: factory.task.pay.IData & {
|
|
22
|
+
sameAs?: {
|
|
23
|
+
/**
|
|
24
|
+
* 実行元タスクID
|
|
25
|
+
*/
|
|
26
|
+
id: string;
|
|
27
|
+
typeOf: 'Task';
|
|
28
|
+
};
|
|
29
|
+
}): (repos: {
|
|
22
30
|
acceptedOffer: AcceptedOfferRepo;
|
|
23
31
|
action: ActionRepo;
|
|
24
32
|
accountingReport: AccountingReportRepo;
|
|
@@ -19,6 +19,7 @@ const MovieTicketPaymentService = require("./payment/movieTicket");
|
|
|
19
19
|
const PaymentCardPaymentService = require("./payment/paymentCard");
|
|
20
20
|
function payTask2payActionAttributes(params) {
|
|
21
21
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
var _a;
|
|
22
23
|
let transaction;
|
|
23
24
|
if (typeof params.object.paymentMethod.paymentMethodId === 'string') {
|
|
24
25
|
transaction = yield repos.assetTransaction.findByTransactionNumber({
|
|
@@ -38,7 +39,7 @@ function payTask2payActionAttributes(params) {
|
|
|
38
39
|
potentialActions: { pay: { purpose: params.purpose } },
|
|
39
40
|
order
|
|
40
41
|
});
|
|
41
|
-
return payActions[0];
|
|
42
|
+
return Object.assign(Object.assign({}, payActions[0]), (typeof ((_a = params.sameAs) === null || _a === void 0 ? void 0 : _a.id) === 'string') ? { sameAs: params.sameAs } : undefined);
|
|
42
43
|
});
|
|
43
44
|
}
|
|
44
45
|
/**
|
|
@@ -84,7 +84,8 @@ function call(params) {
|
|
|
84
84
|
// アクションが存在すればタスクを実行済扱いにする
|
|
85
85
|
const action = (yield actionRepo.searchBySameAs({
|
|
86
86
|
sameAs: { id: { $eq: params.id } },
|
|
87
|
-
purpose: { id: { $eq: params.data.purpose.id } }
|
|
87
|
+
purpose: { id: { $eq: params.data.purpose.id } },
|
|
88
|
+
typeOf: { $eq: factory.actionType.AcceptAction }
|
|
88
89
|
})).shift();
|
|
89
90
|
if (typeof (action === null || action === void 0 ? void 0 : action.id) === 'string') {
|
|
90
91
|
throwsError = false;
|
|
@@ -67,7 +67,8 @@ function call(params) {
|
|
|
67
67
|
// アクションが存在すればタスクを実行済扱いにする
|
|
68
68
|
const action = (yield actionRepo.searchBySameAs({
|
|
69
69
|
sameAs: { id: { $eq: params.id } },
|
|
70
|
-
purpose: { id: { $eq: params.data.purpose.id } }
|
|
70
|
+
purpose: { id: { $eq: params.data.purpose.id } },
|
|
71
|
+
typeOf: { $eq: factory.actionType.AuthorizeAction }
|
|
71
72
|
})).shift();
|
|
72
73
|
if (typeof (action === null || action === void 0 ? void 0 : action.id) === 'string') {
|
|
73
74
|
throwsError = false;
|