@chevre/domain 23.2.0-alpha.1 → 23.2.0-alpha.11
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/example/src/chevre/eventSeries/migrateEventSeriesOffers.ts +75 -0
- package/example/src/chevre/place/migrateSectionIdentifier.ts +92 -0
- package/example/src/chevre/place/upsertSeatsByBranchCode.ts +72 -0
- package/example/src/chevre/roles/addAdminEventSeriesReadPermissionIfNotExists.ts +49 -0
- package/example/src/chevre/roles/addAdminMovieReadPermissionIfNotExists.ts +49 -0
- package/example/src/chevre/roles/addAdminSeatReadPermissionIfNotExists.ts +33 -0
- package/example/src/chevre/roles/addAdminSeatWritePermissionIfNotExists.ts +33 -0
- package/lib/chevre/repo/acceptedPaymentMethod.js +14 -10
- package/lib/chevre/repo/creativeWork.js +9 -5
- package/lib/chevre/repo/mongoose/schemas/creativeWork.js +10 -9
- package/lib/chevre/repo/place/screeningRoom.d.ts +35 -31
- package/lib/chevre/repo/place/screeningRoom.js +20 -20
- package/lib/chevre/repo/place/seat.d.ts +36 -45
- package/lib/chevre/repo/place/seat.js +140 -45
- package/lib/chevre/repo/place/section.d.ts +28 -29
- package/lib/chevre/repo/place/section.js +86 -39
- 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 +5 -0
- package/lib/chevre/service/payment/any/factory.js +11 -2
- package/lib/chevre/service/payment/any.d.ts +8 -0
- package/lib/chevre/service/payment/any.js +3 -2
- package/lib/chevre/service/task/authorizePayment.js +3 -1
- package/lib/chevre/service/task/publishPaymentUrl.js +3 -1
- package/lib/chevre/service/task/syncResourcesFromCOA.js +148 -15
- 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
|
@@ -23,20 +23,12 @@ class SectionRepo {
|
|
|
23
23
|
this.placeModel = connection.model(place_1.modelName, (0, place_1.createSchema)());
|
|
24
24
|
}
|
|
25
25
|
// tslint:disable-next-line:max-func-body-length
|
|
26
|
-
|
|
26
|
+
createSection(screeningRoomSection, options) {
|
|
27
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
|
|
29
|
-
const screeningRoom = screeningRoomSection.containedInPlace;
|
|
30
|
-
if (typeof (screeningRoom === null || screeningRoom === void 0 ? void 0 : screeningRoom.branchCode) !== 'string') {
|
|
31
|
-
throw new factory.errors.ArgumentNull('containedInPlace.branchCode');
|
|
32
|
-
}
|
|
33
|
-
const movieTheater = screeningRoom.containedInPlace;
|
|
34
|
-
if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
|
|
35
|
-
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
|
|
36
|
-
}
|
|
28
|
+
const { project, parentOrganization, movieTheaterCode, roomCode } = options;
|
|
37
29
|
// 施設存在確認
|
|
38
|
-
const movieTheaterDoc = yield this.civicStructureModel.findOne(Object.assign({ typeOf: { $eq: factory.placeType.MovieTheater }, 'project.id': { $eq:
|
|
39
|
-
? { 'parentOrganization.id': { $exists: true, $eq:
|
|
30
|
+
const movieTheaterDoc = yield this.civicStructureModel.findOne(Object.assign({ typeOf: { $eq: factory.placeType.MovieTheater }, 'project.id': { $eq: project.id }, branchCode: { $eq: movieTheaterCode } }, (typeof (parentOrganization === null || parentOrganization === void 0 ? void 0 : parentOrganization.id) === 'string')
|
|
31
|
+
? { 'parentOrganization.id': { $exists: true, $eq: parentOrganization.id } }
|
|
40
32
|
: undefined), { _id: 1 })
|
|
41
33
|
.lean()
|
|
42
34
|
.exec();
|
|
@@ -46,13 +38,13 @@ class SectionRepo {
|
|
|
46
38
|
// セクションコードが存在しなければ追加する
|
|
47
39
|
const doc = yield this.placeModel.findOneAndUpdate({
|
|
48
40
|
typeOf: { $eq: factory.placeType.ScreeningRoom },
|
|
49
|
-
'project.id': { $eq:
|
|
50
|
-
'containedInPlace.branchCode': { $exists: true, $eq:
|
|
51
|
-
branchCode: { $eq:
|
|
41
|
+
'project.id': { $eq: project.id },
|
|
42
|
+
'containedInPlace.branchCode': { $exists: true, $eq: movieTheaterCode },
|
|
43
|
+
branchCode: { $eq: roomCode },
|
|
52
44
|
'containsPlace.branchCode': { $ne: screeningRoomSection.branchCode }
|
|
53
45
|
}, {
|
|
54
46
|
$push: {
|
|
55
|
-
containsPlace: Object.assign({ typeOf:
|
|
47
|
+
containsPlace: Object.assign({ typeOf: factory.placeType.ScreeningRoomSection, branchCode: screeningRoomSection.branchCode, name: screeningRoomSection.name }, (Array.isArray(screeningRoomSection.additionalProperty))
|
|
56
48
|
? { additionalProperty: screeningRoomSection.additionalProperty }
|
|
57
49
|
: undefined)
|
|
58
50
|
}
|
|
@@ -68,21 +60,16 @@ class SectionRepo {
|
|
|
68
60
|
return doc.toObject();
|
|
69
61
|
});
|
|
70
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* セクションの名称と追加特性を編集する
|
|
65
|
+
*/
|
|
71
66
|
// tslint:disable-next-line:max-func-body-length
|
|
72
|
-
|
|
67
|
+
updateSectionByBranchCode(screeningRoomSection, $unset, options) {
|
|
73
68
|
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
const movieTheater = screeningRoom.containedInPlace;
|
|
80
|
-
if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
|
|
81
|
-
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
|
|
82
|
-
}
|
|
83
|
-
const doc = yield this.placeModel.findOneAndUpdate(Object.assign({ typeOf: { $eq: factory.placeType.ScreeningRoom }, 'project.id': { $eq: screeningRoomSection.project.id }, 'containedInPlace.branchCode': { $exists: true, $eq: movieTheater.branchCode }, branchCode: { $eq: screeningRoom.branchCode }, 'containsPlace.branchCode': { $eq: screeningRoomSection.branchCode } }, (typeof ((_a = screeningRoomSection.parentOrganization) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
84
|
-
? { 'parentOrganization.id': { $exists: true, $eq: screeningRoomSection.parentOrganization.id } }
|
|
85
|
-
: undefined), Object.assign(Object.assign(Object.assign(Object.assign({ 'containsPlace.$[screeningRoomSection].branchCode': screeningRoomSection.branchCode }, (screeningRoomSection.name !== undefined && screeningRoomSection !== null)
|
|
69
|
+
const { project, parentOrganization, movieTheaterCode, roomCode } = options;
|
|
70
|
+
const doc = yield this.placeModel.findOneAndUpdate(Object.assign({ typeOf: { $eq: factory.placeType.ScreeningRoom }, 'project.id': { $eq: project.id }, 'containedInPlace.branchCode': { $exists: true, $eq: movieTheaterCode }, branchCode: { $eq: roomCode }, 'containsPlace.branchCode': { $eq: screeningRoomSection.branchCode } }, (typeof (parentOrganization === null || parentOrganization === void 0 ? void 0 : parentOrganization.id) === 'string')
|
|
71
|
+
? { 'parentOrganization.id': { $exists: true, $eq: parentOrganization.id } }
|
|
72
|
+
: undefined), Object.assign(Object.assign(Object.assign({ 'containsPlace.$[screeningRoomSection].branchCode': screeningRoomSection.branchCode }, (screeningRoomSection.name !== undefined && screeningRoomSection !== null)
|
|
86
73
|
? {
|
|
87
74
|
'containsPlace.$[screeningRoomSection].name': screeningRoomSection.name
|
|
88
75
|
}
|
|
@@ -90,13 +77,73 @@ class SectionRepo {
|
|
|
90
77
|
? {
|
|
91
78
|
'containsPlace.$[screeningRoomSection].additionalProperty': screeningRoomSection.additionalProperty
|
|
92
79
|
}
|
|
93
|
-
: undefined), (
|
|
80
|
+
: undefined), ($unset !== undefined && $unset !== null) ? { $unset } : undefined), {
|
|
81
|
+
new: true,
|
|
82
|
+
arrayFilters: [
|
|
83
|
+
{ 'screeningRoomSection.branchCode': screeningRoomSection.branchCode }
|
|
84
|
+
],
|
|
85
|
+
projection: { 'containedInPlace.id': 1, typeOf: 1 }
|
|
86
|
+
})
|
|
87
|
+
.exec();
|
|
88
|
+
if (doc === null) {
|
|
89
|
+
throw new factory.errors.NotFound(factory.placeType.ScreeningRoomSection);
|
|
90
|
+
}
|
|
91
|
+
return doc.toObject();
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* セクションの座席を上書きする
|
|
96
|
+
*/
|
|
97
|
+
// tslint:disable-next-line:max-func-body-length
|
|
98
|
+
overwriteSeats(screeningRoomSection, options) {
|
|
99
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
+
const { project, parentOrganization, movieTheaterCode, roomCode } = options;
|
|
101
|
+
const { containsPlace } = screeningRoomSection;
|
|
102
|
+
if (!Array.isArray(containsPlace)) {
|
|
103
|
+
throw new factory.errors.ArgumentNull('containsPlace');
|
|
104
|
+
}
|
|
105
|
+
const doc = yield this.placeModel.findOneAndUpdate(Object.assign({ typeOf: { $eq: factory.placeType.ScreeningRoom }, 'project.id': { $eq: project.id }, 'containedInPlace.branchCode': { $exists: true, $eq: movieTheaterCode }, branchCode: { $eq: roomCode }, 'containsPlace.branchCode': { $eq: screeningRoomSection.branchCode } }, (typeof (parentOrganization === null || parentOrganization === void 0 ? void 0 : parentOrganization.id) === 'string')
|
|
106
|
+
? { 'parentOrganization.id': { $exists: true, $eq: parentOrganization.id } }
|
|
107
|
+
: undefined), Object.assign({}, (containsPlace.length > 0)
|
|
94
108
|
? {
|
|
95
|
-
'containsPlace.$[screeningRoomSection].containsPlace':
|
|
109
|
+
'containsPlace.$[screeningRoomSection].containsPlace': containsPlace.map((p) => {
|
|
96
110
|
return Object.assign(Object.assign(Object.assign({ typeOf: p.typeOf, branchCode: p.branchCode }, (p.name !== undefined && p.name !== null) ? { name: p.name } : undefined), (Array.isArray(p.seatingType)) ? { seatingType: p.seatingType } : undefined), (Array.isArray(p.additionalProperty)) ? { additionalProperty: p.additionalProperty } : undefined);
|
|
97
111
|
})
|
|
98
112
|
}
|
|
99
|
-
: undefined),
|
|
113
|
+
: undefined), {
|
|
114
|
+
new: true,
|
|
115
|
+
arrayFilters: [
|
|
116
|
+
{ 'screeningRoomSection.branchCode': screeningRoomSection.branchCode }
|
|
117
|
+
],
|
|
118
|
+
projection: { 'containedInPlace.id': 1, typeOf: 1 }
|
|
119
|
+
})
|
|
120
|
+
.exec();
|
|
121
|
+
if (doc === null) {
|
|
122
|
+
throw new factory.errors.NotFound(factory.placeType.ScreeningRoomSection);
|
|
123
|
+
}
|
|
124
|
+
return doc.toObject();
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
// tslint:disable-next-line:max-func-body-length
|
|
128
|
+
migrateSectionIdentifier(screeningRoomSection) {
|
|
129
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
+
const screeningRoom = screeningRoomSection.containedInPlace;
|
|
131
|
+
if (typeof (screeningRoom === null || screeningRoom === void 0 ? void 0 : screeningRoom.branchCode) !== 'string') {
|
|
132
|
+
throw new factory.errors.ArgumentNull('containedInPlace.branchCode');
|
|
133
|
+
}
|
|
134
|
+
const movieTheater = screeningRoom.containedInPlace;
|
|
135
|
+
if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
|
|
136
|
+
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
|
|
137
|
+
}
|
|
138
|
+
const doc = yield this.placeModel.findOneAndUpdate({
|
|
139
|
+
typeOf: { $eq: factory.placeType.ScreeningRoom },
|
|
140
|
+
'project.id': { $eq: screeningRoomSection.project.id },
|
|
141
|
+
'containedInPlace.branchCode': { $exists: true, $eq: movieTheater.branchCode },
|
|
142
|
+
branchCode: { $eq: screeningRoom.branchCode },
|
|
143
|
+
'containsPlace.branchCode': { $eq: screeningRoomSection.branchCode }
|
|
144
|
+
}, {
|
|
145
|
+
'containsPlace.$[screeningRoomSection].identifier': screeningRoomSection.identifier
|
|
146
|
+
}, {
|
|
100
147
|
new: true,
|
|
101
148
|
arrayFilters: [
|
|
102
149
|
{ 'screeningRoomSection.branchCode': screeningRoomSection.branchCode }
|
|
@@ -209,7 +256,7 @@ class SectionRepo {
|
|
|
209
256
|
{ $unwind: '$containsPlace' },
|
|
210
257
|
...matchStages,
|
|
211
258
|
{
|
|
212
|
-
$project: Object.assign(Object.assign({ _id: 0, typeOf: '$containsPlace.typeOf', branchCode: '$containsPlace.branchCode', name: '$containsPlace.name', additionalProperty: '$containsPlace.additionalProperty' }, (((_p = searchConditions.$projection) === null || _p === void 0 ? void 0 : _p.containedInPlace) === 1)
|
|
259
|
+
$project: Object.assign(Object.assign({ _id: 0, typeOf: '$containsPlace.typeOf', branchCode: '$containsPlace.branchCode', identifier: '$containsPlace.identifier', name: '$containsPlace.name', additionalProperty: '$containsPlace.additionalProperty' }, (((_p = searchConditions.$projection) === null || _p === void 0 ? void 0 : _p.containedInPlace) === 1)
|
|
213
260
|
? {
|
|
214
261
|
containedInPlace: {
|
|
215
262
|
typeOf: '$typeOf',
|
|
@@ -295,14 +342,14 @@ class SectionRepo {
|
|
|
295
342
|
.exec();
|
|
296
343
|
});
|
|
297
344
|
}
|
|
298
|
-
|
|
345
|
+
deleteSectionByBranchCode(screeningRoomSection, options) {
|
|
299
346
|
return __awaiter(this, void 0, void 0, function* () {
|
|
300
|
-
|
|
301
|
-
const doc = yield this.placeModel.findOneAndUpdate(Object.assign({ typeOf: { $eq: factory.placeType.ScreeningRoom }, 'project.id': { $eq:
|
|
347
|
+
const { project, parentOrganization, movieTheaterCode, roomCode } = options;
|
|
348
|
+
const doc = yield this.placeModel.findOneAndUpdate(Object.assign({ typeOf: { $eq: factory.placeType.ScreeningRoom }, 'project.id': { $eq: project.id }, 'containedInPlace.branchCode': {
|
|
302
349
|
$exists: true,
|
|
303
|
-
$eq:
|
|
304
|
-
}, branchCode: { $eq:
|
|
305
|
-
? { 'parentOrganization.id': { $exists: true, $eq:
|
|
350
|
+
$eq: movieTheaterCode
|
|
351
|
+
}, branchCode: { $eq: roomCode }, 'containsPlace.branchCode': { $eq: screeningRoomSection.branchCode } }, (typeof (parentOrganization === null || parentOrganization === void 0 ? void 0 : parentOrganization.id) === 'string')
|
|
352
|
+
? { 'parentOrganization.id': { $exists: true, $eq: parentOrganization.id } }
|
|
306
353
|
: undefined), {
|
|
307
354
|
$pull: {
|
|
308
355
|
containsPlace: {
|
|
@@ -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;
|
|
@@ -40,6 +41,10 @@ export declare function creatPayTransactionStartParams(params: {
|
|
|
40
41
|
* 決済方法チケット
|
|
41
42
|
*/
|
|
42
43
|
ticketToken?: string;
|
|
44
|
+
/**
|
|
45
|
+
* ツールとしての対応決済方法オファー
|
|
46
|
+
*/
|
|
47
|
+
instrument: factory.action.trade.pay.IAcceptedPaymentMethodOfferAsInstrument[];
|
|
43
48
|
}): factory.assetTransaction.pay.IStartParamsWithoutDetail & {
|
|
44
49
|
instrument: factory.action.trade.pay.IPlaceOrderRelatedInstrument[];
|
|
45
50
|
};
|
|
@@ -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
|
}
|
|
@@ -71,7 +79,8 @@ function creatPayTransactionStartParams(params) {
|
|
|
71
79
|
const instrument = [
|
|
72
80
|
{ id: params.action.id, typeOf: params.action.typeOf },
|
|
73
81
|
{ orderNumber, typeOf: factory.order.OrderType.Order },
|
|
74
|
-
...(ticketAsInstrument !== undefined) ? [ticketAsInstrument] : [] // add ticketAsInstrument(2025-11-25~)
|
|
82
|
+
...(ticketAsInstrument !== undefined) ? [ticketAsInstrument] : [], // add ticketAsInstrument(2025-11-25~)
|
|
83
|
+
...(Array.isArray(params.instrument)) ? params.instrument : [] // instrumentを対応決済方法オファーに対応(2025-12-14~)
|
|
75
84
|
];
|
|
76
85
|
return Object.assign({ project: { id: params.transaction.project.id, typeOf: factory.organizationType.Project }, typeOf: factory.assetTransactionType.Pay, transactionNumber: params.transactionNumber, agent: {
|
|
77
86
|
typeOf: params.transaction.seller.typeOf,
|
|
@@ -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
|
* 決済承認
|
|
@@ -173,6 +177,10 @@ declare function authorize(params: {
|
|
|
173
177
|
*/
|
|
174
178
|
id: string;
|
|
175
179
|
};
|
|
180
|
+
/**
|
|
181
|
+
* ツールとしての対応決済方法オファー
|
|
182
|
+
*/
|
|
183
|
+
instrument: factory.action.trade.pay.IAcceptedPaymentMethodOfferAsInstrument[];
|
|
176
184
|
}): IAuthorizeOperation<{
|
|
177
185
|
/**
|
|
178
186
|
* 承認アクションID
|
|
@@ -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 },
|
|
@@ -539,7 +539,8 @@ function authorize(params) {
|
|
|
539
539
|
// orderNumber required(2025-02-14~)
|
|
540
540
|
order: { confirmationNumber, orderNumber },
|
|
541
541
|
action: { id: action.id, typeOf: action.typeOf },
|
|
542
|
-
ticketToken
|
|
542
|
+
ticketToken,
|
|
543
|
+
instrument: params.instrument
|
|
543
544
|
});
|
|
544
545
|
payTransaction = yield PayTransactionService.start(startParams, Object.assign({
|
|
545
546
|
// useCheckByIdentifierIfNotYet: params.options.useCheckByIdentifierIfNotYet,
|
|
@@ -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");
|
|
@@ -52,8 +53,9 @@ function call(params) {
|
|
|
52
53
|
const useCredentialsRepo = typeof paymentServiceId === 'string' && paymentServiceId !== ''
|
|
53
54
|
&& typeof credentialsExpireInSeconds === 'number' && credentialsExpireInSeconds > 0;
|
|
54
55
|
try {
|
|
55
|
-
yield (0, any_1.authorize)(Object.assign(Object.assign({}, params.data), { sameAs: { id: params.id } // タスクIDを関連付け(2024-04-20~)
|
|
56
|
+
yield (0, any_1.authorize)(Object.assign(Object.assign({}, params.data), { instrument: (Array.isArray(params.data.instrument)) ? params.data.instrument : [], 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),
|