@chevre/domain 22.2.0-alpha.2 → 22.2.0-alpha.20
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/playAroundTicket.ts +3 -2
- package/example/src/chevre/{projectReservationFields.ts → projectFields.ts} +10 -8
- package/example/src/chevre/{projectReservationFieldsById.ts → projectOwnershipInfoFieldsById.ts} +4 -4
- package/example/src/chevre/searchSellersByAggregate.ts +3 -3
- package/example/src/chevre/unsetUnnecessaryFields.ts +4 -30
- package/lib/chevre/repo/authorization.d.ts +3 -1
- package/lib/chevre/repo/authorization.js +21 -10
- package/lib/chevre/repo/categoryCode.d.ts +14 -2
- package/lib/chevre/repo/categoryCode.js +41 -19
- package/lib/chevre/repo/mongoose/schemas/paymentService.js +12 -3
- package/lib/chevre/repo/mongoose/schemas/product.js +5 -12
- package/lib/chevre/repo/mongoose/schemas/seller.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/seller.js +21 -23
- package/lib/chevre/repo/ownershipInfo.d.ts +10 -6
- package/lib/chevre/repo/ownershipInfo.js +75 -19
- package/lib/chevre/repo/paymentService.d.ts +2 -2
- package/lib/chevre/repo/paymentService.js +108 -58
- package/lib/chevre/repo/paymentServiceProvider.d.ts +1 -10
- package/lib/chevre/repo/product.d.ts +2 -2
- package/lib/chevre/repo/product.js +67 -33
- package/lib/chevre/repo/seller.d.ts +10 -12
- package/lib/chevre/repo/seller.js +61 -27
- package/lib/chevre/repo/ticket.d.ts +3 -2
- package/lib/chevre/repo/ticket.js +23 -10
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +1 -1
- package/lib/chevre/service/aggregation/event/findEventOffers.js +1 -1
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +1 -1
- package/lib/chevre/service/assetTransaction/pay/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/factory.js +1 -1
- package/lib/chevre/service/assetTransaction/pay.js +3 -3
- package/lib/chevre/service/assetTransaction/refund/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/refund/factory.js +1 -1
- package/lib/chevre/service/assetTransaction/refund.js +3 -3
- package/lib/chevre/service/assetTransaction/registerService.js +3 -5
- package/lib/chevre/service/assetTransaction/reserve/start/createSubReservations.js +26 -23
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createReservation.js +4 -1
- package/lib/chevre/service/assetTransaction/reserve/start.js +1 -3
- package/lib/chevre/service/code.js +2 -2
- package/lib/chevre/service/event.js +3 -3
- package/lib/chevre/service/moneyTransfer.js +1 -3
- package/lib/chevre/service/offer/event/authorize/factory.js +34 -6
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.d.ts +0 -2
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.js +22 -22
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +0 -2
- package/lib/chevre/service/offer/event/authorize.d.ts +0 -2
- package/lib/chevre/service/offer/event/importFromCOA/factory.d.ts +3 -1
- package/lib/chevre/service/offer/event/importFromCOA.js +2 -2
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +4 -12
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +3 -3
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +3 -3
- package/lib/chevre/service/offer/product/searchProductOffers.js +1 -3
- package/lib/chevre/service/offer/product.d.ts +1 -1
- package/lib/chevre/service/offer/product.js +4 -6
- package/lib/chevre/service/order/sendOrder.js +9 -5
- package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.d.ts +1 -6
- package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.js +26 -34
- package/lib/chevre/service/payment/any.d.ts +3 -3
- package/lib/chevre/service/payment/any.js +15 -7
- package/lib/chevre/service/payment/paymentCard.js +1 -3
- package/lib/chevre/service/report/ownershipInfo.d.ts +3 -1
- package/lib/chevre/service/task/authorizePayment.js +0 -2
- package/lib/chevre/service/task/onAuthorizationCreated.js +20 -16
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +2 -2
- package/lib/chevre/service/task/onResourceUpdated/syncCategoryCode.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated.js +2 -2
- package/lib/chevre/service/task/publishPaymentUrl.js +4 -0
- package/lib/chevre/service/transaction/moneyTransfer.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +36 -2
- package/lib/chevre/service/transaction/placeOrder/confirm.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/start/validateStartRequest.d.ts +2 -2
- package/lib/chevre/service/transaction/placeOrder/start/validateStartRequest.js +1 -1
- package/lib/chevre/service/transaction/returnOrder/preStart.d.ts +2 -2
- package/lib/chevre/service/transaction/returnOrder/preStart.js +1 -1
- package/package.json +3 -3
- package/example/src/chevre/searchProducts.ts +0 -28
|
@@ -86,7 +86,8 @@ function sendOrder(params) {
|
|
|
86
86
|
typeOf: factory.actionType.SendAction
|
|
87
87
|
};
|
|
88
88
|
const action = yield repos.action.start(sendOrderActionAttributes);
|
|
89
|
-
let
|
|
89
|
+
let creatingOwnershipInfos = [];
|
|
90
|
+
let createdOwnershipInfos = [];
|
|
90
91
|
let allOffersDelivered = false;
|
|
91
92
|
let acceptedOffers;
|
|
92
93
|
// 所有権生成を最小化(2024-03-01~)
|
|
@@ -111,12 +112,15 @@ function sendOrder(params) {
|
|
|
111
112
|
debug('delivering...', order.orderNumber, acceptedOffers.map((offer) => `${offer.itemOffered.id}`), params.object.acceptedOffers, 'offerIndexBase:', offerIndexBase);
|
|
112
113
|
// 所有権作成
|
|
113
114
|
if (createOwnerships) {
|
|
114
|
-
|
|
115
|
+
creatingOwnershipInfos = (0, factory_1.createOwnershipInfosFromOrder)({
|
|
115
116
|
order: Object.assign(Object.assign({}, order), { acceptedOffers }),
|
|
116
117
|
offerIndexBase
|
|
117
118
|
});
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
createdOwnershipInfos = yield Promise.all(creatingOwnershipInfos.map((creatingOwnershipInfo) => __awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
const { id } = yield repos.ownershipInfo.createIfNotExistByIdentifier(creatingOwnershipInfo);
|
|
121
|
+
return Object.assign({ id }, (typeof creatingOwnershipInfo.identifier === 'string')
|
|
122
|
+
? { identifier: creatingOwnershipInfo.identifier }
|
|
123
|
+
: undefined);
|
|
120
124
|
})));
|
|
121
125
|
}
|
|
122
126
|
// const deliveredCount = limit * page;
|
|
@@ -140,7 +144,7 @@ function sendOrder(params) {
|
|
|
140
144
|
}
|
|
141
145
|
throw error;
|
|
142
146
|
}
|
|
143
|
-
const result =
|
|
147
|
+
const result = createdOwnershipInfos;
|
|
144
148
|
yield repos.action.completeWithVoid({ typeOf: sendOrderActionAttributes.typeOf, id: action.id, result: result });
|
|
145
149
|
debug('allOffersDelivered?:', allOffersDelivered, order.orderNumber);
|
|
146
150
|
if (params.useOnOrderStatusChanged) {
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
import * as factory from '../../../factory';
|
|
2
2
|
import type { AuthorizationRepo } from '../../../repo/authorization';
|
|
3
|
-
import type { OwnershipInfoRepo } from '../../../repo/ownershipInfo';
|
|
4
3
|
import type { TicketRepo } from '../../../repo/ticket';
|
|
5
|
-
type IObjectWithoutDetail = factory.action.authorize.paymentMethod.any.IObjectWithoutDetail & {
|
|
6
|
-
ticketToken?: string;
|
|
7
|
-
};
|
|
8
4
|
declare function verifyTicketTokenAsNeeded(params: {
|
|
9
5
|
project: {
|
|
10
6
|
id: string;
|
|
11
7
|
};
|
|
12
|
-
object: IObjectWithoutDetail
|
|
8
|
+
object: Pick<factory.action.authorize.paymentMethod.any.IObjectWithoutDetail, 'issuedThrough' | 'ticketToken'>;
|
|
13
9
|
paymentServiceType: factory.service.paymentService.PaymentServiceType;
|
|
14
10
|
purpose: factory.action.authorize.paymentMethod.any.IPurpose;
|
|
15
11
|
}): (repos: {
|
|
16
12
|
authorization: AuthorizationRepo;
|
|
17
|
-
ownershipInfo: OwnershipInfoRepo;
|
|
18
13
|
ticket: TicketRepo;
|
|
19
14
|
}) => Promise<{
|
|
20
15
|
permit: Pick<factory.ownershipInfo.IPermitAsGood, 'identifier'> | undefined;
|
|
@@ -13,22 +13,21 @@ exports.verifyTicketTokenAsNeeded = void 0;
|
|
|
13
13
|
const factory = require("../../../factory");
|
|
14
14
|
function verifyTicketTokenAsNeeded(params) {
|
|
15
15
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
var _a;
|
|
16
|
+
var _a, _b;
|
|
17
17
|
const { paymentServiceType, object, project } = params;
|
|
18
|
-
const { ticketToken } = object;
|
|
18
|
+
const { issuedThrough, ticketToken } = object;
|
|
19
19
|
let permit;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const ticket = (yield repos.ticket.search({
|
|
20
|
+
// メンバーシップチケットが指定された場合、メンバーシップコードへ変換する
|
|
21
|
+
if (typeof ticketToken === 'string' && ticketToken !== '') {
|
|
22
|
+
switch (paymentServiceType) {
|
|
23
|
+
case factory.service.paymentService.PaymentServiceType.CreditCard:
|
|
24
|
+
case factory.service.paymentService.PaymentServiceType.FaceToFace:
|
|
25
|
+
const ticket = (yield repos.ticket.projectFields({
|
|
27
26
|
limit: 1,
|
|
28
27
|
page: 1,
|
|
29
28
|
project: { id: { $eq: project.id } },
|
|
30
29
|
ticketToken: { $eq: ticketToken }
|
|
31
|
-
})).shift();
|
|
30
|
+
}, ['ticketToken'])).shift();
|
|
32
31
|
if (ticket === undefined) {
|
|
33
32
|
throw new factory.errors.NotFound('Ticket');
|
|
34
33
|
}
|
|
@@ -37,41 +36,34 @@ function verifyTicketTokenAsNeeded(params) {
|
|
|
37
36
|
project: { id: params.project.id },
|
|
38
37
|
code: ticket.ticketToken
|
|
39
38
|
});
|
|
40
|
-
authorizedObject = validAuthorization.object;
|
|
39
|
+
const authorizedObject = validAuthorization.object;
|
|
41
40
|
if (authorizedObject.typeOf !== 'OwnershipInfo') {
|
|
42
41
|
throw new factory.errors.Argument('ticketToken', 'must be OwnershipInfo');
|
|
43
42
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
project: { id: { $eq: params.project.id } },
|
|
49
|
-
ids: [ownershipInfoId]
|
|
50
|
-
})).shift();
|
|
51
|
-
if (permitOwnershipInfo === undefined) {
|
|
52
|
-
throw new factory.errors.NotFound('OwnershipInfo');
|
|
43
|
+
// audience検証
|
|
44
|
+
if (((_a = validAuthorization.audience) === null || _a === void 0 ? void 0 : _a.typeOf) !== factory.transactionType.PlaceOrder
|
|
45
|
+
|| validAuthorization.audience.id !== params.purpose.id) {
|
|
46
|
+
throw new factory.errors.Argument('ticketToken', 'audience not matched with placeOrder');
|
|
53
47
|
}
|
|
54
|
-
const {
|
|
48
|
+
const { typeOfGood } = authorizedObject;
|
|
55
49
|
if (typeOfGood.typeOf !== factory.permit.PermitType.Permit) {
|
|
56
50
|
throw new factory.errors.Argument('ticketToken', 'must be Permit');
|
|
57
51
|
}
|
|
58
|
-
if (((
|
|
52
|
+
if (((_b = typeOfGood.issuedThrough) === null || _b === void 0 ? void 0 : _b.typeOf) !== paymentServiceType) {
|
|
59
53
|
throw new factory.errors.Argument('ticketToken', 'paymentServiceType not matched');
|
|
60
54
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
if (ownedBy[0].id !== params.purpose.id) {
|
|
68
|
-
throw new factory.errors.Argument('ticketToken', 'ownershipInfo.ownedBy.id not matched');
|
|
55
|
+
// CreditCardの場合、発行サービスIDを検証
|
|
56
|
+
if (typeOfGood.issuedThrough.typeOf === factory.service.paymentService.PaymentServiceType.CreditCard) {
|
|
57
|
+
if (typeOfGood.issuedThrough.id !== issuedThrough.id) {
|
|
58
|
+
throw new factory.errors.Argument('ticketToken', 'issuedThrough.id not matched');
|
|
59
|
+
}
|
|
69
60
|
}
|
|
70
61
|
permit = { identifier: typeOfGood.identifier };
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
62
|
+
break;
|
|
63
|
+
default:
|
|
64
|
+
// no op
|
|
65
|
+
throw new factory.errors.NotImplemented(`ticketToken issued through ${paymentServiceType} not implemented`);
|
|
66
|
+
}
|
|
75
67
|
}
|
|
76
68
|
return { permit };
|
|
77
69
|
});
|
|
@@ -10,7 +10,6 @@ import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
|
10
10
|
import type { AuthorizationRepo } from '../../repo/authorization';
|
|
11
11
|
import type { ConfirmationNumberRepo } from '../../repo/confirmationNumber';
|
|
12
12
|
import type { EventRepo } from '../../repo/event';
|
|
13
|
-
import type { OwnershipInfoRepo } from '../../repo/ownershipInfo';
|
|
14
13
|
import type { PaymentServiceRepo } from '../../repo/paymentService';
|
|
15
14
|
import type { PaymentServiceProviderRepo } from '../../repo/paymentServiceProvider';
|
|
16
15
|
import type { ProductRepo } from '../../repo/product';
|
|
@@ -80,7 +79,6 @@ interface IAuthorizeRepos {
|
|
|
80
79
|
authorization: AuthorizationRepo;
|
|
81
80
|
confirmationNumber: ConfirmationNumberRepo;
|
|
82
81
|
event: EventRepo;
|
|
83
|
-
ownershipInfo: OwnershipInfoRepo;
|
|
84
82
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
85
83
|
paymentService: PaymentServiceRepo;
|
|
86
84
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
@@ -97,9 +95,11 @@ type IAuthorizeOperation<T> = (repos: IAuthorizeRepos, settings: Settings, crede
|
|
|
97
95
|
interface IPublishPaymentUrlRepos {
|
|
98
96
|
action: ActionRepo;
|
|
99
97
|
assetTransaction: AssetTransactionRepo;
|
|
98
|
+
authorization: AuthorizationRepo;
|
|
100
99
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
101
100
|
paymentService: PaymentServiceRepo;
|
|
102
101
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
102
|
+
ticket: TicketRepo;
|
|
103
103
|
transaction: TransactionRepo;
|
|
104
104
|
transactionNumber: TransactionNumberRepo;
|
|
105
105
|
}
|
|
@@ -117,7 +117,7 @@ declare function publishPaymentUrl(params: {
|
|
|
117
117
|
agent: {
|
|
118
118
|
id: string;
|
|
119
119
|
};
|
|
120
|
-
object: Pick<IObjectWithoutDetail, 'amount' | 'creditCard' | 'issuedThrough' | 'method' | 'paymentMethod'>;
|
|
120
|
+
object: Pick<IObjectWithoutDetail, 'amount' | 'creditCard' | 'issuedThrough' | 'method' | 'paymentMethod' | 'ticketToken'>;
|
|
121
121
|
purpose: factory.action.authorize.paymentMethod.any.IPurpose;
|
|
122
122
|
paymentServiceType: factory.service.paymentService.PaymentServiceType;
|
|
123
123
|
location: factory.action.trade.pay.ILocation;
|
|
@@ -228,16 +228,24 @@ exports.processVoidPayTransaction = processVoidPayTransaction;
|
|
|
228
228
|
function publishPaymentUrl(params) {
|
|
229
229
|
return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
|
|
230
230
|
var _a;
|
|
231
|
-
|
|
232
|
-
|
|
231
|
+
const { paymentServiceType, purpose, project } = params;
|
|
232
|
+
if (purpose.typeOf !== factory.transactionType.PlaceOrder) {
|
|
233
|
+
throw new factory.errors.NotImplemented(`purpose.typeOf '${purpose.typeOf} not implemented'`);
|
|
233
234
|
}
|
|
234
235
|
try {
|
|
235
|
-
const transaction = yield repos.transaction.findInProgressById({ typeOf:
|
|
236
|
-
const paymentServiceType = params.paymentServiceType;
|
|
236
|
+
const transaction = yield repos.transaction.findInProgressById({ typeOf: purpose.typeOf, id: purpose.id }, ['expires', 'seller', 'project']);
|
|
237
237
|
// 取引番号生成
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
});
|
|
238
|
+
let transactionNumber;
|
|
239
|
+
// support ticketToken(2024-08-21~)
|
|
240
|
+
const { permit } = yield (0, verifyTicketTokenAsNeeded_1.verifyTicketTokenAsNeeded)({ project, object: params.object, paymentServiceType, purpose })(repos);
|
|
241
|
+
const paymentMethodIdByPermit = permit === null || permit === void 0 ? void 0 : permit.identifier;
|
|
242
|
+
if (typeof paymentMethodIdByPermit === 'string') {
|
|
243
|
+
transactionNumber = paymentMethodIdByPermit;
|
|
244
|
+
}
|
|
245
|
+
if (typeof transactionNumber !== 'string') {
|
|
246
|
+
const publishTransactionNumberResult = yield repos.transactionNumber.publishByTimestamp({ startDate: new Date() });
|
|
247
|
+
transactionNumber = publishTransactionNumberResult.transactionNumber;
|
|
248
|
+
}
|
|
241
249
|
let result;
|
|
242
250
|
// URL発行
|
|
243
251
|
const authorizeObject = Object.assign(Object.assign({}, params.object), { accountId: '', paymentMethodId: transactionNumber, typeOf: factory.action.authorize.paymentMethod.any.ResultType.Payment });
|
|
@@ -79,9 +79,7 @@ function validatePaymentMethod(params, paymentServiceId) {
|
|
|
79
79
|
throw new factory.errors.ArgumentNull('object.paymentMethod.identifier');
|
|
80
80
|
}
|
|
81
81
|
// プロダクトから通貨区分を取得
|
|
82
|
-
|
|
83
|
-
// await repos.product.findProductById({ id: paymentServiceId }, ['serviceOutput'], []);
|
|
84
|
-
const paymentCatdProduct = (yield repos.product.searchProducts({
|
|
82
|
+
const paymentCatdProduct = (yield repos.product.projectFields({
|
|
85
83
|
limit: 1,
|
|
86
84
|
page: 1,
|
|
87
85
|
id: { $eq: paymentServiceId },
|
|
@@ -21,5 +21,7 @@ export interface IOwnershipInfoReport {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
export declare function ownershipInfo2report(params: {
|
|
24
|
-
ownershipInfo: factory.ownershipInfo.IOwnershipInfo<factory.ownershipInfo.IGood
|
|
24
|
+
ownershipInfo: factory.ownershipInfo.IOwnershipInfo<factory.ownershipInfo.IGood> & {
|
|
25
|
+
id: string;
|
|
26
|
+
};
|
|
25
27
|
}): IOwnershipInfoReport;
|
|
@@ -17,7 +17,6 @@ const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
|
17
17
|
const authorization_1 = require("../../repo/authorization");
|
|
18
18
|
const confirmationNumber_1 = require("../../repo/confirmationNumber");
|
|
19
19
|
const event_1 = require("../../repo/event");
|
|
20
|
-
const ownershipInfo_1 = require("../../repo/ownershipInfo");
|
|
21
20
|
const paymentService_1 = require("../../repo/paymentService");
|
|
22
21
|
const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
23
22
|
const product_1 = require("../../repo/product");
|
|
@@ -55,7 +54,6 @@ function call(params) {
|
|
|
55
54
|
authorization: new authorization_1.AuthorizationRepo(connection),
|
|
56
55
|
confirmationNumber: new confirmationNumber_1.ConfirmationNumberRepo(redisClient),
|
|
57
56
|
event: new event_1.EventRepo(connection),
|
|
58
|
-
ownershipInfo: new ownershipInfo_1.OwnershipInfoRepo(connection),
|
|
59
57
|
paymentAccepted: new sellerPaymentAccepted_1.SellerPaymentAcceptedRepo(connection),
|
|
60
58
|
paymentService: new paymentService_1.PaymentServiceRepo(connection),
|
|
61
59
|
paymentServiceProvider: new paymentServiceProvider_1.PaymentServiceProviderRepo(connection),
|
|
@@ -67,22 +67,26 @@ function onAuthorizationCreated(params) {
|
|
|
67
67
|
}
|
|
68
68
|
break;
|
|
69
69
|
case 'OwnershipInfo':
|
|
70
|
-
//
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
70
|
+
// 所有権に対する承認はいったん廃止したので、所有権のケースは処理不要(2024-08-21~)
|
|
71
|
+
reservationIds = [];
|
|
72
|
+
// const ownershipInfoId = authorization.object.id;
|
|
73
|
+
// if (typeof ownershipInfoId === 'string' && ownershipInfoId.length > 0) {
|
|
74
|
+
// const ownershipInfo = <Pick<factory.ownershipInfo.IOwnershipInfo<factory.ownershipInfo.IGood>, 'id' | 'typeOfGood'>>
|
|
75
|
+
// await repos.ownershipInfo.projectFieldsById({ id: ownershipInfoId }, ['typeOfGood']);
|
|
76
|
+
// // 予約に対する所有権であれば発券
|
|
77
|
+
// if (ownershipInfo.typeOfGood.typeOf === factory.reservationType.EventReservation
|
|
78
|
+
// || ownershipInfo.typeOfGood.typeOf === factory.reservationType.BusReservation) {
|
|
79
|
+
// const reservationId = String(ownershipInfo.typeOfGood.id);
|
|
80
|
+
// reservationIds = [reservationId];
|
|
81
|
+
// const { reservationFor } = <{ reservationFor: { id: string } }>await repos.reservation.projectFieldsById<
|
|
82
|
+
// factory.reservationType.EventReservation | factory.reservationType.BusReservation
|
|
83
|
+
// >({
|
|
84
|
+
// id: reservationId,
|
|
85
|
+
// inclusion: ['reservationFor.id']
|
|
86
|
+
// });
|
|
87
|
+
// reservationForIds = [String(reservationFor.id)];
|
|
88
|
+
// }
|
|
89
|
+
// }
|
|
86
90
|
break;
|
|
87
91
|
default:
|
|
88
92
|
// no op
|
|
@@ -343,10 +343,10 @@ function deleteResourcesByOfferCatalog(params) {
|
|
|
343
343
|
const action = yield repos.action.start(deleteActionAttributes);
|
|
344
344
|
try {
|
|
345
345
|
// カタログからプロダクト検索
|
|
346
|
-
const productsWithCatalog = yield repos.product.
|
|
346
|
+
const productsWithCatalog = yield repos.product.projectFields({
|
|
347
347
|
project: { id: { $eq: params.project.id } },
|
|
348
348
|
hasOfferCatalog: { id: { $eq: catalogId } }
|
|
349
|
-
}, ['
|
|
349
|
+
}, ['id'], []);
|
|
350
350
|
let deleteEventResult;
|
|
351
351
|
let updateOfferResult;
|
|
352
352
|
if (productsWithCatalog.length > 0) {
|
|
@@ -29,7 +29,7 @@ function syncCategoryCode(params) {
|
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
31
31
|
for (const categoryCodeId of params.ids) {
|
|
32
|
-
const syncingCategoryCode = (yield repos.categoryCode.
|
|
32
|
+
const syncingCategoryCode = (yield repos.categoryCode.projectFields({
|
|
33
33
|
limit: 1,
|
|
34
34
|
page: 1,
|
|
35
35
|
project: { id: { $eq: params.project.id } },
|
|
@@ -275,7 +275,7 @@ function createInformMovieTasks(params) {
|
|
|
275
275
|
}
|
|
276
276
|
function createInformProductTasks(params) {
|
|
277
277
|
return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
|
|
278
|
-
const products4inform = yield repos.product.
|
|
278
|
+
const products4inform = yield repos.product.projectFields({
|
|
279
279
|
typeOf: { $eq: params.typeOf },
|
|
280
280
|
id: { $in: params.ids }
|
|
281
281
|
}, ['additionalProperty', 'description', 'name', 'productID', 'project', 'typeOf', 'serviceType'], []);
|
|
@@ -322,7 +322,7 @@ function createInformProductTasks(params) {
|
|
|
322
322
|
}
|
|
323
323
|
function createInformCategoryCodeTasks(params) {
|
|
324
324
|
return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
|
|
325
|
-
const categoryCodes4inform = yield repos.categoryCode.
|
|
325
|
+
const categoryCodes4inform = yield repos.categoryCode.projectFields({
|
|
326
326
|
id: { $in: params.ids },
|
|
327
327
|
// ひとまずDistributorTypeのみ
|
|
328
328
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.DistributorType } }
|
|
@@ -13,9 +13,11 @@ exports.call = void 0;
|
|
|
13
13
|
const factory = require("../../factory");
|
|
14
14
|
const action_1 = require("../../repo/action");
|
|
15
15
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
16
|
+
const authorization_1 = require("../../repo/authorization");
|
|
16
17
|
const paymentService_1 = require("../../repo/paymentService");
|
|
17
18
|
const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
18
19
|
const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
|
|
20
|
+
const ticket_1 = require("../../repo/ticket");
|
|
19
21
|
const transaction_1 = require("../../repo/transaction");
|
|
20
22
|
const transactionNumber_1 = require("../../repo/transactionNumber");
|
|
21
23
|
const transactionProcess_1 = require("../../repo/transactionProcess");
|
|
@@ -38,9 +40,11 @@ function call(params) {
|
|
|
38
40
|
yield (0, any_1.publishPaymentUrl)(Object.assign(Object.assign({}, params.data), { sameAs: { id: params.id } }))({
|
|
39
41
|
action: actionRepo,
|
|
40
42
|
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
43
|
+
authorization: new authorization_1.AuthorizationRepo(connection),
|
|
41
44
|
paymentAccepted: new sellerPaymentAccepted_1.SellerPaymentAcceptedRepo(connection),
|
|
42
45
|
paymentService: new paymentService_1.PaymentServiceRepo(connection),
|
|
43
46
|
paymentServiceProvider: new paymentServiceProvider_1.PaymentServiceProviderRepo(connection),
|
|
47
|
+
ticket: new ticket_1.TicketRepo(connection),
|
|
44
48
|
transaction: new transaction_1.TransactionRepo(connection),
|
|
45
49
|
transactionNumber: new transactionNumber_1.TransactionNumberRepo(redisClient)
|
|
46
50
|
}, settings);
|
|
@@ -28,7 +28,7 @@ const CodeService = require("../code");
|
|
|
28
28
|
function start(params) {
|
|
29
29
|
return (repos, credentials) => __awaiter(this, void 0, void 0, function* () {
|
|
30
30
|
const { passport } = yield repos.passport.validatePassportTokenIfExist(params);
|
|
31
|
-
const sellers = yield repos.seller.
|
|
31
|
+
const sellers = yield repos.seller.projectFields({
|
|
32
32
|
limit: 1,
|
|
33
33
|
page: 1,
|
|
34
34
|
id: { $eq: params.seller.id }
|
|
@@ -41,7 +41,7 @@ export declare function validatePaymentMethods(params: {
|
|
|
41
41
|
* 興行オファー適用条件確認
|
|
42
42
|
*/
|
|
43
43
|
export declare function validateEventOffers(params: {
|
|
44
|
-
order: factory.transaction.placeOrder.IOrderAsResult
|
|
44
|
+
order: Pick<factory.transaction.placeOrder.IOrderAsResult, 'price'>;
|
|
45
45
|
paymentMethods: factory.order.IReferencedInvoice[];
|
|
46
46
|
authorizeEventServiceOfferActions: Pick<IAuthorizeEventServiceOffer, 'id' | 'instrument' | 'object' | 'result'>[];
|
|
47
47
|
}): void;
|
|
@@ -350,11 +350,12 @@ exports.validatePaymentMethods = validatePaymentMethods;
|
|
|
350
350
|
// tslint:disable-next-line:max-func-body-length
|
|
351
351
|
function validateEventOffers(params) {
|
|
352
352
|
var _a, _b;
|
|
353
|
-
const
|
|
353
|
+
const { paymentMethods } = params;
|
|
354
|
+
const firstCreditCardPaymentMethodIdentifier = (_b = (_a = paymentMethods.find((referenceInvoice) => {
|
|
354
355
|
return referenceInvoice.issuedThrough.typeOf === factory.service.paymentService.PaymentServiceType.CreditCard
|
|
355
356
|
|| referenceInvoice.issuedThrough.typeOf === factory.service.paymentService.PaymentServiceType.FaceToFace;
|
|
356
357
|
})) === null || _a === void 0 ? void 0 : _a.paymentMethod) === null || _b === void 0 ? void 0 : _b.identifier;
|
|
357
|
-
const numCreditCardOrFaceToFacePaymentMethod =
|
|
358
|
+
const numCreditCardOrFaceToFacePaymentMethod = paymentMethods.filter((referenceInvoice) => {
|
|
358
359
|
return referenceInvoice.issuedThrough.typeOf === factory.service.paymentService.PaymentServiceType.CreditCard
|
|
359
360
|
|| referenceInvoice.issuedThrough.typeOf === factory.service.paymentService.PaymentServiceType.FaceToFace;
|
|
360
361
|
}).length;
|
|
@@ -411,5 +412,38 @@ function validateEventOffers(params) {
|
|
|
411
412
|
});
|
|
412
413
|
}
|
|
413
414
|
});
|
|
415
|
+
// check programMembershipUsed(2024-08-15~)
|
|
416
|
+
const programMembershipRequired = params.authorizeEventServiceOfferActions.reduce((a, b) => {
|
|
417
|
+
var _a, _b;
|
|
418
|
+
const programMembershipUsedfromResult = (_b = (_a = b.result) === null || _a === void 0 ? void 0 : _a.itemOffered) === null || _b === void 0 ? void 0 : _b.serviceOutput.programMembershipUsed;
|
|
419
|
+
if (Array.isArray(programMembershipUsedfromResult)) {
|
|
420
|
+
a.push(...programMembershipUsedfromResult);
|
|
421
|
+
}
|
|
422
|
+
return a;
|
|
423
|
+
}, []);
|
|
424
|
+
const satisfyProgramMembershipRequirement = programMembershipRequired.every(({ identifier, issuedThrough }) => {
|
|
425
|
+
let satisfyThisRequirement = false;
|
|
426
|
+
switch (issuedThrough.typeOf) {
|
|
427
|
+
case factory.product.ProductType.MembershipService:
|
|
428
|
+
// 検証の必要なし
|
|
429
|
+
satisfyThisRequirement = true;
|
|
430
|
+
break;
|
|
431
|
+
case factory.service.paymentService.PaymentServiceType.CreditCard:
|
|
432
|
+
satisfyThisRequirement = paymentMethods.some((paymentMethod) => paymentMethod.paymentMethodId === identifier
|
|
433
|
+
&& paymentMethod.issuedThrough.id === issuedThrough.id
|
|
434
|
+
&& paymentMethod.issuedThrough.typeOf === issuedThrough.typeOf);
|
|
435
|
+
break;
|
|
436
|
+
case factory.service.paymentService.PaymentServiceType.FaceToFace:
|
|
437
|
+
satisfyThisRequirement = paymentMethods.some((paymentMethod) => paymentMethod.paymentMethodId === identifier
|
|
438
|
+
&& paymentMethod.issuedThrough.typeOf === issuedThrough.typeOf);
|
|
439
|
+
break;
|
|
440
|
+
default:
|
|
441
|
+
// no op
|
|
442
|
+
}
|
|
443
|
+
return satisfyThisRequirement;
|
|
444
|
+
});
|
|
445
|
+
if (!satisfyProgramMembershipRequirement) {
|
|
446
|
+
throw new factory.errors.Argument('Transaction', `programMembershipUsed requirement not satisfied`);
|
|
447
|
+
}
|
|
414
448
|
}
|
|
415
449
|
exports.validateEventOffers = validateEventOffers;
|
|
@@ -293,7 +293,7 @@ function createResult(params, options) {
|
|
|
293
293
|
price
|
|
294
294
|
});
|
|
295
295
|
(0, validation_1.validateEventOffers)({
|
|
296
|
-
order:
|
|
296
|
+
order: { price },
|
|
297
297
|
paymentMethods,
|
|
298
298
|
authorizeEventServiceOfferActions: params.authorizeEventServiceOfferActions
|
|
299
299
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { MemberRepo } from '../../../../repo/member';
|
|
2
2
|
import type { ProjectMakesOfferRepo } from '../../../../repo/projectMakesOffer';
|
|
3
|
-
import type { SellerRepo } from '../../../../repo/seller';
|
|
3
|
+
import type { ISellerWithId, SellerRepo } from '../../../../repo/seller';
|
|
4
4
|
import * as factory from '../../../../factory';
|
|
5
|
-
type ISeller = Pick<
|
|
5
|
+
type ISeller = Pick<ISellerWithId, 'id' | 'name' | 'project' | 'typeOf' | 'makesOffer' | 'additionalProperty'>;
|
|
6
6
|
declare function validateStartRequest(params: {
|
|
7
7
|
project: {
|
|
8
8
|
id: string;
|
|
@@ -67,7 +67,7 @@ function validateStartRequest(params) {
|
|
|
67
67
|
if (projectMakesOffer === undefined) {
|
|
68
68
|
throw new factory.errors.Argument('project', 'project makes no offers');
|
|
69
69
|
}
|
|
70
|
-
const seller = (yield repos.seller.
|
|
70
|
+
const seller = (yield repos.seller.projectFields({
|
|
71
71
|
limit: 1,
|
|
72
72
|
page: 1,
|
|
73
73
|
project: { id: { $eq: params.project.id } },
|
|
@@ -7,7 +7,7 @@ import type { OfferItemConditionRepo } from '../../../repo/offerItemCondition';
|
|
|
7
7
|
import type { OrderRepo } from '../../../repo/order';
|
|
8
8
|
import type { ProjectRepo } from '../../../repo/project';
|
|
9
9
|
import type { ReservationRepo } from '../../../repo/reservation';
|
|
10
|
-
import type { SellerRepo } from '../../../repo/seller';
|
|
10
|
+
import type { ISellerWithId, SellerRepo } from '../../../repo/seller';
|
|
11
11
|
interface IPreStartOperationRepos {
|
|
12
12
|
acceptedOffer: AcceptedOfferRepo;
|
|
13
13
|
event: EventRepo;
|
|
@@ -20,7 +20,7 @@ interface IPreStartOperationRepos {
|
|
|
20
20
|
seller: SellerRepo;
|
|
21
21
|
}
|
|
22
22
|
type IPreStartOperation<T> = (repos: IPreStartOperationRepos) => Promise<T>;
|
|
23
|
-
type IFixedSeller = Pick<
|
|
23
|
+
type IFixedSeller = Pick<ISellerWithId, 'id' | 'name' | 'project' | 'hasMerchantReturnPolicy' | 'typeOf'>;
|
|
24
24
|
/**
|
|
25
25
|
* 返品取引開始前処理
|
|
26
26
|
*/
|
|
@@ -36,7 +36,7 @@ function preStart(params) {
|
|
|
36
36
|
const now = new Date();
|
|
37
37
|
const { acceptedOffers, eventIds, offerIds, orders } = yield fixOrders(params)(repos);
|
|
38
38
|
// sellerはorderから自動取得
|
|
39
|
-
const sellers = yield repos.seller.
|
|
39
|
+
const sellers = yield repos.seller.projectFields({
|
|
40
40
|
limit: 1,
|
|
41
41
|
page: 1,
|
|
42
42
|
id: { $eq: String(orders[0].seller.id) }
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.381.0-alpha.
|
|
13
|
-
"@cinerino/sdk": "10.
|
|
12
|
+
"@chevre/factory": "4.381.0-alpha.12",
|
|
13
|
+
"@cinerino/sdk": "10.7.0-alpha.3",
|
|
14
14
|
"@motionpicture/coa-service": "9.4.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.3.0",
|
|
16
16
|
"@sendgrid/mail": "6.4.0",
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"postversion": "git push origin --tags",
|
|
111
111
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
112
112
|
},
|
|
113
|
-
"version": "22.2.0-alpha.
|
|
113
|
+
"version": "22.2.0-alpha.20"
|
|
114
114
|
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-implicit-dependencies no-console
|
|
2
|
-
import { chevre } from '../../../lib/index';
|
|
3
|
-
|
|
4
|
-
import * as mongoose from 'mongoose';
|
|
5
|
-
|
|
6
|
-
const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
-
|
|
8
|
-
async function main() {
|
|
9
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
|
-
|
|
11
|
-
const productRepo = await chevre.repository.Product.createInstance(mongoose.connection);
|
|
12
|
-
const products = await productRepo.searchProducts(
|
|
13
|
-
{
|
|
14
|
-
project: { id: { $eq: project.id } }
|
|
15
|
-
},
|
|
16
|
-
// ['_id', 'typeOf'],
|
|
17
|
-
[],
|
|
18
|
-
[]
|
|
19
|
-
);
|
|
20
|
-
console.log('products:', products);
|
|
21
|
-
console.log(products.length, 'products found');
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
main()
|
|
25
|
-
.then(() => {
|
|
26
|
-
console.log('success!');
|
|
27
|
-
})
|
|
28
|
-
.catch(console.error);
|