@chevre/domain 20.12.0-alpha.0 → 20.12.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/service/assetTransaction/pay.d.ts +4 -1
- package/lib/chevre/service/assetTransaction/pay.js +3 -1
- package/lib/chevre/service/payment/movieTicket/validation.js +28 -9
- package/lib/chevre/service/payment/movieTicket.d.ts +3 -2
- package/lib/chevre/service/payment/movieTicket.js +11 -2
- package/package.json +1 -1
|
@@ -13,6 +13,7 @@ import { MongoRepository as ProductRepo } from '../../repo/product';
|
|
|
13
13
|
import { MongoRepository as ProjectRepo } from '../../repo/project';
|
|
14
14
|
import { MongoRepository as SellerRepo } from '../../repo/seller';
|
|
15
15
|
import { MongoRepository as TaskRepo } from '../../repo/task';
|
|
16
|
+
import * as MovieTicketPayment from '../payment/movieTicket';
|
|
16
17
|
export interface IStartOperationRepos {
|
|
17
18
|
accountingReport: AccountingReportRepo;
|
|
18
19
|
action: ActionRepo;
|
|
@@ -89,7 +90,9 @@ export declare function invalidatePaymentUrl(params: factory.task.refund.IData):
|
|
|
89
90
|
/**
|
|
90
91
|
* 決済方法認証
|
|
91
92
|
*/
|
|
92
|
-
export declare function check(params: factory.action.check.paymentMethod.movieTicket.IAttributes): ICheckOperation<
|
|
93
|
+
export declare function check(params: factory.action.check.paymentMethod.movieTicket.IAttributes): ICheckOperation<{
|
|
94
|
+
result: MovieTicketPayment.ICheckResult;
|
|
95
|
+
}>;
|
|
93
96
|
/**
|
|
94
97
|
* 取引開始
|
|
95
98
|
*/
|
|
@@ -80,7 +80,9 @@ exports.invalidatePaymentUrl = invalidatePaymentUrl;
|
|
|
80
80
|
/**
|
|
81
81
|
* 決済方法認証
|
|
82
82
|
*/
|
|
83
|
-
function check(params
|
|
83
|
+
function check(params
|
|
84
|
+
// ): ICheckOperation<factory.action.check.paymentMethod.movieTicket.IAction> {
|
|
85
|
+
) {
|
|
84
86
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
85
87
|
var _a;
|
|
86
88
|
let action;
|
|
@@ -15,6 +15,7 @@ exports.validateMovieTicket = void 0;
|
|
|
15
15
|
*/
|
|
16
16
|
const factory = require("../../../factory");
|
|
17
17
|
const checkByIdentifier_1 = require("./checkByIdentifier");
|
|
18
|
+
// tslint:disable-next-line:max-func-body-length
|
|
18
19
|
function validateMovieTicket(params, paymentServiceId, useCheckMovieTicketBeforePay) {
|
|
19
20
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
20
21
|
var _a, _b, _c, _d;
|
|
@@ -61,21 +62,39 @@ function validateMovieTicket(params, paymentServiceId, useCheckMovieTicketBefore
|
|
|
61
62
|
screeningEvent: screeningEvent,
|
|
62
63
|
paymentServiceId
|
|
63
64
|
})(repos);
|
|
65
|
+
// checkResult.movieTicketsへの依存排除(2023-03-24~)
|
|
64
66
|
// 要求に対して十分かどうか検証する
|
|
65
|
-
const availableMovieTickets = checkResult.movieTickets.filter((t) =>
|
|
66
|
-
// 総数が足りているか
|
|
67
|
-
if (availableMovieTickets.length < movieTickets.length) {
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
// const availableMovieTickets = checkResult.movieTickets.filter((t) => t.amount?.validThrough === undefined);
|
|
68
|
+
// 総数が足りているか(券種ごとに枚数検証を実行するので不要)
|
|
69
|
+
// if (availableMovieTickets.length < movieTickets.length) {
|
|
70
|
+
// throw new factory.errors.Argument(
|
|
71
|
+
// 'movieTickets',
|
|
72
|
+
// `${movieTickets.length - availableMovieTickets.length} movie tickets short`
|
|
73
|
+
// );
|
|
74
|
+
// }
|
|
70
75
|
// 券種ごとに枚数が足りているか
|
|
71
76
|
const serviceTypes = [...new Set(movieTickets.map((t) => t.serviceType))];
|
|
72
77
|
serviceTypes.forEach((serviceType) => {
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
var _a, _b, _c;
|
|
79
|
+
const requiredMovieTicketsCountByServiceType = movieTickets.filter((t) => t.serviceType === serviceType).length;
|
|
80
|
+
let availableMovieTicketsCountByServiceType = 0;
|
|
81
|
+
const ykknInfos = (_b = (_a = checkResult.purchaseNumberAuthResult.knyknrNoInfoOut) === null || _a === void 0 ? void 0 : _a.find((knyknrNoInfoOut) => knyknrNoInfoOut.knyknrNo === movieTicketIdentifiers[0])) === null || _b === void 0 ? void 0 : _b.ykknInfo;
|
|
82
|
+
const ykknKnshbtsmiNum = (_c = ykknInfos === null || ykknInfos === void 0 ? void 0 : ykknInfos.find((ykknInfo) => ykknInfo.ykknshTyp === serviceType)) === null || _c === void 0 ? void 0 : _c.ykknKnshbtsmiNum;
|
|
83
|
+
if (typeof ykknKnshbtsmiNum === 'string') {
|
|
84
|
+
availableMovieTicketsCountByServiceType = Number(ykknKnshbtsmiNum);
|
|
85
|
+
}
|
|
86
|
+
if (availableMovieTicketsCountByServiceType < requiredMovieTicketsCountByServiceType) {
|
|
87
|
+
const shortNumber = requiredMovieTicketsCountByServiceType - availableMovieTicketsCountByServiceType;
|
|
77
88
|
throw new factory.errors.Argument('movieTickets', `${shortNumber} movie tickets by service type ${serviceType} short`);
|
|
78
89
|
}
|
|
90
|
+
// const availableMovieTicketsByServiceType = availableMovieTickets.filter((t) => t.serviceType === serviceType);
|
|
91
|
+
// if (availableMovieTicketsByServiceType.length < requiredMovieTicketsCountByServiceType) {
|
|
92
|
+
// const shortNumber = requiredMovieTicketsCountByServiceType - availableMovieTicketsByServiceType.length;
|
|
93
|
+
// throw new factory.errors.Argument(
|
|
94
|
+
// 'movieTickets',
|
|
95
|
+
// `${shortNumber} movie tickets by service type ${serviceType} short`
|
|
96
|
+
// );
|
|
97
|
+
// }
|
|
79
98
|
});
|
|
80
99
|
// checkはするが保管は保留(2023-03-09~)
|
|
81
100
|
return;
|
|
@@ -34,11 +34,12 @@ interface IRefundOperationRepos {
|
|
|
34
34
|
task: TaskRepo;
|
|
35
35
|
}
|
|
36
36
|
declare type IRefundOperation<T> = (repos: IRefundOperationRepos) => Promise<T>;
|
|
37
|
-
declare type ICheckMovieTicketAction = factory.action.check.paymentMethod.movieTicket.IAction;
|
|
38
37
|
/**
|
|
39
38
|
* MovieTicket認証
|
|
40
39
|
*/
|
|
41
|
-
declare function checkMovieTicket(params: factory.action.check.paymentMethod.movieTicket.IAttributes): ICheckOperation<
|
|
40
|
+
declare function checkMovieTicket(params: factory.action.check.paymentMethod.movieTicket.IAttributes): ICheckOperation<{
|
|
41
|
+
result: ICheckResult;
|
|
42
|
+
}>;
|
|
42
43
|
interface IAuthorizeResult {
|
|
43
44
|
accountId: string;
|
|
44
45
|
checkResult?: ICheckResult;
|
|
@@ -23,6 +23,7 @@ const validation_1 = require("./movieTicket/validation");
|
|
|
23
23
|
const errorHandler_1 = require("../../errorHandler");
|
|
24
24
|
const onPaid_1 = require("./any/onPaid");
|
|
25
25
|
const onRefund_1 = require("./any/onRefund");
|
|
26
|
+
// type ICheckMovieTicketAction = factory.action.check.paymentMethod.movieTicket.IAction;
|
|
26
27
|
/**
|
|
27
28
|
* MovieTicket認証
|
|
28
29
|
*/
|
|
@@ -84,8 +85,16 @@ function checkMovieTicket(params) {
|
|
|
84
85
|
error = (0, errorHandler_1.handleMvtkReserveError)(error);
|
|
85
86
|
throw error;
|
|
86
87
|
}
|
|
87
|
-
const result =
|
|
88
|
-
|
|
88
|
+
const result = {
|
|
89
|
+
purchaseNumberAuthIn: checkResult.purchaseNumberAuthIn,
|
|
90
|
+
purchaseNumberAuthResult: checkResult.purchaseNumberAuthResult,
|
|
91
|
+
// action.resultへの保管を廃止(2023-03-24~)
|
|
92
|
+
movieTickets: []
|
|
93
|
+
};
|
|
94
|
+
yield repos.action.complete({ typeOf: actionAttributes.typeOf, id: action.id, result });
|
|
95
|
+
return {
|
|
96
|
+
result: checkResult
|
|
97
|
+
};
|
|
89
98
|
});
|
|
90
99
|
}
|
|
91
100
|
exports.checkMovieTicket = checkMovieTicket;
|
package/package.json
CHANGED