@chevre/domain 23.1.0-alpha.8 → 23.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/example/src/chevre/{eventOffer/adminEventOffers.ts → acceptedPaymentMethodOffer/adminAcceptedPaymentMethodOffers.ts} +12 -11
- package/example/src/chevre/actions/checkAcceptPayActions.ts +60 -0
- package/example/src/chevre/assetTransaction/checkPayTransactionsTicketToken.ts +67 -0
- package/example/src/chevre/assetTransaction/processReserve.ts +7 -3
- package/example/src/chevre/authorizeEventServiceOffer.ts +6 -5
- package/example/src/chevre/eventSeries/migrateEventSeriesUnacceptedPaymentMethod.ts +93 -0
- package/example/src/chevre/importEventsFromCOA.ts +5 -5
- package/example/src/chevre/member/migrateMemberIdentifier.ts +20 -15
- package/example/src/chevre/pendingReservation/findEventSeatOffersBySection.ts +46 -0
- package/example/src/chevre/place/checkSectionCount.ts +27 -0
- package/example/src/chevre/place/findSectionsByRoom.ts +50 -0
- package/example/src/chevre/project/unsetProjectSettings.ts +73 -0
- package/example/src/chevre/reIndex.ts +1 -2
- package/example/src/chevre/roles/{addAdminSellerEventIfNotExists.ts → addAdminSellerEventOfferIfNotExists.ts} +1 -1
- package/example/src/chevre/stockHolder/findSeatsBySection.ts +59 -0
- package/example/src/chevre/stockHolder/searchSeats.ts +2 -2
- package/lib/chevre/repo/acceptedPaymentMethod.d.ts +41 -0
- package/lib/chevre/repo/acceptedPaymentMethod.js +180 -0
- package/lib/chevre/repo/authorization.d.ts +3 -2
- package/lib/chevre/repo/authorization.js +13 -5
- package/lib/chevre/repo/event.d.ts +1 -35
- package/lib/chevre/repo/event.js +2 -102
- package/lib/chevre/repo/eventOffer.js +3 -3
- package/lib/chevre/repo/mongoose/schemas/acceptedPaymentMethod.d.ts +10 -0
- package/lib/chevre/repo/mongoose/schemas/acceptedPaymentMethod.js +97 -0
- package/lib/chevre/repo/mongoose/schemas/eventOffer.js +48 -35
- package/lib/chevre/repo/mongoose/schemas/member.js +10 -0
- package/lib/chevre/repo/note.js +4 -2
- package/lib/chevre/repo/pendingReservation.js +28 -71
- package/lib/chevre/repo/place/seat.d.ts +24 -0
- package/lib/chevre/repo/place/seat.js +103 -21
- package/lib/chevre/repo/place/section.d.ts +20 -0
- package/lib/chevre/repo/place/section.js +47 -0
- package/lib/chevre/repo/ticket.d.ts +7 -1
- package/lib/chevre/repo/ticket.js +14 -1
- package/lib/chevre/repository.d.ts +5 -0
- package/lib/chevre/repository.js +15 -2
- package/lib/chevre/service/assetTransaction/pay/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/factory.js +8 -3
- package/lib/chevre/service/assetTransaction/pay/validateAcceptedPaymentMethodIfNeeded.d.ts +16 -0
- package/lib/chevre/service/assetTransaction/pay/validateAcceptedPaymentMethodIfNeeded.js +94 -0
- package/lib/chevre/service/assetTransaction/pay.d.ts +6 -1
- package/lib/chevre/service/assetTransaction/pay.js +6 -1
- package/lib/chevre/service/assetTransaction/reserve/start.d.ts +4 -0
- package/lib/chevre/service/assetTransaction/reserve/start.js +4 -1
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/fixExtendedEventOffer.d.ts +2 -2
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/fixExtendedEventOffer.js +8 -8
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.d.ts +7 -2
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.js +32 -32
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateMemberTierIfExists.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateMemberTierIfExists.js +10 -54
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/verifyTicketTokenAsNeeded.d.ts +23 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/verifyTicketTokenAsNeeded.js +62 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.d.ts +34 -1
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.js +21 -9
- package/lib/chevre/service/offer/event/authorize/factory.d.ts +0 -4
- package/lib/chevre/service/offer/event/authorize/factory.js +2 -5
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.js +1 -1
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +1 -0
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.js +2 -7
- package/lib/chevre/service/offer/event/authorize.d.ts +1 -0
- package/lib/chevre/service/offer/event/authorize.js +7 -7
- package/lib/chevre/service/offer/event/issueEventOfferTicket.d.ts +48 -0
- package/lib/chevre/service/offer/event/issueEventOfferTicket.js +123 -0
- package/lib/chevre/service/offer/event.d.ts +2 -1
- package/lib/chevre/service/offer/event.js +3 -1
- package/lib/chevre/service/offer.d.ts +31 -1
- package/lib/chevre/service/offer.js +104 -34
- package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.d.ts +9 -0
- package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.js +22 -11
- package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts +19 -2
- package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.js +87 -9
- package/lib/chevre/service/payment/any/factory.d.ts +20 -3
- package/lib/chevre/service/payment/any/factory.js +26 -6
- package/lib/chevre/service/payment/any/publishPaymentUrl/fixTransactionNumberOnPublishPaymentUrl.d.ts +4 -0
- package/lib/chevre/service/payment/any/publishPaymentUrl/fixTransactionNumberOnPublishPaymentUrl.js +15 -11
- package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.d.ts +6 -3
- package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.js +8 -22
- package/lib/chevre/service/payment/any.d.ts +5 -1
- package/lib/chevre/service/payment/any.js +22 -13
- package/lib/chevre/service/payment/factory.js +0 -5
- package/lib/chevre/service/payment/movieTicket/authorize.js +0 -5
- package/lib/chevre/service/task/authorizePayment.js +2 -0
- package/lib/chevre/service/task/publishPaymentUrl.js +4 -0
- package/lib/chevre/service/transaction/placeOrder/confirm/publishCode.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/factory.d.ts +9 -0
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/factory.js +2 -0
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateInvoiceReferencesOrder.d.ts +8 -0
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateInvoiceReferencesOrder.js +45 -0
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/validatePrice.d.ts +3 -0
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/validatePrice.js +38 -0
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +2 -8
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +5 -35
- package/package.json +3 -3
- package/example/src/chevre/checkReplaceActions.ts +0 -65
- package/example/src/chevre/upsertManyEventsByAdditionalProperty.ts +0 -193
- package/lib/chevre/service/code.d.ts +0 -8
- package/lib/chevre/service/code.js +0 -7
package/lib/chevre/service/payment/any/publishPaymentUrl/fixTransactionNumberOnPublishPaymentUrl.js
CHANGED
|
@@ -17,26 +17,30 @@ const verifyTicketTokenAsNeeded_1 = require("../verifyTicketTokenAsNeeded");
|
|
|
17
17
|
*/
|
|
18
18
|
function fixTransactionNumberOnPublishPaymentUrl(params) {
|
|
19
19
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
var _a, _b, _c, _d;
|
|
20
21
|
const { paymentServiceType, transaction, object } = params;
|
|
21
22
|
// 取引番号生成
|
|
22
23
|
let transactionNumber;
|
|
24
|
+
let ticketToken;
|
|
23
25
|
// support ticketToken(2024-08-21~)
|
|
24
|
-
const {
|
|
26
|
+
const { verifyPaymentMethodTicketResult } = yield (0, verifyTicketTokenAsNeeded_1.verifyTicketTokenAsNeeded)({
|
|
25
27
|
project: { id: transaction.project.id },
|
|
26
28
|
object,
|
|
27
29
|
paymentServiceType,
|
|
28
30
|
purpose: { id: transaction.id }
|
|
29
31
|
})(repos);
|
|
30
|
-
if ((
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
if (((_a = verifyPaymentMethodTicketResult === null || verifyPaymentMethodTicketResult === void 0 ? void 0 : verifyPaymentMethodTicketResult.invoiceByTicketToken) === null || _a === void 0 ? void 0 : _a.typeOf) === factory.permit.PermitType.Permit) {
|
|
33
|
+
throw new factory.errors.Argument('ticketToken', `typeOfGood.typeOf ${(_b = verifyPaymentMethodTicketResult === null || verifyPaymentMethodTicketResult === void 0 ? void 0 : verifyPaymentMethodTicketResult.invoiceByTicketToken) === null || _b === void 0 ? void 0 : _b.typeOf} discontinued`);
|
|
34
|
+
// const paymentMethodIdByPermit = permitOrInvoice?.identifier;
|
|
35
|
+
// if (typeof paymentMethodIdByPermit === 'string') {
|
|
36
|
+
// transactionNumber = paymentMethodIdByPermit;
|
|
37
|
+
// }
|
|
35
38
|
}
|
|
36
|
-
else if ((
|
|
39
|
+
else if (((_c = verifyPaymentMethodTicketResult === null || verifyPaymentMethodTicketResult === void 0 ? void 0 : verifyPaymentMethodTicketResult.invoiceByTicketToken) === null || _c === void 0 ? void 0 : _c.typeOf) === 'Invoice') {
|
|
37
40
|
// support Invoice ticket(2025-11-09~)
|
|
38
|
-
if (typeof (
|
|
39
|
-
transactionNumber =
|
|
41
|
+
if (typeof ((_d = verifyPaymentMethodTicketResult.invoiceByTicketToken) === null || _d === void 0 ? void 0 : _d.paymentMethodId) === 'string') {
|
|
42
|
+
transactionNumber = verifyPaymentMethodTicketResult.invoiceByTicketToken.paymentMethodId;
|
|
43
|
+
ticketToken = verifyPaymentMethodTicketResult.ticketToken;
|
|
40
44
|
}
|
|
41
45
|
}
|
|
42
46
|
if (typeof transactionNumber !== 'string') {
|
|
@@ -44,8 +48,8 @@ function fixTransactionNumberOnPublishPaymentUrl(params) {
|
|
|
44
48
|
transactionNumber = publishTransactionNumberResult.transactionNumber;
|
|
45
49
|
}
|
|
46
50
|
return {
|
|
47
|
-
transactionNumber
|
|
48
|
-
|
|
51
|
+
transactionNumber,
|
|
52
|
+
ticketToken
|
|
49
53
|
};
|
|
50
54
|
});
|
|
51
55
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as factory from '../../../factory';
|
|
2
2
|
import type { AuthorizationRepo } from '../../../repo/authorization';
|
|
3
3
|
import type { TicketRepo } from '../../../repo/ticket';
|
|
4
|
-
type
|
|
4
|
+
import type { IInvoiceByTicketToken } from './factory';
|
|
5
5
|
declare function verifyTicketTokenAsNeeded(params: {
|
|
6
6
|
project: {
|
|
7
7
|
id: string;
|
|
@@ -13,6 +13,9 @@ declare function verifyTicketTokenAsNeeded(params: {
|
|
|
13
13
|
authorization: AuthorizationRepo;
|
|
14
14
|
ticket: TicketRepo;
|
|
15
15
|
}) => Promise<{
|
|
16
|
-
|
|
16
|
+
verifyPaymentMethodTicketResult?: {
|
|
17
|
+
invoiceByTicketToken: IInvoiceByTicketToken;
|
|
18
|
+
ticketToken: string;
|
|
19
|
+
};
|
|
17
20
|
}>;
|
|
18
|
-
export {
|
|
21
|
+
export { verifyTicketTokenAsNeeded };
|
|
@@ -18,14 +18,14 @@ function verifyTicketTokenAsNeeded(params) {
|
|
|
18
18
|
var _a;
|
|
19
19
|
const { paymentServiceType, object, project } = params;
|
|
20
20
|
const { issuedThrough, ticketToken } = object;
|
|
21
|
-
let
|
|
21
|
+
let verifyPaymentMethodTicketResult;
|
|
22
22
|
// メンバーシップチケットが指定された場合、メンバーシップコードへ変換する
|
|
23
23
|
if (typeof ticketToken === 'string' && ticketToken !== '') {
|
|
24
24
|
switch (paymentServiceType) {
|
|
25
25
|
case factory.service.paymentService.PaymentServiceType.CreditCard:
|
|
26
26
|
case factory.service.paymentService.PaymentServiceType.MovieTicket:
|
|
27
27
|
case factory.service.paymentService.PaymentServiceType.FaceToFace:
|
|
28
|
-
const ticket = (yield repos.ticket.
|
|
28
|
+
const ticket = (yield repos.ticket.findTickets({
|
|
29
29
|
limit: 1,
|
|
30
30
|
page: 1,
|
|
31
31
|
project: { id: { $eq: project.id } },
|
|
@@ -47,26 +47,9 @@ function verifyTicketTokenAsNeeded(params) {
|
|
|
47
47
|
}
|
|
48
48
|
if (authorizedObject.typeOf === 'OwnershipInfo') {
|
|
49
49
|
const { typeOfGood } = authorizedObject;
|
|
50
|
-
if (typeOfGood.typeOf === factory.permit.PermitType.Permit
|
|
50
|
+
if (typeOfGood.typeOf === factory.permit.PermitType.Permit) {
|
|
51
51
|
// discontinue(2025-11-14~)
|
|
52
52
|
throw new factory.errors.Argument('ticketToken', `typeOfGood.typeOf ${typeOfGood.typeOf} discontinued`);
|
|
53
|
-
// if (typeOfGood.issuedThrough?.typeOf !== paymentServiceType) {
|
|
54
|
-
// throw new factory.errors.Argument('ticketToken', 'paymentServiceType not matched');
|
|
55
|
-
// }
|
|
56
|
-
// // FaceToFace以外の場合、発行サービスIDを検証
|
|
57
|
-
// if (typeOfGood.issuedThrough.typeOf !== factory.service.paymentService.PaymentServiceType.FaceToFace) {
|
|
58
|
-
// if (typeOfGood.issuedThrough.id !== issuedThrough.id) {
|
|
59
|
-
// throw new factory.errors.Argument('ticketToken', 'issuedThrough.id not matched');
|
|
60
|
-
// }
|
|
61
|
-
// }
|
|
62
|
-
// if (typeOfGood.typeOf === factory.permit.PermitType.Permit) {
|
|
63
|
-
// permitOrInvoice = { identifier: typeOfGood.identifier, typeOf: factory.permit.PermitType.Permit };
|
|
64
|
-
// } else if (typeOfGood.typeOf === 'Invoice') {
|
|
65
|
-
// // support paymentServiceType.MovieTicket(2024-11-23~)
|
|
66
|
-
// permitOrInvoice = { paymentMethodId: typeOfGood.paymentMethodId, typeOf: 'Invoice' };
|
|
67
|
-
// } else {
|
|
68
|
-
// throw new factory.errors.Argument('ticketToken', 'must be Permit or Invoice');
|
|
69
|
-
// }
|
|
70
53
|
}
|
|
71
54
|
else if (typeOfGood.typeOf === factory.service.paymentService.PaymentServiceType.CreditCard
|
|
72
55
|
|| typeOfGood.typeOf === factory.service.paymentService.PaymentServiceType.MovieTicket
|
|
@@ -81,7 +64,10 @@ function verifyTicketTokenAsNeeded(params) {
|
|
|
81
64
|
throw new factory.errors.Argument('ticketToken', 'issuedThrough.id not matched');
|
|
82
65
|
}
|
|
83
66
|
}
|
|
84
|
-
|
|
67
|
+
verifyPaymentMethodTicketResult = {
|
|
68
|
+
invoiceByTicketToken: { paymentMethodId: typeOfGood.serviceOutput.paymentMethodId, typeOf: 'Invoice' },
|
|
69
|
+
ticketToken
|
|
70
|
+
};
|
|
85
71
|
}
|
|
86
72
|
else {
|
|
87
73
|
throw new factory.errors.Argument('ticketToken', `invalid typeOfGood.typeOf ${typeOfGood.typeOf}`);
|
|
@@ -96,6 +82,6 @@ function verifyTicketTokenAsNeeded(params) {
|
|
|
96
82
|
throw new factory.errors.NotImplemented(`ticketToken issued through ${paymentServiceType} not implemented`);
|
|
97
83
|
}
|
|
98
84
|
}
|
|
99
|
-
return {
|
|
85
|
+
return { verifyPaymentMethodTicketResult };
|
|
100
86
|
});
|
|
101
87
|
}
|
|
@@ -7,6 +7,7 @@ import type { AuthorizationRepo } from '../../repo/authorization';
|
|
|
7
7
|
import type { ConfirmationNumberRepo } from '../../repo/confirmationNumber';
|
|
8
8
|
import type { CredentialsRepo } from '../../repo/credentials';
|
|
9
9
|
import type { EventRepo } from '../../repo/event';
|
|
10
|
+
import type { EventSeriesRepo } from '../../repo/eventSeries';
|
|
10
11
|
import type { OrderNumberRepo } from '../../repo/orderNumber';
|
|
11
12
|
import type { PaymentServiceRepo } from '../../repo/paymentService';
|
|
12
13
|
import type { PaymentServiceProviderRepo } from '../../repo/paymentServiceProvider';
|
|
@@ -85,6 +86,7 @@ interface IAuthorizeRepos {
|
|
|
85
86
|
confirmationNumber: ConfirmationNumberRepo;
|
|
86
87
|
credentials: CredentialsRepo;
|
|
87
88
|
event: EventRepo;
|
|
89
|
+
eventSeries: EventSeriesRepo;
|
|
88
90
|
orderNumber: OrderNumberRepo;
|
|
89
91
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
90
92
|
paymentService: PaymentServiceRepo;
|
|
@@ -102,6 +104,8 @@ interface IPublishPaymentUrlRepos {
|
|
|
102
104
|
action: ActionRepo;
|
|
103
105
|
assetTransaction: AssetTransactionRepo;
|
|
104
106
|
authorization: AuthorizationRepo;
|
|
107
|
+
event: EventRepo;
|
|
108
|
+
eventSeries: EventSeriesRepo;
|
|
105
109
|
orderNumber: OrderNumberRepo;
|
|
106
110
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
107
111
|
paymentService: PaymentServiceRepo;
|
|
@@ -125,7 +129,7 @@ declare function publishPaymentUrl(params: {
|
|
|
125
129
|
agent: {
|
|
126
130
|
id: string;
|
|
127
131
|
};
|
|
128
|
-
object: Pick<IObjectWithoutDetail, 'amount' | 'creditCard' | 'issuedThrough' | 'method' | 'paymentMethod'>;
|
|
132
|
+
object: Pick<IObjectWithoutDetail, 'amount' | 'creditCard' | 'issuedThrough' | 'method' | 'paymentMethod' | 'referencesOrder'>;
|
|
129
133
|
purpose: factory.action.authorize.paymentMethod.any.IPurpose;
|
|
130
134
|
paymentServiceType: factory.service.paymentService.PaymentServiceType;
|
|
131
135
|
location: factory.action.trade.pay.ILocation;
|
|
@@ -323,7 +323,7 @@ function processVoidPayTransaction(params) {
|
|
|
323
323
|
function publishPaymentUrl(params) {
|
|
324
324
|
// tslint:disable-next-line:max-func-body-length
|
|
325
325
|
return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
|
|
326
|
-
var _a;
|
|
326
|
+
var _a, _b;
|
|
327
327
|
const { paymentServiceType, purpose, project } = params;
|
|
328
328
|
if (purpose.typeOf !== factory.transactionType.PlaceOrder) {
|
|
329
329
|
throw new factory.errors.NotImplemented(`purpose.typeOf '${purpose.typeOf} not implemented'`);
|
|
@@ -340,7 +340,7 @@ function publishPaymentUrl(params) {
|
|
|
340
340
|
object: { orderDate: new Date() }
|
|
341
341
|
})(repos);
|
|
342
342
|
// 取引番号生成
|
|
343
|
-
const { transactionNumber } = yield (0, fixTransactionNumberOnPublishPaymentUrl_1.fixTransactionNumberOnPublishPaymentUrl)({
|
|
343
|
+
const { transactionNumber, ticketToken } = yield (0, fixTransactionNumberOnPublishPaymentUrl_1.fixTransactionNumberOnPublishPaymentUrl)({
|
|
344
344
|
object: params.object,
|
|
345
345
|
transaction,
|
|
346
346
|
paymentServiceType
|
|
@@ -361,9 +361,13 @@ function publishPaymentUrl(params) {
|
|
|
361
361
|
// }
|
|
362
362
|
let result;
|
|
363
363
|
// URL発行
|
|
364
|
-
const authorizeObject = Object.assign(Object.assign({}, params.object), { accountId: '', paymentMethodId: transactionNumber, typeOf: factory.action.authorize.paymentMethod.any.ResultType.Payment
|
|
365
|
-
|
|
366
|
-
|
|
364
|
+
const authorizeObject = Object.assign(Object.assign({}, params.object), { accountId: '', paymentMethodId: transactionNumber, typeOf: factory.action.authorize.paymentMethod.any.ResultType.Payment,
|
|
365
|
+
// support referencesOrder(2025-11-24~)
|
|
366
|
+
referencesOrder: (((_a = params.object.referencesOrder) === null || _a === void 0 ? void 0 : _a.typeOf) === factory.order.OrderType.Order)
|
|
367
|
+
? params.object.referencesOrder
|
|
368
|
+
: { typeOf: factory.order.OrderType.Order } });
|
|
369
|
+
const startParams = (0, factory_1.creatPublishPaymentUrlParams)(Object.assign(Object.assign({ object: authorizeObject, paymentServiceType, transaction: transaction, transactionNumber: transactionNumber, location: params.location }, (typeof params.identifier === 'string') ? { identifier: params.identifier } : undefined), (typeof ticketToken === 'string') ? { ticketToken } : undefined));
|
|
370
|
+
const taskId = (_b = params.sameAs) === null || _b === void 0 ? void 0 : _b.id;
|
|
367
371
|
result = yield PayTransactionService.publishPaymentUrl(startParams, {
|
|
368
372
|
purposeAsTransaction: { id: transaction.id },
|
|
369
373
|
executor: (typeof taskId === 'string') ? { id: taskId } : {} // タスク関連付け(2024-05-22~)
|
|
@@ -416,7 +420,7 @@ function minimizeObjectIncludingPaymentMethodDetails(authorizeObjectIncludingPay
|
|
|
416
420
|
function authorize(params) {
|
|
417
421
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
418
422
|
return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
|
|
419
|
-
var _a, _b;
|
|
423
|
+
var _a, _b, _c;
|
|
420
424
|
const { paymentServiceType, purpose, project } = params;
|
|
421
425
|
if (purpose.typeOf !== factory.transactionType.PlaceOrder) {
|
|
422
426
|
throw new factory.errors.NotImplemented(`purpose.typeOf '${purpose.typeOf} not implemented'`);
|
|
@@ -439,7 +443,7 @@ function authorize(params) {
|
|
|
439
443
|
if (typeof fixTransactionNumberResult.id === 'string') {
|
|
440
444
|
return { id: fixTransactionNumberResult.id };
|
|
441
445
|
}
|
|
442
|
-
const { transactionNumber, pendingPaymentAgencyTransaction, creditCard } = fixTransactionNumberResult;
|
|
446
|
+
const { transactionNumber, pendingPaymentAgencyTransaction, creditCard, invoiceByTicketToken, ticketToken } = fixTransactionNumberResult;
|
|
443
447
|
// let transactionNumber: string | undefined;
|
|
444
448
|
// let pendingPaymentAgencyTransaction: PayTransactionService.IPaymentAgencyTransaction | undefined;
|
|
445
449
|
// let creditCard: factory.action.authorize.paymentMethod.any.ICreditCard | undefined = params.object.creditCard;
|
|
@@ -497,10 +501,14 @@ function authorize(params) {
|
|
|
497
501
|
const { accountId } = yield fixAccountIdIfPossible({
|
|
498
502
|
object: params.object, project: { id: transaction.project.id }
|
|
499
503
|
})();
|
|
500
|
-
const authorizeObjectIncludingPaymentMethodDetails = Object.assign(Object.assign(Object.assign(Object.assign({}, params.object), { accountId, paymentMethodId: transactionNumber, typeOf: factory.action.authorize.paymentMethod.any.ResultType.Payment
|
|
504
|
+
const authorizeObjectIncludingPaymentMethodDetails = Object.assign(Object.assign(Object.assign(Object.assign({}, params.object), { accountId, paymentMethodId: transactionNumber, typeOf: factory.action.authorize.paymentMethod.any.ResultType.Payment,
|
|
505
|
+
// support referencesOrder(2025-11-24~)
|
|
506
|
+
referencesOrder: (((_a = params.object.referencesOrder) === null || _a === void 0 ? void 0 : _a.typeOf) === factory.order.OrderType.Order)
|
|
507
|
+
? params.object.referencesOrder
|
|
508
|
+
: { typeOf: factory.order.OrderType.Order } }), (creditCard !== undefined) ? { creditCard } : undefined), (Array.isArray(movieTickets)) ? { movieTickets } : undefined);
|
|
501
509
|
const { authorizeObject } = minimizeObjectIncludingPaymentMethodDetails(authorizeObjectIncludingPaymentMethodDetails);
|
|
502
510
|
// 承認アクションを開始する
|
|
503
|
-
const taskId = (
|
|
511
|
+
const taskId = (_b = params.sameAs) === null || _b === void 0 ? void 0 : _b.id;
|
|
504
512
|
const uniqueActionIdentifier = util.format(`%s:%s:%s`, factory.actionType.AuthorizeAction, factory.action.authorize.paymentMethod.any.ResultType.Payment, authorizeObject.paymentMethodId);
|
|
505
513
|
const actionAttributes = Object.assign({ project: transaction.project, typeOf: factory.actionType.AuthorizeAction, object: authorizeObject, agent: {
|
|
506
514
|
typeOf: transaction.agent.typeOf,
|
|
@@ -514,7 +522,7 @@ function authorize(params) {
|
|
|
514
522
|
id: transaction.seller.id,
|
|
515
523
|
name: (typeof transaction.seller.name === 'string')
|
|
516
524
|
? transaction.seller.name
|
|
517
|
-
: String((
|
|
525
|
+
: String((_c = transaction.seller.name) === null || _c === void 0 ? void 0 : _c.ja)
|
|
518
526
|
}, purpose: { typeOf: transaction.typeOf, id: transaction.id }, identifier: uniqueActionIdentifier }, (typeof taskId === 'string') ? { sameAs: { id: taskId, typeOf: 'Task' } } : undefined // タスク関連付け(2024-04-22~)
|
|
519
527
|
);
|
|
520
528
|
const action = yield repos.action.start(actionAttributes);
|
|
@@ -530,7 +538,8 @@ function authorize(params) {
|
|
|
530
538
|
// confirmationNumber required(2025-02-12~)
|
|
531
539
|
// orderNumber required(2025-02-14~)
|
|
532
540
|
order: { confirmationNumber, orderNumber },
|
|
533
|
-
action: { id: action.id, typeOf: action.typeOf }
|
|
541
|
+
action: { id: action.id, typeOf: action.typeOf },
|
|
542
|
+
ticketToken
|
|
534
543
|
});
|
|
535
544
|
payTransaction = yield PayTransactionService.start(startParams, Object.assign({
|
|
536
545
|
// useCheckByIdentifierIfNotYet: params.options.useCheckByIdentifierIfNotYet,
|
|
@@ -570,8 +579,8 @@ function authorize(params) {
|
|
|
570
579
|
}
|
|
571
580
|
const result = (0, factory_1.createAuthorizeResult)({
|
|
572
581
|
payTransaction,
|
|
573
|
-
object: authorizeObjectIncludingPaymentMethodDetails
|
|
574
|
-
|
|
582
|
+
object: authorizeObjectIncludingPaymentMethodDetails,
|
|
583
|
+
invoiceByTicketToken
|
|
575
584
|
});
|
|
576
585
|
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: result });
|
|
577
586
|
return { id: action.id };
|
|
@@ -15,11 +15,6 @@ function createPayOrderAction(params) {
|
|
|
15
15
|
confirmationNumber: params.order.confirmationNumber,
|
|
16
16
|
orderNumber: params.order.orderNumber
|
|
17
17
|
};
|
|
18
|
-
// const instrument: factory.action.trade.pay.IInstrument = {
|
|
19
|
-
// id: params.transaction.id,
|
|
20
|
-
// transactionNumber: params.transaction.transactionNumber,
|
|
21
|
-
// typeOf: params.transaction.typeOf
|
|
22
|
-
// };
|
|
23
18
|
const instrument = [
|
|
24
19
|
{
|
|
25
20
|
id: params.transaction.id,
|
|
@@ -48,11 +48,6 @@ function authorize(params, transaction, paymentServiceId, options) {
|
|
|
48
48
|
}, typeOf: paymentMethodType }, (typeof accountId === 'string') ? { accountId } : undefined),
|
|
49
49
|
movieTickets: paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.movieTickets
|
|
50
50
|
};
|
|
51
|
-
// const instrument: factory.action.trade.pay.IInstrument = {
|
|
52
|
-
// id: transaction.id,
|
|
53
|
-
// transactionNumber: transaction.transactionNumber,
|
|
54
|
-
// typeOf: transaction.typeOf
|
|
55
|
-
// };
|
|
56
51
|
const instrument = [
|
|
57
52
|
{
|
|
58
53
|
id: transaction.id,
|
|
@@ -18,6 +18,7 @@ const authorization_1 = require("../../repo/authorization");
|
|
|
18
18
|
const confirmationNumber_1 = require("../../repo/confirmationNumber");
|
|
19
19
|
const credentials_1 = require("../../repo/credentials");
|
|
20
20
|
const event_1 = require("../../repo/event");
|
|
21
|
+
const eventSeries_1 = require("../../repo/eventSeries");
|
|
21
22
|
const orderNumber_1 = require("../../repo/orderNumber");
|
|
22
23
|
const paymentService_1 = require("../../repo/paymentService");
|
|
23
24
|
const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
@@ -63,6 +64,7 @@ function call(params) {
|
|
|
63
64
|
expireInSeconds: (useCredentialsRepo) ? credentialsExpireInSeconds : 0
|
|
64
65
|
}),
|
|
65
66
|
event: new event_1.EventRepo(connection),
|
|
67
|
+
eventSeries: new eventSeries_1.EventSeriesRepo(connection),
|
|
66
68
|
orderNumber: new orderNumber_1.OrderNumberRepo({ connection }),
|
|
67
69
|
paymentAccepted: new sellerPaymentAccepted_1.SellerPaymentAcceptedRepo(connection),
|
|
68
70
|
paymentService: new paymentService_1.PaymentServiceRepo(connection),
|
|
@@ -14,6 +14,8 @@ const factory = require("../../factory");
|
|
|
14
14
|
const action_1 = require("../../repo/action");
|
|
15
15
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
16
16
|
const authorization_1 = require("../../repo/authorization");
|
|
17
|
+
const event_1 = require("../../repo/event");
|
|
18
|
+
const eventSeries_1 = require("../../repo/eventSeries");
|
|
17
19
|
const orderNumber_1 = require("../../repo/orderNumber");
|
|
18
20
|
const paymentService_1 = require("../../repo/paymentService");
|
|
19
21
|
const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
@@ -43,6 +45,8 @@ function call(params) {
|
|
|
43
45
|
action: actionRepo,
|
|
44
46
|
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
45
47
|
authorization: new authorization_1.AuthorizationRepo(connection),
|
|
48
|
+
event: new event_1.EventRepo(connection),
|
|
49
|
+
eventSeries: new eventSeries_1.EventSeriesRepo(connection),
|
|
46
50
|
orderNumber: new orderNumber_1.OrderNumberRepo({ connection }),
|
|
47
51
|
paymentAccepted: new sellerPaymentAccepted_1.SellerPaymentAcceptedRepo(connection),
|
|
48
52
|
paymentService: new paymentService_1.PaymentServiceRepo(connection),
|
|
@@ -21,7 +21,7 @@ function publishCode(params) {
|
|
|
21
21
|
const issuedBy = { id: params.object.seller.id, typeOf: factory.organizationType.Corporation };
|
|
22
22
|
let authorizations;
|
|
23
23
|
try {
|
|
24
|
-
authorizations = yield repos.authorization.
|
|
24
|
+
authorizations = yield repos.authorization.issueAuthorization([{
|
|
25
25
|
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
26
26
|
object: authorizationObject,
|
|
27
27
|
validFrom: params.validFrom,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as factory from '../../../../../factory';
|
|
2
|
+
export type IAcceptPayAction = Pick<factory.action.accept.pay.IAction, 'object' | 'result' | 'endDate'>;
|
|
3
|
+
export type IAuthorizeEventServiceOffer = factory.action.authorize.offer.eventService.IAction;
|
|
4
|
+
export type IAuthorizeProductOffer = factory.action.authorize.offer.product.IAction;
|
|
5
|
+
export type IAuthorizeMoneyTransferOffer = factory.action.authorize.offer.moneyTransfer.IAction;
|
|
6
|
+
export type IAuthorizePaymentAction = Pick<factory.action.authorize.paymentMethod.any.IAction, 'id' | 'result' | 'endDate' | 'instrument'> & {
|
|
7
|
+
object: Pick<factory.action.authorize.paymentMethod.any.IObject, 'typeOf'>;
|
|
8
|
+
};
|
|
9
|
+
export type IPayTransaction = Pick<factory.assetTransaction.pay.ITransaction, 'object'>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as factory from '../../../../../factory';
|
|
2
|
+
import { IAuthorizePaymentAction } from './factory';
|
|
3
|
+
declare function validateInvoiceReferencesOrder(authorizePaymentActions: IAuthorizePaymentAction[],
|
|
4
|
+
/**
|
|
5
|
+
* 受け入れられた興行オファー
|
|
6
|
+
*/
|
|
7
|
+
eventReservationAcceptedOffers: factory.order.IAcceptedOffer<factory.order.IReservation>[]): void;
|
|
8
|
+
export { validateInvoiceReferencesOrder };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateInvoiceReferencesOrder = validateInvoiceReferencesOrder;
|
|
4
|
+
const createDebug = require("debug");
|
|
5
|
+
const factory = require("../../../../../factory");
|
|
6
|
+
const debug = createDebug('chevre-domain:service:transaction');
|
|
7
|
+
function validateInvoiceReferencesOrder(authorizePaymentActions,
|
|
8
|
+
/**
|
|
9
|
+
* 受け入れられた興行オファー
|
|
10
|
+
*/
|
|
11
|
+
eventReservationAcceptedOffers) {
|
|
12
|
+
// 興行オファーに含まれるイベントIDリスト
|
|
13
|
+
let eventIdsMustBe = [];
|
|
14
|
+
if (Array.isArray(eventReservationAcceptedOffers)) {
|
|
15
|
+
eventReservationAcceptedOffers.forEach((offer) => {
|
|
16
|
+
eventIdsMustBe.push(offer.itemOffered.reservationFor.id);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
eventIdsMustBe = [...new Set(eventIdsMustBe)];
|
|
20
|
+
debug('validateInvoiceReferencesOrder: eventIdsMustBe: ', JSON.stringify(eventIdsMustBe));
|
|
21
|
+
// 全決済承認について、承認ごとに検証
|
|
22
|
+
authorizePaymentActions.forEach((authorizePaymentAction) => {
|
|
23
|
+
var _a, _b, _c, _d;
|
|
24
|
+
const paymentMethodId = (_a = authorizePaymentAction.result) === null || _a === void 0 ? void 0 : _a[0].paymentMethodId;
|
|
25
|
+
const paymentServiceType = (_b = authorizePaymentAction.result) === null || _b === void 0 ? void 0 : _b[0].issuedThrough.typeOf;
|
|
26
|
+
if (paymentServiceType !== factory.service.paymentService.PaymentServiceType.CreditCard) {
|
|
27
|
+
// クレジットカードIF以外は検証不要
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const orderedItemsByInvoice = (_d = (_c = authorizePaymentAction.result) === null || _c === void 0 ? void 0 : _c[0].referencesOrder) === null || _d === void 0 ? void 0 : _d.orderedItem;
|
|
31
|
+
if (!Array.isArray(orderedItemsByInvoice)) {
|
|
32
|
+
// 決済承認時に注文アイテムの指定がなければ検証不要
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
// 請求の関連注文アイテムが定義されていれば(空配列であったとしても)、イベントIDの一致検証が必要
|
|
36
|
+
// 請求の関連イベントIDリスト
|
|
37
|
+
const eventIdsByInvoice = orderedItemsByInvoice.map((orderedItem) => orderedItem.orderedItem.serviceOutput.reservationFor.id);
|
|
38
|
+
debug('validateInvoiceReferencesOrder: eventIdsByInvoice: ', JSON.stringify(eventIdsByInvoice), paymentServiceType, paymentMethodId);
|
|
39
|
+
const eventIdsMatched = eventIdsMustBe.length === eventIdsByInvoice.length
|
|
40
|
+
&& eventIdsMustBe.every((eventIdMustExist) => eventIdsByInvoice.includes(eventIdMustExist));
|
|
41
|
+
if (!eventIdsMatched) {
|
|
42
|
+
throw new factory.errors.Argument('id', `referencesOrder.orderedItem not matched. ${paymentMethodId}`);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { IAuthorizeEventServiceOffer, IAuthorizeMoneyTransferOffer, IAuthorizePaymentAction, IAuthorizeProductOffer } from './factory';
|
|
2
|
+
declare function validatePrice(authorizePaymentActions: IAuthorizePaymentAction[], authorizeEventServiceOfferActions: Pick<IAuthorizeEventServiceOffer, 'id' | 'result'>[], authorizeProductOfferActions: Pick<IAuthorizeProductOffer, 'id' | 'result'>[], authorizeMoneyTansferActions: Pick<IAuthorizeMoneyTransferOffer, 'id' | 'result'>[]): void;
|
|
3
|
+
export { validatePrice };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validatePrice = validatePrice;
|
|
4
|
+
const factory = require("../../../../../factory");
|
|
5
|
+
function validatePrice(authorizePaymentActions, authorizeEventServiceOfferActions, authorizeProductOfferActions, authorizeMoneyTansferActions) {
|
|
6
|
+
let priceByAgent = 0;
|
|
7
|
+
let priceBySeller = 0;
|
|
8
|
+
// 決済承認を確認
|
|
9
|
+
authorizePaymentActions.forEach(({ result }) => {
|
|
10
|
+
var _a;
|
|
11
|
+
const resultAsInvoice = (Array.isArray(result))
|
|
12
|
+
// ? result.find(({ typeOf }) => typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
13
|
+
? result[0]
|
|
14
|
+
: undefined;
|
|
15
|
+
const jpyAmount = (((_a = resultAsInvoice === null || resultAsInvoice === void 0 ? void 0 : resultAsInvoice.totalPaymentDue) === null || _a === void 0 ? void 0 : _a.currency) === factory.priceCurrency.JPY)
|
|
16
|
+
? resultAsInvoice.totalPaymentDue.value
|
|
17
|
+
: 0;
|
|
18
|
+
priceByAgent += jpyAmount;
|
|
19
|
+
});
|
|
20
|
+
// 販売者が提供するアイテムの発生金額
|
|
21
|
+
[
|
|
22
|
+
...authorizeEventServiceOfferActions,
|
|
23
|
+
...authorizeProductOfferActions,
|
|
24
|
+
...authorizeMoneyTansferActions
|
|
25
|
+
].forEach(({ id, result }) => {
|
|
26
|
+
const priceByAction = result === null || result === void 0 ? void 0 : result.price;
|
|
27
|
+
if (typeof priceByAction === 'number' && priceByAction >= 0) {
|
|
28
|
+
priceBySeller += priceByAction;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
// price未確定(オファー未指定)のオファー承認アクションが存在すれば確定不可能(2023-11-27~)
|
|
32
|
+
throw new factory.errors.Argument('id', `some actions with no offer specified. [${id}]`);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
if (priceByAgent !== priceBySeller) {
|
|
36
|
+
throw new factory.errors.Argument('id', `prices are not matched. [${priceByAgent},${priceBySeller}]`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import * as factory from '../../../../factory';
|
|
2
2
|
import { placeOrder as PlaceOrderFactory } from '../../../../factory/transaction';
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
export type IAuthorizeProductOffer = factory.action.authorize.offer.product.IAction;
|
|
6
|
-
export type IAuthorizeMoneyTransferOffer = factory.action.authorize.offer.moneyTransfer.IAction;
|
|
7
|
-
export type IAuthorizePaymentAction = Pick<factory.action.authorize.paymentMethod.any.IAction, 'id' | 'result' | 'endDate' | 'instrument'> & {
|
|
8
|
-
object: Pick<factory.action.authorize.paymentMethod.any.IObject, 'typeOf'>;
|
|
9
|
-
};
|
|
10
|
-
export type IPayTransaction = Pick<factory.assetTransaction.pay.ITransaction, 'object'>;
|
|
3
|
+
import { IAcceptPayAction, IAuthorizeEventServiceOffer, IAuthorizeMoneyTransferOffer, IAuthorizePaymentAction, IAuthorizeProductOffer, IPayTransaction } from './validation/factory';
|
|
4
|
+
export { IAcceptPayAction, IAuthorizeEventServiceOffer, IAuthorizeMoneyTransferOffer, IAuthorizePaymentAction, IAuthorizeProductOffer, IPayTransaction };
|
|
11
5
|
/**
|
|
12
6
|
* 取引が確定可能な状態かどうかをチェックする
|
|
13
7
|
*/
|
|
@@ -11,7 +11,9 @@ exports.validateEventOffers = validateEventOffers;
|
|
|
11
11
|
const createDebug = require("debug");
|
|
12
12
|
const util_1 = require("util");
|
|
13
13
|
const factory = require("../../../../factory");
|
|
14
|
+
const validateInvoiceReferencesOrder_1 = require("./validation/validateInvoiceReferencesOrder");
|
|
14
15
|
const validateMovieTicket_1 = require("./validation/validateMovieTicket");
|
|
16
|
+
const validatePrice_1 = require("./validation/validatePrice");
|
|
15
17
|
const debug = createDebug('chevre-domain:service:transaction');
|
|
16
18
|
/**
|
|
17
19
|
* 取引が確定可能な状態かどうかをチェックする
|
|
@@ -19,7 +21,9 @@ const debug = createDebug('chevre-domain:service:transaction');
|
|
|
19
21
|
function validateTransaction(transaction, acceptPayActions, authorizePaymentActions, authorizeEventServiceOfferActions, authorizeMoneyTansferActions, authorizeProductOfferActions, eventReservationAcceptedOffers, payTransactions, customer) {
|
|
20
22
|
// validateProfile(transaction);
|
|
21
23
|
validateProfile({ customer });
|
|
22
|
-
validatePrice(authorizePaymentActions, authorizeEventServiceOfferActions, authorizeProductOfferActions, authorizeMoneyTansferActions);
|
|
24
|
+
(0, validatePrice_1.validatePrice)(authorizePaymentActions, authorizeEventServiceOfferActions, authorizeProductOfferActions, authorizeMoneyTansferActions);
|
|
25
|
+
// 請求のreferencesOrder検証(2025-11-23~)
|
|
26
|
+
(0, validateInvoiceReferencesOrder_1.validateInvoiceReferencesOrder)(authorizePaymentActions, eventReservationAcceptedOffers);
|
|
23
27
|
// 利用可能な通貨単位に対して取引検証
|
|
24
28
|
validateMonetaryAmount(authorizePaymentActions, authorizeEventServiceOfferActions);
|
|
25
29
|
// 利用可能なMovieTicketIF決済方法タイプに対して動的にコーディング
|
|
@@ -119,40 +123,6 @@ function validateProfile(params) {
|
|
|
119
123
|
throw new factory.errors.Argument('Transaction', 'customer name required');
|
|
120
124
|
}
|
|
121
125
|
}
|
|
122
|
-
function validatePrice(authorizePaymentActions, authorizeEventServiceOfferActions, authorizeProductOfferActions, authorizeMoneyTansferActions) {
|
|
123
|
-
let priceByAgent = 0;
|
|
124
|
-
let priceBySeller = 0;
|
|
125
|
-
// 決済承認を確認
|
|
126
|
-
authorizePaymentActions.forEach(({ result }) => {
|
|
127
|
-
var _a;
|
|
128
|
-
const resultAsInvoice = (Array.isArray(result))
|
|
129
|
-
// ? result.find(({ typeOf }) => typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
130
|
-
? result[0]
|
|
131
|
-
: undefined;
|
|
132
|
-
const jpyAmount = (((_a = resultAsInvoice === null || resultAsInvoice === void 0 ? void 0 : resultAsInvoice.totalPaymentDue) === null || _a === void 0 ? void 0 : _a.currency) === factory.priceCurrency.JPY)
|
|
133
|
-
? resultAsInvoice.totalPaymentDue.value
|
|
134
|
-
: 0;
|
|
135
|
-
priceByAgent += jpyAmount;
|
|
136
|
-
});
|
|
137
|
-
// 販売者が提供するアイテムの発生金額
|
|
138
|
-
[
|
|
139
|
-
...authorizeEventServiceOfferActions,
|
|
140
|
-
...authorizeProductOfferActions,
|
|
141
|
-
...authorizeMoneyTansferActions
|
|
142
|
-
].forEach(({ id, result }) => {
|
|
143
|
-
const priceByAction = result === null || result === void 0 ? void 0 : result.price;
|
|
144
|
-
if (typeof priceByAction === 'number' && priceByAction >= 0) {
|
|
145
|
-
priceBySeller += priceByAction;
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
// price未確定(オファー未指定)のオファー承認アクションが存在すれば確定不可能(2023-11-27~)
|
|
149
|
-
throw new factory.errors.Argument('id', `some actions with no offer specified. [${id}]`);
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
if (priceByAgent !== priceBySeller) {
|
|
153
|
-
throw new factory.errors.Argument('id', `prices are not matched. [${priceByAgent},${priceBySeller}]`);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
126
|
function validatePaymentUrl(transaction, acceptPayActions, authorizePaymentActions) {
|
|
157
127
|
var _a;
|
|
158
128
|
// 決済URLが発行されている場合、検証
|
package/package.json
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.600.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.600.0",
|
|
14
|
-
"@chevre/factory": "5.
|
|
15
|
-
"@cinerino/sdk": "12.
|
|
14
|
+
"@chevre/factory": "5.4.0-alpha.3",
|
|
15
|
+
"@cinerino/sdk": "12.12.1",
|
|
16
16
|
"@motionpicture/coa-service": "9.6.0",
|
|
17
17
|
"@motionpicture/gmo-service": "5.4.0-alpha.1",
|
|
18
18
|
"@sendgrid/client": "8.1.4",
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"postversion": "git push origin --tags",
|
|
116
116
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
117
117
|
},
|
|
118
|
-
"version": "23.1.0
|
|
118
|
+
"version": "23.1.0"
|
|
119
119
|
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as moment from 'moment';
|
|
3
|
-
import * as mongoose from 'mongoose';
|
|
4
|
-
|
|
5
|
-
import { chevre } from '../../../lib/index';
|
|
6
|
-
|
|
7
|
-
const CONSOLE_CLIENT_ID = 'xxx';
|
|
8
|
-
// const project = { id: String(process.env.PROJECT_ID) };
|
|
9
|
-
type IAction = chevre.factory.action.IAction<chevre.factory.action.IAttributes<chevre.factory.actionType, any, any>>;
|
|
10
|
-
|
|
11
|
-
// tslint:disable-next-line:max-func-body-length
|
|
12
|
-
async function main() {
|
|
13
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
14
|
-
|
|
15
|
-
const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
|
|
16
|
-
|
|
17
|
-
const cursor = actionRepo.getCursor(
|
|
18
|
-
{
|
|
19
|
-
typeOf: { $eq: chevre.factory.actionType.ReplaceAction },
|
|
20
|
-
'object.typeOf': { $exists: true, $eq: chevre.factory.eventType.ScreeningEventSeries },
|
|
21
|
-
startDate: {
|
|
22
|
-
$gte: moment()
|
|
23
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
24
|
-
.add(-60, 'days')
|
|
25
|
-
.toDate()
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
console.log('actions found');
|
|
32
|
-
|
|
33
|
-
let i = 0;
|
|
34
|
-
await cursor.eachAsync(async (doc) => {
|
|
35
|
-
i += 1;
|
|
36
|
-
const action = <IAction>doc.toObject();
|
|
37
|
-
// const size = JSON.stringify(action).length;
|
|
38
|
-
// // console.log(JSON.stringify(action).length);
|
|
39
|
-
// if (action.typeOf !== chevre.factory.actionType.InformAction
|
|
40
|
-
// && action.typeOf !== chevre.factory.actionType.AuthorizeAction
|
|
41
|
-
// && action.typeOf !== chevre.factory.actionType.CheckAction
|
|
42
|
-
// && size > 2000) {
|
|
43
|
-
// console.log(action.typeOf, action.object?.typeOf);
|
|
44
|
-
// console.log(size);
|
|
45
|
-
// }
|
|
46
|
-
|
|
47
|
-
const eventCount = (Array.isArray(action.object))
|
|
48
|
-
? action.object.filter(({ typeOf }) => typeOf === chevre.factory.eventType.ScreeningEventSeries)
|
|
49
|
-
.length
|
|
50
|
-
: 0;
|
|
51
|
-
if (action.instrument?.id !== CONSOLE_CLIENT_ID) {
|
|
52
|
-
console.log(eventCount, 'events created', action.project.id, action.startDate, action.instrument?.id, i);
|
|
53
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
54
|
-
if (eventCount > 20) {
|
|
55
|
-
throw new Error('eventCount too large');
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
console.log(i, 'actions checked');
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
main()
|
|
64
|
-
.then()
|
|
65
|
-
.catch(console.error);
|