@chevre/domain 20.1.0-alpha.9 → 20.2.0-alpha.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/deleteReservationTicketUnderNames.ts +20 -0
- package/example/src/chevre/migrateAccountTitleAdditionalProperties.ts +157 -0
- package/example/src/chevre/migrateCreativeWorkAdditionalProperties.ts +116 -0
- package/example/src/chevre/migrateEventOffersSellerMakesOffer.ts +17 -5
- package/example/src/chevre/migrateEventProjectAttributes.ts +57 -0
- package/example/src/chevre/migratePlaceAdditionalProperties.ts +162 -0
- package/example/src/chevre/migrateSSKTEventCOAEndpoint.ts +64 -0
- package/example/src/chevre/searchEvents.ts +36 -16
- package/example/src/chevre/transaction/callOrderMembershipServiceTask.ts +0 -4
- package/example/src/chevre/transaction/orderMembershipService.ts +0 -4
- package/lib/chevre/factory/reservedAgentIdentifireNames.d.ts +1 -0
- package/lib/chevre/factory/reservedAgentIdentifireNames.js +12 -0
- package/lib/chevre/repo/accountAction.d.ts +0 -18
- package/lib/chevre/repo/accountAction.js +402 -355
- package/lib/chevre/repo/accountTitle.d.ts +1 -0
- package/lib/chevre/repo/accountTitle.js +6 -1
- package/lib/chevre/repo/additionalProperty.d.ts +35 -0
- package/lib/chevre/repo/additionalProperty.js +205 -0
- package/lib/chevre/repo/categoryCode.d.ts +1 -0
- package/lib/chevre/repo/categoryCode.js +15 -1
- package/lib/chevre/repo/creativeWork.js +10 -1
- package/lib/chevre/repo/customer.d.ts +1 -0
- package/lib/chevre/repo/customer.js +5 -0
- package/lib/chevre/repo/event.d.ts +12 -4
- package/lib/chevre/repo/event.js +84 -48
- package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -0
- package/lib/chevre/repo/merchantReturnPolicy.js +5 -0
- package/lib/chevre/repo/mongoose/model/additionalProperty.d.ts +7 -0
- package/lib/chevre/repo/mongoose/model/additionalProperty.js +81 -0
- package/lib/chevre/repo/mongoose/model/categoryCode.js +18 -2
- package/lib/chevre/repo/mongoose/model/creativeWork.js +6 -0
- package/lib/chevre/repo/mongoose/model/event.js +6 -0
- package/lib/chevre/repo/mongoose/model/offer.js +7 -1
- package/lib/chevre/repo/mongoose/model/offerCatalog.js +21 -2
- package/lib/chevre/repo/mongoose/model/ownershipInfo.js +3 -15
- package/lib/chevre/repo/mongoose/model/place.js +24 -0
- package/lib/chevre/repo/mongoose/model/trip.d.ts +7 -0
- package/lib/chevre/repo/mongoose/model/trip.js +51 -0
- package/lib/chevre/repo/offer.js +10 -1
- package/lib/chevre/repo/offerCatalog.js +10 -10
- package/lib/chevre/repo/person.js +4 -1
- package/lib/chevre/repo/place.d.ts +1 -0
- package/lib/chevre/repo/place.js +55 -8
- package/lib/chevre/repo/reservation.d.ts +17 -2
- package/lib/chevre/repo/reservation.js +41 -1
- package/lib/chevre/repo/transaction.js +20 -5
- package/lib/chevre/repo/trip.d.ts +54 -0
- package/lib/chevre/repo/trip.js +222 -0
- package/lib/chevre/repository.d.ts +9 -3
- package/lib/chevre/repository.js +13 -5
- package/lib/chevre/service/account.d.ts +0 -4
- package/lib/chevre/service/account.js +24 -22
- package/lib/chevre/service/accountTransaction/deposit.d.ts +0 -2
- package/lib/chevre/service/accountTransaction/deposit.js +3 -3
- package/lib/chevre/service/accountTransaction/transfer.d.ts +0 -2
- package/lib/chevre/service/accountTransaction/transfer.js +3 -3
- package/lib/chevre/service/accountTransaction/withdraw.d.ts +0 -2
- package/lib/chevre/service/accountTransaction/withdraw.js +3 -3
- package/lib/chevre/service/assetTransaction/cancelReservation/factory.js +86 -42
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +7 -18
- package/lib/chevre/service/assetTransaction/reserve/factory.js +81 -113
- package/lib/chevre/service/assetTransaction/reserve.js +41 -95
- package/lib/chevre/service/event.js +20 -6
- package/lib/chevre/service/offer/event/authorize.d.ts +3 -0
- package/lib/chevre/service/offer/event/authorize.js +32 -21
- package/lib/chevre/service/offer/event/factory.d.ts +1 -1
- package/lib/chevre/service/offer/event/factory.js +17 -12
- package/lib/chevre/service/offer/eventServiceByCOA/factory.js +19 -9
- package/lib/chevre/service/offer/factory.js +7 -20
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +32 -22
- package/lib/chevre/service/reserve/cancelReservation.d.ts +5 -5
- package/lib/chevre/service/reserve/cancelReservation.js +260 -107
- package/lib/chevre/service/reserve/confirmReservation.js +65 -33
- package/lib/chevre/service/reserve/factory.d.ts +14 -2
- package/lib/chevre/service/reserve/factory.js +13 -6
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +85 -30
- package/lib/chevre/service/task/confirmReserveTransaction.js +1 -1
- package/lib/chevre/service/transaction/orderProgramMembership.js +15 -28
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +1 -0
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +14 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +9 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +10 -6
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.d.ts +3 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.js +3 -2
- package/lib/chevre/service/transaction/placeOrderInProgress.js +16 -2
- package/lib/chevre/service/transaction/returnOrder.js +10 -1
- package/lib/chevre/service.d.ts +2 -0
- package/lib/chevre/service.js +2 -0
- package/package.json +4 -4
- package/example/src/chevre/accountBlanceTest.ts +0 -24
- package/example/src/chevre/checkOffersAppliesToMovieTicket.ts +0 -56
- package/example/src/chevre/createSeats.ts +0 -59
- package/example/src/chevre/deleteEvents.ts +0 -50
- package/example/src/chevre/manageOwnedByOfOwnershipInfo.ts +0 -35
- package/example/src/chevre/migrateMovieTicketChargePriceSpecs.ts +0 -92
- package/example/src/chevre/migrateSellerMakesOffers.ts +0 -84
- package/example/src/chevre/migrateTTTSOldEventId.ts +0 -68
- package/example/src/chevre/publishConfirmationNumber.ts +0 -30
- package/example/src/chevre/publishServiceOutputIdentifier.ts +0 -28
- package/example/src/chevre/publishTransactionNumber.ts +0 -28
- package/example/src/chevre/renameTransaction.ts +0 -22
- package/lib/chevre/service/task/accountMoneyTransfer.d.ts +0 -3
- package/lib/chevre/service/task/accountMoneyTransfer.js +0 -31
- package/lib/chevre/service/task/cancelAccountMoneyTransfer.d.ts +0 -3
- package/lib/chevre/service/task/cancelAccountMoneyTransfer.js +0 -33
|
@@ -5,10 +5,22 @@ export interface IProject {
|
|
|
5
5
|
id: string;
|
|
6
6
|
typeOf: factory.organizationType.Project;
|
|
7
7
|
}
|
|
8
|
+
export declare type ISubReservation = Omit<IEventReservation, 'broker' | 'project' | 'reservationFor' | 'reservationNumber' | 'reservationStatus' | 'underName'>;
|
|
9
|
+
/**
|
|
10
|
+
* 確定予約通知
|
|
11
|
+
*/
|
|
12
|
+
export interface IReservationPackage4informConfirmed {
|
|
13
|
+
project: IProject;
|
|
14
|
+
reservationFor: factory.reservation.IReservationFor<factory.reservationType.EventReservation>;
|
|
15
|
+
reservationNumber: string;
|
|
16
|
+
reservationStatus: factory.reservationStatusType;
|
|
17
|
+
subReservation: ISubReservation[];
|
|
18
|
+
underName?: factory.reservation.IUnderName<factory.reservationType.EventReservation>;
|
|
19
|
+
typeOf: factory.reservationType.ReservationPackage;
|
|
20
|
+
}
|
|
8
21
|
/**
|
|
9
22
|
* 確定予約通知
|
|
10
23
|
*/
|
|
11
|
-
export declare type IReservation4informConfirmed = IEventReservation;
|
|
12
24
|
/**
|
|
13
25
|
* 予約取消通知
|
|
14
26
|
*/
|
|
@@ -44,7 +56,7 @@ export interface IReservation4informUsed {
|
|
|
44
56
|
dateUsed?: Date;
|
|
45
57
|
};
|
|
46
58
|
}
|
|
47
|
-
export declare type IReservation4inform =
|
|
59
|
+
export declare type IReservation4inform = IReservationPackage4informConfirmed | IReservation4informCanceled | IReservation4informCheckedIn | IReservation4informUsed;
|
|
48
60
|
export declare type IInformObject = IReservation4inform[];
|
|
49
61
|
export declare type InformReservationActionattributes = factory.action.interact.inform.IAttributes<IInformObject, any>;
|
|
50
62
|
export declare const NUM_TRY_INFORM_RESERVATION: number;
|
|
@@ -3,13 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.NUM_TRY_INFORM_RESERVATION = exports.maskUnderName = void 0;
|
|
4
4
|
const MASKED_PROFILE = '****';
|
|
5
5
|
function maskUnderName(reservation) {
|
|
6
|
-
|
|
6
|
+
// 予約後を隠蔽(2022-12-24~)
|
|
7
|
+
// const underNameIdentifiers: factory.propertyValue.IPropertyValue<string>[] | undefined =
|
|
8
|
+
// (Array.isArray(reservation.underName?.identifier))
|
|
9
|
+
// ? reservation.underName?.identifier.filter((p) => {
|
|
10
|
+
// return !RESERVED_AGENT_IDENTIFIER_NAMES.includes(p.name);
|
|
11
|
+
// })
|
|
12
|
+
// : undefined;
|
|
13
|
+
var _a;
|
|
7
14
|
const underName = (typeof ((_a = reservation.underName) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
|
|
8
|
-
? Object.assign(Object.assign({}, reservation.underName), { email: MASKED_PROFILE, telephone: MASKED_PROFILE, name: MASKED_PROFILE, familyName: MASKED_PROFILE, givenName: MASKED_PROFILE
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return Object.assign(Object.assign(
|
|
15
|
+
? Object.assign(Object.assign({}, reservation.underName), { email: MASKED_PROFILE, telephone: MASKED_PROFILE, name: MASKED_PROFILE, familyName: MASKED_PROFILE, givenName: MASKED_PROFILE,
|
|
16
|
+
// ... (Array.isArray(underNameIdentifiers)) ? { identifier: underNameIdentifiers } : undefined,
|
|
17
|
+
// identifierも隠蔽(2022-12-27~)
|
|
18
|
+
identifier: [] }) : undefined;
|
|
19
|
+
return Object.assign(Object.assign({}, reservation), (underName !== undefined) ? { underName } : undefined);
|
|
13
20
|
}
|
|
14
21
|
exports.maskUnderName = maskUnderName;
|
|
15
22
|
exports.NUM_TRY_INFORM_RESERVATION = 10;
|
|
@@ -7,7 +7,7 @@ declare type IEventReservation = factory.reservation.IReservation<factory.reserv
|
|
|
7
7
|
/**
|
|
8
8
|
* 予約確定後のアクション
|
|
9
9
|
*/
|
|
10
|
-
export declare function onReservationConfirmedByAction(actionAttributes: factory.action.reserve.IAttributes
|
|
10
|
+
export declare function onReservationConfirmedByAction(actionAttributes: factory.action.reserve.IAttributes): (repos: {
|
|
11
11
|
task: TaskRepo;
|
|
12
12
|
}) => Promise<void>;
|
|
13
13
|
export declare function onReservationConfirmed(confirmedReservations: IEventReservation[]): (repos: {
|
|
@@ -8,6 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
11
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
23
|
exports.onReservationConfirmed = exports.onReservationConfirmedByAction = void 0;
|
|
13
24
|
/**
|
|
@@ -21,7 +32,9 @@ const informReservations = settings_1.settings.onReservationStatusChanged.inform
|
|
|
21
32
|
/**
|
|
22
33
|
* 予約確定後のアクション
|
|
23
34
|
*/
|
|
24
|
-
function onReservationConfirmedByAction(actionAttributes
|
|
35
|
+
function onReservationConfirmedByAction(actionAttributes
|
|
36
|
+
// confirmedReservation: IEventReservation
|
|
37
|
+
) {
|
|
25
38
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
26
39
|
const potentialActions = actionAttributes.potentialActions;
|
|
27
40
|
const now = new Date();
|
|
@@ -45,35 +58,34 @@ function onReservationConfirmedByAction(actionAttributes, confirmedReservation)
|
|
|
45
58
|
}
|
|
46
59
|
}
|
|
47
60
|
// inform galobally
|
|
48
|
-
if (Array.isArray(informReservations)) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
61
|
+
// if (Array.isArray(informReservations)) {
|
|
62
|
+
// const reservation4inform: IReservation4informConfirmed = maskUnderName(confirmedReservation);
|
|
63
|
+
// taskAttributes.push(...informReservations.map<ITriggerWebhookTaskAttributes>((informReservation) => {
|
|
64
|
+
// const informUrl: string = String(informReservation.recipient?.url);
|
|
65
|
+
// const informReservationAttributes: InformReservationActionattributes = {
|
|
66
|
+
// agent: confirmedReservation.project,
|
|
67
|
+
// object: [reservation4inform],
|
|
68
|
+
// project: confirmedReservation.project,
|
|
69
|
+
// recipient: {
|
|
70
|
+
// id: '',
|
|
71
|
+
// name: informUrl,
|
|
72
|
+
// typeOf: factory.creativeWorkType.WebApplication,
|
|
73
|
+
// url: informUrl
|
|
74
|
+
// },
|
|
75
|
+
// typeOf: factory.actionType.InformAction
|
|
76
|
+
// };
|
|
77
|
+
// return {
|
|
78
|
+
// project: actionAttributes.project,
|
|
79
|
+
// name: factory.taskName.TriggerWebhook,
|
|
80
|
+
// status: factory.taskStatus.Ready,
|
|
81
|
+
// runsAt: now,
|
|
82
|
+
// remainingNumberOfTries: NUM_TRY_INFORM_RESERVATION,
|
|
83
|
+
// numberOfTried: 0,
|
|
84
|
+
// executionResults: [],
|
|
85
|
+
// data: informReservationAttributes
|
|
86
|
+
// };
|
|
87
|
+
// }));
|
|
88
|
+
// }
|
|
77
89
|
// タスク保管
|
|
78
90
|
if (taskAttributes.length > 0) {
|
|
79
91
|
yield repos.task.saveMany(taskAttributes);
|
|
@@ -88,6 +100,49 @@ function onReservationConfirmed(confirmedReservations) {
|
|
|
88
100
|
project: confirmedReservations[0].project,
|
|
89
101
|
reservationFor: { id: confirmedReservations[0].reservationFor.id }
|
|
90
102
|
})({ task: repos.task });
|
|
103
|
+
const now = new Date();
|
|
104
|
+
const taskAttributes = [];
|
|
105
|
+
// inform galobally
|
|
106
|
+
if (Array.isArray(informReservations)) {
|
|
107
|
+
taskAttributes.push(...informReservations.map((informReservation) => {
|
|
108
|
+
var _a, _b;
|
|
109
|
+
const informUrl = String((_a = informReservation.recipient) === null || _a === void 0 ? void 0 : _a.url);
|
|
110
|
+
// ReservationPackage通知に変更(2022-12-24~)
|
|
111
|
+
// const informObject: IInformObject = confirmedReservations.map(maskUnderName);
|
|
112
|
+
const informObject = [Object.assign({ project: confirmedReservations[0].project, reservationFor: confirmedReservations[0].reservationFor, reservationNumber: confirmedReservations[0].reservationNumber, reservationStatus: confirmedReservations[0].reservationStatus, subReservation: confirmedReservations.map((r) => {
|
|
113
|
+
const { broker, project, reservationFor, reservationNumber, reservationStatus, underName } = r, subReservation = __rest(r, ["broker", "project", "reservationFor", "reservationNumber", "reservationStatus", "underName"]);
|
|
114
|
+
return subReservation;
|
|
115
|
+
}), typeOf: factory.reservationType.ReservationPackage }, (typeof ((_b = confirmedReservations[0].underName) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string')
|
|
116
|
+
? { underName: (0, factory_1.maskUnderName)(confirmedReservations[0]).underName }
|
|
117
|
+
: undefined)];
|
|
118
|
+
const informReservationAttributes = {
|
|
119
|
+
agent: confirmedReservations[0].project,
|
|
120
|
+
object: informObject,
|
|
121
|
+
project: confirmedReservations[0].project,
|
|
122
|
+
recipient: {
|
|
123
|
+
id: '',
|
|
124
|
+
name: informUrl,
|
|
125
|
+
typeOf: factory.creativeWorkType.WebApplication,
|
|
126
|
+
url: informUrl
|
|
127
|
+
},
|
|
128
|
+
typeOf: factory.actionType.InformAction
|
|
129
|
+
};
|
|
130
|
+
return {
|
|
131
|
+
project: confirmedReservations[0].project,
|
|
132
|
+
name: factory.taskName.TriggerWebhook,
|
|
133
|
+
status: factory.taskStatus.Ready,
|
|
134
|
+
runsAt: now,
|
|
135
|
+
remainingNumberOfTries: factory_1.NUM_TRY_INFORM_RESERVATION,
|
|
136
|
+
numberOfTried: 0,
|
|
137
|
+
executionResults: [],
|
|
138
|
+
data: informReservationAttributes
|
|
139
|
+
};
|
|
140
|
+
}));
|
|
141
|
+
}
|
|
142
|
+
// タスク保管
|
|
143
|
+
if (taskAttributes.length > 0) {
|
|
144
|
+
yield repos.task.saveMany(taskAttributes);
|
|
145
|
+
}
|
|
91
146
|
}
|
|
92
147
|
});
|
|
93
148
|
}
|
|
@@ -72,7 +72,7 @@ function confirmReserveTransaction(params) {
|
|
|
72
72
|
object = object;
|
|
73
73
|
yield ReserveTransactionService.confirm({
|
|
74
74
|
transactionNumber: object.transactionNumber,
|
|
75
|
-
object: object.object,
|
|
75
|
+
// object: object.object,
|
|
76
76
|
potentialActions: object.potentialActions
|
|
77
77
|
})(repos);
|
|
78
78
|
}
|
|
@@ -15,7 +15,6 @@ exports.orderProgramMembership = exports.ISS_PREFIX = void 0;
|
|
|
15
15
|
*/
|
|
16
16
|
const GMO = require("@motionpicture/gmo-service");
|
|
17
17
|
const createDebug = require("debug");
|
|
18
|
-
const moment = require("moment-timezone");
|
|
19
18
|
const accountTransactionIdentifier_1 = require("../../factory/accountTransactionIdentifier");
|
|
20
19
|
const OfferService = require("../offer");
|
|
21
20
|
const AnyPaymentService = require("../payment/any");
|
|
@@ -32,34 +31,20 @@ exports.ISS_PREFIX = 'https://cognito-idp.ap-northeast-1.amazonaws.com/';
|
|
|
32
31
|
*/
|
|
33
32
|
function orderProgramMembership(params, paymentMethodType) {
|
|
34
33
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
|
|
36
|
-
// if (Array.isArray(params.agent.identifier)) {
|
|
37
|
-
// const issByAgent = params.agent.identifier?.find((p) => p.name === 'iss')?.value;
|
|
38
|
-
// if (typeof issByAgent === 'string' && issByAgent.length > 0) {
|
|
39
|
-
// iss = issByAgent.replace(ISS_PREFIX, '');
|
|
40
|
-
// }
|
|
41
|
-
// }
|
|
42
|
-
var _a, _b, _c, _d, _e;
|
|
34
|
+
var _a, _b, _c;
|
|
43
35
|
// ユーザー存在確認(管理者がマニュアルでユーザーを削除する可能性があるので)
|
|
44
36
|
const customer = yield repos.person.findById({ userId: String(params.agent.id) });
|
|
45
|
-
// iss
|
|
46
|
-
|
|
47
|
-
if (
|
|
48
|
-
issByCustomer = (_b = (_a = customer.identifier) === null || _a === void 0 ? void 0 : _a.find((p) => p.name === 'iss')) === null || _b === void 0 ? void 0 : _b.value;
|
|
49
|
-
}
|
|
50
|
-
if (typeof issByCustomer === 'string' && issByCustomer.length > 0) {
|
|
51
|
-
// iss = issByCustomer.replace(ISS_PREFIX, '');
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
37
|
+
// issに依存するので存在確認
|
|
38
|
+
const issByCustomer = (_b = (_a = customer.identifier) === null || _a === void 0 ? void 0 : _a.find((p) => p.name === 'iss')) === null || _b === void 0 ? void 0 : _b.value;
|
|
39
|
+
if (typeof issByCustomer !== 'string' || issByCustomer.length === 0) {
|
|
54
40
|
throw new factory.errors.NotFound(`iss of customer ${customer.id}`);
|
|
55
41
|
}
|
|
56
42
|
const acceptedOffer = params.object;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
43
|
+
const sellerId = (_c = acceptedOffer.seller) === null || _c === void 0 ? void 0 : _c.id;
|
|
44
|
+
// if (typeof sellerId !== 'string') {
|
|
45
|
+
// // 互換性維持対応として↓
|
|
46
|
+
// sellerId = (<any>acceptedOffer.itemOffered)?.hostingOrganization?.id;
|
|
47
|
+
// }
|
|
63
48
|
if (typeof sellerId !== 'string') {
|
|
64
49
|
throw new factory.errors.NotFound('acceptedOffer seller ID undefined');
|
|
65
50
|
}
|
|
@@ -123,10 +108,12 @@ function createStartPlaceOrderInProgressParams(params) {
|
|
|
123
108
|
};
|
|
124
109
|
return {
|
|
125
110
|
project: { typeOf: factory.organizationType.Project, id: params.project.id },
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
111
|
+
// expiresInSeconds指定に変更(2022-11-29~)
|
|
112
|
+
// expires: moment()
|
|
113
|
+
// // tslint:disable-next-line:no-magic-numbers
|
|
114
|
+
// .add(5, 'minutes')
|
|
115
|
+
// .toDate(),
|
|
116
|
+
expiresInSeconds: 300,
|
|
130
117
|
agent,
|
|
131
118
|
seller: { id: params.seller.id },
|
|
132
119
|
object: {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as factory from '../../../../factory';
|
|
2
|
+
export declare type IPlaceOrderTransactionAsInformObject = Pick<factory.transaction.ITransaction<factory.transactionType.PlaceOrder>, 'id' | 'typeOf' | 'agent' | 'endDate' | 'expires' | 'project' | 'seller' | 'result' | 'startDate' | 'status'>;
|
|
2
3
|
/**
|
|
3
4
|
* 取引のタスクを作成する
|
|
4
5
|
*/
|
|
@@ -15,6 +15,18 @@ function createTasks(params) {
|
|
|
15
15
|
const taskRunsAt = params.runsAt;
|
|
16
16
|
const transactionWebhookUrls = (Array.isArray(settings_1.settings.transactionWebhookUrls)) ? settings_1.settings.transactionWebhookUrls : [];
|
|
17
17
|
const triggerWebhookTaskAttributes = transactionWebhookUrls.map((webhookUrl) => {
|
|
18
|
+
const informObject = {
|
|
19
|
+
id: transaction.id,
|
|
20
|
+
typeOf: transaction.typeOf,
|
|
21
|
+
agent: transaction.agent,
|
|
22
|
+
endDate: transaction.endDate,
|
|
23
|
+
expires: transaction.expires,
|
|
24
|
+
project: transaction.project,
|
|
25
|
+
seller: transaction.seller,
|
|
26
|
+
result: transaction.result,
|
|
27
|
+
startDate: transaction.startDate,
|
|
28
|
+
status: transaction.status
|
|
29
|
+
};
|
|
18
30
|
return {
|
|
19
31
|
project: transaction.project,
|
|
20
32
|
name: factory.taskName.TriggerWebhook,
|
|
@@ -25,7 +37,8 @@ function createTasks(params) {
|
|
|
25
37
|
executionResults: [],
|
|
26
38
|
data: {
|
|
27
39
|
agent: transaction.project,
|
|
28
|
-
|
|
40
|
+
// 通知内容最適化(2022-12-28~)
|
|
41
|
+
object: informObject,
|
|
29
42
|
project: transaction.project,
|
|
30
43
|
purpose: { typeOf: transaction.typeOf, id: transaction.id },
|
|
31
44
|
recipient: {
|
|
@@ -10,7 +10,9 @@ function createStartParams(params, passport, seller, broker) {
|
|
|
10
10
|
if (typeof seller.id !== 'string') {
|
|
11
11
|
throw new factory.errors.NotFound('seller.id');
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
if (typeof params.expiresInSeconds !== 'number') {
|
|
14
|
+
throw new factory.errors.ArgumentNull('expiresInSeconds');
|
|
15
|
+
}
|
|
14
16
|
return {
|
|
15
17
|
project: { typeOf: seller.project.typeOf, id: seller.project.id },
|
|
16
18
|
typeOf: factory.transactionType.PlaceOrder,
|
|
@@ -19,11 +21,14 @@ function createStartParams(params, passport, seller, broker) {
|
|
|
19
21
|
id: seller.id,
|
|
20
22
|
name: seller.name,
|
|
21
23
|
typeOf: seller.typeOf
|
|
22
|
-
// ↓最適化(2022-05-24~)
|
|
23
|
-
// ...{ project: seller.project }
|
|
24
24
|
},
|
|
25
25
|
object: transactionObject,
|
|
26
|
-
expires: params.expires
|
|
26
|
+
// expires: params.expires,
|
|
27
|
+
expiresInSeconds: params.expiresInSeconds
|
|
28
|
+
// 販売者にexpires設定があれば適用
|
|
29
|
+
// ...(typeof makesOfferFromClient?.eligibleTransactionDuration?.maxValue === 'number')
|
|
30
|
+
// ? { expiresInSeconds: makesOfferFromClient.eligibleTransactionDuration.maxValue }
|
|
31
|
+
// : undefined
|
|
27
32
|
};
|
|
28
33
|
}
|
|
29
34
|
exports.createStartParams = createStartParams;
|
|
@@ -35,25 +35,29 @@ function createReservationAcceptedOffers(params) {
|
|
|
35
35
|
}
|
|
36
36
|
exports.createReservationAcceptedOffers = createReservationAcceptedOffers;
|
|
37
37
|
function reservationOffers2orderedItem(params) {
|
|
38
|
-
var _a, _b, _c, _d
|
|
38
|
+
var _a, _b, _c, _d;
|
|
39
39
|
const reservationFor = params.reservationFor;
|
|
40
40
|
const issuedThrough = params.issuedThrough;
|
|
41
41
|
const reservationFor4orderedItem = {
|
|
42
42
|
location: {
|
|
43
43
|
branchCode: (_a = reservationFor.location) === null || _a === void 0 ? void 0 : _a.branchCode,
|
|
44
44
|
name: (_b = reservationFor.location) === null || _b === void 0 ? void 0 : _b.name,
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
// 不要なので廃止(2022-12-19~)
|
|
46
|
+
// project: reservationFor.location?.project,
|
|
47
|
+
typeOf: (_c = reservationFor.location) === null || _c === void 0 ? void 0 : _c.typeOf
|
|
47
48
|
},
|
|
48
|
-
|
|
49
|
+
// 不要なので廃止(2022-12-19~)
|
|
50
|
+
// project: reservationFor.project,
|
|
49
51
|
typeOf: reservationFor.typeOf,
|
|
50
52
|
id: reservationFor.id,
|
|
51
53
|
name: reservationFor.name,
|
|
52
54
|
startDate: reservationFor.startDate,
|
|
53
55
|
endDate: reservationFor.endDate
|
|
54
|
-
// eventStatus: reservationFor.eventStatus
|
|
55
56
|
};
|
|
56
|
-
return Object.assign(Object.assign({
|
|
57
|
+
return Object.assign(Object.assign({
|
|
58
|
+
// 不要なので廃止(2022-12-19~)
|
|
59
|
+
// project: reservationFor.project,
|
|
60
|
+
typeOf: issuedThrough.typeOf }, (typeof ((_d = issuedThrough.serviceType) === null || _d === void 0 ? void 0 : _d.typeOf) === 'string')
|
|
57
61
|
? { serviceType: issuedThrough.serviceType }
|
|
58
62
|
: undefined), { serviceOutput: {
|
|
59
63
|
typeOf: factory.reservationType.EventReservation,
|
|
@@ -8,12 +8,13 @@ function validateSeller(params) {
|
|
|
8
8
|
if (typeof clientId !== 'string' || clientId.length === 0) {
|
|
9
9
|
throw new factory.errors.ArgumentNull('client_id');
|
|
10
10
|
}
|
|
11
|
-
const makesOfferFromClient = (_b = params.seller.makesOffer) === null || _b === void 0 ? void 0 : _b.
|
|
11
|
+
const makesOfferFromClient = (_b = params.seller.makesOffer) === null || _b === void 0 ? void 0 : _b.find((offer) => {
|
|
12
12
|
var _a;
|
|
13
13
|
return (_a = offer.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.some((availableApplication) => availableApplication.id === clientId);
|
|
14
14
|
});
|
|
15
|
-
if (makesOfferFromClient
|
|
15
|
+
if (makesOfferFromClient === undefined) {
|
|
16
16
|
throw new factory.errors.Argument('seller', 'makes no offers');
|
|
17
17
|
}
|
|
18
|
+
return { makesOfferFromClient };
|
|
18
19
|
}
|
|
19
20
|
exports.validateSeller = validateSeller;
|
|
@@ -27,14 +27,28 @@ exports.POINT_AWARD_IDENTIFIER_NAME = 'pointAwardIdentifiers';
|
|
|
27
27
|
*/
|
|
28
28
|
function start(params) {
|
|
29
29
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
var _a;
|
|
30
31
|
const seller = yield repos.seller.findById({ id: params.seller.id });
|
|
32
|
+
let makesOfferFromClient;
|
|
31
33
|
// 販売者オファー検証(2022-10-14~)
|
|
32
34
|
if (params.validateSeller === true) {
|
|
33
|
-
(0, validateSeller_1.validateSeller)({ seller, clientUser: params.object.clientUser });
|
|
35
|
+
const validateSellerResult = (0, validateSeller_1.validateSeller)({ seller, clientUser: params.object.clientUser });
|
|
36
|
+
makesOfferFromClient = validateSellerResult.makesOfferFromClient;
|
|
34
37
|
}
|
|
35
38
|
const passport = yield (0, validation_2.validateWaiterPassport)(params);
|
|
39
|
+
// fix expiresInSeconds(2022-11-29~)
|
|
40
|
+
let expiresInSeconds;
|
|
41
|
+
if (typeof ((_a = makesOfferFromClient === null || makesOfferFromClient === void 0 ? void 0 : makesOfferFromClient.eligibleTransactionDuration) === null || _a === void 0 ? void 0 : _a.maxValue) === 'number') {
|
|
42
|
+
expiresInSeconds = makesOfferFromClient.eligibleTransactionDuration.maxValue;
|
|
43
|
+
}
|
|
44
|
+
else if (typeof params.expiresInSeconds === 'number') {
|
|
45
|
+
expiresInSeconds = params.expiresInSeconds;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
throw new factory.errors.ArgumentNull('expiresInSeconds');
|
|
49
|
+
}
|
|
36
50
|
// 取引ファクトリーで新しい進行中取引オブジェクトを作成
|
|
37
|
-
const startParams = (0, factory_1.createStartParams)(params, passport, seller, params.broker);
|
|
51
|
+
const startParams = (0, factory_1.createStartParams)(Object.assign(Object.assign({}, params), { expiresInSeconds }), passport, seller, params.broker);
|
|
38
52
|
let transaction;
|
|
39
53
|
try {
|
|
40
54
|
transaction = yield repos.transaction.start(startParams);
|
|
@@ -55,6 +55,14 @@ function start(params) {
|
|
|
55
55
|
returnPolicy: appliedReturnPolicy,
|
|
56
56
|
reason: params.object.reason
|
|
57
57
|
};
|
|
58
|
+
// fix expiresInSeconds(2022-11-30~)
|
|
59
|
+
let expiresInSeconds;
|
|
60
|
+
if (typeof params.expiresInSeconds === 'number') {
|
|
61
|
+
expiresInSeconds = params.expiresInSeconds;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
throw new factory.errors.ArgumentNull('expiresInSeconds');
|
|
65
|
+
}
|
|
58
66
|
const returnOrderAttributes = {
|
|
59
67
|
project: params.project,
|
|
60
68
|
typeOf: factory.transactionType.ReturnOrder,
|
|
@@ -65,7 +73,8 @@ function start(params) {
|
|
|
65
73
|
name: seller.name
|
|
66
74
|
},
|
|
67
75
|
object: transactionObject,
|
|
68
|
-
expires: params.expires
|
|
76
|
+
// expires: params.expires,
|
|
77
|
+
expiresInSeconds
|
|
69
78
|
};
|
|
70
79
|
let returnOrderTransaction;
|
|
71
80
|
try {
|
package/lib/chevre/service.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as AccountTransactionIdentifierFactory from './factory/accountTransactionIdentifier';
|
|
5
5
|
import * as OrderFactory from './factory/order';
|
|
6
|
+
import * as ReservedAgentIdentifireNamesFactory from './factory/reservedAgentIdentifireNames';
|
|
6
7
|
import * as AccountService from './service/account';
|
|
7
8
|
import * as AccountTransactionService from './service/accountTransaction';
|
|
8
9
|
import * as AggregationService from './service/aggregation';
|
|
@@ -46,4 +47,5 @@ export import util = UtilService;
|
|
|
46
47
|
export declare namespace factory {
|
|
47
48
|
export import accountTransactionIdentifier = AccountTransactionIdentifierFactory;
|
|
48
49
|
export import order = OrderFactory;
|
|
50
|
+
export import reservedAgentIdentifireNames = ReservedAgentIdentifireNamesFactory;
|
|
49
51
|
}
|
package/lib/chevre/service.js
CHANGED
|
@@ -6,6 +6,7 @@ exports.factory = exports.util = exports.transaction = exports.task = exports.re
|
|
|
6
6
|
*/
|
|
7
7
|
const AccountTransactionIdentifierFactory = require("./factory/accountTransactionIdentifier");
|
|
8
8
|
const OrderFactory = require("./factory/order");
|
|
9
|
+
const ReservedAgentIdentifireNamesFactory = require("./factory/reservedAgentIdentifireNames");
|
|
9
10
|
const AccountService = require("./service/account");
|
|
10
11
|
const AccountTransactionService = require("./service/accountTransaction");
|
|
11
12
|
const AggregationService = require("./service/aggregation");
|
|
@@ -52,4 +53,5 @@ var factory;
|
|
|
52
53
|
factory.accountTransactionIdentifier = AccountTransactionIdentifierFactory;
|
|
53
54
|
// tslint:disable-next-line:no-shadowed-variable
|
|
54
55
|
factory.order = OrderFactory;
|
|
56
|
+
factory.reservedAgentIdentifireNames = ReservedAgentIdentifireNamesFactory;
|
|
55
57
|
})(factory = exports.factory || (exports.factory = {}));
|
package/package.json
CHANGED
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.
|
|
13
|
-
"@cinerino/sdk": "3.
|
|
12
|
+
"@chevre/factory": "4.281.0-alpha.0",
|
|
13
|
+
"@cinerino/sdk": "3.135.0-alpha.6",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
16
16
|
"@sendgrid/mail": "6.4.0",
|
|
17
|
-
"@surfrock/sdk": "1.
|
|
17
|
+
"@surfrock/sdk": "1.2.0-alpha.0",
|
|
18
18
|
"@waiter/domain": "5.1.0",
|
|
19
19
|
"JSONStream": "^1.3.5",
|
|
20
20
|
"aws-sdk": "^2.984.0",
|
|
@@ -120,5 +120,5 @@
|
|
|
120
120
|
"postversion": "git push origin --tags",
|
|
121
121
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
122
122
|
},
|
|
123
|
-
"version": "20.
|
|
123
|
+
"version": "20.2.0-alpha.0"
|
|
124
124
|
}
|
|
@@ -1,24 +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
|
-
async function main() {
|
|
8
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
9
|
-
|
|
10
|
-
const accountRepo = new chevre.repository.Account(mongoose.connection);
|
|
11
|
-
|
|
12
|
-
// 不要な所有権を削除
|
|
13
|
-
const result = await accountRepo.authorizeAmount({
|
|
14
|
-
accountNumber: '139151625010963',
|
|
15
|
-
amount: 10,
|
|
16
|
-
transaction: <any>{ id: 'test' },
|
|
17
|
-
force: false
|
|
18
|
-
});
|
|
19
|
-
console.log('result:', result);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
main()
|
|
23
|
-
.then(console.log)
|
|
24
|
-
.catch(console.error);
|
|
@@ -1,56 +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 project = { id: String(process.env.PROJECT_ID) };
|
|
8
|
-
|
|
9
|
-
async function main() {
|
|
10
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
11
|
-
|
|
12
|
-
const offerRepo = new chevre.repository.Offer(mongoose.connection);
|
|
13
|
-
|
|
14
|
-
const cursor = offerRepo.getCursor(
|
|
15
|
-
{
|
|
16
|
-
// 'project.id': { $eq: project.id }
|
|
17
|
-
'priceSpecification.appliesToMovieTicket': {
|
|
18
|
-
$exists: true,
|
|
19
|
-
$type: 'array'
|
|
20
|
-
// $not: { $type: 'array' }
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
// _id: 1,
|
|
25
|
-
// ownedFrom: 1,
|
|
26
|
-
// typeOfGood: 1
|
|
27
|
-
}
|
|
28
|
-
);
|
|
29
|
-
console.log('offers found');
|
|
30
|
-
|
|
31
|
-
let i = 0;
|
|
32
|
-
let isArrayCount = 0;
|
|
33
|
-
let updateCount = 0;
|
|
34
|
-
await cursor.eachAsync(async (doc) => {
|
|
35
|
-
i += 1;
|
|
36
|
-
const offer = <chevre.factory.unitPriceOffer.IUnitPriceOffer>doc.toObject();
|
|
37
|
-
const applieToMovieTicket = offer.priceSpecification?.appliesToMovieTicket;
|
|
38
|
-
if (Array.isArray(applieToMovieTicket)) {
|
|
39
|
-
console.log('is Array', offer.project.id, offer.id, i);
|
|
40
|
-
isArrayCount += 1;
|
|
41
|
-
} else if (typeof (<any>applieToMovieTicket)?.typeOf === 'string') {
|
|
42
|
-
console.log('is not array', offer.project.id, offer.id, i);
|
|
43
|
-
updateCount += 1;
|
|
44
|
-
} else {
|
|
45
|
-
console.log('no applieToMovieTicket', offer.project.id, offer.id, i);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
console.log(i, 'offers checked');
|
|
50
|
-
console.log(isArrayCount, 'isArrayCount');
|
|
51
|
-
console.log(updateCount, 'offers updated');
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
main()
|
|
55
|
-
.then()
|
|
56
|
-
.catch(console.error);
|