@chevre/domain 21.8.0-alpha.4 → 21.8.0-alpha.41
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/countOffers.ts +32 -0
- package/example/src/chevre/importOffersFromCOA.ts +7 -1
- package/example/src/chevre/migrateAggregateOffers.ts +75 -0
- package/example/src/chevre/migrateOrderPaymentMethodIdentifier.ts +81 -0
- package/example/src/chevre/migratePayTransactionPaymentMethodId.ts +72 -0
- package/example/src/chevre/migratePayTransactionPaymentMethodIdentifier.ts +78 -0
- package/example/src/chevre/processPay.ts +3 -4
- package/example/src/chevre/publishPermitOwnershipInfoToken.ts +56 -0
- package/example/src/chevre/pullAddOnsFromOffer.ts +26 -0
- package/example/src/chevre/searchOffersByCatalog.ts +9 -4
- package/example/src/chevre/searchOffersFromAggregateOffer.ts +167 -0
- package/example/src/chevre/sync2aggregateOffer.ts +27 -0
- package/example/src/chevre/syncAggregateOffer.ts +25 -0
- package/lib/chevre/repo/assetTransaction.d.ts +16 -1
- package/lib/chevre/repo/assetTransaction.js +54 -2
- package/lib/chevre/repo/mongoose/schemas/aggregateOffer.d.ts +71 -0
- package/lib/chevre/repo/mongoose/schemas/aggregateOffer.js +176 -0
- package/lib/chevre/repo/mongoose/schemas/offer.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +3 -0
- package/lib/chevre/repo/mongoose/schemas/order.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/task.d.ts +3 -0
- package/lib/chevre/repo/mongoose/schemas/task.js +8 -0
- package/lib/chevre/repo/offer.d.ts +71 -14
- package/lib/chevre/repo/offer.js +1061 -87
- package/lib/chevre/repo/order.d.ts +15 -0
- package/lib/chevre/repo/order.js +34 -1
- package/lib/chevre/repo/task.d.ts +7 -1
- package/lib/chevre/repo/task.js +100 -0
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +2 -2
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +2 -2
- package/lib/chevre/service/assetTransaction/pay/account/validation.js +2 -2
- package/lib/chevre/service/assetTransaction/pay/factory.js +26 -18
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +3 -3
- package/lib/chevre/service/assetTransaction/pay.js +65 -46
- package/lib/chevre/service/assetTransaction/refund/factory.js +8 -2
- package/lib/chevre/service/assetTransaction/reserve.js +105 -31
- package/lib/chevre/service/delivery.js +17 -0
- package/lib/chevre/service/offer/event/authorize.js +18 -19
- package/lib/chevre/service/offer/event/factory.js +8 -8
- package/lib/chevre/service/offer/event/importFromCOA.d.ts +2 -0
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +2 -2
- package/lib/chevre/service/offer/event/voidTransaction.js +7 -2
- package/lib/chevre/service/offer/product/searchProductOffers.js +1 -1
- package/lib/chevre/service/order/confirmPayTransaction.d.ts +0 -2
- package/lib/chevre/service/order/confirmPayTransaction.js +29 -40
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +27 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +226 -0
- package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +8 -6
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +80 -57
- package/lib/chevre/service/order/onOrderStatusChanged.js +104 -81
- package/lib/chevre/service/order/payOrder.d.ts +2 -10
- package/lib/chevre/service/order/payOrder.js +4 -45
- package/lib/chevre/service/order/placeOrder.js +11 -13
- package/lib/chevre/service/order.d.ts +3 -1
- package/lib/chevre/service/order.js +6 -2
- package/lib/chevre/service/payment/any/factory.js +33 -8
- package/lib/chevre/service/payment/any.js +30 -21
- package/lib/chevre/service/payment/creditCard.js +12 -12
- package/lib/chevre/service/payment/movieTicket/validation.js +2 -2
- package/lib/chevre/service/payment/movieTicket.js +10 -11
- package/lib/chevre/service/payment/paymentCard.js +9 -12
- package/lib/chevre/service/project.js +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +3 -0
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +1 -4
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +1 -5
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.d.ts +3 -0
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +1 -4
- package/lib/chevre/service/task/confirmPayTransaction.js +1 -3
- package/lib/chevre/service/task/importOffersFromCOA.js +3 -0
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.d.ts +6 -0
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +37 -0
- package/lib/chevre/service/task/onOrderPaymentCompleted.d.ts +6 -0
- package/lib/chevre/service/task/onOrderPaymentCompleted.js +35 -0
- package/lib/chevre/service/task/returnPayTransaction.js +8 -3
- package/lib/chevre/service/task/syncAggregateOffer.d.ts +7 -0
- package/lib/chevre/service/task/syncAggregateOffer.js +23 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/result.js +32 -16
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +13 -11
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +53 -17
- package/lib/chevre/service/transaction/placeOrderInProgress.js +4 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +7 -6
- package/lib/chevre/service/transaction/returnOrder.js +5 -1
- package/lib/chevre/settings.d.ts +4 -2
- package/lib/chevre/settings.js +5 -5
- package/package.json +3 -3
- package/example/src/chevre/migrateAuthorizePaymentActionResult.ts +0 -83
- package/example/src/chevre/migrateEventOrganizer.ts +0 -154
|
@@ -34,9 +34,9 @@ function authorize(params, paymentServiceId, searchTrade4accountId) {
|
|
|
34
34
|
exclusion: []
|
|
35
35
|
});
|
|
36
36
|
// CreditCard系統の決済方法タイプは動的
|
|
37
|
-
const paymentMethodType = (_a = params.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.
|
|
37
|
+
const paymentMethodType = (_a = params.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.identifier;
|
|
38
38
|
if (typeof paymentMethodType !== 'string') {
|
|
39
|
-
throw new factory.errors.ArgumentNull('object.paymentMethod.
|
|
39
|
+
throw new factory.errors.ArgumentNull('object.paymentMethod.identifier');
|
|
40
40
|
}
|
|
41
41
|
const availableChannel = yield repos.product.findAvailableChannel({
|
|
42
42
|
project: params.project,
|
|
@@ -205,16 +205,16 @@ function handleAuthorizeError(error) {
|
|
|
205
205
|
*/
|
|
206
206
|
function voidTransaction(params) {
|
|
207
207
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
208
|
-
var _a, _b, _c, _d, _e, _f
|
|
208
|
+
var _a, _b, _c, _d, _e, _f;
|
|
209
209
|
const transaction = params.object;
|
|
210
210
|
// CreditCard系統の決済方法タイプは動的
|
|
211
|
-
const paymentMethodType = (_a = transaction.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.
|
|
211
|
+
const paymentMethodType = (_a = transaction.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.identifier;
|
|
212
212
|
if (typeof paymentMethodType !== 'string') {
|
|
213
|
-
throw new factory.errors.ArgumentNull('object.paymentMethod.
|
|
213
|
+
throw new factory.errors.ArgumentNull('object.paymentMethod.identifier');
|
|
214
214
|
}
|
|
215
|
-
const paymentMethodId =
|
|
215
|
+
const paymentMethodId = transaction.object.paymentMethodId;
|
|
216
216
|
if (typeof paymentMethodId !== 'string') {
|
|
217
|
-
throw new factory.errors.ArgumentNull('object.
|
|
217
|
+
throw new factory.errors.ArgumentNull('object.paymentMethodId');
|
|
218
218
|
}
|
|
219
219
|
const paymentServiceId = String(transaction.object.id);
|
|
220
220
|
const availableChannel = yield repos.product.findAvailableChannel({
|
|
@@ -222,7 +222,7 @@ function voidTransaction(params) {
|
|
|
222
222
|
typeOf: factory.service.paymentService.PaymentServiceType.CreditCard,
|
|
223
223
|
id: paymentServiceId
|
|
224
224
|
});
|
|
225
|
-
const sellerId = (
|
|
225
|
+
const sellerId = (_b = transaction.recipient) === null || _b === void 0 ? void 0 : _b.id;
|
|
226
226
|
if (typeof sellerId !== 'string') {
|
|
227
227
|
throw new factory.errors.ArgumentNull('object.recipient.id');
|
|
228
228
|
}
|
|
@@ -236,8 +236,8 @@ function voidTransaction(params) {
|
|
|
236
236
|
shopId: shopId,
|
|
237
237
|
shopPass: shopPass,
|
|
238
238
|
orderId: paymentMethodId,
|
|
239
|
-
siteId: (
|
|
240
|
-
sitePass: (
|
|
239
|
+
siteId: (_c = availableChannel.credentials) === null || _c === void 0 ? void 0 : _c.siteId,
|
|
240
|
+
sitePass: (_d = availableChannel.credentials) === null || _d === void 0 ? void 0 : _d.sitePass
|
|
241
241
|
});
|
|
242
242
|
debug('searchTradeResult:', searchTradeResult);
|
|
243
243
|
// 仮売上であれば取消
|
|
@@ -248,8 +248,8 @@ function voidTransaction(params) {
|
|
|
248
248
|
accessId: searchTradeResult.accessId,
|
|
249
249
|
accessPass: searchTradeResult.accessPass,
|
|
250
250
|
jobCd: GMO.utils.util.JobCd.Void,
|
|
251
|
-
siteId: (
|
|
252
|
-
sitePass: (
|
|
251
|
+
siteId: (_e = availableChannel.credentials) === null || _e === void 0 ? void 0 : _e.siteId,
|
|
252
|
+
sitePass: (_f = availableChannel.credentials) === null || _f === void 0 ? void 0 : _f.sitePass
|
|
253
253
|
});
|
|
254
254
|
debug('alterTran processed', alterTranResult);
|
|
255
255
|
}
|
|
@@ -39,9 +39,9 @@ function validateMovieTicket(params, paymentServiceId, useCheckMovieTicketBefore
|
|
|
39
39
|
throw new factory.errors.Argument('movieTickets', 'Number of movie ticket accessCodes must be 1');
|
|
40
40
|
}
|
|
41
41
|
// ムビチケ系統の決済方法タイプは動的
|
|
42
|
-
const paymentMethodType = (_b = params.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.
|
|
42
|
+
const paymentMethodType = (_b = params.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.identifier;
|
|
43
43
|
if (typeof paymentMethodType !== 'string') {
|
|
44
|
-
throw new factory.errors.ArgumentNull('object.paymentMethod.
|
|
44
|
+
throw new factory.errors.ArgumentNull('object.paymentMethod.identifier');
|
|
45
45
|
}
|
|
46
46
|
// イベント取得属性最適化(2023-01-23~)
|
|
47
47
|
const screeningEvent = yield repos.event.findMinimizedIndividualEventById({
|
|
@@ -122,11 +122,9 @@ function authorize(params, transaction, paymentServiceId, useCheckMovieTicketBef
|
|
|
122
122
|
const validateMovieTicketResult = yield (0, validation_1.validateMovieTicket)(params, paymentServiceId, useCheckMovieTicketBeforePay, useCheckByIdentifierIfNotYet)(repos);
|
|
123
123
|
accountsReceivablesByServiceType = validateMovieTicketResult.accountsReceivablesByServiceType;
|
|
124
124
|
const paymentMethod = transaction.object.paymentMethod;
|
|
125
|
-
const paymentMethodType = String(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.
|
|
125
|
+
const paymentMethodType = String(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.identifier);
|
|
126
126
|
const additionalProperty = paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.additionalProperty;
|
|
127
|
-
const paymentMethodId =
|
|
128
|
-
? paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.paymentMethodId
|
|
129
|
-
: transaction.id;
|
|
127
|
+
const paymentMethodId = transaction.object.paymentMethodId;
|
|
130
128
|
const paymentMethodName = (typeof (paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.name) === 'string') ? paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.name : paymentMethodType;
|
|
131
129
|
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;
|
|
132
130
|
if (typeof accountId !== 'string' || accountId.length === 0) {
|
|
@@ -157,15 +155,16 @@ function authorize(params, transaction, paymentServiceId, useCheckMovieTicketBef
|
|
|
157
155
|
exports.authorize = authorize;
|
|
158
156
|
function voidTransaction(params) {
|
|
159
157
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
160
|
-
var _a, _b, _c
|
|
158
|
+
var _a, _b, _c;
|
|
161
159
|
const transaction = params.object;
|
|
162
|
-
const paymentMethodType = (_a = transaction.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.
|
|
160
|
+
const paymentMethodType = (_a = transaction.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.identifier;
|
|
163
161
|
if (typeof paymentMethodType !== 'string') {
|
|
164
|
-
throw new factory.errors.ArgumentNull('object.paymentMethod.
|
|
162
|
+
throw new factory.errors.ArgumentNull('object.paymentMethod.identifier');
|
|
165
163
|
}
|
|
166
|
-
const paymentMethodId =
|
|
164
|
+
// const paymentMethodId = transaction.object.paymentMethod?.paymentMethodId;
|
|
165
|
+
const paymentMethodId = transaction.object.paymentMethodId;
|
|
167
166
|
if (typeof paymentMethodId !== 'string') {
|
|
168
|
-
throw new factory.errors.ArgumentNull('object.
|
|
167
|
+
throw new factory.errors.ArgumentNull('object.paymentMethodId');
|
|
169
168
|
}
|
|
170
169
|
// 決済開始時に着券していれば、取消
|
|
171
170
|
// 例えばtimeoutが原因でCompletedActionStatusでない場合、外部サービス側では着券済の可能性もあるので、そこを考慮する
|
|
@@ -192,14 +191,14 @@ function voidTransaction(params) {
|
|
|
192
191
|
paymentMethod: {
|
|
193
192
|
paymentMethodId: paymentMethodId,
|
|
194
193
|
typeOf: paymentMethodType,
|
|
195
|
-
name: (typeof ((
|
|
194
|
+
name: (typeof ((_b = transaction.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.name) === 'string')
|
|
196
195
|
? transaction.object.paymentMethod.name
|
|
197
196
|
: paymentMethodType,
|
|
198
197
|
additionalProperty: []
|
|
199
198
|
}
|
|
200
199
|
}], agent: {
|
|
201
200
|
id: seller.id,
|
|
202
|
-
name: (typeof seller.name === 'string') ? seller.name : String((
|
|
201
|
+
name: (typeof seller.name === 'string') ? seller.name : String((_c = seller.name) === null || _c === void 0 ? void 0 : _c.ja),
|
|
203
202
|
typeOf: seller.typeOf
|
|
204
203
|
}, recipient: transaction.recipient }, ((payAction === null || payAction === void 0 ? void 0 : payAction.purpose) !== undefined)
|
|
205
204
|
? { purpose: payAction.purpose }
|
|
@@ -68,7 +68,7 @@ function validatePaymentMethod(params, paymentServiceId) {
|
|
|
68
68
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
69
69
|
const serviceOutputIdentifier = (_a = params.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.accountId;
|
|
70
70
|
const amount = (_b = params.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.amount;
|
|
71
|
-
const paymentMethodType = (_c = params.object.paymentMethod) === null || _c === void 0 ? void 0 : _c.
|
|
71
|
+
const paymentMethodType = (_c = params.object.paymentMethod) === null || _c === void 0 ? void 0 : _c.identifier;
|
|
72
72
|
if (typeof serviceOutputIdentifier !== 'string') {
|
|
73
73
|
throw new factory.errors.ArgumentNull('object.paymentMethod.accountId');
|
|
74
74
|
}
|
|
@@ -76,7 +76,7 @@ function validatePaymentMethod(params, paymentServiceId) {
|
|
|
76
76
|
throw new factory.errors.ArgumentNull('object.paymentMethod.amount');
|
|
77
77
|
}
|
|
78
78
|
if (typeof paymentMethodType !== 'string') {
|
|
79
|
-
throw new factory.errors.ArgumentNull('object.paymentMethod.
|
|
79
|
+
throw new factory.errors.ArgumentNull('object.paymentMethod.identifier');
|
|
80
80
|
}
|
|
81
81
|
// プロダクトから通貨区分を取得
|
|
82
82
|
const paymentCatdProduct = yield repos.product.findById({ id: paymentServiceId }, ['serviceOutput'], []);
|
|
@@ -182,15 +182,12 @@ function processAccountTransaction(params) {
|
|
|
182
182
|
}
|
|
183
183
|
function voidTransaction(params) {
|
|
184
184
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
185
|
-
var _a, _b, _c
|
|
185
|
+
var _a, _b, _c;
|
|
186
186
|
const transaction = params.object;
|
|
187
|
-
const
|
|
188
|
-
const paymentMethodId =
|
|
189
|
-
if (typeof paymentMethodType !== 'string') {
|
|
190
|
-
throw new factory.errors.ArgumentNull('object.paymentMethod.typeOf');
|
|
191
|
-
}
|
|
187
|
+
// const paymentMethodId = transaction.object.paymentMethod?.paymentMethodId;
|
|
188
|
+
const paymentMethodId = transaction.object.paymentMethodId;
|
|
192
189
|
if (typeof paymentMethodId !== 'string') {
|
|
193
|
-
throw new factory.errors.ArgumentNull('object.
|
|
190
|
+
throw new factory.errors.ArgumentNull('object.paymentMethodId');
|
|
194
191
|
}
|
|
195
192
|
const paymentServiceId = String(transaction.object.id);
|
|
196
193
|
// アクションステータスに関係なく取消処理実行
|
|
@@ -204,9 +201,9 @@ function voidTransaction(params) {
|
|
|
204
201
|
const accountTransactionService = new pecorinoapi.service.AccountTransaction({
|
|
205
202
|
endpoint: String(availableChannel.serviceUrl),
|
|
206
203
|
auth: new pecorinoapi.auth.ClientCredentials({
|
|
207
|
-
domain: String((
|
|
208
|
-
clientId: String((
|
|
209
|
-
clientSecret: String((
|
|
204
|
+
domain: String((_a = availableChannel.credentials) === null || _a === void 0 ? void 0 : _a.authorizeServerDomain),
|
|
205
|
+
clientId: String((_b = availableChannel.credentials) === null || _b === void 0 ? void 0 : _b.clientId),
|
|
206
|
+
clientSecret: String((_c = availableChannel.credentials) === null || _c === void 0 ? void 0 : _c.clientSecret),
|
|
210
207
|
scopes: [],
|
|
211
208
|
state: ''
|
|
212
209
|
})
|
|
@@ -27,7 +27,7 @@ function cleanUpDatabaseByProject(params) {
|
|
|
27
27
|
yield repos.categoryCode.deleteByProject({ project: { id: params.id } });
|
|
28
28
|
yield repos.creativeWork.deleteByProject({ project: { id: params.id } });
|
|
29
29
|
yield repos.event.deleteByProject({ project: { id: params.id } });
|
|
30
|
-
|
|
30
|
+
// await repos.offer.deleteByProject({ project: { id: params.id } });
|
|
31
31
|
yield repos.offerCatalog.deleteByProject({ project: { id: params.id } });
|
|
32
32
|
yield repos.place.deleteByProject({ project: { id: params.id } });
|
|
33
33
|
yield repos.priceSpecification.deleteByProject({ project: { id: params.id } });
|
|
@@ -13,7 +13,6 @@ exports.onReservationCanceled = void 0;
|
|
|
13
13
|
/**
|
|
14
14
|
* 予約取消時アクション
|
|
15
15
|
*/
|
|
16
|
-
const moment = require("moment");
|
|
17
16
|
const factory = require("../../../factory");
|
|
18
17
|
const settings_1 = require("../../../settings");
|
|
19
18
|
const offer_1 = require("../../offer");
|
|
@@ -41,9 +40,7 @@ reservationFor) {
|
|
|
41
40
|
if (useInformReservation) {
|
|
42
41
|
if (Array.isArray(informReservations)) {
|
|
43
42
|
// やや遅延させる(確定通知が未達の可能性を考慮して)
|
|
44
|
-
const informTaskRunsAt =
|
|
45
|
-
.add(settings_1.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS, 'seconds')
|
|
46
|
-
.toDate();
|
|
43
|
+
const informTaskRunsAt = now;
|
|
47
44
|
const reservations4inform = canceledReservations.map((r) => {
|
|
48
45
|
return {
|
|
49
46
|
typeOf: r.typeOf,
|
|
@@ -13,7 +13,6 @@ exports.onReservationCheckedIn = void 0;
|
|
|
13
13
|
/**
|
|
14
14
|
* 予約発券時アクション
|
|
15
15
|
*/
|
|
16
|
-
const moment = require("moment");
|
|
17
16
|
const factory = require("../../../factory");
|
|
18
17
|
const settings_1 = require("../../../settings");
|
|
19
18
|
const offer_1 = require("../../offer");
|
|
@@ -28,10 +27,7 @@ function onReservationCheckedIn(params) {
|
|
|
28
27
|
const project = { id: params.project.id, typeOf: factory.organizationType.Project };
|
|
29
28
|
// inform galobally
|
|
30
29
|
if (Array.isArray(informReservations)) {
|
|
31
|
-
|
|
32
|
-
const informTaskRunsAt = moment(params.now)
|
|
33
|
-
.add(settings_1.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS, 'seconds')
|
|
34
|
-
.toDate();
|
|
30
|
+
const informTaskRunsAt = params.now;
|
|
35
31
|
informReservations.forEach((informReservation) => {
|
|
36
32
|
var _a;
|
|
37
33
|
const informUrl = String((_a = informReservation.recipient) === null || _a === void 0 ? void 0 : _a.url);
|
|
@@ -13,7 +13,6 @@ exports.onReservationUsed = void 0;
|
|
|
13
13
|
/**
|
|
14
14
|
* 予約使用時アクション
|
|
15
15
|
*/
|
|
16
|
-
const moment = require("moment");
|
|
17
16
|
const factory = require("../../../factory");
|
|
18
17
|
const settings_1 = require("../../../settings");
|
|
19
18
|
const offer_1 = require("../../offer");
|
|
@@ -30,9 +29,7 @@ function onReservationUsed(action, attendedReservation) {
|
|
|
30
29
|
// inform galobally
|
|
31
30
|
if (Array.isArray(informReservations)) {
|
|
32
31
|
// やや遅延させる(確定通知が未達の可能性を考慮して)
|
|
33
|
-
const informTaskRunsAt =
|
|
34
|
-
.add(settings_1.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS, 'seconds')
|
|
35
|
-
.toDate();
|
|
32
|
+
const informTaskRunsAt = now;
|
|
36
33
|
const reservation4inform = {
|
|
37
34
|
typeOf: attendedReservation.typeOf,
|
|
38
35
|
project: attendedReservation.project,
|
|
@@ -13,7 +13,6 @@ exports.call = void 0;
|
|
|
13
13
|
const factory = require("../../factory");
|
|
14
14
|
const accountingReport_1 = require("../../repo/accountingReport");
|
|
15
15
|
const action_1 = require("../../repo/action");
|
|
16
|
-
const registerServiceInProgress_1 = require("../../repo/action/registerServiceInProgress");
|
|
17
16
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
18
17
|
const event_1 = require("../../repo/event");
|
|
19
18
|
const order_1 = require("../../repo/order");
|
|
@@ -41,8 +40,7 @@ function call(data) {
|
|
|
41
40
|
project: new project_1.MongoRepository(settings.connection),
|
|
42
41
|
seller: new seller_1.MongoRepository(settings.connection),
|
|
43
42
|
task: new task_1.MongoRepository(settings.connection),
|
|
44
|
-
transaction: new transaction_1.MongoRepository(settings.connection)
|
|
45
|
-
registerServiceInProgress: new registerServiceInProgress_1.RedisRepository(settings.redisClient)
|
|
43
|
+
transaction: new transaction_1.MongoRepository(settings.connection)
|
|
46
44
|
});
|
|
47
45
|
});
|
|
48
46
|
}
|
|
@@ -13,6 +13,7 @@ exports.call = void 0;
|
|
|
13
13
|
const COA = require("@motionpicture/coa-service");
|
|
14
14
|
const categoryCode_1 = require("../../repo/categoryCode");
|
|
15
15
|
const offer_1 = require("../../repo/offer");
|
|
16
|
+
const task_1 = require("../../repo/task");
|
|
16
17
|
const credentials_1 = require("../../credentials");
|
|
17
18
|
const OfferService = require("../offer");
|
|
18
19
|
const coaAuthClient = new COA.auth.RefreshToken({
|
|
@@ -26,6 +27,7 @@ function call(data) {
|
|
|
26
27
|
return (settings) => __awaiter(this, void 0, void 0, function* () {
|
|
27
28
|
const categoryCodeRepo = new categoryCode_1.MongoRepository(settings.connection);
|
|
28
29
|
const offerRepo = new offer_1.MongoRepository(settings.connection);
|
|
30
|
+
const taskRepo = new task_1.MongoRepository(settings.connection);
|
|
29
31
|
const masterService = new COA.service.Master({
|
|
30
32
|
endpoint: credentials_1.credentials.coa.endpoint,
|
|
31
33
|
auth: coaAuthClient
|
|
@@ -33,6 +35,7 @@ function call(data) {
|
|
|
33
35
|
yield OfferService.event.importFromCOA(data)({
|
|
34
36
|
categoryCode: categoryCodeRepo,
|
|
35
37
|
offer: offerRepo,
|
|
38
|
+
task: taskRepo,
|
|
36
39
|
masterService
|
|
37
40
|
});
|
|
38
41
|
yield OfferService.event.importCategoryCodesFromCOA(data)({
|
|
@@ -0,0 +1,37 @@
|
|
|
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 registerServiceInProgress_1 = require("../../repo/action/registerServiceInProgress");
|
|
15
|
+
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
16
|
+
const order_1 = require("../../repo/order");
|
|
17
|
+
const task_1 = require("../../repo/task");
|
|
18
|
+
const transaction_1 = require("../../repo/transaction");
|
|
19
|
+
const onAssetTransactionStatusChanged_1 = require("../order/onAssetTransactionStatusChanged");
|
|
20
|
+
/**
|
|
21
|
+
* タスク実行関数
|
|
22
|
+
*/
|
|
23
|
+
function call(data) {
|
|
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
|
+
yield (0, onAssetTransactionStatusChanged_1.onAssetTransactionStatusChanged)(data)({
|
|
29
|
+
assetTransaction: new assetTransaction_1.MongoRepository(settings.connection),
|
|
30
|
+
order: new order_1.MongoRepository(settings.connection),
|
|
31
|
+
registerActionInProgress: new registerServiceInProgress_1.RedisRepository(settings.redisClient),
|
|
32
|
+
task: new task_1.MongoRepository(settings.connection),
|
|
33
|
+
transaction: new transaction_1.MongoRepository(settings.connection)
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
exports.call = call;
|
|
@@ -0,0 +1,35 @@
|
|
|
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 registerServiceInProgress_1 = require("../../repo/action/registerServiceInProgress");
|
|
15
|
+
const order_1 = require("../../repo/order");
|
|
16
|
+
const task_1 = require("../../repo/task");
|
|
17
|
+
const transaction_1 = require("../../repo/transaction");
|
|
18
|
+
const payOrder_1 = require("../order/payOrder");
|
|
19
|
+
/**
|
|
20
|
+
* タスク実行関数
|
|
21
|
+
*/
|
|
22
|
+
function call(data) {
|
|
23
|
+
return (settings) => __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
if (settings.redisClient === undefined) {
|
|
25
|
+
throw new factory.errors.Argument('settings', 'redisClient required');
|
|
26
|
+
}
|
|
27
|
+
yield (0, payOrder_1.payOrder)(data)({
|
|
28
|
+
order: new order_1.MongoRepository(settings.connection),
|
|
29
|
+
registerActionInProgress: new registerServiceInProgress_1.RedisRepository(settings.redisClient),
|
|
30
|
+
task: new task_1.MongoRepository(settings.connection),
|
|
31
|
+
transaction: new transaction_1.MongoRepository(settings.connection)
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
exports.call = call;
|
|
@@ -159,7 +159,11 @@ function transaction2refundFee(params) {
|
|
|
159
159
|
return refundFee;
|
|
160
160
|
}
|
|
161
161
|
function createStartRefundTransactionParams(params) {
|
|
162
|
-
var _a;
|
|
162
|
+
var _a, _b;
|
|
163
|
+
const paymentMethodType = (_a = params.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.identifier;
|
|
164
|
+
if (typeof paymentMethodType !== 'string') {
|
|
165
|
+
throw new factory.errors.NotFound('object.paymentMethod.identifier');
|
|
166
|
+
}
|
|
163
167
|
return {
|
|
164
168
|
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
165
169
|
typeOf: factory.assetTransactionType.Refund,
|
|
@@ -173,11 +177,12 @@ function createStartRefundTransactionParams(params) {
|
|
|
173
177
|
recipient: { typeOf: params.recipient.typeOf, name: params.recipient.name },
|
|
174
178
|
object: {
|
|
175
179
|
typeOf: params.paymentServiceType,
|
|
176
|
-
id: (typeof ((
|
|
180
|
+
id: (typeof ((_b = params.object.issuedThrough) === null || _b === void 0 ? void 0 : _b.id) === 'string') ? params.object.issuedThrough.id : '',
|
|
177
181
|
paymentMethod: {
|
|
178
182
|
additionalProperty: params.object.additionalProperty,
|
|
179
183
|
name: params.object.name,
|
|
180
|
-
typeOf: params.object.typeOf,
|
|
184
|
+
// typeOf: params.object.typeOf,
|
|
185
|
+
typeOf: paymentMethodType,
|
|
181
186
|
paymentMethodId: params.object.paymentMethodId
|
|
182
187
|
},
|
|
183
188
|
refundFee: params.refundFee
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as factory from '../../factory';
|
|
2
|
+
import { IConnectionSettings } from '../task';
|
|
3
|
+
export type IOperation<T> = (settings: IConnectionSettings) => Promise<T>;
|
|
4
|
+
/**
|
|
5
|
+
* タスク実行関数
|
|
6
|
+
*/
|
|
7
|
+
export declare function call(data: factory.task.syncAggregateOffer.IData): IOperation<void>;
|
|
@@ -0,0 +1,23 @@
|
|
|
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 offer_1 = require("../../repo/offer");
|
|
14
|
+
/**
|
|
15
|
+
* タスク実行関数
|
|
16
|
+
*/
|
|
17
|
+
function call(data) {
|
|
18
|
+
return (connectionSettings) => __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
const offerRepo = new offer_1.MongoRepository(connectionSettings.connection);
|
|
20
|
+
yield offerRepo.sync2aggregateOffer(data);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
exports.call = call;
|
|
@@ -65,35 +65,51 @@ function createPaymentMethods(params) {
|
|
|
65
65
|
const authorizePaymentActions = params.authorizeActions
|
|
66
66
|
.filter((a) => {
|
|
67
67
|
var _a;
|
|
68
|
+
const resultAsInvoice = (Array.isArray(a.result))
|
|
69
|
+
? (_a = a.result) === null || _a === void 0 ? void 0 : _a.find((resultObject) => resultObject.typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
70
|
+
: a.result;
|
|
68
71
|
return a.actionStatus === factory.actionStatusType.CompletedActionStatus
|
|
69
|
-
&& (
|
|
72
|
+
&& (resultAsInvoice === null || resultAsInvoice === void 0 ? void 0 : resultAsInvoice.typeOf) === factory.action.authorize.paymentMethod.any.ResultType.Payment;
|
|
70
73
|
});
|
|
71
74
|
// 決済方法をセット
|
|
72
75
|
authorizePaymentActions.forEach((a) => {
|
|
73
|
-
var _a, _b, _c;
|
|
74
|
-
const result = a.result;
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
var _a, _b, _c, _d;
|
|
77
|
+
// const result = (<factory.action.authorize.paymentMethod.any.IResult>a.result);
|
|
78
|
+
const resultAsInvoice = (Array.isArray(a.result))
|
|
79
|
+
? (_a = a.result) === null || _a === void 0 ? void 0 : _a.find((resultObject) => resultObject.typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
80
|
+
: a.result;
|
|
81
|
+
const paymentMethodAmountCurrencyByAuthorizeAction = (_c = (_b = resultAsInvoice.paymentMethodAsObject) === null || _b === void 0 ? void 0 : _b.amount) === null || _c === void 0 ? void 0 : _c.currency;
|
|
79
82
|
// 決済方法区分は必ず存在するはず(2023-08-15~)
|
|
80
|
-
const paymentMethodType = (
|
|
83
|
+
const paymentMethodType = (_d = resultAsInvoice.paymentMethodAsObject) === null || _d === void 0 ? void 0 : _d.typeOf;
|
|
81
84
|
if (typeof paymentMethodType !== 'string') {
|
|
82
85
|
throw new factory.errors.NotFound('authorizePaymentAction.result.paymentMethodAsObject.typeOf');
|
|
83
86
|
}
|
|
84
|
-
|
|
87
|
+
const paymentMethodOfInvoice = Object.assign({ identifier: paymentMethodType }, (typeof paymentMethodAmountCurrencyByAuthorizeAction === 'string') ?
|
|
88
|
+
{ amount: { currency: paymentMethodAmountCurrencyByAuthorizeAction } }
|
|
89
|
+
: undefined);
|
|
90
|
+
paymentMethods.push({
|
|
91
|
+
accountId: resultAsInvoice.accountId,
|
|
92
|
+
additionalProperty: (Array.isArray(resultAsInvoice.additionalProperty)) ? resultAsInvoice.additionalProperty : [],
|
|
93
|
+
issuedThrough: resultAsInvoice.issuedThrough,
|
|
94
|
+
name: resultAsInvoice.name,
|
|
95
|
+
paymentMethodId: resultAsInvoice.paymentMethodId,
|
|
96
|
+
paymentStatus: resultAsInvoice.paymentStatus,
|
|
97
|
+
totalPaymentDue: resultAsInvoice.totalPaymentDue,
|
|
98
|
+
typeOf: paymentMethodType,
|
|
99
|
+
// CreditCardIFのカード通貨区分を追加(2023-08-15~)
|
|
100
|
+
// 決済方法区分を保証(2023-08-28~)
|
|
101
|
+
paymentMethod: paymentMethodOfInvoice
|
|
102
|
+
});
|
|
85
103
|
});
|
|
86
104
|
// 決済方法から注文金額の計算
|
|
87
|
-
// price += authorizePaymentActions
|
|
88
|
-
// .filter((a) => {
|
|
89
|
-
// return a.result?.totalPaymentDue?.currency === factory.priceCurrency.JPY;
|
|
90
|
-
// })
|
|
91
|
-
// .reduce((a, b) => a + (<IAuthorizeAnyPaymentResult>b.result).amount, 0);
|
|
92
105
|
price += authorizePaymentActions
|
|
93
106
|
.reduce((a, b) => {
|
|
94
107
|
var _a, _b;
|
|
95
|
-
const
|
|
96
|
-
? b.result.
|
|
108
|
+
const resultAsInvoice = (Array.isArray(b.result))
|
|
109
|
+
? (_a = b.result) === null || _a === void 0 ? void 0 : _a.find((resultObject) => resultObject.typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
110
|
+
: b.result;
|
|
111
|
+
const jpyAmount = (((_b = resultAsInvoice === null || resultAsInvoice === void 0 ? void 0 : resultAsInvoice.totalPaymentDue) === null || _b === void 0 ? void 0 : _b.currency) === factory.priceCurrency.JPY)
|
|
112
|
+
? resultAsInvoice.totalPaymentDue.value
|
|
97
113
|
: 0;
|
|
98
114
|
return a + jpyAmount;
|
|
99
115
|
}, 0);
|
package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js
CHANGED
|
@@ -12,15 +12,17 @@ const debug = createDebug('cinerino-domain:service:validateMovieTicket');
|
|
|
12
12
|
*/
|
|
13
13
|
function validateMovieTicket(paymentMethodType, transaction, authorizeActions) {
|
|
14
14
|
const authorizeMovieTicketActions = authorizeActions.filter((a) => {
|
|
15
|
-
var _a, _b
|
|
15
|
+
var _a, _b;
|
|
16
|
+
const resultAsInvoice = (Array.isArray(a.result))
|
|
17
|
+
? (_a = a.result) === null || _a === void 0 ? void 0 : _a.find((resultObject) => resultObject.typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
18
|
+
: a.result;
|
|
16
19
|
return a.actionStatus === factory.actionStatusType.CompletedActionStatus
|
|
17
|
-
&& (
|
|
18
|
-
&& (
|
|
20
|
+
&& (resultAsInvoice === null || resultAsInvoice === void 0 ? void 0 : resultAsInvoice.typeOf) === factory.action.authorize.paymentMethod.any.ResultType.Payment
|
|
21
|
+
&& (resultAsInvoice === null || resultAsInvoice === void 0 ? void 0 : resultAsInvoice.issuedThrough.typeOf) === factory.service.paymentService.PaymentServiceType.MovieTicket
|
|
19
22
|
// 決済方法区分は必ず存在するはず(2023-08-15~)
|
|
20
|
-
&& ((
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
);
|
|
23
|
+
&& ((_b = resultAsInvoice === null || resultAsInvoice === void 0 ? void 0 : resultAsInvoice.paymentMethodAsObject) === null || _b === void 0 ? void 0 : _b.typeOf) === paymentMethodType;
|
|
24
|
+
// && a.result?.paymentMethod === paymentMethodType
|
|
25
|
+
});
|
|
24
26
|
const seatReservationAuthorizeActions = authorizeActions.filter((a) => a.actionStatus === factory.actionStatusType.CompletedActionStatus
|
|
25
27
|
&& a.object.typeOf === factory.action.authorize.offer.seatReservation.ObjectType.SeatReservation);
|
|
26
28
|
// 予約によって必要とされるMovieTicket
|
|
@@ -149,10 +151,10 @@ function authorizeSeatReservationActions2requiredMovieTickets(params) {
|
|
|
149
151
|
appliesToMovieTickets4paymentMethod = appliesToMovieTickets4reservation.filter((a) => {
|
|
150
152
|
return a.serviceOutput.typeOf === paymentMethodType;
|
|
151
153
|
});
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
// Arrayでない場合を廃止(2022-08-01~)
|
|
155
|
-
throw new factory.errors.NotImplemented('appliesToMovieTickets.typeOf as string not implemented');
|
|
154
|
+
// Array以外への考慮自体を廃止(2023-09-01~)
|
|
155
|
+
// } else if (typeof appliesToMovieTickets4reservation?.identifier === 'string') {
|
|
156
|
+
// // Arrayでない場合を廃止(2022-08-01~)
|
|
157
|
+
// throw new factory.errors.NotImplemented('appliesToMovieTickets.typeOf as string not implemented');
|
|
156
158
|
}
|
|
157
159
|
if (Array.isArray(appliesToMovieTickets4paymentMethod) && appliesToMovieTickets4paymentMethod.length > 0) {
|
|
158
160
|
appliesToMovieTickets4paymentMethod.forEach((appliesToMovieTicket) => {
|