@chevre/domain 23.2.0-alpha.2 → 23.2.0-alpha.3
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/example/src/chevre/actions/checkAuthorizePaymentActions.ts +55 -0
- package/lib/chevre/repo/acceptedPaymentMethod.js +14 -10
- package/lib/chevre/service/assetTransaction/pay/validateAcceptedPaymentMethodIfNeeded.d.ts +6 -1
- package/lib/chevre/service/assetTransaction/pay/validateAcceptedPaymentMethodIfNeeded.js +26 -4
- package/lib/chevre/service/assetTransaction/pay.d.ts +3 -0
- package/lib/chevre/service/payment/any/factory.d.ts +1 -0
- package/lib/chevre/service/payment/any/factory.js +9 -1
- package/lib/chevre/service/payment/any.d.ts +4 -0
- package/lib/chevre/service/payment/any.js +1 -1
- package/lib/chevre/service/task/authorizePayment.js +2 -0
- package/lib/chevre/service/task/publishPaymentUrl.js +3 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/factory.d.ts +2 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +3 -1
- package/lib/chevre/service/transaction/placeOrder/confirm.js +3 -1
- package/package.json +2 -2
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as moment from 'moment';
|
|
3
|
+
import * as mongoose from 'mongoose';
|
|
4
|
+
|
|
5
|
+
import { chevre } from '../../../../lib/index';
|
|
6
|
+
|
|
7
|
+
// tslint:disable-next-line:max-func-body-length
|
|
8
|
+
async function main() {
|
|
9
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
|
+
|
|
11
|
+
const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
|
|
12
|
+
|
|
13
|
+
const cursor = actionRepo.getCursor(
|
|
14
|
+
{
|
|
15
|
+
typeOf: { $eq: chevre.factory.actionType.AuthorizeAction },
|
|
16
|
+
'object.typeOf': { $exists: true, $eq: chevre.factory.action.authorize.paymentMethod.any.ResultType.Payment },
|
|
17
|
+
startDate: {
|
|
18
|
+
$gte: moment()
|
|
19
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
20
|
+
.add(-7, 'days')
|
|
21
|
+
.toDate()
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
console.log('docs found');
|
|
28
|
+
|
|
29
|
+
let i = 0;
|
|
30
|
+
let expectdCount = 0;
|
|
31
|
+
await cursor.eachAsync(async (doc) => {
|
|
32
|
+
i += 1;
|
|
33
|
+
const authorizeAction = <chevre.factory.action.authorize.paymentMethod.any.IAction>doc.toObject();
|
|
34
|
+
|
|
35
|
+
const isExpected = authorizeAction.object.paymentMethodId === authorizeAction.instrument.transactionNumber;
|
|
36
|
+
if (isExpected) {
|
|
37
|
+
console.log(
|
|
38
|
+
authorizeAction.object.paymentMethodId,
|
|
39
|
+
' expected.',
|
|
40
|
+
authorizeAction.project.id, authorizeAction.typeOf, authorizeAction.object.typeOf,
|
|
41
|
+
authorizeAction.startDate, authorizeAction.identifier, i
|
|
42
|
+
);
|
|
43
|
+
expectdCount += 1;
|
|
44
|
+
} else {
|
|
45
|
+
throw new Error(`not expected ${authorizeAction.object.paymentMethodId} ${authorizeAction.instrument.transactionNumber} ${authorizeAction.project.id}`);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
console.log(i, 'docs checked');
|
|
50
|
+
console.log(expectdCount, 'expectd');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
main()
|
|
54
|
+
.then()
|
|
55
|
+
.catch(console.error);
|
|
@@ -31,45 +31,49 @@ class AcceptedPaymentMethodRepo {
|
|
|
31
31
|
this.acceptedPaymentMethodModel = connection.model(acceptedPaymentMethod_1.modelName, (0, acceptedPaymentMethod_1.createSchema)());
|
|
32
32
|
}
|
|
33
33
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
34
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
34
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
35
35
|
const andConditions = [];
|
|
36
36
|
const idEq = (_a = params.id) === null || _a === void 0 ? void 0 : _a.$eq;
|
|
37
37
|
if (typeof idEq === 'string') {
|
|
38
38
|
andConditions.push({ _id: { $eq: idEq } });
|
|
39
39
|
}
|
|
40
|
-
const
|
|
40
|
+
const idIn = (_b = params.id) === null || _b === void 0 ? void 0 : _b.$in;
|
|
41
|
+
if (Array.isArray(idIn)) {
|
|
42
|
+
andConditions.push({ _id: { $in: idIn } });
|
|
43
|
+
}
|
|
44
|
+
const projectIdEq = (_d = (_c = params.project) === null || _c === void 0 ? void 0 : _c.id) === null || _d === void 0 ? void 0 : _d.$eq;
|
|
41
45
|
if (typeof projectIdEq === 'string') {
|
|
42
46
|
andConditions.push({ 'project.id': { $eq: projectIdEq } });
|
|
43
47
|
}
|
|
44
|
-
const identifierEq = (
|
|
48
|
+
const identifierEq = (_e = params.identifier) === null || _e === void 0 ? void 0 : _e.$eq;
|
|
45
49
|
if (typeof identifierEq === 'string') {
|
|
46
50
|
andConditions.push({ identifier: { $eq: identifierEq } });
|
|
47
51
|
}
|
|
48
|
-
const identifierIn = (
|
|
52
|
+
const identifierIn = (_f = params.identifier) === null || _f === void 0 ? void 0 : _f.$in;
|
|
49
53
|
if (Array.isArray(identifierIn)) {
|
|
50
54
|
andConditions.push({ identifier: { $in: identifierIn } });
|
|
51
55
|
}
|
|
52
|
-
const itemOfferedIdEq = (
|
|
56
|
+
const itemOfferedIdEq = (_h = (_g = params.itemOffered) === null || _g === void 0 ? void 0 : _g.id) === null || _h === void 0 ? void 0 : _h.$eq;
|
|
53
57
|
if (typeof itemOfferedIdEq === 'string') {
|
|
54
58
|
andConditions.push({ 'itemOffered.id': { $eq: itemOfferedIdEq } });
|
|
55
59
|
}
|
|
56
|
-
const itemOfferedIdIn = (
|
|
60
|
+
const itemOfferedIdIn = (_k = (_j = params.itemOffered) === null || _j === void 0 ? void 0 : _j.id) === null || _k === void 0 ? void 0 : _k.$in;
|
|
57
61
|
if (Array.isArray(itemOfferedIdIn)) {
|
|
58
62
|
andConditions.push({ 'itemOffered.id': { $in: itemOfferedIdIn } });
|
|
59
63
|
}
|
|
60
|
-
const acceptedPaymentMethodIdEq = (
|
|
64
|
+
const acceptedPaymentMethodIdEq = (_m = (_l = params.acceptedPaymentMethod) === null || _l === void 0 ? void 0 : _l.id) === null || _m === void 0 ? void 0 : _m.$eq;
|
|
61
65
|
if (typeof acceptedPaymentMethodIdEq === 'string') {
|
|
62
66
|
andConditions.push({ 'acceptedPaymentMethod.id': { $eq: acceptedPaymentMethodIdEq } });
|
|
63
67
|
}
|
|
64
|
-
const sellerByIdEq = (
|
|
68
|
+
const sellerByIdEq = (_p = (_o = params.seller) === null || _o === void 0 ? void 0 : _o.id) === null || _p === void 0 ? void 0 : _p.$eq;
|
|
65
69
|
if (typeof sellerByIdEq === 'string') {
|
|
66
70
|
andConditions.push({ 'seller.id': { $eq: sellerByIdEq } });
|
|
67
71
|
}
|
|
68
|
-
const validFromLte = (
|
|
72
|
+
const validFromLte = (_q = params.validFrom) === null || _q === void 0 ? void 0 : _q.$lte;
|
|
69
73
|
if (validFromLte instanceof Date) {
|
|
70
74
|
andConditions.push({ validFrom: { $lte: validFromLte } });
|
|
71
75
|
}
|
|
72
|
-
const validThroughGte = (
|
|
76
|
+
const validThroughGte = (_r = params.validThrough) === null || _r === void 0 ? void 0 : _r.$gte;
|
|
73
77
|
if (validThroughGte instanceof Date) {
|
|
74
78
|
andConditions.push({ validThrough: { $gte: validThroughGte } });
|
|
75
79
|
}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import * as factory from '../../../factory';
|
|
2
|
+
import type { AcceptedPaymentMethodRepo } from '../../../repo/acceptedPaymentMethod';
|
|
2
3
|
import type { EventRepo } from '../../../repo/event';
|
|
3
4
|
import type { EventSeriesRepo } from '../../../repo/eventSeries';
|
|
4
5
|
/**
|
|
5
6
|
* 必要あらば関連リソースの対応決済方法を検証する
|
|
6
7
|
*/
|
|
7
|
-
export declare function validateAcceptedPaymentMethodIfNeeded(params: Pick<factory.assetTransaction.pay.IStartParamsWithoutDetail, 'object'>
|
|
8
|
+
export declare function validateAcceptedPaymentMethodIfNeeded(params: Pick<factory.assetTransaction.pay.IStartParamsWithoutDetail, 'object'> & {
|
|
9
|
+
instrument: factory.action.trade.pay.IPlaceOrderRelatedInstrument[];
|
|
10
|
+
} | {
|
|
8
11
|
object: factory.action.accept.pay.IPayObject & {
|
|
9
12
|
paymentMethod: factory.action.accept.pay.IPaymentMethod & {
|
|
10
13
|
movieTickets: never;
|
|
11
14
|
};
|
|
12
15
|
};
|
|
16
|
+
instrument: factory.action.accept.pay.IInstrument[];
|
|
13
17
|
}): (repos: {
|
|
18
|
+
acceptedPaymentMethod: AcceptedPaymentMethodRepo;
|
|
14
19
|
event: EventRepo;
|
|
15
20
|
eventSeries: EventSeriesRepo;
|
|
16
21
|
}) => Promise<void>;
|
|
@@ -19,14 +19,18 @@ const debug = createDebug('chevre-domain:service:assetTransaction:pay');
|
|
|
19
19
|
/**
|
|
20
20
|
* 必要あらば関連リソースの対応決済方法を検証する
|
|
21
21
|
*/
|
|
22
|
+
// tslint:disable-next-line:max-func-body-length
|
|
22
23
|
function validateAcceptedPaymentMethodIfNeeded(params) {
|
|
24
|
+
// tslint:disable-next-line:max-func-body-length
|
|
23
25
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
24
26
|
var _a, _b;
|
|
27
|
+
const now = new Date();
|
|
25
28
|
/**
|
|
26
29
|
* 検証対象のイベントIDリスト
|
|
27
30
|
*/
|
|
28
31
|
let checkingEventIds;
|
|
29
32
|
const paymentServiceType = params.object.typeOf;
|
|
33
|
+
const paymentServiceId = params.object.id;
|
|
30
34
|
// CreditCard or MovieTicket?
|
|
31
35
|
if (paymentServiceType === factory.service.paymentService.PaymentServiceType.CreditCard) {
|
|
32
36
|
// クレジットカードIF決済の場合、objectに注文アイテム指定があればそちらで検証する
|
|
@@ -77,10 +81,28 @@ function validateAcceptedPaymentMethodIfNeeded(params) {
|
|
|
77
81
|
}
|
|
78
82
|
if (((_b = eventSeries.offers) === null || _b === void 0 ? void 0 : _b.typeOf) === factory.offerType.AggregateOffer) {
|
|
79
83
|
// 対応決済方法オファーIDの指定が必要
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
+
const acceptedPaymentMethodOfferIds = [];
|
|
85
|
+
params.instrument.forEach((instrument) => {
|
|
86
|
+
if (instrument.typeOf === factory.offerType.Offer) {
|
|
87
|
+
acceptedPaymentMethodOfferIds.push(instrument.id);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
if (acceptedPaymentMethodOfferIds.length === 0) {
|
|
91
|
+
throw new factory.errors.ArgumentNull('acceptedPaymentMethodOfferIds');
|
|
92
|
+
}
|
|
93
|
+
// 全施設コンテンツについて有効な対応決済方法オファーの存在を検証
|
|
94
|
+
const validAcceptedPaymentMethodOffer = (yield repos.acceptedPaymentMethod.findAcceptedPaymentMethods({
|
|
95
|
+
limit: 1,
|
|
96
|
+
page: 1,
|
|
97
|
+
id: { $in: acceptedPaymentMethodOfferIds }, // 指定されたIDで
|
|
98
|
+
itemOffered: { id: { $eq: eventSeriesId } }, // リソースに対して
|
|
99
|
+
acceptedPaymentMethod: { id: { $eq: paymentServiceId } }, // 決済方法を許可
|
|
100
|
+
validFrom: { $lte: now }, // 現在有効
|
|
101
|
+
validThrough: { $gte: now } // 現在有効
|
|
102
|
+
}, ['identifier'])).shift();
|
|
103
|
+
if (validAcceptedPaymentMethodOffer === undefined) {
|
|
104
|
+
throw new factory.errors.NotFound(factory.offerType.Offer, `payment not accepted. eventSeriesId: ${eventSeriesId}`);
|
|
105
|
+
}
|
|
84
106
|
}
|
|
85
107
|
else {
|
|
86
108
|
// 集約オファーでなければ検証の必要なし
|
|
@@ -5,6 +5,7 @@ import * as GMO from '@motionpicture/gmo-service';
|
|
|
5
5
|
import * as factory from '../../factory';
|
|
6
6
|
import { Settings } from '../../settings';
|
|
7
7
|
import type { AcceptedOfferRepo } from '../../repo/acceptedOffer';
|
|
8
|
+
import type { AcceptedPaymentMethodRepo } from '../../repo/acceptedPaymentMethod';
|
|
8
9
|
import type { AccountingReportRepo } from '../../repo/accountingReport';
|
|
9
10
|
import type { ActionRepo } from '../../repo/action';
|
|
10
11
|
import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
@@ -21,6 +22,7 @@ import type { TaskRepo } from '../../repo/task';
|
|
|
21
22
|
import * as CreditCardPayment from '../payment/creditCard';
|
|
22
23
|
import * as MovieTicketPayment from '../payment/movieTicket';
|
|
23
24
|
export interface IStartOperationRepos {
|
|
25
|
+
acceptedPaymentMethod: AcceptedPaymentMethodRepo;
|
|
24
26
|
accountingReport: AccountingReportRepo;
|
|
25
27
|
action: ActionRepo;
|
|
26
28
|
credentials: CredentialsRepo;
|
|
@@ -62,6 +64,7 @@ export type ICheckOperation<T> = (repos: {
|
|
|
62
64
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
63
65
|
}, settings: Settings) => Promise<T>;
|
|
64
66
|
export type IPublishPaymentUrlOperation<T> = (repos: {
|
|
67
|
+
acceptedPaymentMethod: AcceptedPaymentMethodRepo;
|
|
65
68
|
action: ActionRepo;
|
|
66
69
|
event: EventRepo;
|
|
67
70
|
eventSeries: EventSeriesRepo;
|
|
@@ -16,6 +16,7 @@ export declare function creatPublishPaymentUrlParams(params: {
|
|
|
16
16
|
* 決済採用に使用される決済方法チケットトークン
|
|
17
17
|
*/
|
|
18
18
|
ticketToken?: string;
|
|
19
|
+
instrument: factory.action.trade.pay.IAcceptedPaymentMethodOfferAsInstrument[];
|
|
19
20
|
}): Pick<factory.assetTransaction.pay.IStartParamsWithoutDetail, 'agent' | 'location' | 'project' | 'recipient' | 'transactionNumber' | 'typeOf'> & {
|
|
20
21
|
object: factory.action.accept.pay.IPayObject;
|
|
21
22
|
identifier?: string;
|
|
@@ -28,7 +28,15 @@ function creatPublishPaymentUrlParams(params) {
|
|
|
28
28
|
referencesOrder: params.object.referencesOrder
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
+
const instrument = [];
|
|
31
32
|
const ticketAsInstrument = (typeof params.ticketToken === 'string') ? { ticketToken: params.ticketToken, typeOf: 'Ticket' } : undefined;
|
|
33
|
+
if (ticketAsInstrument !== undefined) {
|
|
34
|
+
instrument.push(ticketAsInstrument);
|
|
35
|
+
}
|
|
36
|
+
// instrumentを対応決済方法オファーに対応(2025-12-14~)
|
|
37
|
+
if (Array.isArray(params.instrument)) {
|
|
38
|
+
instrument.push(...params.instrument);
|
|
39
|
+
}
|
|
32
40
|
return Object.assign(Object.assign(Object.assign({ project: { id: params.transaction.project.id, typeOf: factory.organizationType.Project }, typeOf: factory.assetTransactionType.Pay, transactionNumber: params.transactionNumber, agent: {
|
|
33
41
|
typeOf: params.transaction.seller.typeOf,
|
|
34
42
|
id: params.transaction.seller.id,
|
|
@@ -43,7 +51,7 @@ function creatPublishPaymentUrlParams(params) {
|
|
|
43
51
|
typeOf: params.transaction.seller.typeOf
|
|
44
52
|
}, object }, (typeof ((_d = params.location) === null || _d === void 0 ? void 0 : _d.typeOf) === 'string')
|
|
45
53
|
? { location: params.location }
|
|
46
|
-
: undefined), { instrument
|
|
54
|
+
: undefined), { instrument }), (typeof params.identifier === 'string')
|
|
47
55
|
? { identifier: params.identifier }
|
|
48
56
|
: undefined);
|
|
49
57
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
2
|
import { Settings } from '../../settings';
|
|
3
|
+
import type { AcceptedPaymentMethodRepo } from '../../repo/acceptedPaymentMethod';
|
|
3
4
|
import type { AccountingReportRepo } from '../../repo/accountingReport';
|
|
4
5
|
import type { ActionRepo, IMinimizedPurchaseNumberAuthResult } from '../../repo/action';
|
|
5
6
|
import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
@@ -79,6 +80,7 @@ declare function processVoidPayTransaction(params: factory.task.IData<factory.ta
|
|
|
79
80
|
transaction: TransactionRepo;
|
|
80
81
|
}) => Promise<void>;
|
|
81
82
|
interface IAuthorizeRepos {
|
|
83
|
+
acceptedPaymentMethod: AcceptedPaymentMethodRepo;
|
|
82
84
|
accountingReport: AccountingReportRepo;
|
|
83
85
|
action: ActionRepo;
|
|
84
86
|
assetTransaction: AssetTransactionRepo;
|
|
@@ -101,6 +103,7 @@ interface IAuthorizeRepos {
|
|
|
101
103
|
}
|
|
102
104
|
type IAuthorizeOperation<T> = (repos: IAuthorizeRepos, settings: Settings) => Promise<T>;
|
|
103
105
|
interface IPublishPaymentUrlRepos {
|
|
106
|
+
acceptedPaymentMethod: AcceptedPaymentMethodRepo;
|
|
104
107
|
action: ActionRepo;
|
|
105
108
|
assetTransaction: AssetTransactionRepo;
|
|
106
109
|
authorization: AuthorizationRepo;
|
|
@@ -143,6 +146,7 @@ declare function publishPaymentUrl(params: {
|
|
|
143
146
|
* add identifier for an unique index(2025-02-25~)
|
|
144
147
|
*/
|
|
145
148
|
identifier?: string;
|
|
149
|
+
instrument: factory.action.trade.pay.IAcceptedPaymentMethodOfferAsInstrument[];
|
|
146
150
|
}): IPublishPaymentUrlOperation<Pick<PayTransactionService.IPublishPaymentUrlResult, 'paymentMethodId' | 'paymentUrl'>>;
|
|
147
151
|
/**
|
|
148
152
|
* 決済承認
|
|
@@ -366,7 +366,7 @@ function publishPaymentUrl(params) {
|
|
|
366
366
|
referencesOrder: (((_a = params.object.referencesOrder) === null || _a === void 0 ? void 0 : _a.typeOf) === factory.order.OrderType.Order)
|
|
367
367
|
? params.object.referencesOrder
|
|
368
368
|
: { typeOf: factory.order.OrderType.Order } });
|
|
369
|
-
const startParams = (0, factory_1.creatPublishPaymentUrlParams)(Object.assign(Object.assign({ object: authorizeObject, paymentServiceType, transaction: transaction, transactionNumber: transactionNumber, location: params.location }, (typeof params.identifier === 'string') ? { identifier: params.identifier } : undefined), (typeof ticketToken === 'string') ? { ticketToken } : undefined));
|
|
369
|
+
const startParams = (0, factory_1.creatPublishPaymentUrlParams)(Object.assign(Object.assign({ object: authorizeObject, paymentServiceType, transaction: transaction, transactionNumber: transactionNumber, location: params.location, instrument: params.instrument }, (typeof params.identifier === 'string') ? { identifier: params.identifier } : undefined), (typeof ticketToken === 'string') ? { ticketToken } : undefined));
|
|
370
370
|
const taskId = (_b = params.sameAs) === null || _b === void 0 ? void 0 : _b.id;
|
|
371
371
|
result = yield PayTransactionService.publishPaymentUrl(startParams, {
|
|
372
372
|
purposeAsTransaction: { id: transaction.id },
|
|
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.call = call;
|
|
13
13
|
const factory = require("../../factory");
|
|
14
|
+
const acceptedPaymentMethod_1 = require("../../repo/acceptedPaymentMethod");
|
|
14
15
|
const accountingReport_1 = require("../../repo/accountingReport");
|
|
15
16
|
const action_1 = require("../../repo/action");
|
|
16
17
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
@@ -54,6 +55,7 @@ function call(params) {
|
|
|
54
55
|
try {
|
|
55
56
|
yield (0, any_1.authorize)(Object.assign(Object.assign({}, params.data), { sameAs: { id: params.id } // タスクIDを関連付け(2024-04-20~)
|
|
56
57
|
}))({
|
|
58
|
+
acceptedPaymentMethod: new acceptedPaymentMethod_1.AcceptedPaymentMethodRepo(connection),
|
|
57
59
|
accountingReport: new accountingReport_1.AccountingReportRepo(connection),
|
|
58
60
|
action: actionRepo,
|
|
59
61
|
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.call = call;
|
|
13
13
|
const factory = require("../../factory");
|
|
14
|
+
const acceptedPaymentMethod_1 = require("../../repo/acceptedPaymentMethod");
|
|
14
15
|
const action_1 = require("../../repo/action");
|
|
15
16
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
16
17
|
const authorization_1 = require("../../repo/authorization");
|
|
@@ -41,7 +42,8 @@ function call(params) {
|
|
|
41
42
|
const actionRepo = new action_1.ActionRepo(connection);
|
|
42
43
|
// const transactionProcessRepo = new TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
|
|
43
44
|
try {
|
|
44
|
-
yield (0, any_1.publishPaymentUrl)(Object.assign(Object.assign({}, params.data), { sameAs: { id: params.id } }))({
|
|
45
|
+
yield (0, any_1.publishPaymentUrl)(Object.assign(Object.assign({}, params.data), { instrument: (Array.isArray(params.data.instrument)) ? params.data.instrument : [], sameAs: { id: params.id } }))({
|
|
46
|
+
acceptedPaymentMethod: new acceptedPaymentMethod_1.AcceptedPaymentMethodRepo(connection),
|
|
45
47
|
action: actionRepo,
|
|
46
48
|
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
47
49
|
authorization: new authorization_1.AuthorizationRepo(connection),
|
|
@@ -3,7 +3,7 @@ export type IAcceptPayAction = Pick<factory.action.accept.pay.IAction, 'object'
|
|
|
3
3
|
export type IAuthorizeEventServiceOffer = factory.action.authorize.offer.eventService.IAction;
|
|
4
4
|
export type IAuthorizeProductOffer = factory.action.authorize.offer.product.IAction;
|
|
5
5
|
export type IAuthorizeMoneyTransferOffer = factory.action.authorize.offer.moneyTransfer.IAction;
|
|
6
|
-
export type IAuthorizePaymentAction = Pick<factory.action.authorize.paymentMethod.any.IAction, 'id' | 'result' | 'endDate'
|
|
7
|
-
object: Pick<factory.action.authorize.paymentMethod.any.IObject, 'typeOf'>;
|
|
6
|
+
export type IAuthorizePaymentAction = Pick<factory.action.authorize.paymentMethod.any.IAction, 'id' | 'result' | 'endDate'> & {
|
|
7
|
+
object: Pick<factory.action.authorize.paymentMethod.any.IObject, 'typeOf' | 'paymentMethodId'>;
|
|
8
8
|
};
|
|
9
9
|
export type IPayTransaction = Pick<factory.assetTransaction.pay.ITransaction, 'object'>;
|
|
@@ -47,7 +47,9 @@ function validateTransaction(transaction, acceptPayActions, authorizePaymentActi
|
|
|
47
47
|
// authorizeMovieTicketActions.forEach((a) => {
|
|
48
48
|
// authorizedMovieTickets.push(...(Array.isArray(a.object.movieTickets)) ? a.object.movieTickets : []);
|
|
49
49
|
// });
|
|
50
|
-
|
|
50
|
+
// 決済承認アクションのinstrument依存をobject依存へ変更(2025-12-14~)
|
|
51
|
+
const payTransactionNumbers = authorizeMovieTicketActions.map((authorizeAction) => authorizeAction.object.paymentMethodId);
|
|
52
|
+
// const payTransactionNumbers = authorizeMovieTicketActions.map(({ instrument }) => instrument.transactionNumber);
|
|
51
53
|
payTransactions.filter(({ object }) => payTransactionNumbers.includes(object.paymentMethodId))
|
|
52
54
|
.forEach(({ object }) => {
|
|
53
55
|
if (Array.isArray(object.paymentMethod.movieTickets)) {
|
|
@@ -106,7 +106,9 @@ function confirm(params, options) {
|
|
|
106
106
|
.filter(({ serialNumber }) => typeof serialNumber === 'string' && serialNumbers.includes(serialNumber));
|
|
107
107
|
// authorizePaymentActionsからpayTransactionsを参照(2024-06-20~)
|
|
108
108
|
let payTransactions = [];
|
|
109
|
-
|
|
109
|
+
// 決済承認アクションのinstrument依存をobject依存へ変更(2025-12-14~)
|
|
110
|
+
const payTransactionNumbers = authorizePaymentActions.map((authorizeAction) => authorizeAction.object.paymentMethodId);
|
|
111
|
+
// const payTransactionNumbers = authorizePaymentActions.map(({ instrument }) => instrument.transactionNumber);
|
|
110
112
|
if (payTransactionNumbers.length > 0) {
|
|
111
113
|
payTransactions = yield repos.assetTransaction.search({
|
|
112
114
|
typeOf: factory.assetTransactionType.Pay,
|
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.4.0-alpha.
|
|
14
|
+
"@chevre/factory": "5.4.0-alpha.7",
|
|
15
15
|
"@cinerino/sdk": "12.12.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.2.0-alpha.
|
|
118
|
+
"version": "23.2.0-alpha.3"
|
|
119
119
|
}
|