@chevre/domain 20.2.0-alpha.15 → 20.2.0-alpha.16
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/aggregateOrdersGlobally.ts +83 -0
- package/example/src/chevre/aggregateReservationsGlobally.ts +84 -0
- package/lib/chevre/repo/order.d.ts +4 -0
- package/lib/chevre/repo/order.js +29 -0
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +0 -3
- package/lib/chevre/service/assetTransaction/pay.d.ts +19 -4
- package/lib/chevre/service/assetTransaction/pay.js +65 -32
- package/lib/chevre/service/payment/any.d.ts +5 -0
- package/lib/chevre/service/task/confirmPayTransaction.js +20 -1
- package/lib/chevre/settings.d.ts +1 -0
- package/lib/chevre/settings.js +2 -1
- package/package.json +2 -2
- package/example/src/chevre/aggregateReservationOnProject.ts +0 -32
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as moment from 'moment-timezone';
|
|
3
|
+
import * as mongoose from 'mongoose';
|
|
4
|
+
|
|
5
|
+
import { chevre } from '../../../lib/index';
|
|
6
|
+
|
|
7
|
+
// const project = { id: <string>process.env.PROJECT_ID };
|
|
8
|
+
interface IAggregation {
|
|
9
|
+
typeOf: 'AggregateOrder';
|
|
10
|
+
project: { id: string; typeOf: chevre.factory.organizationType.Project };
|
|
11
|
+
aggregateDate: Date;
|
|
12
|
+
aggregateDuration: string;
|
|
13
|
+
aggregateStart: Date;
|
|
14
|
+
orderCount: number;
|
|
15
|
+
acceptedOfferCount: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async function main() {
|
|
19
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
20
|
+
|
|
21
|
+
const now: Date = new Date();
|
|
22
|
+
|
|
23
|
+
const aggregationRepo = new chevre.repository.Aggregation(mongoose.connection);
|
|
24
|
+
const orderRepo = new chevre.repository.Order(mongoose.connection);
|
|
25
|
+
|
|
26
|
+
let i = 0;
|
|
27
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
28
|
+
while (i < 7) {
|
|
29
|
+
i += 1;
|
|
30
|
+
|
|
31
|
+
const orderDateFrom: Date = moment()
|
|
32
|
+
// .tz('Asia/Tokyo')
|
|
33
|
+
.add(-i, 'days')
|
|
34
|
+
.startOf('day')
|
|
35
|
+
.toDate();
|
|
36
|
+
const orderDateThrough: Date = moment()
|
|
37
|
+
// .tz('Asia/Tokyo')
|
|
38
|
+
.add(-i, 'days')
|
|
39
|
+
.endOf('day')
|
|
40
|
+
.toDate();
|
|
41
|
+
// console.log(bookingFrom, bookingThrough);
|
|
42
|
+
|
|
43
|
+
const aggregateResult = await orderRepo.aggregateOrder({
|
|
44
|
+
orderDate: {
|
|
45
|
+
$gte: orderDateFrom,
|
|
46
|
+
$lte: orderDateThrough
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const aggregation: IAggregation = {
|
|
51
|
+
typeOf: 'AggregateOrder',
|
|
52
|
+
project: { id: '*', typeOf: chevre.factory.organizationType.Project },
|
|
53
|
+
aggregateDuration: moment.duration(1, 'days')
|
|
54
|
+
.toISOString(),
|
|
55
|
+
aggregateStart: orderDateFrom,
|
|
56
|
+
aggregateDate: now,
|
|
57
|
+
orderCount: (aggregateResult.length > 0) ? aggregateResult[0].orderCount : 0,
|
|
58
|
+
acceptedOfferCount: (aggregateResult.length > 0) ? aggregateResult[0].acceptedOfferCount : 0
|
|
59
|
+
};
|
|
60
|
+
const { acceptedOfferCount, orderCount, aggregateDate, ...setOnInsert } = aggregation;
|
|
61
|
+
const doc = await aggregationRepo.aggregationModel.findOneAndUpdate(
|
|
62
|
+
{
|
|
63
|
+
typeOf: { $eq: aggregation.typeOf },
|
|
64
|
+
'project.id': { $eq: aggregation.project.id },
|
|
65
|
+
aggregateStart: { $eq: aggregation.aggregateStart },
|
|
66
|
+
aggregateDuration: { $eq: aggregation.aggregateDuration }
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
$setOnInsert: setOnInsert,
|
|
70
|
+
$set: { aggregateDate, orderCount, acceptedOfferCount }
|
|
71
|
+
},
|
|
72
|
+
{ upsert: true }
|
|
73
|
+
)
|
|
74
|
+
.exec();
|
|
75
|
+
console.log(doc);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
main()
|
|
80
|
+
.then(() => {
|
|
81
|
+
console.log('success!');
|
|
82
|
+
})
|
|
83
|
+
.catch(console.error);
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as moment from 'moment-timezone';
|
|
3
|
+
import * as mongoose from 'mongoose';
|
|
4
|
+
|
|
5
|
+
import { chevre } from '../../../lib/index';
|
|
6
|
+
|
|
7
|
+
// const project = { id: <string>process.env.PROJECT_ID };
|
|
8
|
+
interface IAggregation {
|
|
9
|
+
typeOf: 'AggregateReservation';
|
|
10
|
+
project: { id: string; typeOf: chevre.factory.organizationType.Project };
|
|
11
|
+
aggregateDate: Date;
|
|
12
|
+
aggregateDuration: string;
|
|
13
|
+
aggregateStart: Date;
|
|
14
|
+
// bookingTime: Date;
|
|
15
|
+
reservationCount: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async function main() {
|
|
19
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
20
|
+
|
|
21
|
+
const now: Date = new Date();
|
|
22
|
+
|
|
23
|
+
const aggregationRepo = new chevre.repository.Aggregation(mongoose.connection);
|
|
24
|
+
const reservationRepo = new chevre.repository.Reservation(mongoose.connection);
|
|
25
|
+
|
|
26
|
+
let i = 0;
|
|
27
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
28
|
+
while (i < 7) {
|
|
29
|
+
i += 1;
|
|
30
|
+
|
|
31
|
+
const bookingFrom: Date = moment()
|
|
32
|
+
// .tz('Asia/Tokyo')
|
|
33
|
+
.add(-i, 'days')
|
|
34
|
+
.startOf('day')
|
|
35
|
+
.toDate();
|
|
36
|
+
const bookingThrough: Date = moment()
|
|
37
|
+
// .tz('Asia/Tokyo')
|
|
38
|
+
.add(-i, 'days')
|
|
39
|
+
.endOf('day')
|
|
40
|
+
.toDate();
|
|
41
|
+
// console.log(bookingFrom, bookingThrough);
|
|
42
|
+
|
|
43
|
+
// i日前の予約検索
|
|
44
|
+
const searchReservationCountResult = await reservationRepo.count({
|
|
45
|
+
typeOf: chevre.factory.reservationType.EventReservation,
|
|
46
|
+
reservationStatus: { $eq: chevre.factory.reservationStatusType.ReservationConfirmed },
|
|
47
|
+
bookingFrom,
|
|
48
|
+
bookingThrough
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const aggregation: IAggregation = {
|
|
52
|
+
typeOf: 'AggregateReservation',
|
|
53
|
+
project: { id: '*', typeOf: chevre.factory.organizationType.Project },
|
|
54
|
+
aggregateDuration: moment.duration(1, 'days')
|
|
55
|
+
.toISOString(),
|
|
56
|
+
aggregateStart: bookingFrom,
|
|
57
|
+
aggregateDate: now,
|
|
58
|
+
reservationCount: searchReservationCountResult
|
|
59
|
+
};
|
|
60
|
+
console.log(aggregation);
|
|
61
|
+
const { reservationCount, aggregateDate, ...setOnInsert } = aggregation;
|
|
62
|
+
const doc = await aggregationRepo.aggregationModel.findOneAndUpdate(
|
|
63
|
+
{
|
|
64
|
+
typeOf: { $eq: aggregation.typeOf },
|
|
65
|
+
'project.id': { $eq: aggregation.project.id },
|
|
66
|
+
aggregateStart: { $eq: aggregation.aggregateStart },
|
|
67
|
+
aggregateDuration: { $eq: aggregation.aggregateDuration }
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
$setOnInsert: setOnInsert,
|
|
71
|
+
$set: { aggregateDate, reservationCount }
|
|
72
|
+
},
|
|
73
|
+
{ upsert: true }
|
|
74
|
+
)
|
|
75
|
+
.exec();
|
|
76
|
+
console.log(doc);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
main()
|
|
81
|
+
.then(() => {
|
|
82
|
+
console.log('success!');
|
|
83
|
+
})
|
|
84
|
+
.catch(console.error);
|
package/lib/chevre/repo/order.js
CHANGED
|
@@ -920,5 +920,34 @@ class MongoRepository {
|
|
|
920
920
|
return [...new Set(reservationNumbers)];
|
|
921
921
|
});
|
|
922
922
|
}
|
|
923
|
+
aggregateOrder(params) {
|
|
924
|
+
var _a, _b;
|
|
925
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
926
|
+
return this.orderModel.aggregate([
|
|
927
|
+
{
|
|
928
|
+
$match: {
|
|
929
|
+
orderDate: {
|
|
930
|
+
$gte: (_a = params.orderDate) === null || _a === void 0 ? void 0 : _a.$gte,
|
|
931
|
+
$lte: (_b = params.orderDate) === null || _b === void 0 ? void 0 : _b.$lte
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
},
|
|
935
|
+
{
|
|
936
|
+
$group: {
|
|
937
|
+
_id: '$typeOf',
|
|
938
|
+
acceptedOfferCount: {
|
|
939
|
+
$sum: {
|
|
940
|
+
$cond: { if: { $isArray: '$acceptedOffers' }, then: { $size: '$acceptedOffers' }, else: 0 }
|
|
941
|
+
}
|
|
942
|
+
},
|
|
943
|
+
orderCount: {
|
|
944
|
+
$sum: 1
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
])
|
|
949
|
+
.exec();
|
|
950
|
+
});
|
|
951
|
+
}
|
|
923
952
|
}
|
|
924
953
|
exports.MongoRepository = MongoRepository;
|
|
@@ -11,13 +11,10 @@ function createPayActions(params) {
|
|
|
11
11
|
if (payObject !== undefined) {
|
|
12
12
|
const maskedCustomer = (0, order_1.createMaskedCustomer)(params.order);
|
|
13
13
|
const simpleOrder = {
|
|
14
|
-
// project: params.order.project,
|
|
15
14
|
typeOf: params.order.typeOf,
|
|
16
15
|
seller: params.order.seller,
|
|
17
16
|
// mask
|
|
18
17
|
customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id, name: maskedCustomer.name },
|
|
19
|
-
// IOrderへ移行(2022-11-17~)
|
|
20
|
-
// confirmationNumber: params.order.confirmationNumber,
|
|
21
18
|
orderNumber: params.order.orderNumber,
|
|
22
19
|
price: params.order.price,
|
|
23
20
|
priceCurrency: params.order.priceCurrency,
|
|
@@ -25,13 +25,28 @@ export interface IStartOperationRepos {
|
|
|
25
25
|
task: TaskRepo;
|
|
26
26
|
}
|
|
27
27
|
export declare type IStartOperation<T> = (repos: IStartOperationRepos) => Promise<T>;
|
|
28
|
-
export
|
|
28
|
+
export interface ICancelRepos {
|
|
29
|
+
action: ActionRepo;
|
|
30
|
+
accountingReport: AccountingReportRepo;
|
|
29
31
|
assetTransaction: AssetTransactionRepo;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
product: ProductRepo;
|
|
33
|
+
project: ProjectRepo;
|
|
34
|
+
seller: SellerRepo;
|
|
35
|
+
task: TaskRepo;
|
|
36
|
+
}
|
|
37
|
+
export declare type ICancelOperation<T> = (repos: ICancelRepos) => Promise<T>;
|
|
38
|
+
export interface IConfirmRepos {
|
|
39
|
+
action: ActionRepo;
|
|
40
|
+
accountingReport: AccountingReportRepo;
|
|
32
41
|
assetTransaction: AssetTransactionRepo;
|
|
42
|
+
event: EventRepo;
|
|
33
43
|
order: OrderRepo;
|
|
34
|
-
|
|
44
|
+
product: ProductRepo;
|
|
45
|
+
project: ProjectRepo;
|
|
46
|
+
seller: SellerRepo;
|
|
47
|
+
task: TaskRepo;
|
|
48
|
+
}
|
|
49
|
+
export declare type IConfirmOperation<T> = (repos: IConfirmRepos) => Promise<T>;
|
|
35
50
|
export declare type IExportTasksOperation<T> = (repos: {
|
|
36
51
|
task: TaskRepo;
|
|
37
52
|
assetTransaction: AssetTransactionRepo;
|
|
@@ -13,6 +13,7 @@ exports.searchGMOTrade = exports.exportTasksById = exports.cancel = exports.conf
|
|
|
13
13
|
const moment = require("moment");
|
|
14
14
|
const factory = require("../../factory");
|
|
15
15
|
const settings_1 = require("../../settings");
|
|
16
|
+
const payment_1 = require("../payment");
|
|
16
17
|
const CreditCardPayment = require("../payment/creditCard");
|
|
17
18
|
const MovieTicketPayment = require("../payment/movieTicket");
|
|
18
19
|
const PaymentCardPayment = require("../payment/paymentCard");
|
|
@@ -307,8 +308,19 @@ function confirm(params) {
|
|
|
307
308
|
typeOf: factory.assetTransactionType.Pay,
|
|
308
309
|
id: transaction.id,
|
|
309
310
|
result: {},
|
|
310
|
-
|
|
311
|
+
// sync対応(2023-01-14~)
|
|
312
|
+
potentialActions: (settings_1.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING)
|
|
313
|
+
? { pay: [] }
|
|
314
|
+
: potentialActions
|
|
311
315
|
});
|
|
316
|
+
// sync対応(2023-01-14~)
|
|
317
|
+
if (settings_1.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING) {
|
|
318
|
+
if (Array.isArray(potentialActions.pay)) {
|
|
319
|
+
for (const payAction of potentialActions.pay) {
|
|
320
|
+
yield (0, payment_1.pay)(payAction)(repos);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
312
324
|
});
|
|
313
325
|
}
|
|
314
326
|
exports.confirm = confirm;
|
|
@@ -341,11 +353,23 @@ function fixOrderAsPurpose(params, transaction) {
|
|
|
341
353
|
*/
|
|
342
354
|
function cancel(params) {
|
|
343
355
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
344
|
-
yield repos.assetTransaction.cancel({
|
|
356
|
+
const transaction = yield repos.assetTransaction.cancel({
|
|
345
357
|
typeOf: factory.assetTransactionType.Pay,
|
|
346
358
|
id: params.id,
|
|
347
359
|
transactionNumber: params.transactionNumber
|
|
348
360
|
});
|
|
361
|
+
// sync対応(2023-01-14~)
|
|
362
|
+
if (settings_1.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING) {
|
|
363
|
+
const payTransactionAsObject = {
|
|
364
|
+
project: transaction.project,
|
|
365
|
+
typeOf: transaction.typeOf,
|
|
366
|
+
id: transaction.id,
|
|
367
|
+
transactionNumber: transaction.transactionNumber,
|
|
368
|
+
object: transaction.object,
|
|
369
|
+
recipient: transaction.recipient
|
|
370
|
+
};
|
|
371
|
+
yield (0, payment_1.voidPayment)({ object: payTransactionAsObject })(repos);
|
|
372
|
+
}
|
|
349
373
|
});
|
|
350
374
|
}
|
|
351
375
|
exports.cancel = cancel;
|
|
@@ -353,6 +377,7 @@ exports.cancel = cancel;
|
|
|
353
377
|
* 取引のタスク出力
|
|
354
378
|
*/
|
|
355
379
|
function exportTasksById(params) {
|
|
380
|
+
// tslint:disable-next-line:max-func-body-length
|
|
356
381
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
357
382
|
const transaction = yield repos.assetTransaction.findById({
|
|
358
383
|
typeOf: factory.assetTransactionType.Pay,
|
|
@@ -388,42 +413,50 @@ function exportTasksById(params) {
|
|
|
388
413
|
.add(params.runsTasksAfterInSeconds, 'seconds')
|
|
389
414
|
.toDate();
|
|
390
415
|
}
|
|
416
|
+
const payTransactionAsObject = {
|
|
417
|
+
project: transaction.project,
|
|
418
|
+
typeOf: transaction.typeOf,
|
|
419
|
+
id: transaction.id,
|
|
420
|
+
transactionNumber: transaction.transactionNumber,
|
|
421
|
+
object: transaction.object,
|
|
422
|
+
recipient: transaction.recipient
|
|
423
|
+
};
|
|
424
|
+
const voidPaymentTasks = {
|
|
425
|
+
project: transaction.project,
|
|
426
|
+
name: factory.taskName.VoidPayment,
|
|
427
|
+
status: factory.taskStatus.Ready,
|
|
428
|
+
runsAt: taskRunsAt,
|
|
429
|
+
remainingNumberOfTries: 10,
|
|
430
|
+
numberOfTried: 0,
|
|
431
|
+
executionResults: [],
|
|
432
|
+
data: { object: payTransactionAsObject }
|
|
433
|
+
};
|
|
391
434
|
switch (transaction.status) {
|
|
392
435
|
case factory.transactionStatusType.Confirmed:
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
data: a
|
|
409
|
-
};
|
|
410
|
-
});
|
|
411
|
-
taskAttributes.push(...payTasks);
|
|
412
|
-
}
|
|
436
|
+
const payActions = potentialActions === null || potentialActions === void 0 ? void 0 : potentialActions.pay;
|
|
437
|
+
if (Array.isArray(payActions) && payActions.length > 0) {
|
|
438
|
+
const payTasks = payActions.map((a) => {
|
|
439
|
+
return {
|
|
440
|
+
project: transaction.project,
|
|
441
|
+
name: factory.taskName.Pay,
|
|
442
|
+
status: factory.taskStatus.Ready,
|
|
443
|
+
runsAt: taskRunsAt,
|
|
444
|
+
remainingNumberOfTries: 10,
|
|
445
|
+
numberOfTried: 0,
|
|
446
|
+
executionResults: [],
|
|
447
|
+
data: a
|
|
448
|
+
};
|
|
449
|
+
});
|
|
450
|
+
taskAttributes.push(...payTasks);
|
|
413
451
|
}
|
|
414
452
|
break;
|
|
415
453
|
case factory.transactionStatusType.Canceled:
|
|
454
|
+
// sync対応(2023-01-14~)
|
|
455
|
+
if (!settings_1.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING) {
|
|
456
|
+
taskAttributes.push(voidPaymentTasks);
|
|
457
|
+
}
|
|
458
|
+
break;
|
|
416
459
|
case factory.transactionStatusType.Expired:
|
|
417
|
-
const voidPaymentTasks = {
|
|
418
|
-
project: transaction.project,
|
|
419
|
-
name: factory.taskName.VoidPayment,
|
|
420
|
-
status: factory.taskStatus.Ready,
|
|
421
|
-
runsAt: taskRunsAt,
|
|
422
|
-
remainingNumberOfTries: 10,
|
|
423
|
-
numberOfTried: 0,
|
|
424
|
-
executionResults: [],
|
|
425
|
-
data: { object: transaction }
|
|
426
|
-
};
|
|
427
460
|
taskAttributes.push(voidPaymentTasks);
|
|
428
461
|
break;
|
|
429
462
|
default:
|
|
@@ -47,7 +47,12 @@ declare function invalidatePaymentUrl(params: factory.task.IData<factory.taskNam
|
|
|
47
47
|
*/
|
|
48
48
|
declare function processVoidPayTransaction(params: factory.task.IData<factory.taskName.VoidPayTransaction>): (repos: {
|
|
49
49
|
action: ActionRepo;
|
|
50
|
+
accountingReport: AccountingReportRepo;
|
|
50
51
|
assetTransaction: AssetTransactionRepo;
|
|
52
|
+
product: ProductRepo;
|
|
53
|
+
project: ProjectRepo;
|
|
54
|
+
seller: SellerRepo;
|
|
55
|
+
task: TaskRepo;
|
|
51
56
|
transaction: TransactionRepo;
|
|
52
57
|
}) => Promise<void>;
|
|
53
58
|
interface IAuthorizeRepos {
|
|
@@ -10,9 +10,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.call = void 0;
|
|
13
|
+
const accountingReport_1 = require("../../repo/accountingReport");
|
|
13
14
|
const action_1 = require("../../repo/action");
|
|
14
15
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
16
|
+
const event_1 = require("../../repo/event");
|
|
15
17
|
const order_1 = require("../../repo/order");
|
|
18
|
+
const product_1 = require("../../repo/product");
|
|
19
|
+
const project_1 = require("../../repo/project");
|
|
20
|
+
const seller_1 = require("../../repo/seller");
|
|
21
|
+
const task_1 = require("../../repo/task");
|
|
16
22
|
const PayTransactionService = require("../assetTransaction/pay");
|
|
17
23
|
/**
|
|
18
24
|
* タスク実行関数
|
|
@@ -22,6 +28,12 @@ function call(data) {
|
|
|
22
28
|
const actionRepo = new action_1.MongoRepository(settings.connection);
|
|
23
29
|
const assetTransactionRepo = new assetTransaction_1.MongoRepository(settings.connection);
|
|
24
30
|
const orderRepo = new order_1.MongoRepository(settings.connection);
|
|
31
|
+
const accountingReportRepo = new accountingReport_1.MongoRepository(settings.connection);
|
|
32
|
+
const eventRepo = new event_1.MongoRepository(settings.connection);
|
|
33
|
+
const productRepo = new product_1.MongoRepository(settings.connection);
|
|
34
|
+
const projectRepo = new project_1.MongoRepository(settings.connection);
|
|
35
|
+
const sellerRepo = new seller_1.MongoRepository(settings.connection);
|
|
36
|
+
const taskRepo = new task_1.MongoRepository(settings.connection);
|
|
25
37
|
// アクション開始
|
|
26
38
|
const action = yield actionRepo.start(data);
|
|
27
39
|
try {
|
|
@@ -38,8 +50,15 @@ function call(data) {
|
|
|
38
50
|
}
|
|
39
51
|
}
|
|
40
52
|
})({
|
|
53
|
+
action: actionRepo,
|
|
54
|
+
accountingReport: accountingReportRepo,
|
|
41
55
|
assetTransaction: assetTransactionRepo,
|
|
42
|
-
|
|
56
|
+
event: eventRepo,
|
|
57
|
+
order: orderRepo,
|
|
58
|
+
product: productRepo,
|
|
59
|
+
project: projectRepo,
|
|
60
|
+
seller: sellerRepo,
|
|
61
|
+
task: taskRepo
|
|
43
62
|
});
|
|
44
63
|
}
|
|
45
64
|
}
|
package/lib/chevre/settings.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export declare type ISettings = factory.project.ISettings & {
|
|
|
24
24
|
};
|
|
25
25
|
export declare const DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD: string;
|
|
26
26
|
export declare const USE_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
|
|
27
|
+
export declare const USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
|
|
27
28
|
/**
|
|
28
29
|
* グローバル設定
|
|
29
30
|
*/
|
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.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.ABORTED_TASKS_WITHOUT_REPORT = void 0;
|
|
3
|
+
exports.settings = exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.ABORTED_TASKS_WITHOUT_REPORT = 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(',')
|
|
@@ -47,6 +47,7 @@ exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = 7;
|
|
|
47
47
|
exports.DEFAULT_SENDER_EMAIL = process.env.DEFAULT_SENDER_EMAIL;
|
|
48
48
|
exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = String(process.env.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD);
|
|
49
49
|
exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = process.env.USE_ASSET_TRANSACTION_SYNC_PROCESSING === '1';
|
|
50
|
+
exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = process.env.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING === '1';
|
|
50
51
|
/**
|
|
51
52
|
* グローバル設定
|
|
52
53
|
*/
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.
|
|
12
|
+
"@chevre/factory": "4.282.0-alpha.0",
|
|
13
13
|
"@cinerino/sdk": "3.135.0",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.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.2.0-alpha.
|
|
123
|
+
"version": "20.2.0-alpha.16"
|
|
124
124
|
}
|
|
@@ -1,32 +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 now = new Date();
|
|
13
|
-
await chevre.service.aggregation.project.aggregate({
|
|
14
|
-
project: { id: project.id },
|
|
15
|
-
reservationFor: {
|
|
16
|
-
startFrom: moment('2022-01-01T00:00:00+09:00')
|
|
17
|
-
.toDate(),
|
|
18
|
-
startThrough: moment('2022-01-31T23:59:59+09:00')
|
|
19
|
-
.toDate(),
|
|
20
|
-
}
|
|
21
|
-
})({
|
|
22
|
-
project: new chevre.repository.Project(mongoose.connection),
|
|
23
|
-
reservation: new chevre.repository.Reservation(mongoose.connection),
|
|
24
|
-
task: new chevre.repository.Task(mongoose.connection)
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
main()
|
|
29
|
-
.then(() => {
|
|
30
|
-
console.log('success!');
|
|
31
|
-
})
|
|
32
|
-
.catch(console.error);
|