@chevre/domain 21.2.0-alpha.26 → 21.2.0-alpha.27
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/lib/chevre/repo/assetTransaction.d.ts +5 -0
- package/lib/chevre/repo/assetTransaction.js +10 -2
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +3 -0
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +1 -0
- package/lib/chevre/service/assetTransaction.d.ts +5 -0
- package/lib/chevre/service/assetTransaction.js +10 -1
- package/lib/chevre/service/transaction.js +2 -2
- package/lib/chevre/settings.d.ts +1 -0
- package/lib/chevre/settings.js +2 -1
- package/package.json +1 -1
|
@@ -98,6 +98,11 @@ export declare class MongoRepository {
|
|
|
98
98
|
};
|
|
99
99
|
status: factory.transactionStatusType;
|
|
100
100
|
id?: string;
|
|
101
|
+
tasksExportAction: {
|
|
102
|
+
agent: {
|
|
103
|
+
name: string;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
101
106
|
}): Promise<Pick<factory.assetTransaction.ITransaction<T>, 'id' | 'typeOf'> | null>;
|
|
102
107
|
/**
|
|
103
108
|
* タスクエクスポートリトライ
|
|
@@ -360,7 +360,13 @@ class MongoRepository {
|
|
|
360
360
|
// no op
|
|
361
361
|
}
|
|
362
362
|
const typeOfIn = (_a = params.typeOf) === null || _a === void 0 ? void 0 : _a.$in;
|
|
363
|
-
return this.transactionModel.findOneAndUpdate(Object.assign(Object.assign(Object.assign(Object.assign({}, (typeof ((_b = params.project) === null || _b === void 0 ? void 0 : _b.id) === 'string') ? { 'project.id': { $eq: params.project.id } } : undefined), (Array.isArray(typeOfIn)) ? { typeOf: { $in: typeOfIn } } : undefined), { status: { $eq: params.status }, tasksExportationStatus: { $eq: factory.transactionTasksExportationStatus.Unexported } }), (typeof params.id === 'string') ? { _id: { $eq: params.id } } : undefined), {
|
|
363
|
+
return this.transactionModel.findOneAndUpdate(Object.assign(Object.assign(Object.assign(Object.assign({}, (typeof ((_b = params.project) === null || _b === void 0 ? void 0 : _b.id) === 'string') ? { 'project.id': { $eq: params.project.id } } : undefined), (Array.isArray(typeOfIn)) ? { typeOf: { $in: typeOfIn } } : undefined), { status: { $eq: params.status }, tasksExportationStatus: { $eq: factory.transactionTasksExportationStatus.Unexported } }), (typeof params.id === 'string') ? { _id: { $eq: params.id } } : undefined), {
|
|
364
|
+
tasksExportAction: {
|
|
365
|
+
agent: { name: params.tasksExportAction.agent.name },
|
|
366
|
+
startDate: new Date()
|
|
367
|
+
},
|
|
368
|
+
tasksExportationStatus: factory.transactionTasksExportationStatus.Exporting
|
|
369
|
+
}, { new: true })
|
|
364
370
|
.select({
|
|
365
371
|
_id: 1,
|
|
366
372
|
typeOf: 1
|
|
@@ -396,12 +402,14 @@ class MongoRepository {
|
|
|
396
402
|
*/
|
|
397
403
|
setTasksExportedById(params) {
|
|
398
404
|
return __awaiter(this, void 0, void 0, function* () {
|
|
405
|
+
const endDate = new Date();
|
|
399
406
|
yield this.transactionModel.updateOne({
|
|
400
407
|
_id: { $eq: params.id },
|
|
401
408
|
tasksExportationStatus: { $eq: factory.transactionTasksExportationStatus.Exporting }
|
|
402
409
|
}, {
|
|
403
410
|
tasksExportationStatus: factory.transactionTasksExportationStatus.Exported,
|
|
404
|
-
tasksExportedAt:
|
|
411
|
+
tasksExportedAt: endDate,
|
|
412
|
+
'tasksExportAction.endDate': endDate
|
|
405
413
|
})
|
|
406
414
|
.exec();
|
|
407
415
|
});
|
|
@@ -69,6 +69,7 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
|
|
|
69
69
|
tasksExportedAt?: Date | undefined;
|
|
70
70
|
location?: any;
|
|
71
71
|
seller?: any;
|
|
72
|
+
tasksExportAction?: any;
|
|
72
73
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
73
74
|
object?: any;
|
|
74
75
|
typeOf?: string | undefined;
|
|
@@ -87,6 +88,7 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
|
|
|
87
88
|
tasksExportedAt?: Date | undefined;
|
|
88
89
|
location?: any;
|
|
89
90
|
seller?: any;
|
|
91
|
+
tasksExportAction?: any;
|
|
90
92
|
}>> & Omit<import("mongoose").FlatRecord<{
|
|
91
93
|
object?: any;
|
|
92
94
|
typeOf?: string | undefined;
|
|
@@ -105,6 +107,7 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
|
|
|
105
107
|
tasksExportedAt?: Date | undefined;
|
|
106
108
|
location?: any;
|
|
107
109
|
seller?: any;
|
|
110
|
+
tasksExportAction?: any;
|
|
108
111
|
}> & {
|
|
109
112
|
_id: import("mongoose").Types.ObjectId;
|
|
110
113
|
}, never>>;
|
|
@@ -28,6 +28,11 @@ export declare function exportTasks<T extends factory.assetTransactionType>(para
|
|
|
28
28
|
typeOf?: {
|
|
29
29
|
$in: T[];
|
|
30
30
|
};
|
|
31
|
+
tasksExportAction?: {
|
|
32
|
+
agent: {
|
|
33
|
+
name: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
31
36
|
}): (repos: {
|
|
32
37
|
task: TaskRepo;
|
|
33
38
|
assetTransaction: AssetTransactionRepo;
|
|
@@ -20,6 +20,7 @@ const PayTransactionService = require("./assetTransaction/pay");
|
|
|
20
20
|
const RefundTransactionService = require("./assetTransaction/refund");
|
|
21
21
|
const RegisterServiceTransactionService = require("./assetTransaction/registerService");
|
|
22
22
|
const ReserveTransactionService = require("./assetTransaction/reserve");
|
|
23
|
+
const settings_1 = require("../settings");
|
|
23
24
|
exports.cancelReservation = CancelReservationTransactionService;
|
|
24
25
|
exports.moneyTransfer = MoneyTransferTransactionService;
|
|
25
26
|
exports.pay = PayTransactionService;
|
|
@@ -31,9 +32,17 @@ exports.reserve = ReserveTransactionService;
|
|
|
31
32
|
*/
|
|
32
33
|
function exportTasks(params) {
|
|
33
34
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
var _a;
|
|
34
36
|
const transaction = yield repos.assetTransaction.startExportTasks({
|
|
35
37
|
typeOf: params.typeOf,
|
|
36
|
-
status: params.status
|
|
38
|
+
status: params.status,
|
|
39
|
+
tasksExportAction: {
|
|
40
|
+
agent: {
|
|
41
|
+
name: (typeof ((_a = params.tasksExportAction) === null || _a === void 0 ? void 0 : _a.agent.name) === 'string')
|
|
42
|
+
? params.tasksExportAction.agent.name
|
|
43
|
+
: settings_1.DEFAULT_TASKS_EXPORT_AGENT_NAME
|
|
44
|
+
}
|
|
45
|
+
}
|
|
37
46
|
});
|
|
38
47
|
if (transaction === null) {
|
|
39
48
|
return;
|
|
@@ -19,7 +19,7 @@ const MoneyTransferTransactionService = require("./transaction/moneyTransfer");
|
|
|
19
19
|
const PlaceOrderTransactionService = require("./transaction/placeOrder");
|
|
20
20
|
const PlaceOrderInProgressTransactionService = require("./transaction/placeOrderInProgress");
|
|
21
21
|
const ReturnOrderTransactionService = require("./transaction/returnOrder");
|
|
22
|
-
const
|
|
22
|
+
const settings_1 = require("../settings");
|
|
23
23
|
exports.moneyTransfer = MoneyTransferTransactionService;
|
|
24
24
|
exports.placeOrder = PlaceOrderTransactionService;
|
|
25
25
|
exports.placeOrderInProgress = PlaceOrderInProgressTransactionService;
|
|
@@ -83,7 +83,7 @@ function exportTasks(params) {
|
|
|
83
83
|
agent: {
|
|
84
84
|
name: (typeof ((_a = params.tasksExportAction) === null || _a === void 0 ? void 0 : _a.agent.name) === 'string')
|
|
85
85
|
? params.tasksExportAction.agent.name
|
|
86
|
-
: DEFAULT_TASKS_EXPORT_AGENT_NAME
|
|
86
|
+
: settings_1.DEFAULT_TASKS_EXPORT_AGENT_NAME
|
|
87
87
|
}
|
|
88
88
|
} }, (typeof params.id === 'string') ? { id: params.id } : undefined));
|
|
89
89
|
if (transaction === null) {
|
package/lib/chevre/settings.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export type ISettings = factory.project.ISettings & {
|
|
|
27
27
|
useOfferRateLimitProjects: string[];
|
|
28
28
|
};
|
|
29
29
|
export declare const DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD: string;
|
|
30
|
+
export declare const DEFAULT_TASKS_EXPORT_AGENT_NAME: string;
|
|
30
31
|
export declare const USE_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
|
|
31
32
|
export declare const USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
|
|
32
33
|
export declare const USE_NEW_EVENT_AVAILABILITY_KEY_FROM: moment.Moment;
|
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_EVENT_EMITTERS = exports.USE_NEW_CONFIRMATION_NUMBER_KEY_FROM = exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = 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;
|
|
3
|
+
exports.settings = exports.USE_EVENT_EMITTERS = exports.USE_NEW_CONFIRMATION_NUMBER_KEY_FROM = exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = 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 moment = require("moment");
|
|
5
5
|
const factory = require("./factory");
|
|
6
6
|
const transactionWebhookUrls = (typeof process.env.INFORM_TRANSACTION_URL === 'string')
|
|
@@ -44,6 +44,7 @@ exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = (typeof process.env.TRANSA
|
|
|
44
44
|
: 7;
|
|
45
45
|
exports.DEFAULT_SENDER_EMAIL = process.env.DEFAULT_SENDER_EMAIL;
|
|
46
46
|
exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = String(process.env.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD);
|
|
47
|
+
exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = `${process.env.GAE_APPLICATION}:${process.env.GAE_SERVICE}:jobs`;
|
|
47
48
|
exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = process.env.USE_ASSET_TRANSACTION_SYNC_PROCESSING === '1';
|
|
48
49
|
exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = process.env.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING === '1';
|
|
49
50
|
exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = (typeof process.env.USE_NEW_EVENT_AVAILABILITY_KEY_FROM === 'string')
|
package/package.json
CHANGED