@chevre/domain 21.27.0-alpha.21 → 21.27.0-alpha.23
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/transaction/processPlaceOrder.ts +1 -0
- package/example/src/chevre/unsetUnnecessaryFields.ts +7 -5
- package/lib/chevre/repo/event.d.ts +2 -24
- package/lib/chevre/repo/event.js +43 -37
- package/lib/chevre/service/aggregation/event/aggregateOffers.js +7 -8
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +11 -47
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +6 -7
- package/lib/chevre/service/assetTransaction/pay.d.ts +4 -1
- package/lib/chevre/service/assetTransaction/pay.js +57 -27
- package/lib/chevre/service/payment/any.d.ts +1 -0
- package/lib/chevre/service/payment/any.js +1 -2
- package/package.json +1 -1
- package/example/src/chevre/searchEventAggregations.ts +0 -39
|
@@ -66,6 +66,7 @@ async function main() {
|
|
|
66
66
|
id: CLIENT_ID
|
|
67
67
|
}
|
|
68
68
|
})({
|
|
69
|
+
action: await chevre.repository.Action.createInstance(mongoose.connection),
|
|
69
70
|
assetTransaction: await chevre.repository.AssetTransaction.createInstance(mongoose.connection),
|
|
70
71
|
paymentAccepted: await chevre.repository.SellerPaymentAccepted.createInstance(mongoose.connection),
|
|
71
72
|
paymentService: await chevre.repository.PaymentService.createInstance(mongoose.connection),
|
|
@@ -9,17 +9,19 @@ async function main() {
|
|
|
9
9
|
let updateResult: any;
|
|
10
10
|
|
|
11
11
|
const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
12
|
-
updateResult = await eventRepo.unsetUnnecessaryFields({
|
|
12
|
+
updateResult = await eventRepo.unsetUnnecessaryFields<chevre.factory.eventType.ScreeningEvent>({
|
|
13
13
|
filter: {
|
|
14
14
|
typeOf: {
|
|
15
15
|
$in: [
|
|
16
|
-
chevre.factory.eventType.
|
|
16
|
+
chevre.factory.eventType.ScreeningEvent
|
|
17
17
|
]
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
|
-
$unset:
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
$unset: {
|
|
21
|
+
aggregateEntranceGate: 1,
|
|
22
|
+
...{
|
|
23
|
+
'aggregateOffer.offers': 1
|
|
24
|
+
}
|
|
23
25
|
}
|
|
24
26
|
});
|
|
25
27
|
console.log('unset processed.', updateResult);
|
|
@@ -34,7 +34,7 @@ export interface IUpdateAggregateReservationParams {
|
|
|
34
34
|
$set: {
|
|
35
35
|
updatedAt: Date;
|
|
36
36
|
aggregateReservation: factory.event.screeningEvent.IAggregateReservation;
|
|
37
|
-
aggregateOffer?: factory.event.screeningEvent.IAggregateOffer
|
|
37
|
+
aggregateOffer?: Pick<factory.event.screeningEvent.IAggregateOffer, 'aggregateDate' | 'offerCount' | 'typeOf'>;
|
|
38
38
|
maximumAttendeeCapacity?: number;
|
|
39
39
|
remainingAttendeeCapacity?: number;
|
|
40
40
|
checkInCount?: number;
|
|
@@ -46,24 +46,6 @@ export interface IUpdateAggregateReservationParams {
|
|
|
46
46
|
remainingAttendeeCapacity?: '';
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
-
export interface IUpdateAggregateOfferParams {
|
|
50
|
-
$set: {
|
|
51
|
-
updatedAt: Date;
|
|
52
|
-
aggregateOffer?: factory.event.screeningEvent.IAggregateOffer;
|
|
53
|
-
};
|
|
54
|
-
$unset: {
|
|
55
|
-
noExistingAttributeName: 1;
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
export interface IUpdateAggregateUseActionsParams {
|
|
59
|
-
$set: {
|
|
60
|
-
updatedAt: Date;
|
|
61
|
-
aggregateEntranceGate: factory.event.screeningEvent.IAggregateEntranceGate;
|
|
62
|
-
};
|
|
63
|
-
$unset: {
|
|
64
|
-
noExistingAttributeName: 1;
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
49
|
export type ISearchConditions<T extends factory.eventType> = factory.event.ISearchConditions<T>;
|
|
68
50
|
interface IAggregationByStatus {
|
|
69
51
|
eventCount: number;
|
|
@@ -176,10 +158,6 @@ export declare class MongoRepository {
|
|
|
176
158
|
* イベントを検索する
|
|
177
159
|
*/
|
|
178
160
|
search<T extends factory.eventType>(params: ISearchConditions<T>, inclusion: IKeyOfProjection<T>[], exclusion: IKeyOfProjection<T>[]): Promise<Omit<factory.event.IEvent<T>, 'aggregateEntranceGate' | 'aggregateOffer'>[]>;
|
|
179
|
-
/**
|
|
180
|
-
* イベント集計を検索する
|
|
181
|
-
*/
|
|
182
|
-
searchAggregations(params: Pick<ISearchConditions<factory.eventType.ScreeningEvent>, 'page' | 'limit' | 'sort' | 'project' | 'typeOf' | 'id' | 'startFrom' | 'startThrough' | 'organizer'>, inclusion: ('aggregateEntranceGate' | 'aggregateOffer' | 'aggregateReservation')[]): Promise<Pick<factory.event.IEvent<factory.eventType.ScreeningEvent>, 'aggregateEntranceGate' | 'aggregateOffer' | 'aggregateReservation' | 'id'>[]>;
|
|
183
161
|
searchIds<T extends factory.eventType>(params: ISearchConditions<T>): Promise<string[]>;
|
|
184
162
|
findMinimizedIndividualEventById<T extends factory.eventType.ScreeningEvent | factory.eventType.Event>(params: {
|
|
185
163
|
id: string;
|
|
@@ -304,7 +282,7 @@ export declare class MongoRepository {
|
|
|
304
282
|
*/
|
|
305
283
|
updateAggregationById<T extends factory.eventType>(params: {
|
|
306
284
|
id: string;
|
|
307
|
-
}, update: IUpdateAggregateReservationParams
|
|
285
|
+
}, update: IUpdateAggregateReservationParams): Promise<Pick<factory.event.IEvent<T>, 'id' | 'typeOf' | 'project'>>;
|
|
308
286
|
bulkWrite(bulkWriteOps: any[]): Promise<BulkWriteResult & {
|
|
309
287
|
mongoose?: {
|
|
310
288
|
validationErrors: import("mongoose").Error[];
|
package/lib/chevre/repo/event.js
CHANGED
|
@@ -858,42 +858,45 @@ class MongoRepository {
|
|
|
858
858
|
.then((docs) => docs.map((doc) => doc.toObject()));
|
|
859
859
|
});
|
|
860
860
|
}
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
}
|
|
861
|
+
// イベント集計検索廃止(2024-03-28~)
|
|
862
|
+
// public async searchAggregations(
|
|
863
|
+
// params: Pick<
|
|
864
|
+
// ISearchConditions<factory.eventType.ScreeningEvent>,
|
|
865
|
+
// 'page' | 'limit' | 'sort' | 'project' | 'typeOf' | 'id' | 'startFrom' | 'startThrough' | 'organizer'
|
|
866
|
+
// >,
|
|
867
|
+
// inclusion: ('aggregateEntranceGate' | 'aggregateOffer' | 'aggregateReservation')[]
|
|
868
|
+
// ): Promise<Pick<
|
|
869
|
+
// factory.event.IEvent<factory.eventType.ScreeningEvent>,
|
|
870
|
+
// 'aggregateEntranceGate' | 'aggregateOffer' | 'aggregateReservation' | 'id'
|
|
871
|
+
// >[]> {
|
|
872
|
+
// const conditions = MongoRepository.CREATE_MONGO_CONDITIONS<factory.eventType.ScreeningEvent>(params);
|
|
873
|
+
// let projection: IProjection<factory.eventType.ScreeningEvent> = {};
|
|
874
|
+
// if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
875
|
+
// inclusion.forEach((field) => {
|
|
876
|
+
// projection[field] = 1;
|
|
877
|
+
// });
|
|
878
|
+
// } else {
|
|
879
|
+
// projection = {
|
|
880
|
+
// aggregateEntranceGate: 1,
|
|
881
|
+
// aggregateOffer: 1,
|
|
882
|
+
// aggregateReservation: 1
|
|
883
|
+
// };
|
|
884
|
+
// }
|
|
885
|
+
// const query = this.eventModel.find({ $and: conditions }, projection);
|
|
886
|
+
// if (typeof params.limit === 'number' && params.limit > 0) {
|
|
887
|
+
// const page: number = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
888
|
+
// query.limit(params.limit)
|
|
889
|
+
// .skip(params.limit * (page - 1));
|
|
890
|
+
// }
|
|
891
|
+
// // tslint:disable-next-line:no-single-line-block-comment
|
|
892
|
+
// /* istanbul ignore else */
|
|
893
|
+
// if (params.sort?.startDate !== undefined) {
|
|
894
|
+
// query.sort({ startDate: params.sort.startDate });
|
|
895
|
+
// }
|
|
896
|
+
// return query.setOptions({ maxTimeMS: MONGO_MAX_TIME_MS })
|
|
897
|
+
// .exec()
|
|
898
|
+
// .then((docs) => docs.map((doc) => doc.toObject()));
|
|
899
|
+
// }
|
|
897
900
|
searchIds(params) {
|
|
898
901
|
return __awaiter(this, void 0, void 0, function* () {
|
|
899
902
|
const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
|
|
@@ -1069,7 +1072,10 @@ class MongoRepository {
|
|
|
1069
1072
|
/**
|
|
1070
1073
|
* 集計属性を更新する
|
|
1071
1074
|
*/
|
|
1072
|
-
updateAggregationById(params, update
|
|
1075
|
+
updateAggregationById(params, update
|
|
1076
|
+
// | IUpdateAggregateOfferParams // 廃止(2024-03-28)
|
|
1077
|
+
// | IUpdateAggregateUseActionsParams // 廃止(2024-03-28)
|
|
1078
|
+
) {
|
|
1073
1079
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1074
1080
|
const doc = yield this.eventModel.findOneAndUpdate({ _id: params.id }, update, {
|
|
1075
1081
|
new: true,
|
|
@@ -64,17 +64,16 @@ function aggregateOffersByEvent(params) {
|
|
|
64
64
|
screeningRoom: screeningRoom
|
|
65
65
|
})(repos);
|
|
66
66
|
debug('offers aggregated', aggregateOffer);
|
|
67
|
-
// 値がundefinedの場合に更新しないように注意
|
|
68
67
|
const update = {
|
|
69
|
-
$set: Object.assign({
|
|
70
|
-
$unset: {
|
|
71
|
-
|
|
72
|
-
}
|
|
68
|
+
$set: Object.assign({}, (typeof (aggregateOffer === null || aggregateOffer === void 0 ? void 0 : aggregateOffer.typeOf) === 'string') ? { aggregateOffer: aggregateOffer } : undefined)
|
|
69
|
+
// $unset: {
|
|
70
|
+
// noExistingAttributeName: 1 // $unsetは空だとエラーになるので
|
|
71
|
+
// }
|
|
73
72
|
};
|
|
74
73
|
debug('update:', update);
|
|
75
|
-
//
|
|
76
|
-
const saveResult =
|
|
77
|
-
debug('aggregateOffersByEvent processd', saveResult);
|
|
74
|
+
// 廃止(2024-03-28~)
|
|
75
|
+
// const saveResult = await repos.event.updateAggregationById<typeof event.typeOf>({ id: event.id }, update);
|
|
76
|
+
// debug('aggregateOffersByEvent processd', saveResult);
|
|
78
77
|
// aggregateReservationsにも保管(2024-03-25~)
|
|
79
78
|
yield repos.aggregateReservation.save({
|
|
80
79
|
project: event.project,
|
|
@@ -108,15 +108,15 @@ function aggregateByEvent(params) {
|
|
|
108
108
|
// オファーごとの集計
|
|
109
109
|
const aggregateOffer = yield aggregateOfferByEvent({
|
|
110
110
|
aggregateDate: now,
|
|
111
|
-
event
|
|
112
|
-
|
|
113
|
-
screeningRoom: screeningRoom
|
|
111
|
+
event,
|
|
112
|
+
screeningRoom
|
|
114
113
|
})(repos);
|
|
115
114
|
debug('offers aggregated', aggregateOffer);
|
|
116
115
|
// 値がundefinedの場合に更新しないように注意
|
|
117
116
|
const update = {
|
|
118
|
-
$set: Object.assign(Object.assign(Object.assign(Object.assign(
|
|
119
|
-
aggregateReservation
|
|
117
|
+
$set: Object.assign(Object.assign(Object.assign(Object.assign({ updatedAt: new Date(), // $setオブジェクトが空だとMongoエラーになるので
|
|
118
|
+
aggregateReservation,
|
|
119
|
+
aggregateOffer }, (maximumAttendeeCapacity !== undefined) ? { maximumAttendeeCapacity: maximumAttendeeCapacity } : undefined), (remainingAttendeeCapacity !== undefined) ? { remainingAttendeeCapacity: remainingAttendeeCapacity } : undefined), (aggregateReservation.checkInCount !== undefined) ? { checkInCount: aggregateReservation.checkInCount } : undefined), (aggregateReservation.attendeeCount !== undefined) ? { attendeeCount: aggregateReservation.attendeeCount } : undefined),
|
|
120
120
|
$unset: Object.assign(Object.assign({ noExistingAttributeName: 1 }, (maximumAttendeeCapacity === undefined) ? { maximumAttendeeCapacity: '' } : undefined), (remainingAttendeeCapacity === undefined) ? { remainingAttendeeCapacity: '' } : undefined)
|
|
121
121
|
};
|
|
122
122
|
debug('update:', update);
|
|
@@ -168,48 +168,12 @@ function reservedSeatsAvailable(params) {
|
|
|
168
168
|
}
|
|
169
169
|
function aggregateOfferByEvent(params) {
|
|
170
170
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
// for (const o of availableOffers) {
|
|
178
|
-
// const { maximumAttendeeCapacity, remainingAttendeeCapacity, aggregateReservation } = await aggregateReservationByOffer({
|
|
179
|
-
// aggregateDate: params.aggregateDate,
|
|
180
|
-
// event: params.event,
|
|
181
|
-
// screeningRoom: params.screeningRoom,
|
|
182
|
-
// offer: o
|
|
183
|
-
// })(repos);
|
|
184
|
-
// offersWithAggregateReservation.push({
|
|
185
|
-
// typeOf: <factory.offerType.Offer>o.typeOf,
|
|
186
|
-
// id: o.id,
|
|
187
|
-
// identifier: o.identifier,
|
|
188
|
-
// aggregateReservation: aggregateReservation,
|
|
189
|
-
// name: {
|
|
190
|
-
// en: (<factory.multilingualString | undefined>o.name)?.en,
|
|
191
|
-
// ja: (<factory.multilingualString | undefined>o.name)?.ja
|
|
192
|
-
// },
|
|
193
|
-
// ...(typeof maximumAttendeeCapacity === 'number') ? { maximumAttendeeCapacity } : undefined,
|
|
194
|
-
// ...(typeof remainingAttendeeCapacity === 'number') ? { remainingAttendeeCapacity } : undefined,
|
|
195
|
-
// // category情報を追加
|
|
196
|
-
// ...(typeof o.category?.codeValue === 'string') ? { category: o.category } : undefined
|
|
197
|
-
// });
|
|
198
|
-
// }
|
|
199
|
-
// return {
|
|
200
|
-
// typeOf: factory.offerType.AggregateOffer,
|
|
201
|
-
// offerCount: availableOffers.length,
|
|
202
|
-
// offers: offersWithAggregateReservation
|
|
203
|
-
// };
|
|
204
|
-
}
|
|
205
|
-
else {
|
|
206
|
-
const { offerCount } = yield calculateOfferCount({ event: params.event })(repos);
|
|
207
|
-
return {
|
|
208
|
-
typeOf: factory.offerType.AggregateOffer,
|
|
209
|
-
aggregateDate: params.aggregateDate,
|
|
210
|
-
offerCount
|
|
211
|
-
};
|
|
212
|
-
}
|
|
171
|
+
const { offerCount } = yield calculateOfferCount({ event: params.event })(repos);
|
|
172
|
+
return {
|
|
173
|
+
typeOf: factory.offerType.AggregateOffer,
|
|
174
|
+
aggregateDate: params.aggregateDate,
|
|
175
|
+
offerCount
|
|
176
|
+
};
|
|
213
177
|
});
|
|
214
178
|
}
|
|
215
179
|
function calculateOfferCount(params) {
|
|
@@ -33,19 +33,18 @@ function aggregateUseActionsOnEvent(params) {
|
|
|
33
33
|
entranceGates
|
|
34
34
|
})(repos);
|
|
35
35
|
debug('entrances aggregated', aggregateEntranceGate);
|
|
36
|
-
// 値がundefinedの場合に更新しないように注意
|
|
37
36
|
const update = {
|
|
38
37
|
$set: {
|
|
39
|
-
updatedAt: new Date(),
|
|
38
|
+
// updatedAt: new Date(), // $setオブジェクトが空だとMongoエラーになるので
|
|
40
39
|
aggregateEntranceGate
|
|
41
|
-
},
|
|
42
|
-
$unset: {
|
|
43
|
-
noExistingAttributeName: 1 // $unsetは空だとエラーになるので
|
|
44
40
|
}
|
|
41
|
+
// $unset: {
|
|
42
|
+
// noExistingAttributeName: 1 // $unsetは空だとエラーになるので
|
|
43
|
+
// }
|
|
45
44
|
};
|
|
46
45
|
debug('update:', update);
|
|
47
|
-
//
|
|
48
|
-
|
|
46
|
+
// 廃止(2024-03-28~)
|
|
47
|
+
// await repos.event.updateAggregationById({ id: event.id }, update);
|
|
49
48
|
// aggregateReservationsにも保管(2024-03-25~)
|
|
50
49
|
yield repos.aggregateReservation.save({
|
|
51
50
|
project: event.project,
|
|
@@ -55,6 +55,7 @@ export type ICheckOperation<T> = (repos: {
|
|
|
55
55
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
56
56
|
}) => Promise<T>;
|
|
57
57
|
export type IPublishPaymentUrlOperation<T> = (repos: {
|
|
58
|
+
action: ActionRepo;
|
|
58
59
|
paymentAccepted: PaymentAcceptedRepo;
|
|
59
60
|
paymentService: PaymentServiceRepo;
|
|
60
61
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
@@ -75,7 +76,9 @@ export type IPublishPaymentUrlResult = CreditCardPayment.IPaymentAgencyTransacti
|
|
|
75
76
|
/**
|
|
76
77
|
* 外部決済ロケーション発行
|
|
77
78
|
*/
|
|
78
|
-
export declare function publishPaymentUrl(params: factory.assetTransaction.pay.IStartParamsWithoutDetail
|
|
79
|
+
export declare function publishPaymentUrl(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, purposeAsTransaction?: {
|
|
80
|
+
id: string;
|
|
81
|
+
}): IPublishPaymentUrlOperation<IPublishPaymentUrlResult>;
|
|
79
82
|
/**
|
|
80
83
|
* 決済ロケーションを無効化する
|
|
81
84
|
* 実質、外部で実行された決済に対する返金処理
|
|
@@ -22,7 +22,8 @@ const debug = createDebug('chevre-domain:service:assetTransaction');
|
|
|
22
22
|
/**
|
|
23
23
|
* 外部決済ロケーション発行
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
// tslint:disable-next-line:max-func-body-length
|
|
26
|
+
function publishPaymentUrl(params, purposeAsTransaction) {
|
|
26
27
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
27
28
|
var _a, _b, _c;
|
|
28
29
|
const paymentServiceType = (_a = params.object) === null || _a === void 0 ? void 0 : _a.typeOf;
|
|
@@ -38,34 +39,63 @@ function publishPaymentUrl(params) {
|
|
|
38
39
|
yield validateSeller(params)(repos);
|
|
39
40
|
// 決済サービス確認
|
|
40
41
|
const paymentServiceId = getPaymentServiceId(params);
|
|
42
|
+
// 決済受入アクション生成(2024-03-28~)
|
|
43
|
+
const actionAttributes = Object.assign({ project: params.project, typeOf: 'AcceptAction', agent: params.agent, object: {
|
|
44
|
+
object: params.object,
|
|
45
|
+
transactionNumber,
|
|
46
|
+
typeOf: params.typeOf
|
|
47
|
+
} }, (typeof (purposeAsTransaction === null || purposeAsTransaction === void 0 ? void 0 : purposeAsTransaction.id) === 'string')
|
|
48
|
+
? {
|
|
49
|
+
purpose: Object.assign({ typeOf: factory.transactionType.PlaceOrder }, {
|
|
50
|
+
id: purposeAsTransaction.id
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
: undefined);
|
|
54
|
+
const action = yield repos.action.start(actionAttributes);
|
|
41
55
|
let result;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
56
|
+
try {
|
|
57
|
+
switch (paymentServiceType) {
|
|
58
|
+
case factory.service.paymentService.PaymentServiceType.CreditCard:
|
|
59
|
+
const authorizeResult = yield CreditCardPayment.authorize(params, paymentServiceId, { processPublishPaymentUrl: true })(repos);
|
|
60
|
+
let paymentUrl;
|
|
61
|
+
// 3DS拡張(2024-01-02~)
|
|
62
|
+
const retUrl = (_c = params.object.paymentMethod.creditCard) === null || _c === void 0 ? void 0 : _c.retUrl;
|
|
63
|
+
if (typeof retUrl === 'string' && retUrl.length > 0) {
|
|
64
|
+
paymentUrl = authorizeResult.execTranResult.redirectUrl;
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
paymentUrl = authorizeResult.execTranResult.acsUrl;
|
|
68
|
+
}
|
|
69
|
+
if (typeof paymentUrl !== 'string' || paymentUrl.length === 0) {
|
|
70
|
+
throw new factory.errors.ServiceUnavailable(`Payment URL unable to publish. [retUrl: ${retUrl}]`);
|
|
71
|
+
}
|
|
72
|
+
result = {
|
|
73
|
+
paymentMethodId: transactionNumber,
|
|
74
|
+
paymentUrl,
|
|
75
|
+
entryTranArgs: authorizeResult.entryTranArgs,
|
|
76
|
+
entryTranResult: authorizeResult.entryTranResult,
|
|
77
|
+
execTranArgs: authorizeResult.execTranArgs,
|
|
78
|
+
execTranResult: authorizeResult.execTranResult
|
|
79
|
+
};
|
|
80
|
+
break;
|
|
81
|
+
default:
|
|
82
|
+
throw new factory.errors.NotImplemented(`Payment service '${paymentServiceType}' not implemented`);
|
|
83
|
+
}
|
|
68
84
|
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
try {
|
|
87
|
+
yield repos.action.giveUp({ typeOf: actionAttributes.typeOf, id: action.id, error });
|
|
88
|
+
}
|
|
89
|
+
catch (__) {
|
|
90
|
+
// 失敗したら仕方ない
|
|
91
|
+
}
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
94
|
+
const actionResult = {
|
|
95
|
+
paymentMethodId: result.paymentMethodId,
|
|
96
|
+
paymentUrl: result.paymentUrl
|
|
97
|
+
};
|
|
98
|
+
yield repos.action.completeWithVoid({ typeOf: actionAttributes.typeOf, id: action.id, result: actionResult });
|
|
69
99
|
return result;
|
|
70
100
|
});
|
|
71
101
|
}
|
|
@@ -66,6 +66,7 @@ interface IAuthorizeRepos {
|
|
|
66
66
|
}
|
|
67
67
|
type IAuthorizeOperation<T> = (repos: IAuthorizeRepos) => Promise<T>;
|
|
68
68
|
interface IPublishPaymentUrlRepos {
|
|
69
|
+
action: ActionRepo;
|
|
69
70
|
assetTransaction: AssetTransactionRepo;
|
|
70
71
|
paymentAccepted: PaymentAcceptedRepo;
|
|
71
72
|
paymentService: PaymentServiceRepo;
|
|
@@ -239,8 +239,7 @@ function publishPaymentUrl(params) {
|
|
|
239
239
|
transactionNumber: transactionNumber,
|
|
240
240
|
location: params.location
|
|
241
241
|
});
|
|
242
|
-
|
|
243
|
-
result = yield PayTransactionService.publishPaymentUrl(startParams)(repos);
|
|
242
|
+
result = yield PayTransactionService.publishPaymentUrl(startParams, { id: transaction.id })(repos);
|
|
244
243
|
// 取引に保管
|
|
245
244
|
const paymentMethodByPaymentUrl = {
|
|
246
245
|
typeOf: params.object.paymentMethod,
|
package/package.json
CHANGED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as moment from 'moment';
|
|
3
|
-
import * as mongoose from 'mongoose';
|
|
4
|
-
|
|
5
|
-
const startTime = process.hrtime();
|
|
6
|
-
import { chevre } from '../../../lib/index';
|
|
7
|
-
const diff = process.hrtime(startTime);
|
|
8
|
-
console.log(`importing chevre took ${diff[0]} seconds and ${diff[1]} nanoseconds.`);
|
|
9
|
-
|
|
10
|
-
const PROJECT_ID = process.env.PROJECT_ID;
|
|
11
|
-
|
|
12
|
-
async function main() {
|
|
13
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
14
|
-
|
|
15
|
-
const eventRepo: chevre.repository.Event = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
16
|
-
|
|
17
|
-
const events = await eventRepo.searchAggregations(
|
|
18
|
-
{
|
|
19
|
-
limit: 100,
|
|
20
|
-
page: 1,
|
|
21
|
-
sort: { startDate: 1 },
|
|
22
|
-
typeOf: chevre.factory.eventType.ScreeningEvent,
|
|
23
|
-
project: { id: { $eq: PROJECT_ID } },
|
|
24
|
-
// id: { $eq: 'al6aff83y' },
|
|
25
|
-
startFrom: moment()
|
|
26
|
-
.toDate(),
|
|
27
|
-
startThrough: moment()
|
|
28
|
-
.add(1, 'days')
|
|
29
|
-
.toDate()
|
|
30
|
-
},
|
|
31
|
-
['aggregateReservation', 'aggregateEntranceGate', 'aggregateOffer']
|
|
32
|
-
);
|
|
33
|
-
console.log(events);
|
|
34
|
-
console.log(events.length, 'events found');
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
main()
|
|
38
|
-
.then(console.log)
|
|
39
|
-
.catch(console.error);
|