@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
|
@@ -6,4 +6,20 @@ export type IActionRecipe = factory.action.trade.pay.IPayCreditCardRecipe | fact
|
|
|
6
6
|
* 決済アクションリポジトリ
|
|
7
7
|
*/
|
|
8
8
|
export declare class PayActionRepo extends ActionProcessRepo<IPayAction, IActionRecipe> {
|
|
9
|
+
/**
|
|
10
|
+
* 決済方法IDから決済アクションをひとつ参照する
|
|
11
|
+
* デフォルトでCompletedActionStatusのみ参照
|
|
12
|
+
*/
|
|
13
|
+
findPayActionByPaymentMethodId(params: {
|
|
14
|
+
project: {
|
|
15
|
+
id: string;
|
|
16
|
+
};
|
|
17
|
+
paymentMethodId: string;
|
|
18
|
+
/**
|
|
19
|
+
* 未指定の場合CompletedActionStatusのみ
|
|
20
|
+
*/
|
|
21
|
+
actionStatus?: {
|
|
22
|
+
$in?: factory.actionStatusType[];
|
|
23
|
+
};
|
|
24
|
+
}): Promise<factory.action.trade.pay.IAction | undefined>;
|
|
9
25
|
}
|
|
@@ -1,6 +1,30 @@
|
|
|
1
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
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.PayActionRepo = void 0;
|
|
27
|
+
const factory = __importStar(require("../../factory"));
|
|
4
28
|
// import { MONGO_MAX_TIME_MS } from '../settings';
|
|
5
29
|
// import { createSchema, IModel as IActionModel, modelName } from './mongoose/schemas/action';
|
|
6
30
|
// import { createSchema as createRecipeSchema, IModel as IActionRecipeModel, modelName as recipeModelName } from './mongoose/schemas/actionRecipe';
|
|
@@ -9,5 +33,22 @@ const actionProcess_1 = require("./actionProcess");
|
|
|
9
33
|
* 決済アクションリポジトリ
|
|
10
34
|
*/
|
|
11
35
|
class PayActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
36
|
+
/**
|
|
37
|
+
* 決済方法IDから決済アクションをひとつ参照する
|
|
38
|
+
* デフォルトでCompletedActionStatusのみ参照
|
|
39
|
+
*/
|
|
40
|
+
async findPayActionByPaymentMethodId(params) {
|
|
41
|
+
const payActions = await this.findAnyActions({
|
|
42
|
+
limit: 1,
|
|
43
|
+
page: 1,
|
|
44
|
+
actionStatus: (Array.isArray(params.actionStatus?.$in))
|
|
45
|
+
? { $in: params.actionStatus?.$in }
|
|
46
|
+
: { $in: [factory.actionStatusType.CompletedActionStatus] },
|
|
47
|
+
project: { id: { $eq: params.project.id } },
|
|
48
|
+
typeOf: { $eq: factory.actionType.PayAction },
|
|
49
|
+
object: { paymentMethod: { paymentMethodId: { $eq: params.paymentMethodId } } }
|
|
50
|
+
}, []);
|
|
51
|
+
return payActions.shift();
|
|
52
|
+
}
|
|
12
53
|
}
|
|
13
54
|
exports.PayActionRepo = PayActionRepo;
|
|
@@ -7,8 +7,8 @@ export { ICancelActionAction };
|
|
|
7
7
|
/**
|
|
8
8
|
* 汎用アクションリポジトリで開始可能なアクションタイプ
|
|
9
9
|
*/
|
|
10
|
-
type StartableActionType = Exclude<factory.actionType, factory.actionType.AcceptAction | factory.actionType.CheckAction | factory.actionType.AuthorizeAction>;
|
|
11
|
-
type IAvailableActionRecipe = IActionRecipe<Exclude<factory.recipe.RecipeCategory, factory.recipe.RecipeCategory.publishPaymentUrl | factory.recipe.RecipeCategory.checkMovieTicket | factory.recipe.RecipeCategory.acceptCOAOffer | factory.recipe.RecipeCategory.authorizeInvoice | factory.recipe.RecipeCategory.authorizeInvoice3ds>>;
|
|
10
|
+
type StartableActionType = Exclude<factory.actionType, factory.actionType.AcceptAction | factory.actionType.CheckAction | factory.actionType.AuthorizeAction | factory.actionType.PayAction | factory.actionType.RefundAction>;
|
|
11
|
+
type IAvailableActionRecipe = IActionRecipe<Exclude<factory.recipe.RecipeCategory, factory.recipe.RecipeCategory.publishPaymentUrl | factory.recipe.RecipeCategory.checkMovieTicket | factory.recipe.RecipeCategory.acceptCOAOffer | factory.recipe.RecipeCategory.authorizeInvoice | factory.recipe.RecipeCategory.authorizeInvoice3ds | factory.recipe.RecipeCategory.payCreditCard | factory.recipe.RecipeCategory.payMovieTicket | factory.recipe.RecipeCategory.refundCreditCard | factory.recipe.RecipeCategory.refundMovieTicket>>;
|
|
12
12
|
/**
|
|
13
13
|
* アクションリポジトリ
|
|
14
14
|
*/
|
|
@@ -21,15 +21,6 @@ export declare class ActionRepo extends ActionProcessRepo<IAction<StartableActio
|
|
|
21
21
|
$eq?: T;
|
|
22
22
|
};
|
|
23
23
|
}, inclusion: IKeyOfProjection[]): Promise<IAction<T>[]>;
|
|
24
|
-
findPayAction(params: {
|
|
25
|
-
project: {
|
|
26
|
-
id: string;
|
|
27
|
-
};
|
|
28
|
-
paymentMethodId: string;
|
|
29
|
-
actionStatus?: {
|
|
30
|
-
$in?: factory.actionStatusType[];
|
|
31
|
-
};
|
|
32
|
-
}): Promise<factory.action.trade.pay.IAction | undefined>;
|
|
33
24
|
/**
|
|
34
25
|
* 取引に対するアクションを検索する
|
|
35
26
|
*/
|
|
@@ -280,19 +280,26 @@ class ActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
|
280
280
|
// }
|
|
281
281
|
// return doc;
|
|
282
282
|
// }
|
|
283
|
-
async findPayAction(params
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
}
|
|
283
|
+
// public async findPayAction(params: {
|
|
284
|
+
// project: { id: string };
|
|
285
|
+
// paymentMethodId: string;
|
|
286
|
+
// actionStatus?: { $in?: factory.actionStatusType[] };
|
|
287
|
+
// }): Promise<factory.action.trade.pay.IAction | undefined> {
|
|
288
|
+
// const payActions = await this.findActionsByType<factory.actionType.PayAction>(
|
|
289
|
+
// {
|
|
290
|
+
// limit: 1,
|
|
291
|
+
// page: 1,
|
|
292
|
+
// actionStatus: (Array.isArray(params.actionStatus?.$in))
|
|
293
|
+
// ? { $in: params.actionStatus?.$in }
|
|
294
|
+
// : { $in: [factory.actionStatusType.CompletedActionStatus] },
|
|
295
|
+
// project: { id: { $eq: params.project.id } },
|
|
296
|
+
// typeOf: { $eq: factory.actionType.PayAction },
|
|
297
|
+
// object: { paymentMethod: { paymentMethodId: { $eq: params.paymentMethodId } } }
|
|
298
|
+
// },
|
|
299
|
+
// []
|
|
300
|
+
// ) as factory.action.trade.pay.IAction[];
|
|
301
|
+
// return payActions.shift();
|
|
302
|
+
// }
|
|
296
303
|
/**
|
|
297
304
|
* 取引に対するアクションを検索する
|
|
298
305
|
*/
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as factory from '../../../../factory';
|
|
2
2
|
import { Settings } from '../../../../settings';
|
|
3
3
|
import type { AccountingReportRepo } from '../../../../repo/accountingReport';
|
|
4
|
-
import type { ActionRepo } from '../../../../repo/action';
|
|
5
4
|
import type { PayActionRepo } from '../../../../repo/action/pay';
|
|
6
5
|
import type { RefundActionRepo } from '../../../../repo/action/refund';
|
|
7
6
|
import type { CheckMovieTicketActionRepo } from '../../../../repo/action/checkMovieTicket';
|
|
@@ -17,7 +16,7 @@ import type { TaskRepo } from '../../../../repo/task';
|
|
|
17
16
|
import { IPaymentAgencyTransaction } from '../../../payment/creditCard';
|
|
18
17
|
export interface IProcessAuthorizeOperationRepos {
|
|
19
18
|
accountingReport: AccountingReportRepo;
|
|
20
|
-
action
|
|
19
|
+
action?: never;
|
|
21
20
|
actions: {
|
|
22
21
|
pay: PayActionRepo;
|
|
23
22
|
refund: RefundActionRepo;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as factory from '../../../../factory';
|
|
2
2
|
import { Settings } from '../../../../settings';
|
|
3
3
|
import type { AccountingReportRepo } from '../../../../repo/accountingReport';
|
|
4
|
-
import type { ActionRepo } from '../../../../repo/action';
|
|
5
4
|
import type { PayActionRepo } from '../../../../repo/action/pay';
|
|
6
5
|
import type { RefundActionRepo } from '../../../../repo/action/refund';
|
|
7
6
|
import type { CheckMovieTicketActionRepo } from '../../../../repo/action/checkMovieTicket';
|
|
@@ -34,7 +33,7 @@ export declare function processAuthorizeMovieTicket(params: factory.assetTransac
|
|
|
34
33
|
};
|
|
35
34
|
}): (repos: {
|
|
36
35
|
accountingReport: AccountingReportRepo;
|
|
37
|
-
action
|
|
36
|
+
action?: never;
|
|
38
37
|
actions: {
|
|
39
38
|
pay: PayActionRepo;
|
|
40
39
|
refund: RefundActionRepo;
|
|
@@ -2,7 +2,6 @@ import * as factory from '../../../factory';
|
|
|
2
2
|
import { Settings } from '../../../settings';
|
|
3
3
|
import type { AcceptedPaymentMethodRepo } from '../../../repo/acceptedPaymentMethod';
|
|
4
4
|
import type { AccountingReportRepo } from '../../../repo/accountingReport';
|
|
5
|
-
import type { ActionRepo } from '../../../repo/action';
|
|
6
5
|
import type { PayActionRepo } from '../../../repo/action/pay';
|
|
7
6
|
import type { RefundActionRepo } from '../../../repo/action/refund';
|
|
8
7
|
import type { CheckMovieTicketActionRepo } from '../../../repo/action/checkMovieTicket';
|
|
@@ -21,7 +20,7 @@ import { IPaymentAgencyTransaction } from '../../payment/creditCard';
|
|
|
21
20
|
export interface IStartOperationRepos {
|
|
22
21
|
acceptedPaymentMethod: AcceptedPaymentMethodRepo;
|
|
23
22
|
accountingReport: AccountingReportRepo;
|
|
24
|
-
action
|
|
23
|
+
action?: never;
|
|
25
24
|
actions: {
|
|
26
25
|
pay: PayActionRepo;
|
|
27
26
|
refund: RefundActionRepo;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
|
-
import type {
|
|
2
|
+
import type { PayActionRepo } from '../../repo/action/pay';
|
|
3
3
|
import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
4
4
|
import type { PaymentServiceRepo } from '../../repo/paymentService';
|
|
5
5
|
import type { PotentialActionRepo } from '../../repo/potentialAction';
|
|
6
6
|
import type { ProductRepo } from '../../repo/product';
|
|
7
7
|
import type { TaskRepo } from '../../repo/task';
|
|
8
8
|
export interface IStartOperationRepos {
|
|
9
|
-
action
|
|
9
|
+
action?: never;
|
|
10
|
+
actions: {
|
|
11
|
+
pay: PayActionRepo;
|
|
12
|
+
};
|
|
10
13
|
paymentService: PaymentServiceRepo;
|
|
11
14
|
potentialAction: PotentialActionRepo;
|
|
12
15
|
product: ProductRepo;
|
|
@@ -54,7 +54,7 @@ function start(params) {
|
|
|
54
54
|
});
|
|
55
55
|
const paymentServiceType = payTransaction.object.typeOf;
|
|
56
56
|
// PayActionを確認する
|
|
57
|
-
const payAction = await repos.
|
|
57
|
+
const payAction = await repos.actions.pay.findPayActionByPaymentMethodId({ project: { id: params.project.id }, paymentMethodId });
|
|
58
58
|
if (payAction === undefined) {
|
|
59
59
|
throw new factory.errors.NotFound(factory.actionType.PayAction);
|
|
60
60
|
}
|
|
@@ -25,6 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.createStartParams = createStartParams;
|
|
27
27
|
const factory = __importStar(require("../../../../../factory"));
|
|
28
|
+
const USE_DEPRECATED_RESERVATION_AVAILABLE_CHANNEL = process.env.USE_DEPRECATED_RESERVATION_AVAILABLE_CHANNEL === '1';
|
|
28
29
|
function createStartParams(params) {
|
|
29
30
|
const { reservationNumber, acceptedOffers4transactionObject, objectSubReservations, agent, expires, project, instrument } = params;
|
|
30
31
|
const provider = {
|
|
@@ -135,9 +136,9 @@ function createIssuedThrough(params) {
|
|
|
135
136
|
typeOf: factory.product.ProductType.EventService,
|
|
136
137
|
// 興行IDを追加(2022-09-08~)
|
|
137
138
|
id: eventOffers.itemOffered.id,
|
|
138
|
-
availableChannel,
|
|
139
139
|
// issuedThrough.serviceTypeを連携
|
|
140
|
-
...(typeof serviceTypeOfIssuedThrough?.typeOf === 'string') ? { serviceType: serviceTypeOfIssuedThrough } : undefined
|
|
140
|
+
...(typeof serviceTypeOfIssuedThrough?.typeOf === 'string') ? { serviceType: serviceTypeOfIssuedThrough } : undefined,
|
|
141
|
+
...(USE_DEPRECATED_RESERVATION_AVAILABLE_CHANNEL) && { availableChannel }
|
|
141
142
|
};
|
|
142
143
|
return {
|
|
143
144
|
issuedThrough
|
|
@@ -32,6 +32,7 @@ exports.responseBody2acceptedOffers4result = responseBody2acceptedOffers4result;
|
|
|
32
32
|
const moment_1 = __importDefault(require("moment"));
|
|
33
33
|
const util = __importStar(require("util"));
|
|
34
34
|
const factory = __importStar(require("../../../../factory"));
|
|
35
|
+
const USE_DEPRECATED_RESERVATION_AVAILABLE_CHANNEL = process.env.USE_DEPRECATED_RESERVATION_AVAILABLE_CHANNEL === '1';
|
|
35
36
|
function createAuthorizeSeatReservationActionAttributes(params) {
|
|
36
37
|
const transaction = params.transaction;
|
|
37
38
|
// 最適化(2022-06-07~)
|
|
@@ -206,17 +207,19 @@ function responseBody2acceptedOffers4result(params) {
|
|
|
206
207
|
const issuedThrough = {
|
|
207
208
|
typeOf: factory.product.ProductType.EventService,
|
|
208
209
|
// id: '', // discontinue(2025-01-02~)
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
210
|
+
...(USE_DEPRECATED_RESERVATION_AVAILABLE_CHANNEL) && {
|
|
211
|
+
availableChannel: {
|
|
212
|
+
typeOf: 'ServiceChannel',
|
|
213
|
+
serviceLocation: {
|
|
214
|
+
typeOf: reservationFor.location.typeOf,
|
|
215
|
+
branchCode: reservationFor.location.branchCode,
|
|
216
|
+
name: reservationFor.location.name,
|
|
217
|
+
containedInPlace: {
|
|
218
|
+
typeOf: reservationFor.superEvent.location.typeOf,
|
|
219
|
+
id: reservationFor.superEvent.location.id,
|
|
220
|
+
branchCode: reservationFor.superEvent.location.branchCode,
|
|
221
|
+
name: reservationFor.superEvent.location.name
|
|
222
|
+
}
|
|
220
223
|
}
|
|
221
224
|
}
|
|
222
225
|
}
|
|
@@ -2,7 +2,6 @@ import * as factory from '../../../factory';
|
|
|
2
2
|
import { Settings } from '../../../settings';
|
|
3
3
|
import type { AcceptedPaymentMethodRepo } from '../../../repo/acceptedPaymentMethod';
|
|
4
4
|
import type { AccountingReportRepo } from '../../../repo/accountingReport';
|
|
5
|
-
import type { ActionRepo } from '../../../repo/action';
|
|
6
5
|
import type { PayActionRepo } from '../../../repo/action/pay';
|
|
7
6
|
import type { RefundActionRepo } from '../../../repo/action/refund';
|
|
8
7
|
import type { CheckMovieTicketActionRepo } from '../../../repo/action/checkMovieTicket';
|
|
@@ -29,7 +28,7 @@ import type { TransactionNumberRepo } from '../../../repo/transactionNumber';
|
|
|
29
28
|
interface IAuthorizeRepos {
|
|
30
29
|
acceptedPaymentMethod: AcceptedPaymentMethodRepo;
|
|
31
30
|
accountingReport: AccountingReportRepo;
|
|
32
|
-
action
|
|
31
|
+
action?: never;
|
|
33
32
|
actions: {
|
|
34
33
|
pay: PayActionRepo;
|
|
35
34
|
refund: RefundActionRepo;
|
|
@@ -7,6 +7,7 @@ import type { PayActionRepo } from '../../../repo/action/pay';
|
|
|
7
7
|
import type { RefundActionRepo } from '../../../repo/action/refund';
|
|
8
8
|
import type { TaskRepo } from '../../../repo/task';
|
|
9
9
|
interface IOnPayActionCompletedRepos {
|
|
10
|
+
action?: never;
|
|
10
11
|
actions: {
|
|
11
12
|
pay: PayActionRepo;
|
|
12
13
|
refund: RefundActionRepo;
|
|
@@ -4,6 +4,7 @@ import type { PayActionRepo } from '../../../repo/action/pay';
|
|
|
4
4
|
import type { RefundActionRepo } from '../../../repo/action/refund';
|
|
5
5
|
import type { TaskRepo } from '../../../repo/task';
|
|
6
6
|
interface IOnRefundActionCompletedOrFailedRepos {
|
|
7
|
+
action?: never;
|
|
7
8
|
actions: {
|
|
8
9
|
pay: PayActionRepo;
|
|
9
10
|
refund: RefundActionRepo;
|
|
@@ -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 { PaymentServiceRepo } from '../../../repo/paymentService';
|
|
@@ -12,7 +11,7 @@ import { Settings } from '../../../settings';
|
|
|
12
11
|
* クレジットカード決済
|
|
13
12
|
*/
|
|
14
13
|
declare function payCreditCard(params: factory.action.trade.pay.IAttributes): (repos: {
|
|
15
|
-
action
|
|
14
|
+
action?: never;
|
|
16
15
|
actions: {
|
|
17
16
|
pay: PayActionRepo;
|
|
18
17
|
refund: RefundActionRepo;
|
|
@@ -55,7 +55,7 @@ function payCreditCard(params) {
|
|
|
55
55
|
paymentMethodType, seller: { id: sellerId }, paymentServiceId,
|
|
56
56
|
requirePaymentAccepted
|
|
57
57
|
})(repos);
|
|
58
|
-
const action = await repos.
|
|
58
|
+
const action = await repos.actions.pay.start(params);
|
|
59
59
|
const alterTranResults = [];
|
|
60
60
|
const processAlterTranResults = [];
|
|
61
61
|
let recipe;
|
|
@@ -86,7 +86,7 @@ function payCreditCard(params) {
|
|
|
86
86
|
try {
|
|
87
87
|
// add recipe(2024-06-29~)
|
|
88
88
|
recipe = (0, factory_1.processAlterTranResult2payRecipe)({ processAlterTranResults, project: { id: params.project.id } });
|
|
89
|
-
await repos.
|
|
89
|
+
await repos.actions.pay.giveUp({ typeOf: action.typeOf, id: action.id, error, recipe });
|
|
90
90
|
}
|
|
91
91
|
catch (__) {
|
|
92
92
|
// 失敗したら仕方ない
|
|
@@ -96,7 +96,7 @@ function payCreditCard(params) {
|
|
|
96
96
|
const actionResult = {
|
|
97
97
|
// creditCardSales: alterTranResults // discontinue(2024-06-10~)
|
|
98
98
|
};
|
|
99
|
-
await repos.
|
|
99
|
+
await repos.actions.pay.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult, recipe });
|
|
100
100
|
await (0, onPayActionCompleted_1.onPayActionCompleted)({
|
|
101
101
|
// actionStatus: factory.actionStatusType.CompletedActionStatus,
|
|
102
102
|
id: action.id,
|
|
@@ -105,7 +105,11 @@ function payCreditCard(params) {
|
|
|
105
105
|
project: params.project,
|
|
106
106
|
purpose: params.purpose,
|
|
107
107
|
typeOf: action.typeOf
|
|
108
|
-
})(
|
|
108
|
+
})({
|
|
109
|
+
actions: repos.actions,
|
|
110
|
+
accountingReport: repos.accountingReport,
|
|
111
|
+
task: repos.task
|
|
112
|
+
});
|
|
109
113
|
// return action;
|
|
110
114
|
};
|
|
111
115
|
}
|
|
@@ -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 { PaymentServiceRepo } from '../../../repo/paymentService';
|
|
@@ -17,7 +16,7 @@ declare function refundCreditCard(params: Pick<factory.action.trade.refund.IAttr
|
|
|
17
16
|
id: string;
|
|
18
17
|
};
|
|
19
18
|
}): (repos: {
|
|
20
|
-
action
|
|
19
|
+
action?: never;
|
|
21
20
|
actions: {
|
|
22
21
|
pay: PayActionRepo;
|
|
23
22
|
refund: RefundActionRepo;
|
|
@@ -53,11 +53,11 @@ function refundCreditCard(params
|
|
|
53
53
|
let payAction;
|
|
54
54
|
let alterTranResultByPayAction;
|
|
55
55
|
if (requirePayAction) {
|
|
56
|
-
payAction = await repos.
|
|
56
|
+
payAction = await repos.actions.pay.findPayActionByPaymentMethodId({ project: { id: params.project.id }, paymentMethodId });
|
|
57
57
|
if (payAction === undefined) {
|
|
58
58
|
throw new factory.errors.NotFound(factory.actionType.PayAction);
|
|
59
59
|
}
|
|
60
|
-
const payRecipe = await repos.
|
|
60
|
+
const payRecipe = await repos.actions.pay.findRecipeByAction({
|
|
61
61
|
project: { id: params.project.id },
|
|
62
62
|
recipeFor: { id: payAction.id }
|
|
63
63
|
});
|
|
@@ -73,7 +73,7 @@ function refundCreditCard(params
|
|
|
73
73
|
id: paymentServiceId
|
|
74
74
|
});
|
|
75
75
|
const { sameAs, ...startingActionParams } = params; // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
76
|
-
const action = await repos.
|
|
76
|
+
const action = await repos.actions.refund.start({
|
|
77
77
|
...startingActionParams,
|
|
78
78
|
...(typeof params.sameAs?.id === 'string') ? { sameAs: { id: params.sameAs.id, typeOf: 'Task' } } : undefined
|
|
79
79
|
});
|
|
@@ -106,7 +106,7 @@ function refundCreditCard(params
|
|
|
106
106
|
}
|
|
107
107
|
catch (error) {
|
|
108
108
|
try {
|
|
109
|
-
await repos.
|
|
109
|
+
await repos.actions.refund.giveUp({
|
|
110
110
|
typeOf: action.typeOf, id: action.id, error,
|
|
111
111
|
...(recipe !== undefined) ? { recipe } : undefined
|
|
112
112
|
});
|
|
@@ -118,7 +118,7 @@ function refundCreditCard(params
|
|
|
118
118
|
}
|
|
119
119
|
const actionResult = {}; // optimize(2024-06-10~)
|
|
120
120
|
// add recipe(2024-06-04~)
|
|
121
|
-
await repos.
|
|
121
|
+
await repos.actions.refund.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult, recipe });
|
|
122
122
|
await (0, onRefundActionCompletedOrFailed_1.onRefundActionCompletedOrFailed)({
|
|
123
123
|
actionStatus: factory.actionStatusType.CompletedActionStatus,
|
|
124
124
|
id: action.id,
|
|
@@ -127,7 +127,11 @@ function refundCreditCard(params
|
|
|
127
127
|
project: startingActionParams.project,
|
|
128
128
|
purpose: startingActionParams.purpose,
|
|
129
129
|
typeOf: action.typeOf
|
|
130
|
-
})(
|
|
130
|
+
})({
|
|
131
|
+
actions: repos.actions,
|
|
132
|
+
accountingReport: repos.accountingReport,
|
|
133
|
+
task: repos.task
|
|
134
|
+
});
|
|
131
135
|
};
|
|
132
136
|
}
|
|
133
137
|
function processAlterTran(params) {
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as factory from '../../factory';
|
|
5
5
|
import type { AccountingReportRepo } from '../../repo/accountingReport';
|
|
6
|
-
import type { ActionRepo } from '../../repo/action';
|
|
7
6
|
import type { PayActionRepo } from '../../repo/action/pay';
|
|
8
7
|
import type { RefundActionRepo } from '../../repo/action/refund';
|
|
9
8
|
import type { ProductRepo } from '../../repo/product';
|
|
@@ -12,7 +11,7 @@ declare function voidTransaction(__: factory.task.voidPayment.IData): (___: {
|
|
|
12
11
|
product: ProductRepo;
|
|
13
12
|
}) => Promise<void>;
|
|
14
13
|
declare function payFaceToFace(params: factory.action.trade.pay.IAttributes): (repos: {
|
|
15
|
-
action
|
|
14
|
+
action?: never;
|
|
16
15
|
actions: {
|
|
17
16
|
pay: PayActionRepo;
|
|
18
17
|
refund: RefundActionRepo;
|
|
@@ -22,7 +21,7 @@ declare function payFaceToFace(params: factory.action.trade.pay.IAttributes): (r
|
|
|
22
21
|
task: TaskRepo;
|
|
23
22
|
}) => Promise<void>;
|
|
24
23
|
declare function refundFaceToFace(params: factory.task.refund.IData): (repos: {
|
|
25
|
-
action
|
|
24
|
+
action?: never;
|
|
26
25
|
actions: {
|
|
27
26
|
pay: PayActionRepo;
|
|
28
27
|
refund: RefundActionRepo;
|
|
@@ -39,13 +39,13 @@ function voidTransaction(__) {
|
|
|
39
39
|
}
|
|
40
40
|
function payFaceToFace(params) {
|
|
41
41
|
return async (repos) => {
|
|
42
|
-
const action = await repos.
|
|
42
|
+
const action = await repos.actions.pay.start(params);
|
|
43
43
|
try {
|
|
44
44
|
// no op
|
|
45
45
|
}
|
|
46
46
|
catch (error) {
|
|
47
47
|
try {
|
|
48
|
-
await repos.
|
|
48
|
+
await repos.actions.pay.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
49
49
|
}
|
|
50
50
|
catch (__) {
|
|
51
51
|
// 失敗したら仕方ない
|
|
@@ -53,7 +53,7 @@ function payFaceToFace(params) {
|
|
|
53
53
|
throw error;
|
|
54
54
|
}
|
|
55
55
|
const actionResult = {};
|
|
56
|
-
await repos.
|
|
56
|
+
await repos.actions.pay.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
57
57
|
await (0, onPayActionCompleted_1.onPayActionCompleted)({
|
|
58
58
|
// actionStatus: factory.actionStatusType.CompletedActionStatus,
|
|
59
59
|
id: action.id,
|
|
@@ -62,19 +62,23 @@ function payFaceToFace(params) {
|
|
|
62
62
|
project: params.project,
|
|
63
63
|
purpose: params.purpose,
|
|
64
64
|
typeOf: action.typeOf
|
|
65
|
-
})(
|
|
65
|
+
})({
|
|
66
|
+
actions: repos.actions,
|
|
67
|
+
accountingReport: repos.accountingReport,
|
|
68
|
+
task: repos.task
|
|
69
|
+
});
|
|
66
70
|
// return action;
|
|
67
71
|
};
|
|
68
72
|
}
|
|
69
73
|
function refundFaceToFace(params) {
|
|
70
74
|
return async (repos) => {
|
|
71
|
-
const action = await repos.
|
|
75
|
+
const action = await repos.actions.refund.start(params);
|
|
72
76
|
try {
|
|
73
77
|
// no op
|
|
74
78
|
}
|
|
75
79
|
catch (error) {
|
|
76
80
|
try {
|
|
77
|
-
await repos.
|
|
81
|
+
await repos.actions.refund.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
78
82
|
}
|
|
79
83
|
catch (__) {
|
|
80
84
|
// no op
|
|
@@ -82,7 +86,7 @@ function refundFaceToFace(params) {
|
|
|
82
86
|
throw error;
|
|
83
87
|
}
|
|
84
88
|
const actionResult = {};
|
|
85
|
-
await repos.
|
|
89
|
+
await repos.actions.refund.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
86
90
|
await (0, onRefundActionCompletedOrFailed_1.onRefundActionCompletedOrFailed)({
|
|
87
91
|
actionStatus: factory.actionStatusType.CompletedActionStatus,
|
|
88
92
|
id: action.id,
|
|
@@ -91,7 +95,11 @@ function refundFaceToFace(params) {
|
|
|
91
95
|
project: params.project,
|
|
92
96
|
purpose: params.purpose,
|
|
93
97
|
typeOf: action.typeOf
|
|
94
|
-
})(
|
|
98
|
+
})({
|
|
99
|
+
actions: repos.actions,
|
|
100
|
+
accountingReport: repos.accountingReport,
|
|
101
|
+
task: repos.task
|
|
102
|
+
});
|
|
95
103
|
// return action;
|
|
96
104
|
};
|
|
97
105
|
}
|
|
@@ -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 { CheckMovieTicketActionRepo } from '../../../repo/action/checkMovieTicket';
|
|
@@ -40,7 +39,7 @@ declare function authorize(params: factory.assetTransaction.pay.IStartParamsWith
|
|
|
40
39
|
id: string;
|
|
41
40
|
};
|
|
42
41
|
}): (repos: {
|
|
43
|
-
action
|
|
42
|
+
action?: never;
|
|
44
43
|
actions: {
|
|
45
44
|
pay: PayActionRepo;
|
|
46
45
|
refund: RefundActionRepo;
|
|
@@ -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';
|
|
@@ -11,7 +10,7 @@ import type { TaskRepo } from '../../../repo/task';
|
|
|
11
10
|
import * as factory from '../../../factory';
|
|
12
11
|
import { Settings } from '../../../settings';
|
|
13
12
|
interface IPayOperationRepos {
|
|
14
|
-
action
|
|
13
|
+
action?: never;
|
|
15
14
|
actions: {
|
|
16
15
|
pay: PayActionRepo;
|
|
17
16
|
refund: RefundActionRepo;
|
|
@@ -44,15 +44,15 @@ function payMovieTicket(params, options) {
|
|
|
44
44
|
processSeatInfoSyncResult: { seatInfoSyncIn },
|
|
45
45
|
project: { id: params.project.id }
|
|
46
46
|
});
|
|
47
|
-
const action = await repos.
|
|
47
|
+
const action = await repos.actions.pay.start(startingAction, { recipe });
|
|
48
48
|
let processSeatInfoSyncResult;
|
|
49
49
|
try {
|
|
50
50
|
// 着券済に対する冪等性を確保する必要はあるが、
|
|
51
51
|
// その他のアクションとしての振る舞いは実行される必要もある
|
|
52
|
-
const completedPayAction = await repos.
|
|
52
|
+
const completedPayAction = await repos.actions.pay.findPayActionByPaymentMethodId({ project: { id: params.project.id }, paymentMethodId });
|
|
53
53
|
let payRecipe;
|
|
54
54
|
if (completedPayAction !== undefined) {
|
|
55
|
-
payRecipe = await repos.
|
|
55
|
+
payRecipe = await repos.actions.pay.findRecipeByAction({
|
|
56
56
|
project: { id: params.project.id },
|
|
57
57
|
recipeFor: { id: completedPayAction.id }
|
|
58
58
|
});
|
|
@@ -89,7 +89,7 @@ function payMovieTicket(params, options) {
|
|
|
89
89
|
// アクション保管用のエラーと両方保管(2024-05-22~)
|
|
90
90
|
const errors = [(0, errorHandler_1.handleMvtkReserveError)(error), error];
|
|
91
91
|
try {
|
|
92
|
-
await repos.
|
|
92
|
+
await repos.actions.pay.giveUp({ typeOf: action.typeOf, id: action.id, error: errors });
|
|
93
93
|
}
|
|
94
94
|
catch (__) {
|
|
95
95
|
// 失敗したら仕方ない
|
|
@@ -104,7 +104,7 @@ function payMovieTicket(params, options) {
|
|
|
104
104
|
// ? { seatInfoSyncResult: <factory.action.trade.pay.ISeatInfoSyncResult>seatInfoSyncResult }
|
|
105
105
|
// : undefined
|
|
106
106
|
};
|
|
107
|
-
await repos.
|
|
107
|
+
await repos.actions.pay.completeWithVoid({ typeOf: action.typeOf, id: action.id, result, recipe });
|
|
108
108
|
if (callOnPayActionCompleted) {
|
|
109
109
|
await (0, onPayActionCompleted_1.onPayActionCompleted)({
|
|
110
110
|
// actionStatus: factory.actionStatusType.CompletedActionStatus,
|
|
@@ -114,7 +114,11 @@ function payMovieTicket(params, options) {
|
|
|
114
114
|
project: startingAction.project,
|
|
115
115
|
purpose: startingAction.purpose,
|
|
116
116
|
typeOf: action.typeOf
|
|
117
|
-
})(
|
|
117
|
+
})({
|
|
118
|
+
actions: repos.actions,
|
|
119
|
+
accountingReport: repos.accountingReport,
|
|
120
|
+
task: repos.task
|
|
121
|
+
});
|
|
118
122
|
}
|
|
119
123
|
};
|
|
120
124
|
}
|