@chevre/domain 23.0.0 → 23.1.0-alpha.0
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/payment/any/authorize/fixTransactionNumber.d.ts +39 -0
- package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.js +86 -0
- package/lib/chevre/service/payment/any/{handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts → authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts} +4 -4
- package/lib/chevre/service/payment/any/{handlePrePublishedPaymentMethodIdOnAuthorizing.js → authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.js} +1 -1
- package/lib/chevre/service/payment/any/publishPaymentUrl/fixTransactionNumberOnPublishPaymentUrl.d.ts +25 -0
- package/lib/chevre/service/payment/any/publishPaymentUrl/fixTransactionNumberOnPublishPaymentUrl.js +51 -0
- package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.d.ts +2 -2
- package/lib/chevre/service/payment/any.js +91 -70
- package/package.json +2 -2
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as factory from '../../../../factory';
|
|
2
|
+
import type { ActionRepo } from '../../../../repo/action';
|
|
3
|
+
import type { AuthorizationRepo } from '../../../../repo/authorization';
|
|
4
|
+
import type { TicketRepo } from '../../../../repo/ticket';
|
|
5
|
+
import type { ITransactionInProgress, TransactionRepo } from '../../../../repo/transaction';
|
|
6
|
+
import type { TransactionNumberRepo } from '../../../../repo/transactionNumber';
|
|
7
|
+
import * as PayTransactionService from '../../../assetTransaction/pay';
|
|
8
|
+
import { IPermitOrInvoice } from '../verifyTicketTokenAsNeeded';
|
|
9
|
+
interface IFixTransactionNumberRepos {
|
|
10
|
+
action: ActionRepo;
|
|
11
|
+
authorization: AuthorizationRepo;
|
|
12
|
+
ticket: TicketRepo;
|
|
13
|
+
transaction: TransactionRepo;
|
|
14
|
+
transactionNumber: TransactionNumberRepo;
|
|
15
|
+
}
|
|
16
|
+
type IFixTransactionNumberOperation<T> = (repos: IFixTransactionNumberRepos) => Promise<T>;
|
|
17
|
+
type IObjectWithoutDetail = factory.action.authorize.paymentMethod.any.IObjectWithoutDetail & {
|
|
18
|
+
ticketToken?: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* 決済承認時の取引番号を決定する
|
|
22
|
+
*/
|
|
23
|
+
declare function fixTransactionNumber(params: {
|
|
24
|
+
object: IObjectWithoutDetail;
|
|
25
|
+
transaction: Pick<ITransactionInProgress<factory.transactionType.PlaceOrder>, 'agent' | 'expires' | 'id' | 'typeOf' | 'project' | 'seller'>;
|
|
26
|
+
paymentServiceType: factory.service.paymentService.PaymentServiceType;
|
|
27
|
+
}): IFixTransactionNumberOperation<{
|
|
28
|
+
transactionNumber: string;
|
|
29
|
+
pendingPaymentAgencyTransaction?: PayTransactionService.IPaymentAgencyTransaction;
|
|
30
|
+
creditCard?: factory.action.authorize.paymentMethod.any.ICreditCard;
|
|
31
|
+
permitOrInvoice?: IPermitOrInvoice;
|
|
32
|
+
id?: never;
|
|
33
|
+
} | {
|
|
34
|
+
/**
|
|
35
|
+
* 完了済の決済承認アクションID
|
|
36
|
+
*/
|
|
37
|
+
id: string;
|
|
38
|
+
}>;
|
|
39
|
+
export { fixTransactionNumber };
|
|
@@ -0,0 +1,86 @@
|
|
|
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.fixTransactionNumber = fixTransactionNumber;
|
|
13
|
+
const factory = require("../../../../factory");
|
|
14
|
+
const verifyTicketTokenAsNeeded_1 = require("../verifyTicketTokenAsNeeded");
|
|
15
|
+
const handlePrePublishedPaymentMethodIdOnAuthorizing_1 = require("./handlePrePublishedPaymentMethodIdOnAuthorizing");
|
|
16
|
+
/**
|
|
17
|
+
* 決済承認時の取引番号を決定する
|
|
18
|
+
*/
|
|
19
|
+
function fixTransactionNumber(params) {
|
|
20
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const { paymentServiceType, transaction, object } = params;
|
|
22
|
+
// 取引番号生成
|
|
23
|
+
let transactionNumber;
|
|
24
|
+
let pendingPaymentAgencyTransaction;
|
|
25
|
+
let creditCard = object.creditCard;
|
|
26
|
+
// ticketTokenを解釈(2024-08-13~)
|
|
27
|
+
const { permitOrInvoice } = yield (0, verifyTicketTokenAsNeeded_1.verifyTicketTokenAsNeeded)({
|
|
28
|
+
project: { id: transaction.project.id },
|
|
29
|
+
object: object,
|
|
30
|
+
paymentServiceType,
|
|
31
|
+
purpose: { id: transaction.id }
|
|
32
|
+
})(repos);
|
|
33
|
+
/**
|
|
34
|
+
* ticketTokenによって指定された決済方法ID
|
|
35
|
+
*/
|
|
36
|
+
let paymentMethodIdByTicketToken;
|
|
37
|
+
if ((permitOrInvoice === null || permitOrInvoice === void 0 ? void 0 : permitOrInvoice.typeOf) === factory.permit.PermitType.Permit) {
|
|
38
|
+
paymentMethodIdByTicketToken = permitOrInvoice === null || permitOrInvoice === void 0 ? void 0 : permitOrInvoice.identifier;
|
|
39
|
+
if (typeof paymentMethodIdByTicketToken === 'string') {
|
|
40
|
+
transactionNumber = paymentMethodIdByTicketToken; // メンバーシップ指定の場合、取引番号に適用(2024-08-13~)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
else if ((permitOrInvoice === null || permitOrInvoice === void 0 ? void 0 : permitOrInvoice.typeOf) === 'Invoice') {
|
|
44
|
+
// support paymentServiceType.MovieTicket(2024-11-23~)
|
|
45
|
+
if (typeof (permitOrInvoice === null || permitOrInvoice === void 0 ? void 0 : permitOrInvoice.paymentMethodId) === 'string') {
|
|
46
|
+
paymentMethodIdByTicketToken = permitOrInvoice === null || permitOrInvoice === void 0 ? void 0 : permitOrInvoice.paymentMethodId;
|
|
47
|
+
if (typeof paymentMethodIdByTicketToken === 'string') {
|
|
48
|
+
transactionNumber = paymentMethodIdByTicketToken;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// リクエストでpaymentMethodIdを指定された場合、取引に保管されたpaymentMethodIdに一致すればそちらを適用(外部サイト決済対応)
|
|
53
|
+
if (typeof object.paymentMethodId === 'string' && object.paymentMethodId.length > 0) {
|
|
54
|
+
if (typeof paymentMethodIdByTicketToken === 'string') {
|
|
55
|
+
// 指定されたpaymentMethodIdとチケットから読み取った決済方法IDは一致しなければいけない
|
|
56
|
+
if (paymentMethodIdByTicketToken !== object.paymentMethodId) {
|
|
57
|
+
throw new factory.errors.Argument('ticketToken', 'not matched with paymentMethodId');
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const { authorizeParams, existingCompletedAuthorizeAction } = yield (0, handlePrePublishedPaymentMethodIdOnAuthorizing_1.handlePrePublishedPaymentMethodIdOnAuthorizing)({
|
|
61
|
+
object: object,
|
|
62
|
+
prePublishedPaymentMethodId: object.paymentMethodId,
|
|
63
|
+
transaction
|
|
64
|
+
})(repos);
|
|
65
|
+
if (existingCompletedAuthorizeAction !== undefined) {
|
|
66
|
+
return { id: existingCompletedAuthorizeAction.id };
|
|
67
|
+
}
|
|
68
|
+
else if (authorizeParams !== undefined) {
|
|
69
|
+
// creditCardを決済URL発行時の情報で上書き(2024-01-08~)
|
|
70
|
+
// creditCard = authorizeParams.paymentMethodByTransaction.paymentMethod?.creditCard;
|
|
71
|
+
creditCard = authorizeParams.creditCard;
|
|
72
|
+
transactionNumber = object.paymentMethodId;
|
|
73
|
+
pendingPaymentAgencyTransaction = authorizeParams.pendingPaymentAgencyTransaction;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
throw new factory.errors.NotImplemented('pendingPaymentAgencyTransaction required on paymentMethodId specified');
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
// 取引番号発行済でなければ発行
|
|
80
|
+
if (typeof transactionNumber !== 'string') {
|
|
81
|
+
const publishTransactionNumberResult = yield repos.transactionNumber.publishByTimestamp({ startDate: new Date() });
|
|
82
|
+
transactionNumber = publishTransactionNumberResult.transactionNumber;
|
|
83
|
+
}
|
|
84
|
+
return Object.assign(Object.assign(Object.assign({ transactionNumber }, (pendingPaymentAgencyTransaction !== undefined) ? { pendingPaymentAgencyTransaction } : undefined), (creditCard !== undefined) ? { creditCard } : undefined), (permitOrInvoice !== undefined) ? { permitOrInvoice } : undefined);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as factory from '
|
|
2
|
-
import type { ActionRepo } from '
|
|
3
|
-
import type { ITransactionInProgress, TransactionRepo } from '
|
|
4
|
-
import * as PayTransactionService from '
|
|
1
|
+
import * as factory from '../../../../factory';
|
|
2
|
+
import type { ActionRepo } from '../../../../repo/action';
|
|
3
|
+
import type { ITransactionInProgress, TransactionRepo } from '../../../../repo/transaction';
|
|
4
|
+
import * as PayTransactionService from '../../../assetTransaction/pay';
|
|
5
5
|
type IObjectWithoutDetail = factory.action.authorize.paymentMethod.any.IObjectWithoutDetail;
|
|
6
6
|
declare function handlePrePublishedPaymentMethodIdOnAuthorizing(params: {
|
|
7
7
|
object: Pick<IObjectWithoutDetail, 'amount' | 'issuedThrough' | 'paymentMethod'>;
|
|
@@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.handlePrePublishedPaymentMethodIdOnAuthorizing = handlePrePublishedPaymentMethodIdOnAuthorizing;
|
|
13
13
|
const createDebug = require("debug");
|
|
14
|
-
const factory = require("
|
|
14
|
+
const factory = require("../../../../factory");
|
|
15
15
|
const debug = createDebug('chevre-domain:service:payment');
|
|
16
16
|
function recipe2paymentAgencyTransaction(actionRecipe) {
|
|
17
17
|
var _a;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as factory from '../../../../factory';
|
|
2
|
+
import type { AuthorizationRepo } from '../../../../repo/authorization';
|
|
3
|
+
import type { TicketRepo } from '../../../../repo/ticket';
|
|
4
|
+
import type { ITransactionInProgress } from '../../../../repo/transaction';
|
|
5
|
+
import type { TransactionNumberRepo } from '../../../../repo/transactionNumber';
|
|
6
|
+
interface IFixTransactionNumberRepos {
|
|
7
|
+
authorization: AuthorizationRepo;
|
|
8
|
+
ticket: TicketRepo;
|
|
9
|
+
transactionNumber: TransactionNumberRepo;
|
|
10
|
+
}
|
|
11
|
+
type IFixTransactionNumberOperation<T> = (repos: IFixTransactionNumberRepos) => Promise<T>;
|
|
12
|
+
type IObjectWithoutDetail = factory.action.authorize.paymentMethod.any.IObjectWithoutDetail & {
|
|
13
|
+
ticketToken?: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* 外部決済ロケーション発行時の取引番号を決定する
|
|
17
|
+
*/
|
|
18
|
+
declare function fixTransactionNumberOnPublishPaymentUrl(params: {
|
|
19
|
+
object: IObjectWithoutDetail;
|
|
20
|
+
transaction: Pick<ITransactionInProgress<factory.transactionType.PlaceOrder>, 'id' | 'project'>;
|
|
21
|
+
paymentServiceType: factory.service.paymentService.PaymentServiceType;
|
|
22
|
+
}): IFixTransactionNumberOperation<{
|
|
23
|
+
transactionNumber: string;
|
|
24
|
+
}>;
|
|
25
|
+
export { fixTransactionNumberOnPublishPaymentUrl };
|
package/lib/chevre/service/payment/any/publishPaymentUrl/fixTransactionNumberOnPublishPaymentUrl.js
ADDED
|
@@ -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.fixTransactionNumberOnPublishPaymentUrl = fixTransactionNumberOnPublishPaymentUrl;
|
|
13
|
+
const factory = require("../../../../factory");
|
|
14
|
+
const verifyTicketTokenAsNeeded_1 = require("../verifyTicketTokenAsNeeded");
|
|
15
|
+
/**
|
|
16
|
+
* 外部決済ロケーション発行時の取引番号を決定する
|
|
17
|
+
*/
|
|
18
|
+
function fixTransactionNumberOnPublishPaymentUrl(params) {
|
|
19
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const { paymentServiceType, transaction, object } = params;
|
|
21
|
+
// 取引番号生成
|
|
22
|
+
let transactionNumber;
|
|
23
|
+
// support ticketToken(2024-08-21~)
|
|
24
|
+
const { permitOrInvoice } = yield (0, verifyTicketTokenAsNeeded_1.verifyTicketTokenAsNeeded)({
|
|
25
|
+
project: { id: transaction.project.id },
|
|
26
|
+
object,
|
|
27
|
+
paymentServiceType,
|
|
28
|
+
purpose: { id: transaction.id }
|
|
29
|
+
})(repos);
|
|
30
|
+
if ((permitOrInvoice === null || permitOrInvoice === void 0 ? void 0 : permitOrInvoice.typeOf) === factory.permit.PermitType.Permit) {
|
|
31
|
+
const paymentMethodIdByPermit = permitOrInvoice === null || permitOrInvoice === void 0 ? void 0 : permitOrInvoice.identifier;
|
|
32
|
+
if (typeof paymentMethodIdByPermit === 'string') {
|
|
33
|
+
transactionNumber = paymentMethodIdByPermit;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else if ((permitOrInvoice === null || permitOrInvoice === void 0 ? void 0 : permitOrInvoice.typeOf) === 'Invoice') {
|
|
37
|
+
// support Invoice ticket(2025-11-09~)
|
|
38
|
+
if (typeof (permitOrInvoice === null || permitOrInvoice === void 0 ? void 0 : permitOrInvoice.paymentMethodId) === 'string') {
|
|
39
|
+
transactionNumber = permitOrInvoice.paymentMethodId;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (typeof transactionNumber !== 'string') {
|
|
43
|
+
const publishTransactionNumberResult = yield repos.transactionNumber.publishByTimestamp({ startDate: new Date() });
|
|
44
|
+
transactionNumber = publishTransactionNumberResult.transactionNumber;
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
transactionNumber
|
|
48
|
+
// ...(permitOrInvoice !== undefined) ? { permitOrInvoice } : undefined
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
}
|
|
@@ -8,11 +8,11 @@ declare function verifyTicketTokenAsNeeded(params: {
|
|
|
8
8
|
};
|
|
9
9
|
object: Pick<factory.action.authorize.paymentMethod.any.IObjectWithoutDetail, 'issuedThrough' | 'ticketToken'>;
|
|
10
10
|
paymentServiceType: factory.service.paymentService.PaymentServiceType;
|
|
11
|
-
purpose: factory.action.authorize.paymentMethod.any.IPurpose
|
|
11
|
+
purpose: Pick<factory.action.authorize.paymentMethod.any.IPurpose, 'id'>;
|
|
12
12
|
}): (repos: {
|
|
13
13
|
authorization: AuthorizationRepo;
|
|
14
14
|
ticket: TicketRepo;
|
|
15
15
|
}) => Promise<{
|
|
16
16
|
permitOrInvoice?: IPermitOrInvoice;
|
|
17
17
|
}>;
|
|
18
|
-
export { verifyTicketTokenAsNeeded };
|
|
18
|
+
export { IPermitOrInvoice, verifyTicketTokenAsNeeded };
|
|
@@ -23,14 +23,14 @@ const factory = require("../../factory");
|
|
|
23
23
|
// import type { TransactionProcessRepo } from '../../repo/transactionProcess';
|
|
24
24
|
const PayTransactionService = require("../assetTransaction/pay");
|
|
25
25
|
const publishOrderNumberIfNotExist_1 = require("../transaction/placeOrder/publishOrderNumberIfNotExist");
|
|
26
|
+
const fixTransactionNumber_1 = require("./any/authorize/fixTransactionNumber");
|
|
27
|
+
const fixTransactionNumberOnPublishPaymentUrl_1 = require("./any/publishPaymentUrl/fixTransactionNumberOnPublishPaymentUrl");
|
|
26
28
|
const factory_1 = require("./any/factory");
|
|
27
29
|
const fixOrderAsNeeded_1 = require("./any/fixOrderAsNeeded");
|
|
28
|
-
const handlePrePublishedPaymentMethodIdOnAuthorizing_1 = require("./any/handlePrePublishedPaymentMethodIdOnAuthorizing");
|
|
29
30
|
const onPaymentStatusChanged_1 = require("./any/onPaymentStatusChanged");
|
|
30
31
|
Object.defineProperty(exports, "onPaymentStatusChanged", { enumerable: true, get: function () { return onPaymentStatusChanged_1.onPaymentStatusChanged; } });
|
|
31
32
|
const person2username_1 = require("./any/person2username");
|
|
32
33
|
Object.defineProperty(exports, "person2username", { enumerable: true, get: function () { return person2username_1.person2username; } });
|
|
33
|
-
const verifyTicketTokenAsNeeded_1 = require("./any/verifyTicketTokenAsNeeded");
|
|
34
34
|
/**
|
|
35
35
|
* 決済承認中止
|
|
36
36
|
* タスクから決済承認を取り消す
|
|
@@ -319,7 +319,9 @@ function processVoidPayTransaction(params) {
|
|
|
319
319
|
/**
|
|
320
320
|
* 外部決済ロケーションを発行する
|
|
321
321
|
*/
|
|
322
|
+
// tslint:disable-next-line:max-func-body-length
|
|
322
323
|
function publishPaymentUrl(params) {
|
|
324
|
+
// tslint:disable-next-line:max-func-body-length
|
|
323
325
|
return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
|
|
324
326
|
var _a;
|
|
325
327
|
const { paymentServiceType, purpose, project } = params;
|
|
@@ -328,6 +330,9 @@ function publishPaymentUrl(params) {
|
|
|
328
330
|
}
|
|
329
331
|
try {
|
|
330
332
|
const transaction = yield repos.transaction.projectFieldsInProgressById({ typeOf: purpose.typeOf, id: purpose.id }, ['expires', 'seller', 'project']);
|
|
333
|
+
if (project.id !== transaction.project.id) {
|
|
334
|
+
throw new factory.errors.NotFound(factory.transactionType.PlaceOrder);
|
|
335
|
+
}
|
|
331
336
|
// publishOrderNumber(2025-03-11~)
|
|
332
337
|
yield (0, publishOrderNumberIfNotExist_1.publishOrderNumberIfNotExist)({
|
|
333
338
|
project: { id: transaction.project.id },
|
|
@@ -335,19 +340,25 @@ function publishPaymentUrl(params) {
|
|
|
335
340
|
object: { orderDate: new Date() }
|
|
336
341
|
})(repos);
|
|
337
342
|
// 取引番号生成
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
}
|
|
347
|
-
if (
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
343
|
+
const { transactionNumber } = yield (0, fixTransactionNumberOnPublishPaymentUrl_1.fixTransactionNumberOnPublishPaymentUrl)({
|
|
344
|
+
object: params.object,
|
|
345
|
+
transaction,
|
|
346
|
+
paymentServiceType
|
|
347
|
+
})(repos);
|
|
348
|
+
// let transactionNumber: string | undefined;
|
|
349
|
+
// // support ticketToken(2024-08-21~)
|
|
350
|
+
// const { permitOrInvoice } =
|
|
351
|
+
// await verifyTicketTokenAsNeeded({ project, object: params.object, paymentServiceType, purpose })(repos);
|
|
352
|
+
// if (permitOrInvoice?.typeOf === factory.permit.PermitType.Permit) {
|
|
353
|
+
// const paymentMethodIdByPermit = permitOrInvoice?.identifier;
|
|
354
|
+
// if (typeof paymentMethodIdByPermit === 'string') {
|
|
355
|
+
// transactionNumber = paymentMethodIdByPermit;
|
|
356
|
+
// }
|
|
357
|
+
// }
|
|
358
|
+
// if (typeof transactionNumber !== 'string') {
|
|
359
|
+
// const publishTransactionNumberResult = await repos.transactionNumber.publishByTimestamp({ startDate: new Date() });
|
|
360
|
+
// transactionNumber = publishTransactionNumberResult.transactionNumber;
|
|
361
|
+
// }
|
|
351
362
|
let result;
|
|
352
363
|
// URL発行
|
|
353
364
|
const authorizeObject = Object.assign(Object.assign({}, params.object), { accountId: '', paymentMethodId: transactionNumber, typeOf: factory.action.authorize.paymentMethod.any.ResultType.Payment });
|
|
@@ -411,67 +422,77 @@ function authorize(params) {
|
|
|
411
422
|
throw new factory.errors.NotImplemented(`purpose.typeOf '${purpose.typeOf} not implemented'`);
|
|
412
423
|
}
|
|
413
424
|
const transaction = yield repos.transaction.projectFieldsInProgressById({ typeOf: purpose.typeOf, id: purpose.id }, ['agent', 'expires', 'typeOf', 'project', 'seller']);
|
|
425
|
+
if (project.id !== transaction.project.id) {
|
|
426
|
+
throw new factory.errors.NotFound(factory.transactionType.PlaceOrder);
|
|
427
|
+
}
|
|
414
428
|
const { confirmationNumber, orderNumber } = yield (0, fixOrderAsNeeded_1.fixOrderAsNeeded)({
|
|
415
429
|
project: { id: transaction.project.id },
|
|
416
430
|
purpose
|
|
417
431
|
// paymentServiceType
|
|
418
432
|
})(repos);
|
|
419
433
|
// 取引番号生成
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
}
|
|
444
|
-
//
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
//
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
434
|
+
const fixTransactionNumberResult = yield (0, fixTransactionNumber_1.fixTransactionNumber)({
|
|
435
|
+
object: params.object,
|
|
436
|
+
transaction,
|
|
437
|
+
paymentServiceType
|
|
438
|
+
})(repos);
|
|
439
|
+
if (typeof fixTransactionNumberResult.id === 'string') {
|
|
440
|
+
return { id: fixTransactionNumberResult.id };
|
|
441
|
+
}
|
|
442
|
+
const { transactionNumber, pendingPaymentAgencyTransaction, creditCard, permitOrInvoice } = fixTransactionNumberResult;
|
|
443
|
+
// let transactionNumber: string | undefined;
|
|
444
|
+
// let pendingPaymentAgencyTransaction: PayTransactionService.IPaymentAgencyTransaction | undefined;
|
|
445
|
+
// let creditCard: factory.action.authorize.paymentMethod.any.ICreditCard | undefined = params.object.creditCard;
|
|
446
|
+
// // ticketTokenを解釈(2024-08-13~)
|
|
447
|
+
// const { permitOrInvoice } =
|
|
448
|
+
// await verifyTicketTokenAsNeeded({ project, object: params.object, paymentServiceType, purpose })(repos);
|
|
449
|
+
// /**
|
|
450
|
+
// * ticketTokenによって指定された決済方法ID
|
|
451
|
+
// */
|
|
452
|
+
// let paymentMethodIdByTicketToken: string | undefined;
|
|
453
|
+
// if (permitOrInvoice?.typeOf === factory.permit.PermitType.Permit) {
|
|
454
|
+
// paymentMethodIdByTicketToken = permitOrInvoice?.identifier;
|
|
455
|
+
// if (typeof paymentMethodIdByTicketToken === 'string') {
|
|
456
|
+
// transactionNumber = paymentMethodIdByTicketToken; // メンバーシップ指定の場合、取引番号に適用(2024-08-13~)
|
|
457
|
+
// }
|
|
458
|
+
// } else if (permitOrInvoice?.typeOf === 'Invoice') {
|
|
459
|
+
// // support paymentServiceType.MovieTicket(2024-11-23~)
|
|
460
|
+
// if (typeof permitOrInvoice?.paymentMethodId === 'string') {
|
|
461
|
+
// paymentMethodIdByTicketToken = permitOrInvoice?.paymentMethodId;
|
|
462
|
+
// if (typeof paymentMethodIdByTicketToken === 'string') {
|
|
463
|
+
// transactionNumber = paymentMethodIdByTicketToken;
|
|
464
|
+
// }
|
|
465
|
+
// }
|
|
466
|
+
// }
|
|
467
|
+
// // リクエストでpaymentMethodIdを指定された場合、取引に保管されたpaymentMethodIdに一致すればそちらを適用(外部サイト決済対応)
|
|
468
|
+
// if (typeof params.object.paymentMethodId === 'string' && params.object.paymentMethodId.length > 0) {
|
|
469
|
+
// if (typeof paymentMethodIdByTicketToken === 'string') {
|
|
470
|
+
// if (paymentMethodIdByTicketToken !== params.object.paymentMethodId) {
|
|
471
|
+
// throw new factory.errors.Argument('ticketToken', 'not matched with paymentMethodId');
|
|
472
|
+
// }
|
|
473
|
+
// }
|
|
474
|
+
// const { authorizeParams, existingCompletedAuthorizeAction } = await handlePrePublishedPaymentMethodIdOnAuthorizing({
|
|
475
|
+
// object: params.object,
|
|
476
|
+
// prePublishedPaymentMethodId: params.object.paymentMethodId,
|
|
477
|
+
// transaction
|
|
478
|
+
// })(repos);
|
|
479
|
+
// if (existingCompletedAuthorizeAction !== undefined) {
|
|
480
|
+
// return { id: existingCompletedAuthorizeAction.id };
|
|
481
|
+
// } else if (authorizeParams !== undefined) {
|
|
482
|
+
// // creditCardを決済URL発行時の情報で上書き(2024-01-08~)
|
|
483
|
+
// // creditCard = authorizeParams.paymentMethodByTransaction.paymentMethod?.creditCard;
|
|
484
|
+
// creditCard = authorizeParams.creditCard;
|
|
485
|
+
// transactionNumber = params.object.paymentMethodId;
|
|
486
|
+
// pendingPaymentAgencyTransaction = authorizeParams.pendingPaymentAgencyTransaction;
|
|
487
|
+
// } else {
|
|
488
|
+
// throw new factory.errors.NotImplemented('pendingPaymentAgencyTransaction requied on paymentMethodId specified');
|
|
489
|
+
// }
|
|
490
|
+
// }
|
|
491
|
+
// // 取引番号発行済でなければ発行
|
|
492
|
+
// if (typeof transactionNumber !== 'string') {
|
|
493
|
+
// const publishTransactionNumberResult = await repos.transactionNumber.publishByTimestamp({ startDate: new Date() });
|
|
494
|
+
// transactionNumber = publishTransactionNumberResult.transactionNumber;
|
|
495
|
+
// }
|
|
475
496
|
const movieTickets = (Array.isArray(params.object.movieTickets)) ? params.object.movieTickets.map(factory_1.createMovieTicket) : undefined;
|
|
476
497
|
const { accountId } = yield fixAccountIdIfPossible({
|
|
477
498
|
object: params.object, project: { id: transaction.project.id }
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.600.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.600.0",
|
|
14
|
-
"@chevre/factory": "5.2.0-alpha.
|
|
14
|
+
"@chevre/factory": "5.2.0-alpha.5",
|
|
15
15
|
"@cinerino/sdk": "12.7.0-alpha.1",
|
|
16
16
|
"@motionpicture/coa-service": "9.6.0",
|
|
17
17
|
"@motionpicture/gmo-service": "5.4.0-alpha.1",
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"postversion": "git push origin --tags",
|
|
116
116
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
117
117
|
},
|
|
118
|
-
"version": "23.0.0"
|
|
118
|
+
"version": "23.1.0-alpha.0"
|
|
119
119
|
}
|