@chevre/domain 24.0.0-alpha.41 → 24.0.0-alpha.42
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/action/pay.d.ts +16 -0
- package/lib/chevre/repo/action/pay.js +41 -0
- package/lib/chevre/repo/action.d.ts +2 -11
- package/lib/chevre/repo/action.js +20 -13
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorize.d.ts +1 -2
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeMovieTicket.d.ts +1 -2
- package/lib/chevre/service/assetTransaction/pay/start.d.ts +1 -2
- package/lib/chevre/service/assetTransaction/refund.d.ts +5 -2
- package/lib/chevre/service/assetTransaction/refund.js +1 -1
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createStartParams.js +3 -2
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.js +14 -11
- package/lib/chevre/service/payment/any/authorize.d.ts +1 -2
- package/lib/chevre/service/payment/any/onPayActionCompleted.d.ts +1 -0
- package/lib/chevre/service/payment/any/onRefundActionCompletedOrFailed.d.ts +1 -0
- package/lib/chevre/service/payment/creditCard/payCreditCard.d.ts +1 -2
- package/lib/chevre/service/payment/creditCard/payCreditCard.js +8 -4
- package/lib/chevre/service/payment/creditCard/refundCreditCard.d.ts +1 -2
- package/lib/chevre/service/payment/creditCard/refundCreditCard.js +10 -6
- package/lib/chevre/service/payment/faceToFace.d.ts +2 -3
- package/lib/chevre/service/payment/faceToFace.js +16 -8
- package/lib/chevre/service/payment/movieTicket/authorize.d.ts +1 -2
- package/lib/chevre/service/payment/movieTicket/payMovieTicket.d.ts +1 -2
- package/lib/chevre/service/payment/movieTicket/payMovieTicket.js +10 -6
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket/createSeatInfoSyncCancelInOnRefund.d.ts +14 -0
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket/createSeatInfoSyncCancelInOnRefund.js +49 -0
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket/createSeatInfoSyncInOnRefund.d.ts +14 -0
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket/createSeatInfoSyncInOnRefund.js +46 -0
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket/processSeatInfoSync.d.ts +12 -0
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket/processSeatInfoSync.js +72 -0
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket/processSeatInfoSyncCancel.d.ts +8 -0
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket/processSeatInfoSyncCancel.js +60 -0
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket.d.ts +2 -3
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +20 -125
- package/lib/chevre/service/payment/movieTicket/voidTransaction.d.ts +0 -2
- package/lib/chevre/service/payment/movieTicket/voidTransaction.js +1 -1
- package/lib/chevre/service/payment/paymentCard.d.ts +2 -3
- package/lib/chevre/service/payment/paymentCard.js +16 -8
- package/lib/chevre/service/task/authorizePayment.js +2 -2
- package/lib/chevre/service/task/invalidatePaymentUrl.js +2 -2
- package/lib/chevre/service/task/pay.js +2 -2
- package/lib/chevre/service/task/payment/invalidatePaymentUrlByTask.d.ts +1 -2
- package/lib/chevre/service/task/payment/payByTask.d.ts +1 -2
- package/lib/chevre/service/task/payment/refundByTask.d.ts +1 -2
- package/lib/chevre/service/task/refund.js +2 -2
- package/lib/chevre/service/task/returnPayTransaction.js +5 -2
- package/package.json +2 -2
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as surfrock from '@surfrock/sdk';
|
|
2
|
+
import type { PayActionRepo } from '../../../../repo/action/pay';
|
|
3
|
+
import * as factory from '../../../../factory';
|
|
4
|
+
export declare function createSeatInfoSyncCancelInOnRefund(params: {
|
|
5
|
+
project: {
|
|
6
|
+
id: string;
|
|
7
|
+
};
|
|
8
|
+
paymentMethodId: string;
|
|
9
|
+
payAction: Pick<factory.action.trade.pay.IAction, 'id'>;
|
|
10
|
+
}): (repos: {
|
|
11
|
+
actions: {
|
|
12
|
+
pay: PayActionRepo;
|
|
13
|
+
};
|
|
14
|
+
}) => Promise<surfrock.service.seat.factory.seatInfoSyncCancel.ISeatInfoSyncCancelIn>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.createSeatInfoSyncCancelInOnRefund = createSeatInfoSyncCancelInOnRefund;
|
|
27
|
+
const surfrock = __importStar(require("@surfrock/sdk"));
|
|
28
|
+
const factory = __importStar(require("../../../../factory"));
|
|
29
|
+
function createSeatInfoSyncCancelInOnRefund(params) {
|
|
30
|
+
return async (repos) => {
|
|
31
|
+
const recipe = await repos.actions.pay.findRecipeByAction({
|
|
32
|
+
project: { id: params.project.id },
|
|
33
|
+
recipeFor: { id: params.payAction.id }
|
|
34
|
+
});
|
|
35
|
+
const seatInfoSyncInOnPay = recipe?.step[0]?.itemListElement[0]?.itemListElement[0]?.beforeMedia;
|
|
36
|
+
if (seatInfoSyncInOnPay === undefined) {
|
|
37
|
+
throw new factory.errors.NotFound('PayAction.recipe.step.itemListElement.itemListElement.beforeMedia');
|
|
38
|
+
}
|
|
39
|
+
const seatInfoSyncCancelIn = {
|
|
40
|
+
kgygishCd: seatInfoSyncInOnPay.kgygishCd,
|
|
41
|
+
kgysystmzskyykNo: seatInfoSyncInOnPay.kgygishSstmZskyykNo,
|
|
42
|
+
kgysystmzskyykNoIkktsCnclFlg: '1',
|
|
43
|
+
jyuTyp: surfrock.service.seat.factory.seatInfoSyncCancel.JyuTyp.JyuTyp05,
|
|
44
|
+
jyuTypRmk: ''
|
|
45
|
+
// knyknrNoInfoIn: [],
|
|
46
|
+
};
|
|
47
|
+
return seatInfoSyncCancelIn;
|
|
48
|
+
};
|
|
49
|
+
}
|
package/lib/chevre/service/payment/movieTicket/refundMovieTicket/createSeatInfoSyncInOnRefund.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as surfrock from '@surfrock/sdk';
|
|
2
|
+
import type { PayActionRepo } from '../../../../repo/action/pay';
|
|
3
|
+
import * as factory from '../../../../factory';
|
|
4
|
+
export declare function createSeatInfoSyncInOnRefund(params: {
|
|
5
|
+
project: {
|
|
6
|
+
id: string;
|
|
7
|
+
};
|
|
8
|
+
paymentMethodId: string;
|
|
9
|
+
payAction: Pick<factory.action.trade.pay.IAction, 'id'>;
|
|
10
|
+
}): (repos: {
|
|
11
|
+
actions: {
|
|
12
|
+
pay: PayActionRepo;
|
|
13
|
+
};
|
|
14
|
+
}) => Promise<surfrock.factory.service.seat.seatInfoSync.ISeatInfoSyncIn>;
|
package/lib/chevre/service/payment/movieTicket/refundMovieTicket/createSeatInfoSyncInOnRefund.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.createSeatInfoSyncInOnRefund = createSeatInfoSyncInOnRefund;
|
|
27
|
+
const surfrock = __importStar(require("@surfrock/sdk"));
|
|
28
|
+
const factory = __importStar(require("../../../../factory"));
|
|
29
|
+
function createSeatInfoSyncInOnRefund(params) {
|
|
30
|
+
return async (repos) => {
|
|
31
|
+
const recipe = await repos.actions.pay.findRecipeByAction({
|
|
32
|
+
project: { id: params.project.id },
|
|
33
|
+
recipeFor: { id: params.payAction.id }
|
|
34
|
+
});
|
|
35
|
+
const seatInfoSyncInOnPay = recipe?.step[0]?.itemListElement[0]?.itemListElement[0]?.beforeMedia;
|
|
36
|
+
if (seatInfoSyncInOnPay === undefined) {
|
|
37
|
+
throw new factory.errors.NotFound('PayAction.recipe.step.itemListElement.itemListElement.beforeMedia');
|
|
38
|
+
}
|
|
39
|
+
// 着券時のseatInfoSyncInに対してtrkshFlgだけ変更してリクエストする
|
|
40
|
+
const seatInfoSyncIn = {
|
|
41
|
+
...seatInfoSyncInOnPay,
|
|
42
|
+
trkshFlg: surfrock.factory.service.seat.seatInfoSync.DeleteFlag.True // 取消フラグ
|
|
43
|
+
};
|
|
44
|
+
return seatInfoSyncIn;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as surfrock from '@surfrock/sdk';
|
|
2
|
+
import * as factory from '../../../../factory';
|
|
3
|
+
import { IProcessSeatInfoSyncResult } from '../factory';
|
|
4
|
+
export declare function processSeatInfoSync(params: {
|
|
5
|
+
seatInfoSyncIn: factory.action.trade.refund.ISeatInfoSyncIn;
|
|
6
|
+
paymentMethodId: string;
|
|
7
|
+
purpose: factory.action.trade.refund.IPurposeAsReturnAction | factory.action.trade.refund.IOrderAsPayPurpose;
|
|
8
|
+
}): (repos: {
|
|
9
|
+
seatService: surfrock.service.seat.SeatService;
|
|
10
|
+
}) => Promise<IProcessSeatInfoSyncResult & {
|
|
11
|
+
seatInfoSyncResultAsError?: factory.action.trade.refund.ISeatInfoSyncResultAsError;
|
|
12
|
+
}>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.processSeatInfoSync = processSeatInfoSync;
|
|
27
|
+
const http_status_1 = require("http-status");
|
|
28
|
+
const errorHandler_1 = require("../../../../errorHandler");
|
|
29
|
+
const factory = __importStar(require("../../../../factory"));
|
|
30
|
+
const factory_1 = require("../factory");
|
|
31
|
+
function processSeatInfoSync(params) {
|
|
32
|
+
return async (repos) => {
|
|
33
|
+
let seatInfoSyncResult;
|
|
34
|
+
let seatInfoSyncResultAsError;
|
|
35
|
+
const { seatInfoSyncIn, paymentMethodId, purpose } = params;
|
|
36
|
+
try {
|
|
37
|
+
seatInfoSyncResult = await repos.seatService.seatInfoSync(seatInfoSyncIn);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
let throwsError = true;
|
|
41
|
+
// 「存在しない興行会社システム座席予約番号が入力されました」の場合、取消済なのでok
|
|
42
|
+
if (error.name === errorHandler_1.MOVIE_TICKET_RESERVE_REQUEST_ERROR_NAME) {
|
|
43
|
+
if (error.code === http_status_1.BAD_REQUEST && error.message === factory_1.MovieticketReserveRequestErrorMessage.NotFound) {
|
|
44
|
+
seatInfoSyncResult = error;
|
|
45
|
+
throwsError = false;
|
|
46
|
+
}
|
|
47
|
+
// ReservationResult 19の内容が不明だがリトライする意味はおそらくないパターン
|
|
48
|
+
if (error.code === http_status_1.BAD_REQUEST && error.message === factory_1.MovieticketReserveRequestErrorMessage.ReservationResult19) {
|
|
49
|
+
seatInfoSyncResult = error;
|
|
50
|
+
throwsError = false;
|
|
51
|
+
}
|
|
52
|
+
// surfrock: bookingNoが存在しないケースをハンドル(2024-03-13~)
|
|
53
|
+
const expectedMessage4surfrockNotFound = JSON.stringify({ message: `bookingNo:"${paymentMethodId}" が見つかりません。` });
|
|
54
|
+
if (error.code === http_status_1.BAD_REQUEST && error.message === expectedMessage4surfrockNotFound) {
|
|
55
|
+
seatInfoSyncResult = error;
|
|
56
|
+
throwsError = false;
|
|
57
|
+
}
|
|
58
|
+
// 着券取消可能期間超過を認識した上でのあえての返金の場合(注文からしばらく経って返品など)(2024-03-19~)
|
|
59
|
+
if (error.code === http_status_1.BAD_REQUEST && error.message === factory_1.MovieticketReserveRequestErrorMessage.CancellationPeriodPassed) {
|
|
60
|
+
if (purpose.typeOf === factory.actionType.ReturnAction) {
|
|
61
|
+
seatInfoSyncResultAsError = error;
|
|
62
|
+
throwsError = false;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (throwsError) {
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return { seatInfoSyncIn, seatInfoSyncResult, seatInfoSyncResultAsError };
|
|
71
|
+
};
|
|
72
|
+
}
|
package/lib/chevre/service/payment/movieTicket/refundMovieTicket/processSeatInfoSyncCancel.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as surfrock from '@surfrock/sdk';
|
|
2
|
+
import * as factory from '../../../../factory';
|
|
3
|
+
import { IProcessSeatInfoSyncCancelResult } from '../factory';
|
|
4
|
+
export declare function processSeatInfoSyncCancel(params: {
|
|
5
|
+
seatInfoSyncCancelIn: factory.action.trade.refund.ISeatInfoSyncCancelIn;
|
|
6
|
+
}): (repos: {
|
|
7
|
+
seatService: surfrock.service.seat.SeatService;
|
|
8
|
+
}) => Promise<IProcessSeatInfoSyncCancelResult>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.processSeatInfoSyncCancel = processSeatInfoSyncCancel;
|
|
27
|
+
const surfrock = __importStar(require("@surfrock/sdk"));
|
|
28
|
+
const http_status_1 = require("http-status");
|
|
29
|
+
const errorHandler_1 = require("../../../../errorHandler");
|
|
30
|
+
function processSeatInfoSyncCancel(params) {
|
|
31
|
+
return async (repos) => {
|
|
32
|
+
let seatInfoSyncCancelResult;
|
|
33
|
+
const { seatInfoSyncCancelIn } = params;
|
|
34
|
+
try {
|
|
35
|
+
seatInfoSyncCancelResult = await repos.seatService.seatInfoSyncCancel(seatInfoSyncCancelIn);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
let throwsError = true;
|
|
39
|
+
if (error.name === errorHandler_1.MOVIE_TICKET_RESERVE_REQUEST_ERROR_NAME) {
|
|
40
|
+
if (error.code === http_status_1.BAD_REQUEST) {
|
|
41
|
+
if (Array.isArray(error.errors) && error.errors.length > 0) {
|
|
42
|
+
const mvtkReserveServiceError = error.errors[0];
|
|
43
|
+
// 興行会社システム座席予約番号存在無の場合、取消済なのでok
|
|
44
|
+
if (mvtkReserveServiceError.status === surfrock.factory.ResultStatus.Success) {
|
|
45
|
+
const cnclResult = mvtkReserveServiceError.rawResult?.cnclResult;
|
|
46
|
+
if (cnclResult === surfrock.service.seat.factory.seatInfoSyncCancel.CancelResult.CancelResult02) {
|
|
47
|
+
seatInfoSyncCancelResult = error;
|
|
48
|
+
throwsError = false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (throwsError) {
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return { seatInfoSyncCancelIn, seatInfoSyncCancelResult };
|
|
59
|
+
};
|
|
60
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { AccountingReportRepo } from '../../../repo/accountingReport';
|
|
2
|
-
import type { ActionRepo } from '../../../repo/action';
|
|
3
2
|
import type { PayActionRepo } from '../../../repo/action/pay';
|
|
4
3
|
import type { RefundActionRepo } from '../../../repo/action/refund';
|
|
5
4
|
import type { CredentialsRepo } from '../../../repo/credentials';
|
|
@@ -8,7 +7,7 @@ import type { TaskRepo } from '../../../repo/task';
|
|
|
8
7
|
import * as factory from '../../../factory';
|
|
9
8
|
import { Settings } from '../../../settings';
|
|
10
9
|
interface IRefundOperationRepos {
|
|
11
|
-
action
|
|
10
|
+
action?: never;
|
|
12
11
|
actions: {
|
|
13
12
|
pay: PayActionRepo;
|
|
14
13
|
refund: RefundActionRepo;
|
|
@@ -30,4 +29,4 @@ declare function refundMovieTicket(params: Pick<factory.action.trade.refund.IAtt
|
|
|
30
29
|
}, options: {
|
|
31
30
|
callOnPayActionCompleted: boolean;
|
|
32
31
|
}): IRefundOperation<void>;
|
|
33
|
-
export { refundMovieTicket };
|
|
32
|
+
export { IRefundOperationRepos, refundMovieTicket };
|
|
@@ -28,12 +28,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.refundMovieTicket = refundMovieTicket;
|
|
30
30
|
const surfrock = __importStar(require("@surfrock/sdk"));
|
|
31
|
-
const http_status_1 = require("http-status");
|
|
32
31
|
const moment_1 = __importDefault(require("moment"));
|
|
33
32
|
const errorHandler_1 = require("../../../errorHandler");
|
|
34
33
|
const factory = __importStar(require("../../../factory"));
|
|
35
34
|
const onRefundActionCompletedOrFailed_1 = require("../any/onRefundActionCompletedOrFailed");
|
|
36
35
|
const factory_1 = require("./factory");
|
|
36
|
+
const createSeatInfoSyncCancelInOnRefund_1 = require("./refundMovieTicket/createSeatInfoSyncCancelInOnRefund");
|
|
37
|
+
const createSeatInfoSyncInOnRefund_1 = require("./refundMovieTicket/createSeatInfoSyncInOnRefund");
|
|
38
|
+
const processSeatInfoSync_1 = require("./refundMovieTicket/processSeatInfoSync");
|
|
39
|
+
const processSeatInfoSyncCancel_1 = require("./refundMovieTicket/processSeatInfoSyncCancel");
|
|
37
40
|
function wait4payActionDelayIfNeeded(params) {
|
|
38
41
|
return async (settings) => {
|
|
39
42
|
const { payAction } = params;
|
|
@@ -66,7 +69,7 @@ function refundMovieTicket(params, options) {
|
|
|
66
69
|
const paymentServiceId = params.object[0]?.id;
|
|
67
70
|
// 本アクションに対応するPayActionを取り出す
|
|
68
71
|
// 例えばtimeoutが原因でCompletedActionStatusでない場合、外部サービス側では着券済の可能性もあるので、そこを考慮する
|
|
69
|
-
const payAction = await repos.
|
|
72
|
+
const payAction = await repos.actions.pay.findPayActionByPaymentMethodId({
|
|
70
73
|
project: { id: params.project.id },
|
|
71
74
|
paymentMethodId,
|
|
72
75
|
actionStatus: {
|
|
@@ -99,18 +102,18 @@ function refundMovieTicket(params, options) {
|
|
|
99
102
|
let seatInfoSyncIn;
|
|
100
103
|
const useSeatInfoSyncCancel = availableChannel.credentials?.useSeatInfoSyncCancel === true;
|
|
101
104
|
if (useSeatInfoSyncCancel) {
|
|
102
|
-
seatInfoSyncCancelIn = await createSeatInfoSyncCancelInOnRefund({
|
|
105
|
+
seatInfoSyncCancelIn = await (0, createSeatInfoSyncCancelInOnRefund_1.createSeatInfoSyncCancelInOnRefund)({
|
|
103
106
|
project: { id: params.project.id },
|
|
104
107
|
paymentMethodId,
|
|
105
108
|
payAction: { id: payAction.id }
|
|
106
|
-
})({
|
|
109
|
+
})({ actions: repos.actions });
|
|
107
110
|
}
|
|
108
111
|
else {
|
|
109
|
-
seatInfoSyncIn = await createSeatInfoSyncInOnRefund({
|
|
112
|
+
seatInfoSyncIn = await (0, createSeatInfoSyncInOnRefund_1.createSeatInfoSyncInOnRefund)({
|
|
110
113
|
project: { id: params.project.id },
|
|
111
114
|
paymentMethodId,
|
|
112
115
|
payAction: { id: payAction.id }
|
|
113
|
-
})({
|
|
116
|
+
})({ actions: repos.actions });
|
|
114
117
|
}
|
|
115
118
|
let recipe = (0, factory_1.processSeatInfoSyncResult2refundRecipe)({
|
|
116
119
|
project: { id: params.project.id },
|
|
@@ -123,7 +126,7 @@ function refundMovieTicket(params, options) {
|
|
|
123
126
|
instrument: (Array.isArray(instrument)) ? instrument : [], // add(2025-02-18~)
|
|
124
127
|
...(typeof sameAs?.id === 'string') ? { sameAs: { id: sameAs.id, typeOf: 'Task' } } : undefined
|
|
125
128
|
};
|
|
126
|
-
const action = await repos.
|
|
129
|
+
const action = await repos.actions.refund.start(refundActionAttributes, { recipe });
|
|
127
130
|
let processSeatInfoSyncCancelResult;
|
|
128
131
|
let processSeatInfoSyncResult;
|
|
129
132
|
try {
|
|
@@ -131,13 +134,13 @@ function refundMovieTicket(params, options) {
|
|
|
131
134
|
if (seatInfoSyncCancelIn === undefined) {
|
|
132
135
|
throw new factory.errors.Internal('seatInfoSyncCancelIn must be set');
|
|
133
136
|
}
|
|
134
|
-
processSeatInfoSyncCancelResult = await processSeatInfoSyncCancel({ seatInfoSyncCancelIn })({ seatService });
|
|
137
|
+
processSeatInfoSyncCancelResult = await (0, processSeatInfoSyncCancel_1.processSeatInfoSyncCancel)({ seatInfoSyncCancelIn })({ seatService });
|
|
135
138
|
}
|
|
136
139
|
else {
|
|
137
140
|
if (seatInfoSyncIn === undefined) {
|
|
138
141
|
throw new factory.errors.Internal('seatInfoSyncIn must be set');
|
|
139
142
|
}
|
|
140
|
-
processSeatInfoSyncResult = await processSeatInfoSync({
|
|
143
|
+
processSeatInfoSyncResult = await (0, processSeatInfoSync_1.processSeatInfoSync)({
|
|
141
144
|
seatInfoSyncIn, paymentMethodId, purpose: params.purpose
|
|
142
145
|
})({ seatService });
|
|
143
146
|
}
|
|
@@ -147,7 +150,7 @@ function refundMovieTicket(params, options) {
|
|
|
147
150
|
message += `決済ID:${paymentMethodId}`; // エラー通知先で情報を読み取りやすくするために、messageに情報付加
|
|
148
151
|
try {
|
|
149
152
|
const actionError = { ...error, message: message, name: error.name };
|
|
150
|
-
await repos.
|
|
153
|
+
await repos.actions.refund.giveUp({ typeOf: action.typeOf, id: action.id, error: actionError });
|
|
151
154
|
}
|
|
152
155
|
catch (__) {
|
|
153
156
|
// 失敗したら仕方ない
|
|
@@ -159,7 +162,7 @@ function refundMovieTicket(params, options) {
|
|
|
159
162
|
const seatInfoSyncResultAsError = processSeatInfoSyncResult?.seatInfoSyncResultAsError;
|
|
160
163
|
let actionStatus;
|
|
161
164
|
if (seatInfoSyncResultAsError !== undefined) {
|
|
162
|
-
await repos.
|
|
165
|
+
await repos.actions.refund.giveUp({ typeOf: action.typeOf, id: action.id, error: seatInfoSyncResultAsError });
|
|
163
166
|
actionStatus = factory.actionStatusType.FailedActionStatus;
|
|
164
167
|
}
|
|
165
168
|
else {
|
|
@@ -170,7 +173,7 @@ function refundMovieTicket(params, options) {
|
|
|
170
173
|
...(processSeatInfoSyncCancelResult !== undefined) ? { processSeatInfoSyncCancelResult } : undefined
|
|
171
174
|
});
|
|
172
175
|
const actionResult = {};
|
|
173
|
-
await repos.
|
|
176
|
+
await repos.actions.refund.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult, recipe });
|
|
174
177
|
actionStatus = factory.actionStatusType.CompletedActionStatus;
|
|
175
178
|
}
|
|
176
179
|
if (callOnPayActionCompleted) {
|
|
@@ -182,119 +185,11 @@ function refundMovieTicket(params, options) {
|
|
|
182
185
|
project: refundActionAttributes.project,
|
|
183
186
|
purpose: refundActionAttributes.purpose,
|
|
184
187
|
typeOf: action.typeOf
|
|
185
|
-
})(
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
return async (repos) => {
|
|
191
|
-
const recipe = await repos.action.findRecipeByAction({
|
|
192
|
-
project: { id: params.project.id },
|
|
193
|
-
recipeFor: { id: params.payAction.id }
|
|
194
|
-
});
|
|
195
|
-
const seatInfoSyncInOnPay = recipe?.step[0]?.itemListElement[0]?.itemListElement[0]?.beforeMedia;
|
|
196
|
-
if (seatInfoSyncInOnPay === undefined) {
|
|
197
|
-
throw new factory.errors.NotFound('PayAction.recipe.step.itemListElement.itemListElement.beforeMedia');
|
|
198
|
-
}
|
|
199
|
-
// 着券時のseatInfoSyncInに対してtrkshFlgだけ変更してリクエストする
|
|
200
|
-
const seatInfoSyncIn = {
|
|
201
|
-
...seatInfoSyncInOnPay,
|
|
202
|
-
trkshFlg: surfrock.factory.service.seat.seatInfoSync.DeleteFlag.True // 取消フラグ
|
|
203
|
-
};
|
|
204
|
-
return seatInfoSyncIn;
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
function createSeatInfoSyncCancelInOnRefund(params) {
|
|
208
|
-
return async (repos) => {
|
|
209
|
-
const recipe = await repos.action.findRecipeByAction({
|
|
210
|
-
project: { id: params.project.id },
|
|
211
|
-
recipeFor: { id: params.payAction.id }
|
|
212
|
-
});
|
|
213
|
-
const seatInfoSyncInOnPay = recipe?.step[0]?.itemListElement[0]?.itemListElement[0]?.beforeMedia;
|
|
214
|
-
if (seatInfoSyncInOnPay === undefined) {
|
|
215
|
-
throw new factory.errors.NotFound('PayAction.recipe.step.itemListElement.itemListElement.beforeMedia');
|
|
216
|
-
}
|
|
217
|
-
const seatInfoSyncCancelIn = {
|
|
218
|
-
kgygishCd: seatInfoSyncInOnPay.kgygishCd,
|
|
219
|
-
kgysystmzskyykNo: seatInfoSyncInOnPay.kgygishSstmZskyykNo,
|
|
220
|
-
kgysystmzskyykNoIkktsCnclFlg: '1',
|
|
221
|
-
jyuTyp: surfrock.service.seat.factory.seatInfoSyncCancel.JyuTyp.JyuTyp05,
|
|
222
|
-
jyuTypRmk: ''
|
|
223
|
-
// knyknrNoInfoIn: [],
|
|
224
|
-
};
|
|
225
|
-
return seatInfoSyncCancelIn;
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
function processSeatInfoSyncCancel(params) {
|
|
229
|
-
return async (repos) => {
|
|
230
|
-
let seatInfoSyncCancelResult;
|
|
231
|
-
const { seatInfoSyncCancelIn } = params;
|
|
232
|
-
try {
|
|
233
|
-
seatInfoSyncCancelResult = await repos.seatService.seatInfoSyncCancel(seatInfoSyncCancelIn);
|
|
234
|
-
}
|
|
235
|
-
catch (error) {
|
|
236
|
-
let throwsError = true;
|
|
237
|
-
if (error.name === errorHandler_1.MOVIE_TICKET_RESERVE_REQUEST_ERROR_NAME) {
|
|
238
|
-
if (error.code === http_status_1.BAD_REQUEST) {
|
|
239
|
-
if (Array.isArray(error.errors) && error.errors.length > 0) {
|
|
240
|
-
const mvtkReserveServiceError = error.errors[0];
|
|
241
|
-
// 興行会社システム座席予約番号存在無の場合、取消済なのでok
|
|
242
|
-
if (mvtkReserveServiceError.status === surfrock.factory.ResultStatus.Success) {
|
|
243
|
-
const cnclResult = mvtkReserveServiceError.rawResult?.cnclResult;
|
|
244
|
-
if (cnclResult === surfrock.service.seat.factory.seatInfoSyncCancel.CancelResult.CancelResult02) {
|
|
245
|
-
seatInfoSyncCancelResult = error;
|
|
246
|
-
throwsError = false;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
if (throwsError) {
|
|
253
|
-
throw error;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
return { seatInfoSyncCancelIn, seatInfoSyncCancelResult };
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
function processSeatInfoSync(params) {
|
|
260
|
-
return async (repos) => {
|
|
261
|
-
let seatInfoSyncResult;
|
|
262
|
-
let seatInfoSyncResultAsError;
|
|
263
|
-
const { seatInfoSyncIn, paymentMethodId, purpose } = params;
|
|
264
|
-
try {
|
|
265
|
-
seatInfoSyncResult = await repos.seatService.seatInfoSync(seatInfoSyncIn);
|
|
266
|
-
}
|
|
267
|
-
catch (error) {
|
|
268
|
-
let throwsError = true;
|
|
269
|
-
// 「存在しない興行会社システム座席予約番号が入力されました」の場合、取消済なのでok
|
|
270
|
-
if (error.name === errorHandler_1.MOVIE_TICKET_RESERVE_REQUEST_ERROR_NAME) {
|
|
271
|
-
if (error.code === http_status_1.BAD_REQUEST && error.message === factory_1.MovieticketReserveRequestErrorMessage.NotFound) {
|
|
272
|
-
seatInfoSyncResult = error;
|
|
273
|
-
throwsError = false;
|
|
274
|
-
}
|
|
275
|
-
// ReservationResult 19の内容が不明だがリトライする意味はおそらくないパターン
|
|
276
|
-
if (error.code === http_status_1.BAD_REQUEST && error.message === factory_1.MovieticketReserveRequestErrorMessage.ReservationResult19) {
|
|
277
|
-
seatInfoSyncResult = error;
|
|
278
|
-
throwsError = false;
|
|
279
|
-
}
|
|
280
|
-
// surfrock: bookingNoが存在しないケースをハンドル(2024-03-13~)
|
|
281
|
-
const expectedMessage4surfrockNotFound = JSON.stringify({ message: `bookingNo:"${paymentMethodId}" が見つかりません。` });
|
|
282
|
-
if (error.code === http_status_1.BAD_REQUEST && error.message === expectedMessage4surfrockNotFound) {
|
|
283
|
-
seatInfoSyncResult = error;
|
|
284
|
-
throwsError = false;
|
|
285
|
-
}
|
|
286
|
-
// 着券取消可能期間超過を認識した上でのあえての返金の場合(注文からしばらく経って返品など)(2024-03-19~)
|
|
287
|
-
if (error.code === http_status_1.BAD_REQUEST && error.message === factory_1.MovieticketReserveRequestErrorMessage.CancellationPeriodPassed) {
|
|
288
|
-
if (purpose.typeOf === factory.actionType.ReturnAction) {
|
|
289
|
-
seatInfoSyncResultAsError = error;
|
|
290
|
-
throwsError = false;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
if (throwsError) {
|
|
295
|
-
throw error;
|
|
296
|
-
}
|
|
188
|
+
})({
|
|
189
|
+
actions: repos.actions,
|
|
190
|
+
accountingReport: repos.accountingReport,
|
|
191
|
+
task: repos.task
|
|
192
|
+
});
|
|
297
193
|
}
|
|
298
|
-
return { seatInfoSyncIn, seatInfoSyncResult, seatInfoSyncResultAsError };
|
|
299
194
|
};
|
|
300
195
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { AccountingReportRepo } from '../../../repo/accountingReport';
|
|
2
|
-
import type { ActionRepo } from '../../../repo/action';
|
|
3
2
|
import type { PayActionRepo } from '../../../repo/action/pay';
|
|
4
3
|
import type { RefundActionRepo } from '../../../repo/action/refund';
|
|
5
4
|
import type { CredentialsRepo } from '../../../repo/credentials';
|
|
@@ -8,7 +7,6 @@ import type { TaskRepo } from '../../../repo/task';
|
|
|
8
7
|
import * as factory from '../../../factory';
|
|
9
8
|
import { Settings } from '../../../settings';
|
|
10
9
|
declare function voidTransaction(params: factory.task.voidPayment.IData): (repos: {
|
|
11
|
-
action: ActionRepo;
|
|
12
10
|
actions: {
|
|
13
11
|
pay: PayActionRepo;
|
|
14
12
|
refund: RefundActionRepo;
|
|
@@ -40,7 +40,7 @@ function voidTransaction(params) {
|
|
|
40
40
|
}
|
|
41
41
|
// 決済開始時に着券していれば、取消
|
|
42
42
|
// 例えばtimeoutが原因でCompletedActionStatusでない場合、外部サービス側では着券済の可能性もあるので、そこを考慮する
|
|
43
|
-
const payAction = await repos.
|
|
43
|
+
const payAction = await repos.actions.pay.findPayActionByPaymentMethodId({
|
|
44
44
|
project: { id: transaction.project.id },
|
|
45
45
|
paymentMethodId,
|
|
46
46
|
actionStatus: {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
2
|
import type { AccountingReportRepo } from '../../repo/accountingReport';
|
|
3
|
-
import type { ActionRepo } from '../../repo/action';
|
|
4
3
|
import type { PayActionRepo } from '../../repo/action/pay';
|
|
5
4
|
import type { RefundActionRepo } from '../../repo/action/refund';
|
|
6
5
|
import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
@@ -19,7 +18,7 @@ declare function voidTransaction(params: factory.task.voidPayment.IData): (repos
|
|
|
19
18
|
product: ProductRepo;
|
|
20
19
|
}) => Promise<void>;
|
|
21
20
|
declare function payPaymentCard(params: factory.action.trade.pay.IAttributes): (repos: {
|
|
22
|
-
action
|
|
21
|
+
action?: never;
|
|
23
22
|
actions: {
|
|
24
23
|
pay: PayActionRepo;
|
|
25
24
|
refund: RefundActionRepo;
|
|
@@ -29,7 +28,7 @@ declare function payPaymentCard(params: factory.action.trade.pay.IAttributes): (
|
|
|
29
28
|
task: TaskRepo;
|
|
30
29
|
}) => Promise<void>;
|
|
31
30
|
declare function refundPaymentCard(params: factory.task.refund.IData): (repos: {
|
|
32
|
-
action
|
|
31
|
+
action?: never;
|
|
33
32
|
actions: {
|
|
34
33
|
pay: PayActionRepo;
|
|
35
34
|
refund: RefundActionRepo;
|
|
@@ -250,7 +250,7 @@ function payPaymentCard(params) {
|
|
|
250
250
|
return async (repos) => {
|
|
251
251
|
const payObject = params.object;
|
|
252
252
|
const paymentServiceId = payObject[0].id;
|
|
253
|
-
const action = await repos.
|
|
253
|
+
const action = await repos.actions.pay.start(params);
|
|
254
254
|
try {
|
|
255
255
|
const transactionNumber = payObject[0].paymentMethod.paymentMethodId;
|
|
256
256
|
const availableChannel = await repos.product.findAvailableChannel({
|
|
@@ -272,7 +272,7 @@ function payPaymentCard(params) {
|
|
|
272
272
|
}
|
|
273
273
|
catch (error) {
|
|
274
274
|
try {
|
|
275
|
-
await repos.
|
|
275
|
+
await repos.actions.pay.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
276
276
|
}
|
|
277
277
|
catch (__) {
|
|
278
278
|
// no op
|
|
@@ -280,7 +280,7 @@ function payPaymentCard(params) {
|
|
|
280
280
|
throw error;
|
|
281
281
|
}
|
|
282
282
|
const actionResult = {};
|
|
283
|
-
await repos.
|
|
283
|
+
await repos.actions.pay.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
284
284
|
await (0, onPayActionCompleted_1.onPayActionCompleted)({
|
|
285
285
|
// actionStatus: factory.actionStatusType.CompletedActionStatus,
|
|
286
286
|
id: action.id,
|
|
@@ -289,7 +289,11 @@ function payPaymentCard(params) {
|
|
|
289
289
|
project: params.project,
|
|
290
290
|
purpose: params.purpose,
|
|
291
291
|
typeOf: action.typeOf
|
|
292
|
-
})(
|
|
292
|
+
})({
|
|
293
|
+
actions: repos.actions,
|
|
294
|
+
accountingReport: repos.accountingReport,
|
|
295
|
+
task: repos.task
|
|
296
|
+
});
|
|
293
297
|
// return action;
|
|
294
298
|
};
|
|
295
299
|
}
|
|
@@ -306,7 +310,7 @@ function refundPaymentCard(params) {
|
|
|
306
310
|
if (typeof accountNumber !== 'string') {
|
|
307
311
|
throw new factory.errors.ArgumentNull('serviceOutput.paymentAccount.accountNumber');
|
|
308
312
|
}
|
|
309
|
-
const action = await repos.
|
|
313
|
+
const action = await repos.actions.refund.start(params);
|
|
310
314
|
let accountTransactionNumber4refund;
|
|
311
315
|
try {
|
|
312
316
|
const availableChannel = await repos.product.findAvailableChannel({
|
|
@@ -388,7 +392,7 @@ function refundPaymentCard(params) {
|
|
|
388
392
|
}
|
|
389
393
|
catch (error) {
|
|
390
394
|
try {
|
|
391
|
-
await repos.
|
|
395
|
+
await repos.actions.refund.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
392
396
|
}
|
|
393
397
|
catch (__) {
|
|
394
398
|
// no op
|
|
@@ -398,7 +402,7 @@ function refundPaymentCard(params) {
|
|
|
398
402
|
const result = {
|
|
399
403
|
accountTransaction: { transactionNumber: accountTransactionNumber4refund }
|
|
400
404
|
};
|
|
401
|
-
await repos.
|
|
405
|
+
await repos.actions.refund.completeWithVoid({ typeOf: action.typeOf, id: action.id, result });
|
|
402
406
|
await (0, onRefundActionCompletedOrFailed_1.onRefundActionCompletedOrFailed)({
|
|
403
407
|
actionStatus: factory.actionStatusType.CompletedActionStatus,
|
|
404
408
|
id: action.id,
|
|
@@ -407,7 +411,11 @@ function refundPaymentCard(params) {
|
|
|
407
411
|
project: params.project,
|
|
408
412
|
purpose: params.purpose,
|
|
409
413
|
typeOf: action.typeOf
|
|
410
|
-
})(
|
|
414
|
+
})({
|
|
415
|
+
actions: repos.actions,
|
|
416
|
+
accountingReport: repos.accountingReport,
|
|
417
|
+
task: repos.task
|
|
418
|
+
});
|
|
411
419
|
// return action;
|
|
412
420
|
};
|
|
413
421
|
}
|