@chevre/domain 21.37.0-alpha.8 → 21.37.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/processOrder.ts +87 -0
- package/example/src/chevre/transaction/processPlaceOrder.ts +17 -143
- package/lib/chevre/factory/reservedAgentIdentifireNames.js +2 -1
- package/lib/chevre/factory/transaction.d.ts +1 -4
- package/lib/chevre/repo/passport.d.ts +39 -0
- package/lib/chevre/repo/passport.js +134 -0
- package/lib/chevre/repo/task.d.ts +9 -0
- package/lib/chevre/repo/task.js +23 -2
- package/lib/chevre/repository.d.ts +5 -0
- package/lib/chevre/repository.js +15 -2
- package/lib/chevre/service/accountTransaction/deposit.js +0 -1
- package/lib/chevre/service/accountTransaction/transfer.js +0 -1
- package/lib/chevre/service/accountTransaction/withdraw.js +0 -1
- package/lib/chevre/service/assetTransaction/reserve/cancel.d.ts +22 -0
- package/lib/chevre/service/assetTransaction/reserve/cancel.js +41 -0
- package/lib/chevre/service/assetTransaction/reserve/confirm/factory.d.ts +8 -0
- package/lib/chevre/service/assetTransaction/reserve/confirm/factory.js +94 -0
- package/lib/chevre/service/assetTransaction/reserve/confirm.d.ts +19 -0
- package/lib/chevre/service/assetTransaction/reserve/confirm.js +93 -0
- package/lib/chevre/service/assetTransaction/reserve/exportTasksById.d.ts +15 -0
- package/lib/chevre/service/assetTransaction/reserve/exportTasksById.js +99 -0
- package/lib/chevre/service/assetTransaction/reserve/start/createSubReservations.d.ts +28 -0
- package/lib/chevre/service/assetTransaction/reserve/start/createSubReservations.js +405 -0
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createPointAward.d.ts +15 -0
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createPointAward.js +40 -0
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createReservation.d.ts +54 -0
- package/lib/chevre/service/assetTransaction/reserve/{factory.js → start/factory/createReservation.js} +3 -222
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createStartParams.d.ts +22 -0
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createStartParams.js +90 -0
- package/lib/chevre/service/assetTransaction/reserve/{factory → start/factory}/price.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserve/{factory → start/factory}/price.js +1 -1
- package/lib/chevre/service/assetTransaction/reserve/start.d.ts +74 -0
- package/lib/chevre/service/assetTransaction/reserve/start.js +570 -0
- package/lib/chevre/service/assetTransaction/reserve.d.ts +6 -128
- package/lib/chevre/service/assetTransaction/reserve.js +9 -1047
- package/lib/chevre/service/offer/event/{defaultOffer.d.ts → authorize/defaultOffer.d.ts} +1 -1
- package/lib/chevre/service/offer/event/{defaultOffer.js → authorize/defaultOffer.js} +1 -1
- package/lib/chevre/service/offer/event/{factory.d.ts → authorize/factory.d.ts} +13 -20
- package/lib/chevre/service/offer/event/{factory.js → authorize/factory.js} +72 -146
- package/lib/chevre/service/offer/event/{processStartReserve4chevre.d.ts → authorize/processStartReserve4chevre.d.ts} +19 -19
- package/lib/chevre/service/offer/event/{processStartReserve4chevre.js → authorize/processStartReserve4chevre.js} +8 -13
- package/lib/chevre/service/offer/event/authorize.d.ts +1 -1
- package/lib/chevre/service/offer/event/authorize.js +104 -128
- package/lib/chevre/service/offer/event/importFromCOA/factory.d.ts +9 -0
- package/lib/chevre/service/offer/event/importFromCOA/factory.js +67 -0
- package/lib/chevre/service/offer/event/importFromCOA.js +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +0 -3
- package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +3 -3
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.d.ts +4 -4
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/processOrder.d.ts +16 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/processOrder.js +168 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +4 -5
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +4 -135
- package/lib/chevre/service/order/onOrderStatusChanged.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged.js +2 -1
- package/lib/chevre/service/order.d.ts +2 -2
- package/lib/chevre/service/order.js +2 -1
- package/lib/chevre/service/transaction/moneyTransfer.d.ts +3 -2
- package/lib/chevre/service/transaction/moneyTransfer.js +1 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/start/factory.d.ts +10 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/start/factory.js +36 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/start.d.ts +6 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/start.js +26 -12
- package/lib/chevre/service/validation/validateOrder.js +1 -1
- package/lib/chevre/settings.d.ts +1 -0
- package/lib/chevre/settings.js +5 -1
- package/package.json +3 -3
- package/example/src/chevre/migrateAuthorizeEventServiceOfferResult.ts +0 -163
- package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +0 -96
- package/lib/chevre/service/transaction/placeOrderInProgress/factory.d.ts +0 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +0 -29
- package/lib/chevre/service/transaction/validation.d.ts +0 -14
- package/lib/chevre/service/transaction/validation.js +0 -101
package/lib/chevre/settings.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.settings = exports.DELIVER_ORDER_LIMIT = exports.MONGO_AUTO_INDEX = exports.MONGO_READ_PREFERENCE = exports.MONGO_MAX_TIME_MS = exports.USE_EXPERIMENTAL_FEATURE = exports.USE_VALIDATE_MOVIE_TICKET_BY_TICKET_IDENTIFIER = exports.USE_OPTIMIZE_INFORM_EVENT = exports.USE_CHECK_RESOURCE_TASK = exports.USE_OWNERSHIP_INFO_BY_WEB_APPLICATION = exports.USE_FETCH_API = exports.USE_OPTIMIZE_TICKET_OFFER = exports.USE_DELETE_EVENT_BY_ORDER = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.MAX_NUM_CREDIT_CARD_PAYMENT_METHOD = exports.ABORTED_TASKS_WITHOUT_REPORT = exports.MAXIMUM_RESERVATION_GRACE_PERIOD_IN_DAYS = exports.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS = exports.TRIGGER_WEBHOOK_MAX_RETRY_COUNT = void 0;
|
|
3
|
+
exports.settings = exports.DELIVER_ORDER_LIMIT = exports.MONGO_AUTO_INDEX = exports.MONGO_READ_PREFERENCE = exports.MONGO_MAX_TIME_MS = exports.USE_EXPERIMENTAL_FEATURE = exports.USE_VALIDATE_MOVIE_TICKET_BY_TICKET_IDENTIFIER = exports.USE_OPTIMIZE_INFORM_EVENT = exports.USE_CHECK_RESOURCE_TASK = exports.USE_OWNERSHIP_INFO_BY_WEB_APPLICATION = exports.USE_FETCH_API = exports.USE_OPTIMIZE_TICKET_OFFER = exports.USE_DELETE_EVENT_BY_ORDER = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.NUM_TRY_CONFIRM_RESERVE_TRANSACTION = exports.MAX_NUM_CREDIT_CARD_PAYMENT_METHOD = exports.ABORTED_TASKS_WITHOUT_REPORT = exports.MAXIMUM_RESERVATION_GRACE_PERIOD_IN_DAYS = exports.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS = exports.TRIGGER_WEBHOOK_MAX_RETRY_COUNT = void 0;
|
|
4
4
|
const factory = require("./factory");
|
|
5
5
|
const transactionWebhookUrls = (typeof process.env.INFORM_TRANSACTION_URL === 'string')
|
|
6
6
|
? process.env.INFORM_TRANSACTION_URL.split(' ')
|
|
@@ -35,6 +35,10 @@ exports.ABORTED_TASKS_WITHOUT_REPORT = (typeof process.env.ABORTED_TASKS_WITHOUT
|
|
|
35
35
|
exports.MAX_NUM_CREDIT_CARD_PAYMENT_METHOD = (typeof process.env.MAX_NUM_CREDIT_CARD_PAYMENT_METHOD === 'string')
|
|
36
36
|
? Number(process.env.MAX_NUM_CREDIT_CARD_PAYMENT_METHOD)
|
|
37
37
|
: 1;
|
|
38
|
+
exports.NUM_TRY_CONFIRM_RESERVE_TRANSACTION = (typeof process.env.NUM_TRY_CONFIRM_RESERVE_TRANSACTION === 'string')
|
|
39
|
+
? Number(process.env.NUM_TRY_CONFIRM_RESERVE_TRANSACTION)
|
|
40
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
41
|
+
: 10;
|
|
38
42
|
/**
|
|
39
43
|
* 取引保管期間(Confirmed)
|
|
40
44
|
*/
|
package/package.json
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/credential-providers": "3.433.0",
|
|
13
|
-
"@chevre/factory": "4.377.0
|
|
14
|
-
"@cinerino/sdk": "8.
|
|
13
|
+
"@chevre/factory": "4.377.0",
|
|
14
|
+
"@cinerino/sdk": "8.2.0",
|
|
15
15
|
"@motionpicture/coa-service": "9.4.0",
|
|
16
16
|
"@motionpicture/gmo-service": "5.3.0",
|
|
17
17
|
"@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": "21.37.0
|
|
113
|
+
"version": "21.37.0"
|
|
114
114
|
}
|
|
@@ -1,163 +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
|
-
type IUnitPriceSpecification =
|
|
8
|
-
chevre.factory.priceSpecification.IPriceSpecification<chevre.factory.priceSpecificationType.UnitPriceSpecification>;
|
|
9
|
-
type IAuthorizeAction4chevre = chevre.factory.action.authorize.offer.eventService.IAction<chevre.factory.service.webAPI.Identifier.Chevre>;
|
|
10
|
-
type IAcceptedOffer4chevre = chevre.factory.action.authorize.offer.eventService.IAcceptedOffer4chevre;
|
|
11
|
-
|
|
12
|
-
// tslint:disable-next-line:max-func-body-length
|
|
13
|
-
async function main() {
|
|
14
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
15
|
-
|
|
16
|
-
const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
|
|
17
|
-
const cursor = actionRepo.getCursor(
|
|
18
|
-
{
|
|
19
|
-
// _id: { $eq: '66697991037c9d7243208261' },
|
|
20
|
-
typeOf: { $eq: chevre.factory.actionType.AuthorizeAction },
|
|
21
|
-
actionStatus: { $eq: chevre.factory.actionStatusType.CompletedActionStatus },
|
|
22
|
-
startDate: {
|
|
23
|
-
$lte: moment()
|
|
24
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
25
|
-
.add(-180, 'days')
|
|
26
|
-
// $gte: moment()
|
|
27
|
-
// // tslint:disable-next-line:no-magic-numbers
|
|
28
|
-
// .add(-180, 'days')
|
|
29
|
-
},
|
|
30
|
-
'object.typeOf': { $exists: true, $eq: chevre.factory.action.authorize.offer.eventService.ObjectType.SeatReservation }
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
__id: 1, startDate: 1, endDate: 1, result: 1, project: 1, typeOf: 1, actionStatus: 1, instrument: 1, object: 1
|
|
34
|
-
}
|
|
35
|
-
);
|
|
36
|
-
console.log('actions found');
|
|
37
|
-
|
|
38
|
-
let i = 0;
|
|
39
|
-
let updateCount = 0;
|
|
40
|
-
let saveResultCount = 0;
|
|
41
|
-
// tslint:disable-next-line:max-func-body-length
|
|
42
|
-
await cursor.eachAsync(async (doc) => {
|
|
43
|
-
i += 1;
|
|
44
|
-
const authorizeAction = <Pick<
|
|
45
|
-
chevre.factory.action.authorize.offer.eventService.IAction<chevre.factory.service.webAPI.Identifier>,
|
|
46
|
-
'id' | 'startDate' | 'endDate' | 'result' | 'project' | 'typeOf' | 'actionStatus' | 'instrument' | 'object'
|
|
47
|
-
>>doc.toObject();
|
|
48
|
-
const result = authorizeAction.result;
|
|
49
|
-
if (result === undefined) {
|
|
50
|
-
throw new Error(`result undefined [${authorizeAction.id}]`);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
let migrated = false;
|
|
54
|
-
if (authorizeAction.instrument.typeOf === chevre.factory.assetTransactionType.COAReserveTransaction
|
|
55
|
-
|| (<any>authorizeAction.instrument).identifier === chevre.factory.service.webAPI.Identifier.COA) {
|
|
56
|
-
migrated = true;
|
|
57
|
-
} else {
|
|
58
|
-
if (result.typeOf === chevre.factory.offerType.AggregateOffer && Array.isArray(result.offers)) {
|
|
59
|
-
migrated = true;
|
|
60
|
-
}
|
|
61
|
-
if (typeof result.price !== 'number') {
|
|
62
|
-
migrated = true;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (migrated) {
|
|
67
|
-
console.log(
|
|
68
|
-
'already migrated.',
|
|
69
|
-
authorizeAction.project.id, authorizeAction.id, authorizeAction.startDate, i, updateCount, saveResultCount);
|
|
70
|
-
|
|
71
|
-
// optimize action
|
|
72
|
-
if (Array.isArray((<any>authorizeAction.object).acceptedOffer)) {
|
|
73
|
-
let unsetResult: any;
|
|
74
|
-
unsetResult = await actionRepo.unsetUnnecessaryFields({
|
|
75
|
-
filter: { _id: { $eq: authorizeAction.id } },
|
|
76
|
-
$unset: {
|
|
77
|
-
'object.acceptedOffer': 1
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
updateCount += 1;
|
|
81
|
-
console.log(
|
|
82
|
-
'result unset. unsetResult:', unsetResult,
|
|
83
|
-
authorizeAction.project.id, authorizeAction.id, authorizeAction.startDate, i, updateCount, saveResultCount);
|
|
84
|
-
}
|
|
85
|
-
} else {
|
|
86
|
-
console.log(
|
|
87
|
-
'redefining result as AggreagteOffer...',
|
|
88
|
-
authorizeAction.project.id, authorizeAction.id, authorizeAction.startDate, i, updateCount, saveResultCount);
|
|
89
|
-
const acceptedOffers = <IAcceptedOffer4chevre[]>(<any>(<IAuthorizeAction4chevre>authorizeAction).object).acceptedOffer;
|
|
90
|
-
if (!Array.isArray(acceptedOffers)) {
|
|
91
|
-
throw new Error(`acceptedOffer undefined [${authorizeAction.id}]`);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
let offers: chevre.factory.action.authorize.offer.eventService.IAcceptedOfferInResult[] | undefined;
|
|
95
|
-
if (typeof result.price === 'number') {
|
|
96
|
-
// オファーIDごとに集計
|
|
97
|
-
const offerIds = [...new Set(acceptedOffers.map((o) => o.id))];
|
|
98
|
-
offers = offerIds.map<chevre.factory.action.authorize.offer.eventService.IAcceptedOfferInResult>((offerId) => {
|
|
99
|
-
const acceptedOfferInObject = acceptedOffers.find(({ id }) => id === offerId);
|
|
100
|
-
if (acceptedOfferInObject === undefined) {
|
|
101
|
-
throw new Error(`acceptedOffer not found [id:${offerId}]`);
|
|
102
|
-
}
|
|
103
|
-
const amountOfThisGood: number = acceptedOffers.filter(({ id }) => id === offerId).length;
|
|
104
|
-
const { acceptedPaymentMethod, priceSpecification } = acceptedOfferInObject;
|
|
105
|
-
|
|
106
|
-
const unitPriceSpec = <IUnitPriceSpecification | undefined>priceSpecification.priceComponent.find(
|
|
107
|
-
(spec) => spec.typeOf === chevre.factory.priceSpecificationType.UnitPriceSpecification
|
|
108
|
-
&& (!Array.isArray(spec.appliesToAddOn)) // アドオン単価ではない
|
|
109
|
-
);
|
|
110
|
-
if (unitPriceSpec === undefined) {
|
|
111
|
-
throw new Error(`unitPriceSpec not found [id:${offerId}]`);
|
|
112
|
-
}
|
|
113
|
-
const { eligibleQuantity, eligibleTransactionVolume } = unitPriceSpec;
|
|
114
|
-
|
|
115
|
-
return {
|
|
116
|
-
id: offerId,
|
|
117
|
-
includesObject: { amountOfThisGood },
|
|
118
|
-
typeOf: chevre.factory.offerType.Offer,
|
|
119
|
-
priceSpecification: {
|
|
120
|
-
...(eligibleQuantity !== undefined) ? { eligibleQuantity } : undefined,
|
|
121
|
-
...(eligibleTransactionVolume !== undefined) ? { eligibleTransactionVolume } : undefined
|
|
122
|
-
},
|
|
123
|
-
...(acceptedPaymentMethod !== undefined) ? { acceptedPaymentMethod } : undefined
|
|
124
|
-
};
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
const resultAsAggregateOffer: chevre.factory.action.authorize.offer.eventService.IResultAsAggregateOffer = {
|
|
128
|
-
typeOf: chevre.factory.offerType.AggregateOffer,
|
|
129
|
-
offers
|
|
130
|
-
};
|
|
131
|
-
// const newResult: chevre.factory.action.authorize.offer.eventService.IResult = {
|
|
132
|
-
// ...result,
|
|
133
|
-
// ...resultAsAggregateOffer
|
|
134
|
-
// };
|
|
135
|
-
console.log(
|
|
136
|
-
'saving action...',
|
|
137
|
-
authorizeAction.project.id, authorizeAction.id, authorizeAction.startDate, i, updateCount, saveResultCount);
|
|
138
|
-
// tslint:disable-next-line:no-null-keyword
|
|
139
|
-
console.dir(resultAsAggregateOffer, { depth: null });
|
|
140
|
-
await actionRepo.findByIdAndUpdate({
|
|
141
|
-
id: authorizeAction.id,
|
|
142
|
-
update: {
|
|
143
|
-
$set: {
|
|
144
|
-
'result.typeOf': resultAsAggregateOffer.typeOf,
|
|
145
|
-
'result.offers': resultAsAggregateOffer.offers
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
saveResultCount += 1;
|
|
150
|
-
console.log(
|
|
151
|
-
'action saved.',
|
|
152
|
-
authorizeAction.project.id, authorizeAction.id, authorizeAction.startDate, i, updateCount, saveResultCount);
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
console.log(i, 'actions checked');
|
|
157
|
-
console.log(updateCount, 'actions updated');
|
|
158
|
-
console.log(saveResultCount, 'result saved');
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
main()
|
|
162
|
-
.then()
|
|
163
|
-
.catch(console.error);
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import * as factory from '../../../factory';
|
|
2
|
-
import { IMinimizedIndividualEvent } from '../../../factory/event';
|
|
3
|
-
import { IAcceptedAddOn } from './factory/price';
|
|
4
|
-
type IObjectSubReservation = factory.assetTransaction.reserve.IObjectSubReservation;
|
|
5
|
-
export { IAcceptedAddOn };
|
|
6
|
-
type IObject = factory.assetTransaction.reserve.IObject & {
|
|
7
|
-
issuedThrough: factory.assetTransaction.reserve.IIssuedThrough;
|
|
8
|
-
reservationFor: factory.assetTransaction.reserve.IReservationFor;
|
|
9
|
-
};
|
|
10
|
-
export declare function createStartParams(params: factory.assetTransaction.reserve.IStartParamsWithoutDetail & {
|
|
11
|
-
provider: {
|
|
12
|
-
/**
|
|
13
|
-
* 販売者ID
|
|
14
|
-
*/
|
|
15
|
-
id: string;
|
|
16
|
-
};
|
|
17
|
-
reservationNumber: string;
|
|
18
|
-
event: IMinimizedIndividualEvent<factory.eventType.Event | factory.eventType.ScreeningEvent>;
|
|
19
|
-
}): factory.assetTransaction.IStartParams<factory.assetTransactionType.Reserve> & {
|
|
20
|
-
object: IObject;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* ポイント特典を作成する
|
|
24
|
-
*/
|
|
25
|
-
export declare function createPointAward(params: {
|
|
26
|
-
acceptedOffer: factory.assetTransaction.reserve.IAcceptedTicketOfferWithoutDetail;
|
|
27
|
-
offer: factory.product.ITicketOffer;
|
|
28
|
-
reservation: {
|
|
29
|
-
id: string;
|
|
30
|
-
};
|
|
31
|
-
project: {
|
|
32
|
-
id: string;
|
|
33
|
-
};
|
|
34
|
-
}): factory.action.transfer.moneyTransfer.IPointAward | undefined;
|
|
35
|
-
export declare function createReservedTicket(params: {
|
|
36
|
-
id: string;
|
|
37
|
-
acceptedOffer: factory.assetTransaction.reserve.IAcceptedTicketOfferWithoutDetail;
|
|
38
|
-
availableOffer: factory.unitPriceOffer.IUnitPriceOffer;
|
|
39
|
-
dateIssued: Date;
|
|
40
|
-
reservationFor: {
|
|
41
|
-
id: string;
|
|
42
|
-
};
|
|
43
|
-
reservedSeatsOnly: boolean;
|
|
44
|
-
screeningRoomSections?: factory.place.screeningRoomSection.IPlace[];
|
|
45
|
-
availableSeatOffers: factory.place.seat.IPlaceWithOffer[];
|
|
46
|
-
ticketOffer: factory.product.ITicketOffer;
|
|
47
|
-
}): factory.reservation.ITicket;
|
|
48
|
-
export declare function validateAppliesToMovieTicket(params: {
|
|
49
|
-
availableOffer: factory.unitPriceOffer.IUnitPriceOffer;
|
|
50
|
-
appliesToMovieTicket?: factory.assetTransaction.reserve.IAcceptedAppliesToMovieTicket;
|
|
51
|
-
}): void;
|
|
52
|
-
/**
|
|
53
|
-
* 追加特性を生成する
|
|
54
|
-
*/
|
|
55
|
-
export declare function createAdditionalProperty(params: {
|
|
56
|
-
acceptedOffer: factory.assetTransaction.reserve.IAcceptedTicketOfferWithoutDetail;
|
|
57
|
-
}): factory.propertyValue.IPropertyValue<string>[];
|
|
58
|
-
/**
|
|
59
|
-
* 追加チケットテキストを生成する
|
|
60
|
-
*/
|
|
61
|
-
export declare function createAdditionalTicketText(params: {
|
|
62
|
-
acceptedOffer: factory.assetTransaction.reserve.IAcceptedTicketOfferWithoutDetail;
|
|
63
|
-
reservedTicket: factory.reservation.ITicket;
|
|
64
|
-
}): string | undefined;
|
|
65
|
-
export type IUnitPriceSpecification = factory.priceSpecification.IPriceSpecification<factory.priceSpecificationType.UnitPriceSpecification>;
|
|
66
|
-
export declare function createReservationFor(params: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent> | IMinimizedIndividualEvent<factory.eventType.Event>, useOptimizeReservation: boolean): factory.assetTransaction.reserve.IReservationFor;
|
|
67
|
-
export declare function createIssuedThrough(params: {
|
|
68
|
-
reservationFor: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent> | IMinimizedIndividualEvent<factory.eventType.Event>;
|
|
69
|
-
}): {
|
|
70
|
-
issuedThrough: factory.assetTransaction.reserve.IIssuedThrough;
|
|
71
|
-
};
|
|
72
|
-
export declare function createReservation(params: {
|
|
73
|
-
project: {
|
|
74
|
-
id: string;
|
|
75
|
-
typeOf: factory.organizationType.Project;
|
|
76
|
-
};
|
|
77
|
-
id: string;
|
|
78
|
-
reservationFor: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent> | IMinimizedIndividualEvent<factory.eventType.Event>;
|
|
79
|
-
reservedTicket: factory.reservation.ITicket;
|
|
80
|
-
additionalProperty?: factory.propertyValue.IPropertyValue<string>[];
|
|
81
|
-
additionalTicketText?: string;
|
|
82
|
-
ticketOffer: factory.product.ITicketOffer;
|
|
83
|
-
seatPriceComponent: factory.place.seat.IPriceComponent[];
|
|
84
|
-
acceptedAddOns: IAcceptedAddOn[];
|
|
85
|
-
subReservation?: factory.reservation.ISubReservation<factory.reservationType.EventReservation>[];
|
|
86
|
-
programMembershipUsed?: factory.reservation.IProgramMembershipUsed<factory.reservationType.EventReservation>;
|
|
87
|
-
availableOffer: factory.unitPriceOffer.IUnitPriceOffer;
|
|
88
|
-
appliesToMovieTicket?: factory.assetTransaction.reserve.IAcceptedAppliesToMovieTicket;
|
|
89
|
-
validateAppliesToMovieTicket: boolean;
|
|
90
|
-
}): IObjectSubReservation;
|
|
91
|
-
export declare function createPotentialActions(params: {
|
|
92
|
-
order?: Pick<factory.order.IOrder, 'orderNumber' | 'customer' | 'typeOf'>;
|
|
93
|
-
}): {
|
|
94
|
-
potentialActions: factory.assetTransaction.reserve.IPotentialActions;
|
|
95
|
-
underName?: factory.reservation.IUnderName<factory.reservationType.EventReservation>;
|
|
96
|
-
};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import * as factory from '../../../factory';
|
|
2
|
-
export declare function createStartParams(params: factory.transaction.placeOrder.IStartParamsWithoutDetail, expiresInSeconds: number, passport: factory.waiter.passport.IPassport | undefined, seller: Pick<factory.seller.ISeller, 'id' | 'name' | 'typeOf' | 'project' | 'additionalProperty'>, broker?: factory.order.IBroker, customerType?: string, memeberOfPayload?: factory.transaction.placeOrder.IMemberOfPayload): factory.transaction.placeOrder.IStartParams;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createStartParams = void 0;
|
|
4
|
-
const factory = require("../../../factory");
|
|
5
|
-
function createStartParams(params, expiresInSeconds, passport, seller, broker, customerType, memeberOfPayload) {
|
|
6
|
-
var _a, _b, _c, _d, _e;
|
|
7
|
-
let clientUser;
|
|
8
|
-
let instrument;
|
|
9
|
-
if (typeof ((_a = params.object.clientUser) === null || _a === void 0 ? void 0 : _a.client_id) === 'string') {
|
|
10
|
-
const { sub, token_use, iss, exp, iat, version, jti, client_id, username, aud, typ } = params.object.clientUser;
|
|
11
|
-
clientUser = { sub, token_use, iss, exp, iat, version, jti, client_id, username, aud, typ };
|
|
12
|
-
instrument = { id: client_id, typeOf: factory.creativeWorkType.WebApplication };
|
|
13
|
-
}
|
|
14
|
-
const transactionObject = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (typeof ((_b = params.object.passport) === null || _b === void 0 ? void 0 : _b.token) === 'string') ? { passportToken: params.object.passport.token } : undefined), (typeof (passport === null || passport === void 0 ? void 0 : passport.scope) === 'string') ? { passport } : undefined), (typeof (clientUser === null || clientUser === void 0 ? void 0 : clientUser.client_id) === 'string') ? { clientUser } : undefined), (typeof ((_c = params.object) === null || _c === void 0 ? void 0 : _c.name) === 'string') ? { name: (_d = params.object) === null || _d === void 0 ? void 0 : _d.name } : undefined), (typeof (broker === null || broker === void 0 ? void 0 : broker.typeOf) === 'string') ? { broker: broker } : undefined), (typeof ((_e = params.object.customer) === null || _e === void 0 ? void 0 : _e.typeOf) === 'string') ? { customer: params.object.customer } : undefined), (typeof customerType === 'string') ? { customerType } : undefined);
|
|
15
|
-
if (typeof seller.id !== 'string') {
|
|
16
|
-
throw new factory.errors.NotFound('seller.id');
|
|
17
|
-
}
|
|
18
|
-
if (typeof expiresInSeconds !== 'number') {
|
|
19
|
-
throw new factory.errors.ArgumentNull('expiresInSeconds');
|
|
20
|
-
}
|
|
21
|
-
const agent = Object.assign(Object.assign({}, params.agent), (memeberOfPayload !== undefined) ? { memeberOfPayload } : undefined);
|
|
22
|
-
return Object.assign({ project: { typeOf: seller.project.typeOf, id: seller.project.id }, typeOf: factory.transactionType.PlaceOrder, agent, seller: {
|
|
23
|
-
id: seller.id,
|
|
24
|
-
name: seller.name,
|
|
25
|
-
typeOf: seller.typeOf,
|
|
26
|
-
additionalProperty: (Array.isArray(seller.additionalProperty)) ? seller.additionalProperty : [] // 追加特性を追加(2023-08-08~)
|
|
27
|
-
}, object: transactionObject, expiresInSeconds }, (typeof (instrument === null || instrument === void 0 ? void 0 : instrument.id) === 'string') ? { instrument } : undefined);
|
|
28
|
-
}
|
|
29
|
-
exports.createStartParams = createStartParams;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 取引バリデーション
|
|
3
|
-
*/
|
|
4
|
-
import * as jwt from 'jsonwebtoken';
|
|
5
|
-
import * as factory from '../../factory';
|
|
6
|
-
import { IPassportValidator } from '../../factory/transaction';
|
|
7
|
-
export type IStartParams = (factory.transaction.placeOrder.IStartParamsWithoutDetail | factory.transaction.moneyTransfer.IStartParamsWithoutDetail) & {
|
|
8
|
-
passportValidator?: IPassportValidator;
|
|
9
|
-
};
|
|
10
|
-
export declare function createPassport(params: string | jwt.JwtPayload | undefined): factory.waiter.passport.IPassport;
|
|
11
|
-
export declare function validateWaiterPassport(params: IStartParams): Promise<{
|
|
12
|
-
passport: factory.waiter.passport.IPassport | undefined;
|
|
13
|
-
customerType?: string;
|
|
14
|
-
}>;
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.validateWaiterPassport = exports.createPassport = void 0;
|
|
13
|
-
/**
|
|
14
|
-
* 取引バリデーション
|
|
15
|
-
*/
|
|
16
|
-
const jwt = require("jsonwebtoken");
|
|
17
|
-
const factory = require("../../factory");
|
|
18
|
-
function createPassport(params) {
|
|
19
|
-
var _a;
|
|
20
|
-
if (typeof params === 'string' || params === undefined) {
|
|
21
|
-
throw new factory.errors.Argument('decoded must be an object');
|
|
22
|
-
}
|
|
23
|
-
// eslint-disable-next-line no-magic-numbers
|
|
24
|
-
if (typeof params.scope !== 'string' || params.scope.length === 0) {
|
|
25
|
-
throw new factory.errors.ArgumentNull('scope');
|
|
26
|
-
}
|
|
27
|
-
if (typeof params.iat !== 'number') {
|
|
28
|
-
throw new factory.errors.Argument('iat', 'iat must be number');
|
|
29
|
-
}
|
|
30
|
-
if (typeof params.exp !== 'number') {
|
|
31
|
-
throw new factory.errors.Argument('exp', 'exp must be number');
|
|
32
|
-
}
|
|
33
|
-
// eslint-disable-next-line no-magic-numbers
|
|
34
|
-
if (typeof params.iss !== 'string' || params.iss.length === 0) {
|
|
35
|
-
throw new factory.errors.ArgumentNull('iss');
|
|
36
|
-
}
|
|
37
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, no-magic-numbers
|
|
38
|
-
if (typeof ((_a = params.issueUnit) === null || _a === void 0 ? void 0 : _a.identifier) !== 'string' || params.issueUnit.identifier.length === 0) {
|
|
39
|
-
throw new factory.errors.Argument('issueUnit.identifier', 'issueUnit.identifier must be string');
|
|
40
|
-
}
|
|
41
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
42
|
-
if (typeof params.issueUnit.numberOfRequests !== 'number') {
|
|
43
|
-
throw new factory.errors.Argument('issueUnit.numberOfRequests', 'issueUnit.numberOfRequests must be number');
|
|
44
|
-
}
|
|
45
|
-
return Object.assign({ scope: params.scope, iat: params.iat, exp: params.exp, iss: params.iss,
|
|
46
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
47
|
-
project: params.project,
|
|
48
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
49
|
-
issueUnit: params.issueUnit }, (Array.isArray(params.aud)) ? { aud: params.aud } : undefined);
|
|
50
|
-
}
|
|
51
|
-
exports.createPassport = createPassport;
|
|
52
|
-
/**
|
|
53
|
-
* 暗号化された許可証を検証する
|
|
54
|
-
*/
|
|
55
|
-
function verify(params) {
|
|
56
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
return new Promise((resolve, reject) => {
|
|
58
|
-
jwt.verify(params.token, params.secret, (err, decoded) => {
|
|
59
|
-
if (err instanceof Error) {
|
|
60
|
-
reject(err);
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
const passport = createPassport(decoded);
|
|
64
|
-
resolve(passport);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
function validateWaiterPassport(params) {
|
|
71
|
-
var _a, _b;
|
|
72
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
-
let passport;
|
|
74
|
-
let customerType;
|
|
75
|
-
// WAITER許可証トークンがあれば検証する
|
|
76
|
-
if (typeof ((_b = (_a = params.object) === null || _a === void 0 ? void 0 : _a.passport) === null || _b === void 0 ? void 0 : _b.token) === 'string') {
|
|
77
|
-
try {
|
|
78
|
-
passport = yield verify({
|
|
79
|
-
token: params.object.passport.token,
|
|
80
|
-
secret: params.object.passport.secret
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
catch (error) {
|
|
84
|
-
throw new factory.errors.Argument('Passport Token', `Invalid token: ${error.message}`);
|
|
85
|
-
}
|
|
86
|
-
// 許可証バリデーション
|
|
87
|
-
if (typeof params.passportValidator === 'function') {
|
|
88
|
-
if (!params.passportValidator({ passport: passport })) {
|
|
89
|
-
throw new factory.errors.Argument('Passport Token', 'Invalid passport');
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
// カスタマータイプ決定(2023-11-20~)
|
|
93
|
-
// スコープのフォーマットは、Transaction:${TransactionType}:${sellerId}:${customerType}
|
|
94
|
-
const splittedScope = passport.scope.split(':');
|
|
95
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
96
|
-
customerType = splittedScope[3];
|
|
97
|
-
}
|
|
98
|
-
return Object.assign(Object.assign({}, (typeof customerType === 'string') ? { customerType } : undefined), { passport });
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
exports.validateWaiterPassport = validateWaiterPassport;
|