@chevre/domain 21.30.0-alpha.0 → 21.30.0-alpha.2
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/mongoose/schemas/action.js +2 -2
- package/lib/chevre/service/payment/creditCard.d.ts +5 -1
- package/lib/chevre/service/payment/creditCard.js +10 -3
- package/lib/chevre/service/payment/movieTicket.d.ts +5 -1
- package/lib/chevre/service/payment/movieTicket.js +9 -2
- package/lib/chevre/service/payment.d.ts +5 -1
- package/lib/chevre/service/task/authorizePayment.d.ts +6 -0
- package/lib/chevre/service/task/authorizePayment.js +51 -0
- package/lib/chevre/service/task/refund.d.ts +1 -1
- package/lib/chevre/service/task/refund.js +9 -1
- package/lib/chevre/service/task.js +8 -1
- package/package.json +2 -2
|
@@ -26,7 +26,8 @@ const schemaDefinition = {
|
|
|
26
26
|
instrument: mongoose_1.SchemaTypes.Mixed,
|
|
27
27
|
location: mongoose_1.SchemaTypes.Mixed,
|
|
28
28
|
replacer: mongoose_1.SchemaTypes.Mixed,
|
|
29
|
-
targetCollection: mongoose_1.SchemaTypes.Mixed
|
|
29
|
+
targetCollection: mongoose_1.SchemaTypes.Mixed,
|
|
30
|
+
sameAs: mongoose_1.SchemaTypes.Mixed // タスク関連付けのために追加(2024-04-20~)
|
|
30
31
|
};
|
|
31
32
|
const schemaOptions = {
|
|
32
33
|
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
|
@@ -35,7 +36,6 @@ const schemaOptions = {
|
|
|
35
36
|
id: true,
|
|
36
37
|
read: 'primary',
|
|
37
38
|
writeConcern: writeConcern_1.writeConcern,
|
|
38
|
-
// true化(2022-11-12~)
|
|
39
39
|
strict: true,
|
|
40
40
|
strictQuery: false,
|
|
41
41
|
timestamps: {
|
|
@@ -56,7 +56,11 @@ declare function payCreditCard(params: factory.task.pay.IPayActionData): (repos:
|
|
|
56
56
|
/**
|
|
57
57
|
* クレジットカード返金
|
|
58
58
|
*/
|
|
59
|
-
declare function refundCreditCard(params: factory.task.refund.IData
|
|
59
|
+
declare function refundCreditCard(params: factory.task.refund.IData & {
|
|
60
|
+
sameAs?: {
|
|
61
|
+
id: string;
|
|
62
|
+
};
|
|
63
|
+
}, options: {
|
|
60
64
|
requirePayAction: boolean;
|
|
61
65
|
}): (repos: {
|
|
62
66
|
action: ActionRepo;
|
|
@@ -421,7 +421,7 @@ function processAlterTran(params) {
|
|
|
421
421
|
*/
|
|
422
422
|
function refundCreditCard(params, options) {
|
|
423
423
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
424
|
-
var _a, _b, _c, _d, _e;
|
|
424
|
+
var _a, _b, _c, _d, _e, _f;
|
|
425
425
|
const paymentMethodType = (_a = params.object[0]) === null || _a === void 0 ? void 0 : _a.paymentMethod.typeOf;
|
|
426
426
|
const paymentMethodId = (_b = params.object[0]) === null || _b === void 0 ? void 0 : _b.paymentMethod.paymentMethodId;
|
|
427
427
|
const paymentServiceId = (_c = params.object[0]) === null || _c === void 0 ? void 0 : _c.id;
|
|
@@ -443,7 +443,14 @@ function refundCreditCard(params, options) {
|
|
|
443
443
|
typeOf: factory.service.paymentService.PaymentServiceType.CreditCard,
|
|
444
444
|
id: paymentServiceId
|
|
445
445
|
});
|
|
446
|
-
let action = yield repos.action.start(params)
|
|
446
|
+
let action = yield repos.action.start(Object.assign(Object.assign({}, params), (typeof ((_e = params.sameAs) === null || _e === void 0 ? void 0 : _e.id) === 'string')
|
|
447
|
+
? {
|
|
448
|
+
sameAs: {
|
|
449
|
+
id: params.sameAs.id,
|
|
450
|
+
typeOf: 'Task'
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
: undefined));
|
|
447
454
|
let alterTranResult = [];
|
|
448
455
|
try {
|
|
449
456
|
alterTranResult = yield processChangeTransaction({
|
|
@@ -452,7 +459,7 @@ function refundCreditCard(params, options) {
|
|
|
452
459
|
paymentMethodId: paymentMethodId,
|
|
453
460
|
shopId: shopId,
|
|
454
461
|
shopPass: shopPass,
|
|
455
|
-
refundFee: (
|
|
462
|
+
refundFee: (_f = params.object[0]) === null || _f === void 0 ? void 0 : _f.refundFee
|
|
456
463
|
});
|
|
457
464
|
}
|
|
458
465
|
catch (error) {
|
|
@@ -70,5 +70,9 @@ declare function payMovieTicket(params: factory.task.pay.IPayActionData): IPayOp
|
|
|
70
70
|
/**
|
|
71
71
|
* MovieTicket着券取消
|
|
72
72
|
*/
|
|
73
|
-
declare function refundMovieTicket(params: factory.task.refund.IData
|
|
73
|
+
declare function refundMovieTicket(params: factory.task.refund.IData & {
|
|
74
|
+
sameAs?: {
|
|
75
|
+
id: string;
|
|
76
|
+
};
|
|
77
|
+
}): IRefundOperation<void>;
|
|
74
78
|
export { ICheckResult, authorize, checkMovieTicket, payMovieTicket, refundMovieTicket, voidTransaction };
|
|
@@ -352,7 +352,7 @@ function payActionParams2seatInfoSyncIn(params) {
|
|
|
352
352
|
function refundMovieTicket(params) {
|
|
353
353
|
// tslint:disable-next-line:max-func-body-length
|
|
354
354
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
355
|
-
var _a, _b, _c, _d, _e;
|
|
355
|
+
var _a, _b, _c, _d, _e, _f;
|
|
356
356
|
const paymentMethodId = (_a = params.object[0]) === null || _a === void 0 ? void 0 : _a.paymentMethod.paymentMethodId;
|
|
357
357
|
const paymentServiceId = (_b = params.object[0]) === null || _b === void 0 ? void 0 : _b.id;
|
|
358
358
|
const availableChannel = yield repos.paymentService.findAvailableChannel({
|
|
@@ -369,7 +369,14 @@ function refundMovieTicket(params) {
|
|
|
369
369
|
});
|
|
370
370
|
const movieTicketSeatService = new surfrock.service.seat.SeatService({ endpoint: String(availableChannel.serviceUrl), auth: mvtkReserveAuthClient }, { timeout: credentials_1.credentials.movieticketReserve.timeout });
|
|
371
371
|
// アクション開始
|
|
372
|
-
let action = yield repos.action.start(params)
|
|
372
|
+
let action = yield repos.action.start(Object.assign(Object.assign({}, params), (typeof ((_f = params.sameAs) === null || _f === void 0 ? void 0 : _f.id) === 'string')
|
|
373
|
+
? {
|
|
374
|
+
sameAs: {
|
|
375
|
+
id: params.sameAs.id,
|
|
376
|
+
typeOf: 'Task'
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
: undefined));
|
|
373
380
|
let seatInfoSyncIn;
|
|
374
381
|
let seatInfoSyncResult;
|
|
375
382
|
let seatInfoSyncResultAsError;
|
|
@@ -45,7 +45,11 @@ export declare function voidPayment(params: factory.task.voidPayment.IData): (re
|
|
|
45
45
|
/**
|
|
46
46
|
* 返金
|
|
47
47
|
*/
|
|
48
|
-
export declare function refund(params: factory.task.refund.IData
|
|
48
|
+
export declare function refund(params: factory.task.refund.IData & {
|
|
49
|
+
sameAs?: {
|
|
50
|
+
id: string;
|
|
51
|
+
};
|
|
52
|
+
}): (repos: {
|
|
49
53
|
action: ActionRepo;
|
|
50
54
|
accountingReport: AccountingReportRepo;
|
|
51
55
|
paymentAccepted: PaymentAcceptedRepo;
|
|
@@ -0,0 +1,51 @@
|
|
|
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.call = void 0;
|
|
13
|
+
const factory = require("../../factory");
|
|
14
|
+
const accountingReport_1 = require("../../repo/accountingReport");
|
|
15
|
+
const action_1 = require("../../repo/action");
|
|
16
|
+
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
17
|
+
const event_1 = require("../../repo/event");
|
|
18
|
+
const paymentService_1 = require("../../repo/paymentService");
|
|
19
|
+
const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
20
|
+
const product_1 = require("../../repo/product");
|
|
21
|
+
const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
|
|
22
|
+
const task_1 = require("../../repo/task");
|
|
23
|
+
const transaction_1 = require("../../repo/transaction");
|
|
24
|
+
const transactionNumber_1 = require("../../repo/transactionNumber");
|
|
25
|
+
const transactionProcess_1 = require("../../repo/transactionProcess");
|
|
26
|
+
const any_1 = require("../payment/any");
|
|
27
|
+
/**
|
|
28
|
+
* タスク実行関数
|
|
29
|
+
*/
|
|
30
|
+
function call(params) {
|
|
31
|
+
return (settings) => __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
if (settings.redisClient === undefined) {
|
|
33
|
+
throw new factory.errors.Argument('settings', 'redisClient required');
|
|
34
|
+
}
|
|
35
|
+
yield (0, any_1.authorize)(params.data)({
|
|
36
|
+
accountingReport: new accountingReport_1.MongoRepository(settings.connection),
|
|
37
|
+
action: new action_1.MongoRepository(settings.connection),
|
|
38
|
+
assetTransaction: new assetTransaction_1.MongoRepository(settings.connection),
|
|
39
|
+
event: new event_1.MongoRepository(settings.connection),
|
|
40
|
+
paymentAccepted: new sellerPaymentAccepted_1.MongoRepository(settings.connection),
|
|
41
|
+
paymentService: new paymentService_1.MongoRepository(settings.connection),
|
|
42
|
+
paymentServiceProvider: new paymentServiceProvider_1.MongoRepository(settings.connection),
|
|
43
|
+
product: new product_1.MongoRepository(settings.connection),
|
|
44
|
+
task: new task_1.MongoRepository(settings.connection),
|
|
45
|
+
transaction: new transaction_1.MongoRepository(settings.connection),
|
|
46
|
+
transactionNumber: new transactionNumber_1.RedisRepository(settings.redisClient),
|
|
47
|
+
transactionProcess: new transactionProcess_1.TransactionProcessRepository(settings.redisClient, { lockExpiresInSeconds: 120 })
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
exports.call = call;
|
|
@@ -25,11 +25,19 @@ const PaymentService = require("../payment");
|
|
|
25
25
|
/**
|
|
26
26
|
* タスク実行関数
|
|
27
27
|
*/
|
|
28
|
-
function call(
|
|
28
|
+
function call(params) {
|
|
29
29
|
return (settings) => __awaiter(this, void 0, void 0, function* () {
|
|
30
30
|
if (settings.redisClient === undefined) {
|
|
31
31
|
throw new factory.errors.Argument('settings', 'redisClient required');
|
|
32
32
|
}
|
|
33
|
+
let data;
|
|
34
|
+
if (params.name === factory.taskName.Refund) {
|
|
35
|
+
data = Object.assign(Object.assign({}, params.data), { sameAs: { id: params.id } // タスクIDを関連付け(2024-04-20~)
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
data = params;
|
|
40
|
+
}
|
|
33
41
|
yield PaymentService.refund(data)({
|
|
34
42
|
accountingReport: new accountingReport_1.MongoRepository(settings.connection),
|
|
35
43
|
action: new action_1.MongoRepository(settings.connection),
|
|
@@ -87,7 +87,14 @@ function execute(task) {
|
|
|
87
87
|
try {
|
|
88
88
|
// タスク名の関数が定義されていなければ、TypeErrorとなる
|
|
89
89
|
const { call } = yield Promise.resolve(`${`./task/${task.name}`}`).then(s => require(s));
|
|
90
|
-
|
|
90
|
+
switch (task.name) {
|
|
91
|
+
case factory.taskName.AuthorizePayment:
|
|
92
|
+
case factory.taskName.Refund:
|
|
93
|
+
yield call(task)(settings);
|
|
94
|
+
break;
|
|
95
|
+
default:
|
|
96
|
+
yield call(task.data)(settings);
|
|
97
|
+
}
|
|
91
98
|
const result = {
|
|
92
99
|
executedAt: now,
|
|
93
100
|
endDate: new Date(),
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/credential-providers": "3.433.0",
|
|
13
|
-
"@chevre/factory": "4.
|
|
13
|
+
"@chevre/factory": "4.368.0-alpha.1",
|
|
14
14
|
"@cinerino/sdk": "5.17.1",
|
|
15
15
|
"@motionpicture/coa-service": "9.4.0",
|
|
16
16
|
"@motionpicture/gmo-service": "5.3.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.30.0-alpha.
|
|
113
|
+
"version": "21.30.0-alpha.2"
|
|
114
114
|
}
|