@chevre/domain 21.18.0-alpha.4 → 21.18.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/aggreateOwnershipInfosByOrder.ts +24 -0
- package/example/src/chevre/offerCatalog2offerCatalogItem.ts +4 -0
- package/example/src/chevre/searchAcceptedOfferIds.ts +57 -0
- package/example/src/chevre/searchOffers.ts +41 -37
- package/example/src/chevre/searchOrderAcceptedOffers.ts +12 -12
- package/example/src/chevre/searchOrders.ts +36 -19
- package/example/src/chevre/searchReservationsByOrder.ts +30 -0
- package/example/src/chevre/searchTransactions.ts +41 -0
- package/example/src/chevre/transaction/processReturnOrder.ts +1 -0
- package/example/src/chevre/upsertMoviesByIdentifier.ts +5 -4
- package/example/src/chevre/upsertOfferCatalogsByIdentifier.ts +46 -0
- package/example/src/chevre/upsertOffersByIdentifier.ts +94 -0
- package/example/src/chevre/upsertScreeningEventSeriesByVersion.ts +104 -0
- package/lib/chevre/credentials.d.ts +0 -3
- package/lib/chevre/credentials.js +4 -3
- package/lib/chevre/repo/acceptedOffer.d.ts +60 -0
- package/lib/chevre/repo/acceptedOffer.js +158 -0
- package/lib/chevre/repo/creativeWork.d.ts +12 -2
- package/lib/chevre/repo/creativeWork.js +39 -25
- package/lib/chevre/repo/event.d.ts +15 -0
- package/lib/chevre/repo/event.js +66 -0
- package/lib/chevre/repo/offer.d.ts +14 -5
- package/lib/chevre/repo/offer.js +94 -19
- package/lib/chevre/repo/offerCatalog.d.ts +18 -1
- package/lib/chevre/repo/offerCatalog.js +51 -39
- package/lib/chevre/repo/order.d.ts +14 -54
- package/lib/chevre/repo/order.js +46 -180
- package/lib/chevre/repo/paymentService.d.ts +30 -0
- package/lib/chevre/repo/paymentService.js +75 -0
- package/lib/chevre/repo/place.js +14 -10
- package/lib/chevre/repo/product.d.ts +41 -10
- package/lib/chevre/repo/product.js +94 -47
- package/lib/chevre/repo/transaction.d.ts +5 -4
- package/lib/chevre/repository.d.ts +10 -7
- package/lib/chevre/repository.js +28 -17
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +10 -1
- package/lib/chevre/service/aggregation/event/findEventOffers.js +10 -1
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +1 -1
- package/lib/chevre/service/assetTransaction/pay/potentialActions.d.ts +3 -1
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +3 -3
- package/lib/chevre/service/assetTransaction/pay.d.ts +2 -0
- package/lib/chevre/service/assetTransaction/pay.js +47 -34
- package/lib/chevre/service/assetTransaction/refund/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/refund/factory.js +0 -5
- package/lib/chevre/service/assetTransaction/refund.js +15 -3
- package/lib/chevre/service/assetTransaction/registerService.js +18 -2
- package/lib/chevre/service/assetTransaction/reserve/factory/price.js +1 -1
- package/lib/chevre/service/assetTransaction/reserve.js +32 -2
- package/lib/chevre/service/delivery/factory.d.ts +3 -1
- package/lib/chevre/service/delivery/factory.js +4 -2
- package/lib/chevre/service/delivery.d.ts +1 -2
- package/lib/chevre/service/delivery.js +1 -3
- package/lib/chevre/service/event.js +1 -1
- package/lib/chevre/service/moneyTransfer.js +11 -1
- package/lib/chevre/service/offer/event/factory.d.ts +1 -1
- package/lib/chevre/service/offer/event/factory.js +4 -2
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +40 -5
- package/lib/chevre/service/offer/product/factory.js +1 -1
- package/lib/chevre/service/offer/product/searchProductOffers.js +10 -1
- package/lib/chevre/service/offer/product.d.ts +0 -14
- package/lib/chevre/service/offer/product.js +61 -44
- package/lib/chevre/service/order/confirmPayTransaction.d.ts +2 -0
- package/lib/chevre/service/order/confirmPayTransaction.js +1 -0
- package/lib/chevre/service/order/createAccountingReportIfNotExist.d.ts +3 -1
- package/lib/chevre/service/order/createAccountingReportIfNotExist.js +4 -1
- package/lib/chevre/service/order/deleteOrder.d.ts +2 -0
- package/lib/chevre/service/order/deleteOrder.js +15 -4
- package/lib/chevre/service/order/findPlaceOrderTransaction.d.ts +3 -1
- package/lib/chevre/service/order/findPlaceOrderTransaction.js +1 -2
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +3 -3
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +15 -9
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +11 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.js +54 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled.d.ts +10 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled.js +38 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.d.ts +12 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.js +111 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.d.ts +12 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +64 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.d.ts +10 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +103 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.d.ts +23 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +180 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +14 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +214 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +10 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +110 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.d.ts +14 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +164 -0
- package/lib/chevre/service/order/onOrderStatusChanged.d.ts +9 -15
- package/lib/chevre/service/order/onOrderStatusChanged.js +11 -446
- package/lib/chevre/service/order/onOrderUpdated/factory.d.ts +6 -0
- package/lib/chevre/service/order/onOrderUpdated/factory.js +45 -0
- package/lib/chevre/service/order/onOrderUpdated.js +1 -1
- package/lib/chevre/service/order/payOrder.d.ts +2 -2
- package/lib/chevre/service/order/placeOrder.d.ts +2 -3
- package/lib/chevre/service/order/placeOrder.js +65 -22
- package/lib/chevre/service/order/returnOrder.d.ts +2 -2
- package/lib/chevre/service/order/returnOrder.js +34 -13
- package/lib/chevre/service/order/sendOrder.d.ts +2 -2
- package/lib/chevre/service/order/sendOrder.js +19 -6
- package/lib/chevre/service/order.d.ts +2 -2
- package/lib/chevre/service/order.js +2 -2
- package/lib/chevre/service/payment/any.js +1 -1
- package/lib/chevre/service/payment/movieTicket/getCredentials.js +1 -2
- package/lib/chevre/service/payment/paymentCard.js +9 -2
- package/lib/chevre/service/reserve/searchByOrder.d.ts +21 -0
- package/lib/chevre/service/reserve/searchByOrder.js +113 -0
- package/lib/chevre/service/reserve/verifyToken4reservation.js +0 -11
- package/lib/chevre/service/reserve.d.ts +2 -1
- package/lib/chevre/service/reserve.js +3 -1
- package/lib/chevre/service/task/confirmPayTransaction.js +2 -1
- package/lib/chevre/service/task/deleteTransaction.js +2 -0
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +5 -6
- package/lib/chevre/service/task/onAuthorizationCreated.js +9 -18
- package/lib/chevre/service/task/onOrderPaymentCompleted.js +5 -6
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated.js +1 -1
- package/lib/chevre/service/task/placeOrder.js +10 -17
- package/lib/chevre/service/task/returnOrder.js +10 -17
- package/lib/chevre/service/task/sendOrder.js +10 -17
- package/lib/chevre/service/task/voidRegisterServiceTransaction.js +3 -7
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +2 -0
- package/lib/chevre/service/transaction/moneyTransfer.js +3 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.d.ts +0 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +0 -86
- 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/returnOrder/potentialActions/returnMoneyTransfer.d.ts +1 -0
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.js +3 -3
- package/lib/chevre/service/transaction/returnOrder/potentialActions.d.ts +1 -0
- package/lib/chevre/service/transaction/returnOrder/potentialActions.js +1 -1
- package/lib/chevre/service/transaction/returnOrder.d.ts +3 -0
- package/lib/chevre/service/transaction/returnOrder.js +73 -55
- package/package.json +3 -3
- package/example/src/chevre/transaction/findPaymentCardPermit.ts +0 -29
- package/lib/chevre/repo/action/registerServiceInProgress.d.ts +0 -29
- package/lib/chevre/repo/action/registerServiceInProgress.js +0 -58
- package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +0 -42
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +0 -467
- package/lib/chevre/service/transaction/orderProgramMembership/findPaymentCardPermit.d.ts +0 -26
- package/lib/chevre/service/transaction/orderProgramMembership/findPaymentCardPermit.js +0 -65
|
@@ -36,7 +36,7 @@ function publishPaymentUrl(params) {
|
|
|
36
36
|
}
|
|
37
37
|
yield validateSeller(params)(repos);
|
|
38
38
|
// 決済サービス確認
|
|
39
|
-
const paymentServiceId =
|
|
39
|
+
const paymentServiceId = getPaymentServiceId(params);
|
|
40
40
|
let result;
|
|
41
41
|
switch (paymentServiceType) {
|
|
42
42
|
case factory.service.paymentService.PaymentServiceType.CreditCard:
|
|
@@ -150,29 +150,27 @@ function start(params, options) {
|
|
|
150
150
|
}
|
|
151
151
|
exports.start = start;
|
|
152
152
|
function getPaymentServiceId(params) {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
throw new factory.errors.NotImplemented(`Payment service '${paymentServiceType}' not implemented`);
|
|
172
|
-
}
|
|
153
|
+
var _a;
|
|
154
|
+
let paymentServiceId = '';
|
|
155
|
+
const paymentServiceType = (_a = params.object) === null || _a === void 0 ? void 0 : _a.typeOf;
|
|
156
|
+
if (typeof params.object.id === 'string' && params.object.id.length > 0) {
|
|
157
|
+
paymentServiceId = params.object.id;
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
switch (paymentServiceType) {
|
|
161
|
+
case factory.service.paymentService.PaymentServiceType.FaceToFace:
|
|
162
|
+
// 対面決済は特に何もしない
|
|
163
|
+
break;
|
|
164
|
+
case factory.service.paymentService.PaymentServiceType.PaymentCard:
|
|
165
|
+
case factory.service.paymentService.PaymentServiceType.CreditCard:
|
|
166
|
+
case factory.service.paymentService.PaymentServiceType.MovieTicket:
|
|
167
|
+
// リクエストでの指定を必須化(2022-04-12~)
|
|
168
|
+
throw new factory.errors.ArgumentNull('object.id');
|
|
169
|
+
default:
|
|
170
|
+
throw new factory.errors.NotImplemented(`Payment service '${paymentServiceType}' not implemented`);
|
|
173
171
|
}
|
|
174
|
-
|
|
175
|
-
|
|
172
|
+
}
|
|
173
|
+
return paymentServiceId;
|
|
176
174
|
}
|
|
177
175
|
function fixPaymentService(params) {
|
|
178
176
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -184,16 +182,27 @@ function fixPaymentService(params) {
|
|
|
184
182
|
// no op
|
|
185
183
|
// FaceToFaceの場合プロダクトは存在しない
|
|
186
184
|
break;
|
|
185
|
+
// PaymentCardの場合、プロダクト検索
|
|
186
|
+
case factory.service.paymentService.PaymentServiceType.PaymentCard:
|
|
187
|
+
paymentService = (yield repos.product.searchProducts({
|
|
188
|
+
limit: 1,
|
|
189
|
+
page: 1,
|
|
190
|
+
project: { id: { $eq: params.project.id } },
|
|
191
|
+
typeOf: { $eq: factory.product.ProductType.PaymentCard },
|
|
192
|
+
id: { $eq: getPaymentServiceId(params) }
|
|
193
|
+
}, [], [])).shift();
|
|
194
|
+
if (paymentService === undefined) {
|
|
195
|
+
throw new factory.errors.NotFound('PaymentService');
|
|
196
|
+
}
|
|
197
|
+
break;
|
|
187
198
|
default:
|
|
188
|
-
|
|
189
|
-
const paymentServices = yield repos.product.search({
|
|
199
|
+
paymentService = (yield repos.product.searchPaymentServices({
|
|
190
200
|
limit: 1,
|
|
191
201
|
page: 1,
|
|
192
202
|
project: { id: { $eq: params.project.id } },
|
|
193
203
|
typeOf: { $eq: paymentServiceType },
|
|
194
|
-
id: { $eq:
|
|
195
|
-
}, [], []);
|
|
196
|
-
paymentService = paymentServices.shift();
|
|
204
|
+
id: { $eq: getPaymentServiceId(params) }
|
|
205
|
+
}, [], [])).shift();
|
|
197
206
|
if (paymentService === undefined) {
|
|
198
207
|
throw new factory.errors.NotFound('PaymentService');
|
|
199
208
|
}
|
|
@@ -365,25 +374,29 @@ exports.confirm = confirm;
|
|
|
365
374
|
function fixOrderAsPurpose(params, transaction) {
|
|
366
375
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
367
376
|
var _a, _b, _c, _d, _e, _f;
|
|
368
|
-
let order;
|
|
369
377
|
const payPurposeConfirmationNumber = (_c = (_b = (_a = params.potentialActions) === null || _a === void 0 ? void 0 : _a.pay) === null || _b === void 0 ? void 0 : _b.purpose) === null || _c === void 0 ? void 0 : _c.confirmationNumber;
|
|
370
378
|
const payPurposeOrderNumber = (_f = (_e = (_d = params.potentialActions) === null || _d === void 0 ? void 0 : _d.pay) === null || _e === void 0 ? void 0 : _e.purpose) === null || _f === void 0 ? void 0 : _f.orderNumber;
|
|
371
379
|
if (typeof payPurposeConfirmationNumber !== 'string' || payPurposeConfirmationNumber.length === 0
|
|
372
380
|
|| typeof payPurposeOrderNumber !== 'string' || payPurposeOrderNumber.length === 0) {
|
|
373
381
|
throw new factory.errors.ArgumentNull('potentialActions.pay.purpose');
|
|
374
382
|
}
|
|
375
|
-
const
|
|
383
|
+
const ordersWithoutAcceptedOffers = yield repos.order.search({
|
|
376
384
|
limit: 1,
|
|
377
385
|
page: 1,
|
|
378
386
|
project: { id: { $eq: transaction.project.id } },
|
|
379
387
|
confirmationNumbers: [payPurposeConfirmationNumber],
|
|
380
388
|
orderNumbers: [payPurposeOrderNumber]
|
|
381
|
-
});
|
|
382
|
-
|
|
383
|
-
if (
|
|
389
|
+
}, { typeOf: 1, confirmationNumber: 1, orderNumber: 1 });
|
|
390
|
+
const orderWithoutAcceptedOffers = ordersWithoutAcceptedOffers.shift();
|
|
391
|
+
if (orderWithoutAcceptedOffers === undefined) {
|
|
384
392
|
throw new factory.errors.NotFound('Order as purpose');
|
|
385
393
|
}
|
|
386
|
-
|
|
394
|
+
// 全acceptedOffersを検索(2023-12-06~)
|
|
395
|
+
const acceptedOffers = yield repos.acceptedOffer.searchAcceptedOffersByOrderNumber({
|
|
396
|
+
orderNumber: { $eq: orderWithoutAcceptedOffers.orderNumber },
|
|
397
|
+
project: { id: { $eq: transaction.project.id } }
|
|
398
|
+
});
|
|
399
|
+
return Object.assign(Object.assign({}, orderWithoutAcceptedOffers), { acceptedOffers });
|
|
387
400
|
});
|
|
388
401
|
}
|
|
389
402
|
/**
|
|
@@ -6,5 +6,5 @@ export declare function createStartParams(params: factory.assetTransaction.refun
|
|
|
6
6
|
transactionNumber: string;
|
|
7
7
|
paymentServiceType: factory.service.paymentService.PaymentServiceType;
|
|
8
8
|
payAction: factory.action.trade.pay.IAction;
|
|
9
|
-
paymentService?: factory.service.paymentService.IService;
|
|
9
|
+
paymentService?: factory.product.IProduct | factory.service.paymentService.IService;
|
|
10
10
|
}): factory.assetTransaction.IStartParams<factory.assetTransactionType.Refund>;
|
|
@@ -54,11 +54,6 @@ exports.createStartParams = createStartParams;
|
|
|
54
54
|
function createInformPaymentParams(params) {
|
|
55
55
|
var _a, _b, _c;
|
|
56
56
|
const informPaymentParams = [];
|
|
57
|
-
// 廃止(2022-10-29~)
|
|
58
|
-
// const informPaymentParamsByGlobalSettings = settings.onPaymentStatusChanged?.informPayment;
|
|
59
|
-
// if (Array.isArray(informPaymentParamsByGlobalSettings)) {
|
|
60
|
-
// informPaymentParams.push(...informPaymentParamsByGlobalSettings);
|
|
61
|
-
// }
|
|
62
57
|
// プロダクト設定を適用
|
|
63
58
|
const informPaymentParamsByProduct = (_c = (_b = (_a = params.paymentService) === null || _a === void 0 ? void 0 : _a.availableChannel) === null || _b === void 0 ? void 0 : _b.onPaymentStatusChanged) === null || _c === void 0 ? void 0 : _c.informPayment;
|
|
64
59
|
if (Array.isArray(informPaymentParamsByProduct)) {
|
|
@@ -84,15 +84,27 @@ function fixPaymentService(params) {
|
|
|
84
84
|
// no op
|
|
85
85
|
// FaceToFaceの場合プロダクトは存在しない
|
|
86
86
|
break;
|
|
87
|
+
// PaymentCardの場合、プロダクト検索
|
|
88
|
+
case factory.service.paymentService.PaymentServiceType.PaymentCard:
|
|
89
|
+
paymentService = (yield repos.product.searchProducts({
|
|
90
|
+
limit: 1,
|
|
91
|
+
page: 1,
|
|
92
|
+
project: { id: { $eq: params.payAction.project.id } },
|
|
93
|
+
typeOf: { $eq: factory.product.ProductType.PaymentCard },
|
|
94
|
+
id: { $eq: paymentServiceId }
|
|
95
|
+
}, [], [])).shift();
|
|
96
|
+
if (paymentService === undefined) {
|
|
97
|
+
throw new factory.errors.NotFound('PaymentService');
|
|
98
|
+
}
|
|
99
|
+
break;
|
|
87
100
|
default:
|
|
88
|
-
|
|
101
|
+
paymentService = (yield repos.product.searchPaymentServices({
|
|
89
102
|
limit: 1,
|
|
90
103
|
page: 1,
|
|
91
104
|
project: { id: { $eq: params.payAction.project.id } },
|
|
92
105
|
typeOf: { $eq: params.paymentServiceType },
|
|
93
106
|
id: { $eq: paymentServiceId }
|
|
94
|
-
}, [], []);
|
|
95
|
-
paymentService = paymentServices.shift();
|
|
107
|
+
}, [], [])).shift();
|
|
96
108
|
if (paymentService === undefined) {
|
|
97
109
|
throw new factory.errors.NotFound('PaymentService');
|
|
98
110
|
}
|
|
@@ -44,7 +44,15 @@ function start(params) {
|
|
|
44
44
|
throw new factory.errors.ArgumentNull('object.itemOffered.id');
|
|
45
45
|
}
|
|
46
46
|
// プロダクト確認
|
|
47
|
-
const product =
|
|
47
|
+
// const product = await repos.product.findProductById({ id: productId }, [], []);
|
|
48
|
+
const product = (yield repos.product.searchProducts({
|
|
49
|
+
limit: 1,
|
|
50
|
+
page: 1,
|
|
51
|
+
id: { $eq: productId }
|
|
52
|
+
}, [], [])).shift();
|
|
53
|
+
if (product === undefined) {
|
|
54
|
+
throw new factory.errors.NotFound('Product');
|
|
55
|
+
}
|
|
48
56
|
const transactionNumber = params.transactionNumber;
|
|
49
57
|
if (typeof transactionNumber !== 'string' || transactionNumber.length === 0) {
|
|
50
58
|
throw new factory.errors.ArgumentNull('transactionNumber');
|
|
@@ -130,7 +138,15 @@ function createTransactionObject(params) {
|
|
|
130
138
|
function createPermitService(params) {
|
|
131
139
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
132
140
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
133
|
-
const product =
|
|
141
|
+
// const product = await repos.product.findProductById({ id: params.issuedThrough.id }, [], []);
|
|
142
|
+
const product = (yield repos.product.searchProducts({
|
|
143
|
+
limit: 1,
|
|
144
|
+
page: 1,
|
|
145
|
+
id: { $eq: params.issuedThrough.id }
|
|
146
|
+
}, [], [])).shift();
|
|
147
|
+
if (product === undefined) {
|
|
148
|
+
throw new factory.errors.NotFound('Product');
|
|
149
|
+
}
|
|
134
150
|
const permitServiceEndpoint = (_a = product.availableChannel) === null || _a === void 0 ? void 0 : _a.serviceUrl;
|
|
135
151
|
const permitServiceAuthorizeServerDomain = (_c = (_b = product.availableChannel) === null || _b === void 0 ? void 0 : _b.credentials) === null || _c === void 0 ? void 0 : _c.authorizeServerDomain;
|
|
136
152
|
const permitServiceClientId = (_e = (_d = product.availableChannel) === null || _d === void 0 ? void 0 : _d.credentials) === null || _e === void 0 ? void 0 : _e.clientId;
|
|
@@ -180,7 +180,7 @@ function eventOfferUnitPriceSpec2reservationUnitPriceSpec(params) {
|
|
|
180
180
|
: undefined), (typeof ((_a = accounting.operatingRevenue) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
|
|
181
181
|
? {
|
|
182
182
|
operatingRevenue: {
|
|
183
|
-
project: accounting.operatingRevenue.project,
|
|
183
|
+
// project: accounting.operatingRevenue.project, // 削除(2023-12-13~)
|
|
184
184
|
typeOf: accounting.operatingRevenue.typeOf,
|
|
185
185
|
codeValue: accounting.operatingRevenue.codeValue
|
|
186
186
|
}
|
|
@@ -558,6 +558,7 @@ function validateAdvanceBookingRequirement(params) {
|
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
560
|
function validateProgramMembershipUsed(params) {
|
|
561
|
+
// tslint:disable-next-line:max-func-body-length
|
|
561
562
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
562
563
|
var _a, _b, _c;
|
|
563
564
|
const now = new Date();
|
|
@@ -572,7 +573,27 @@ function validateProgramMembershipUsed(params) {
|
|
|
572
573
|
if (typeof issuedThroughId !== 'string' || issuedThroughId.length === 0) {
|
|
573
574
|
throw new factory.errors.ArgumentNull('acceptedOffer.itemOffered.serviceOutput.programMembershipUsed.issuedThrough.id');
|
|
574
575
|
}
|
|
575
|
-
|
|
576
|
+
let permitIssuedThrough;
|
|
577
|
+
// まずメンバーシップを検索して、存在しなければCreditCardを検索(どちらが発行元サービスか不明なので)
|
|
578
|
+
permitIssuedThrough = (yield repos.product.searchProducts({
|
|
579
|
+
limit: 1,
|
|
580
|
+
page: 1,
|
|
581
|
+
id: { $eq: issuedThroughId },
|
|
582
|
+
typeOf: { $eq: factory.product.ProductType.MembershipService }
|
|
583
|
+
}, ['_id', 'typeOf', 'project', 'serviceType', 'serviceOutput'], [])).shift();
|
|
584
|
+
if (permitIssuedThrough === undefined) {
|
|
585
|
+
permitIssuedThrough = (yield repos.product.searchPaymentServices({
|
|
586
|
+
limit: 1,
|
|
587
|
+
page: 1,
|
|
588
|
+
id: { $eq: issuedThroughId },
|
|
589
|
+
typeOf: { $eq: factory.service.paymentService.PaymentServiceType.CreditCard }
|
|
590
|
+
}, ['_id', 'typeOf', 'project', 'serviceType', 'serviceOutput'], [])).shift();
|
|
591
|
+
}
|
|
592
|
+
if (typeof (permitIssuedThrough === null || permitIssuedThrough === void 0 ? void 0 : permitIssuedThrough.typeOf) !== 'string') {
|
|
593
|
+
throw new factory.errors.NotFound(`Permit issuer service [${issuedThroughId}]`);
|
|
594
|
+
}
|
|
595
|
+
// permitIssuedThrough =
|
|
596
|
+
// await repos.product.findById({ id: issuedThroughId }, ['_id', 'typeOf', 'project', 'serviceType', 'serviceOutput'], []);
|
|
576
597
|
switch (permitIssuedThrough.typeOf) {
|
|
577
598
|
// 発行サービスがCreditCardのケースに対応(2023-09-01~)
|
|
578
599
|
case factory.service.paymentService.PaymentServiceType.CreditCard:
|
|
@@ -637,7 +658,16 @@ function validateProgramMembershipUsed(params) {
|
|
|
637
658
|
function createPermitService(params) {
|
|
638
659
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
639
660
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
640
|
-
const product =
|
|
661
|
+
// const product = <Pick<factory.product.IProduct, 'availableChannel'>>
|
|
662
|
+
// await repos.product.findProductById({ id: params.issuedThrough.id }, ['availableChannel'], []);
|
|
663
|
+
const product = (yield repos.product.searchProducts({
|
|
664
|
+
limit: 1,
|
|
665
|
+
page: 1,
|
|
666
|
+
id: { $eq: params.issuedThrough.id }
|
|
667
|
+
}, ['availableChannel'], [])).shift();
|
|
668
|
+
if (product === undefined) {
|
|
669
|
+
throw new factory.errors.NotFound('Product');
|
|
670
|
+
}
|
|
641
671
|
const permitServiceEndpoint = (_a = product.availableChannel) === null || _a === void 0 ? void 0 : _a.serviceUrl;
|
|
642
672
|
const permitServiceAuthorizeServerDomain = (_c = (_b = product.availableChannel) === null || _b === void 0 ? void 0 : _b.credentials) === null || _c === void 0 ? void 0 : _c.authorizeServerDomain;
|
|
643
673
|
const permitServiceClientId = (_e = (_d = product.availableChannel) === null || _d === void 0 ? void 0 : _d.credentials) === null || _e === void 0 ? void 0 : _e.clientId;
|
|
@@ -4,5 +4,7 @@ export type IOwnershipInfo = factory.ownershipInfo.IOwnershipInfo<factory.owners
|
|
|
4
4
|
* 注文から所有権を作成する
|
|
5
5
|
*/
|
|
6
6
|
export declare function createOwnershipInfosFromOrder(params: {
|
|
7
|
-
order: Pick<factory.order.IOrder, '
|
|
7
|
+
order: Pick<factory.order.IOrder, 'orderDate' | 'project' | 'customer' | 'orderNumber' | 'seller'> & {
|
|
8
|
+
acceptedOffers: factory.order.IAcceptedOffer<factory.order.IItemOffered>[];
|
|
9
|
+
};
|
|
8
10
|
}): IOwnershipInfo[];
|
|
@@ -11,8 +11,10 @@ const factory_2 = require("./reservation/factory");
|
|
|
11
11
|
*/
|
|
12
12
|
function createOwnershipInfosFromOrder(params) {
|
|
13
13
|
const ownershipInfos = [];
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
if (!Array.isArray(params.order.acceptedOffers)) {
|
|
15
|
+
throw new factory.errors.ArgumentNull('order.acceptedOffers');
|
|
16
|
+
}
|
|
17
|
+
params.order.acceptedOffers.forEach((acceptedOffer, offerIndex) => {
|
|
16
18
|
const itemOffered = acceptedOffer.itemOffered;
|
|
17
19
|
let ownershipInfo;
|
|
18
20
|
const ownedFrom = moment(params.order.orderDate)
|
|
@@ -4,7 +4,6 @@ import type { MongoRepository as AssetRepo } from '../repo/assetTransaction';
|
|
|
4
4
|
import type { MongoRepository as ProductRepo } from '../repo/product';
|
|
5
5
|
import type { MongoRepository as ProjectRepo } from '../repo/project';
|
|
6
6
|
import type { RedisRepository as TransactionNumberRepo } from '../repo/transactionNumber';
|
|
7
|
-
import { createOwnershipInfosFromOrder } from './delivery/factory';
|
|
8
7
|
/**
|
|
9
8
|
* 特典付与
|
|
10
9
|
*/
|
|
@@ -25,4 +24,4 @@ declare function returnPointAward(params: factory.task.IData<factory.taskName.Re
|
|
|
25
24
|
project: ProjectRepo;
|
|
26
25
|
transactionNumber: TransactionNumberRepo;
|
|
27
26
|
}) => Promise<void>;
|
|
28
|
-
export {
|
|
27
|
+
export { givePointAward, returnPointAward };
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.returnPointAward = exports.givePointAward =
|
|
12
|
+
exports.returnPointAward = exports.givePointAward = void 0;
|
|
13
13
|
/**
|
|
14
14
|
* 配送サービス
|
|
15
15
|
* ここでいう「配送」とは、「エンドユーザーが獲得した所有権を利用可能な状態にすること」を指します。
|
|
@@ -21,8 +21,6 @@ exports.returnPointAward = exports.givePointAward = exports.createOwnershipInfos
|
|
|
21
21
|
const moment = require("moment");
|
|
22
22
|
const factory = require("../factory");
|
|
23
23
|
const MoneyTransferAssetTransactionService = require("./assetTransaction/moneyTransfer");
|
|
24
|
-
const factory_1 = require("./delivery/factory");
|
|
25
|
-
Object.defineProperty(exports, "createOwnershipInfosFromOrder", { enumerable: true, get: function () { return factory_1.createOwnershipInfosFromOrder; } });
|
|
26
24
|
const accountTransactionIdentifier_1 = require("../factory/accountTransactionIdentifier");
|
|
27
25
|
/**
|
|
28
26
|
* 特典付与
|
|
@@ -278,7 +278,7 @@ function saveScreeningEventSeries(params) {
|
|
|
278
278
|
yield repos.creativeWork.upsertMoviesByIdentifier(saveParams.map((saveScreeningEventSeriesParams) => {
|
|
279
279
|
var _a;
|
|
280
280
|
return {
|
|
281
|
-
|
|
281
|
+
$set: Object.assign(Object.assign({ typeOf: factory.creativeWorkType.Movie, project: params.project, identifier: saveScreeningEventSeriesParams.attributes.workPerformed.identifier, name: { ja: (_a = saveScreeningEventSeriesParams.attributes.workPerformed.name) === null || _a === void 0 ? void 0 : _a.ja }, offers: { typeOf: factory.offerType.Offer } }, (typeof saveScreeningEventSeriesParams.attributes.workPerformed.contentRating === 'string')
|
|
282
282
|
? { contentRating: saveScreeningEventSeriesParams.attributes.workPerformed.contentRating }
|
|
283
283
|
: undefined), (typeof saveScreeningEventSeriesParams.attributes.workPerformed.duration === 'string')
|
|
284
284
|
? { duration: saveScreeningEventSeriesParams.attributes.workPerformed.duration }
|
|
@@ -326,7 +326,17 @@ function getIssuedThroughIdByAction(params) {
|
|
|
326
326
|
function createPermitServiceCredentials(params) {
|
|
327
327
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
328
328
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
329
|
-
const paymentCardService =
|
|
329
|
+
// const paymentCardService = <Pick<factory.product.IProduct, 'availableChannel'>>
|
|
330
|
+
// await repos.product.findProductById({ id: params.issuedThrough.id }, ['availableChannel'], []);
|
|
331
|
+
const paymentCardService = (yield repos.product.searchProducts({
|
|
332
|
+
limit: 1,
|
|
333
|
+
page: 1,
|
|
334
|
+
id: { $eq: params.issuedThrough.id },
|
|
335
|
+
typeOf: { $eq: factory.product.ProductType.PaymentCard }
|
|
336
|
+
}, ['availableChannel'], [])).shift();
|
|
337
|
+
if (paymentCardService === undefined) {
|
|
338
|
+
throw new factory.errors.NotFound(factory.product.ProductType.PaymentCard);
|
|
339
|
+
}
|
|
330
340
|
const permitServiceEndpoint = (_a = paymentCardService.availableChannel) === null || _a === void 0 ? void 0 : _a.serviceUrl;
|
|
331
341
|
const permitServiceAuthorizeServerDomain = (_c = (_b = paymentCardService.availableChannel) === null || _b === void 0 ? void 0 : _b.credentials) === null || _c === void 0 ? void 0 : _c.authorizeServerDomain;
|
|
332
342
|
const permitServiceClientId = (_e = (_d = paymentCardService.availableChannel) === null || _d === void 0 ? void 0 : _d.credentials) === null || _e === void 0 ? void 0 : _e.clientId;
|
|
@@ -44,5 +44,5 @@ export declare function coaTicket2offer(params: {
|
|
|
44
44
|
ticketResult: COA.factory.master.ITicketResult;
|
|
45
45
|
defaultCurrencyType?: factory.categoryCode.ICategoryCode;
|
|
46
46
|
defaultMembershipType?: factory.categoryCode.ICategoryCode;
|
|
47
|
-
}): factory.unitPriceOffer.IUnitPriceOffer
|
|
47
|
+
}): Omit<factory.unitPriceOffer.IUnitPriceOffer, 'id'>;
|
|
48
48
|
export {};
|
|
@@ -174,7 +174,7 @@ function responseBody2acceptedOffers4result(params) {
|
|
|
174
174
|
: undefined), (typeof ((_a = accounting.operatingRevenue) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
|
|
175
175
|
? {
|
|
176
176
|
operatingRevenue: {
|
|
177
|
-
project: accounting.operatingRevenue.project,
|
|
177
|
+
// project: accounting.operatingRevenue.project, // 削除(2023-12-13~)
|
|
178
178
|
typeOf: accounting.operatingRevenue.typeOf,
|
|
179
179
|
codeValue: accounting.operatingRevenue.codeValue
|
|
180
180
|
}
|
|
@@ -340,7 +340,9 @@ function coaTicket2offer(params) {
|
|
|
340
340
|
? params.ticketResult.ticketNameEng
|
|
341
341
|
: ''
|
|
342
342
|
};
|
|
343
|
-
return Object.assign(Object.assign(Object.assign({ project: { typeOf: factory.organizationType.Project, id: params.project.id }, typeOf: factory.offerType.Offer, priceCurrency: factory.priceCurrency.JPY,
|
|
343
|
+
return Object.assign(Object.assign(Object.assign({ project: { typeOf: factory.organizationType.Project, id: params.project.id }, typeOf: factory.offerType.Offer, priceCurrency: factory.priceCurrency.JPY,
|
|
344
|
+
// id: '',
|
|
345
|
+
identifier: identifier, name: offerName, description: {
|
|
344
346
|
ja: '',
|
|
345
347
|
en: ''
|
|
346
348
|
}, alternateName: {
|
|
@@ -18,9 +18,17 @@ function searchTicketOffersByItemOffered(params) {
|
|
|
18
18
|
// tslint:disable-next-line:max-func-body-length
|
|
19
19
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
20
20
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
21
|
-
let eventService;
|
|
21
|
+
// let eventService: Pick<factory.product.IProduct, 'hasOfferCatalog' | 'project'> | undefined;
|
|
22
22
|
let catalogId;
|
|
23
|
-
eventService =
|
|
23
|
+
// const eventService = await repos.product.findProductById({ id: params.itemOffered?.id }, ['hasOfferCatalog', 'project'], []);
|
|
24
|
+
const eventService = (yield repos.product.searchProducts({
|
|
25
|
+
limit: 1,
|
|
26
|
+
page: 1,
|
|
27
|
+
id: { $eq: String((_a = params.itemOffered) === null || _a === void 0 ? void 0 : _a.id) }
|
|
28
|
+
}, ['hasOfferCatalog', 'project'], [])).shift();
|
|
29
|
+
if (eventService === undefined) {
|
|
30
|
+
throw new factory.errors.NotFound(factory.product.ProductType.EventService);
|
|
31
|
+
}
|
|
24
32
|
if (typeof ((_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
25
33
|
catalogId = eventService.hasOfferCatalog.id;
|
|
26
34
|
}
|
|
@@ -370,7 +378,16 @@ function searchOfferAppliesToMovieTicket(params) {
|
|
|
370
378
|
const eventOffers = event.offers;
|
|
371
379
|
let catalogId;
|
|
372
380
|
if (typeof ((_a = eventOffers.itemOffered) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
|
|
373
|
-
const eventService =
|
|
381
|
+
// const eventService = <Pick<factory.product.IProduct, 'hasOfferCatalog'>>
|
|
382
|
+
// await repos.product.findProductById({ id: eventOffers.itemOffered.id }, ['hasOfferCatalog'], []);
|
|
383
|
+
const eventService = (yield repos.product.searchProducts({
|
|
384
|
+
limit: 1,
|
|
385
|
+
page: 1,
|
|
386
|
+
id: { $eq: eventOffers.itemOffered.id }
|
|
387
|
+
}, ['hasOfferCatalog'], [])).shift();
|
|
388
|
+
if (eventService === undefined) {
|
|
389
|
+
throw new factory.errors.NotFound(factory.product.ProductType.EventService);
|
|
390
|
+
}
|
|
374
391
|
if (typeof ((_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
375
392
|
catalogId = eventService.hasOfferCatalog.id;
|
|
376
393
|
}
|
|
@@ -417,7 +434,16 @@ function searchOfferCatalogItems(params) {
|
|
|
417
434
|
const eventOffers = event.offers;
|
|
418
435
|
let catalogId;
|
|
419
436
|
if (typeof ((_a = eventOffers.itemOffered) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
|
|
420
|
-
const eventService =
|
|
437
|
+
// const eventService = <Pick<factory.product.IProduct, 'hasOfferCatalog'>>
|
|
438
|
+
// await repos.product.findProductById({ id: eventOffers.itemOffered.id }, ['hasOfferCatalog'], []);
|
|
439
|
+
const eventService = (yield repos.product.searchProducts({
|
|
440
|
+
limit: 1,
|
|
441
|
+
page: 1,
|
|
442
|
+
id: { $eq: eventOffers.itemOffered.id }
|
|
443
|
+
}, ['hasOfferCatalog'], [])).shift();
|
|
444
|
+
if (eventService === undefined) {
|
|
445
|
+
throw new factory.errors.NotFound(factory.product.ProductType.EventService);
|
|
446
|
+
}
|
|
421
447
|
if (typeof ((_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
422
448
|
catalogId = eventService.hasOfferCatalog.id;
|
|
423
449
|
}
|
|
@@ -477,7 +503,16 @@ function searchOfferCatalogItemAvailability(params) {
|
|
|
477
503
|
const eventOffers = event.offers;
|
|
478
504
|
let catalogId;
|
|
479
505
|
if (typeof ((_a = eventOffers.itemOffered) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
|
|
480
|
-
const eventService =
|
|
506
|
+
// const eventService = <Pick<factory.product.IProduct, 'hasOfferCatalog'>>
|
|
507
|
+
// await repos.product.findProductById({ id: eventOffers.itemOffered.id }, ['hasOfferCatalog'], []);
|
|
508
|
+
const eventService = (yield repos.product.searchProducts({
|
|
509
|
+
limit: 1,
|
|
510
|
+
page: 1,
|
|
511
|
+
id: { $eq: eventOffers.itemOffered.id }
|
|
512
|
+
}, ['hasOfferCatalog'], [])).shift();
|
|
513
|
+
if (eventService === undefined) {
|
|
514
|
+
throw new factory.errors.NotFound(factory.product.ProductType.EventService);
|
|
515
|
+
}
|
|
481
516
|
if (typeof ((_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
482
517
|
catalogId = eventService.hasOfferCatalog.id;
|
|
483
518
|
}
|
|
@@ -121,7 +121,7 @@ function responseBody2resultAcceptedOffer(params) {
|
|
|
121
121
|
: undefined), (typeof ((_b = component.accounting.operatingRevenue) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string')
|
|
122
122
|
? {
|
|
123
123
|
operatingRevenue: {
|
|
124
|
-
project: component.accounting.operatingRevenue.project,
|
|
124
|
+
// project: component.accounting.operatingRevenue.project, // 削除(2023-12-13~)
|
|
125
125
|
typeOf: component.accounting.operatingRevenue.typeOf,
|
|
126
126
|
codeValue: component.accounting.operatingRevenue.codeValue
|
|
127
127
|
}
|
|
@@ -20,7 +20,16 @@ function searchProductOffers(params) {
|
|
|
20
20
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
21
21
|
var _a, _b;
|
|
22
22
|
// プロダクト検索
|
|
23
|
-
const productWithOffers =
|
|
23
|
+
// const productWithOffers = <Pick<factory.product.IProduct, 'hasOfferCatalog' | 'project'>>
|
|
24
|
+
// await repos.product.findProductById({ id: params.itemOffered.id }, ['hasOfferCatalog', 'project'], []);
|
|
25
|
+
const productWithOffers = (yield repos.product.searchProducts({
|
|
26
|
+
limit: 1,
|
|
27
|
+
page: 1,
|
|
28
|
+
id: { $eq: params.itemOffered.id }
|
|
29
|
+
}, ['hasOfferCatalog', 'project'], [])).shift();
|
|
30
|
+
if (productWithOffers === undefined) {
|
|
31
|
+
throw new factory.errors.NotFound('Product');
|
|
32
|
+
}
|
|
24
33
|
const offerCatalogId = (_a = productWithOffers.hasOfferCatalog) === null || _a === void 0 ? void 0 : _a.id;
|
|
25
34
|
if (typeof offerCatalogId !== 'string') {
|
|
26
35
|
return [];
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
2
|
import type { MongoRepository as AccountRepo } from '../../repo/account';
|
|
3
3
|
import type { MongoRepository as ActionRepo } from '../../repo/action';
|
|
4
|
-
import type { RedisRepository as RegisterServiceInProgressRepo } from '../../repo/action/registerServiceInProgress';
|
|
5
4
|
import type { MongoRepository as AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
6
5
|
import type { MongoRepository as OfferRepo } from '../../repo/offer';
|
|
7
6
|
import type { MongoRepository as OfferCatalogRepo } from '../../repo/offerCatalog';
|
|
@@ -23,7 +22,6 @@ export interface IAuthorizeOperationRepos {
|
|
|
23
22
|
ownershipInfo: OwnershipInfoRepo;
|
|
24
23
|
product: ProductRepo;
|
|
25
24
|
project: ProjectRepo;
|
|
26
|
-
registerActionInProgress: RegisterServiceInProgressRepo;
|
|
27
25
|
serviceOutput: ServiceOutputRepo;
|
|
28
26
|
serviceOutputIdentifier: ServiceOutputIdentifierRepo;
|
|
29
27
|
transaction: TransactionRepo;
|
|
@@ -94,17 +92,5 @@ export declare function authorize(params: {
|
|
|
94
92
|
export declare function voidTransaction(params: factory.task.IData<factory.taskName.VoidRegisterServiceTransaction>): (repos: {
|
|
95
93
|
action: ActionRepo;
|
|
96
94
|
assetTransaction: AssetTransactionRepo;
|
|
97
|
-
registerActionInProgress: RegisterServiceInProgressRepo;
|
|
98
95
|
transaction: TransactionRepo;
|
|
99
96
|
}) => Promise<void>;
|
|
100
|
-
export declare function processUnlockRegisterMembershipService(params: {
|
|
101
|
-
agent: {
|
|
102
|
-
id: string;
|
|
103
|
-
};
|
|
104
|
-
product: {
|
|
105
|
-
id: string;
|
|
106
|
-
};
|
|
107
|
-
purpose: factory.action.authorize.offer.product.IPurpose;
|
|
108
|
-
}): (repos: {
|
|
109
|
-
registerActionInProgress: RegisterServiceInProgressRepo;
|
|
110
|
-
}) => Promise<void>;
|