@chevre/domain 21.18.0-alpha.42 → 21.18.0-alpha.44

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.
@@ -15,7 +15,9 @@ export declare class MongoRepository {
15
15
  * idを指定すれば更新
16
16
  */
17
17
  id?: string;
18
- $set: factory.service.paymentService.IService;
18
+ $set: factory.service.paymentService.IService & {
19
+ provider?: never;
20
+ };
19
21
  $unset: {
20
22
  [key in IUnsetKey]?: 1;
21
23
  };
@@ -1,6 +1,20 @@
1
1
  import { Connection } from 'mongoose';
2
2
  import * as factory from '../factory';
3
- export type IAvailablePaymentServiceType = factory.service.paymentService.PaymentServiceType.CreditCard | factory.service.paymentService.PaymentServiceType.MovieTicket;
3
+ type IAvailablePaymentServiceType = factory.service.paymentService.PaymentServiceType.CreditCard | factory.service.paymentService.PaymentServiceType.MovieTicket;
4
+ /**
5
+ * 決済サービス検索条件
6
+ */
7
+ type ISearchConditions4paymentService = factory.product.ISearchConditions & {
8
+ typeOf?: {
9
+ $eq?: factory.service.paymentService.PaymentServiceType;
10
+ $in?: factory.service.paymentService.PaymentServiceType[];
11
+ };
12
+ };
13
+ export type IPublicPaymentServiceByProvider = Pick<factory.service.paymentService.IService, 'name' | 'description' | 'typeOf' | 'id' | 'productID' | 'serviceType' | 'serviceOutput' | 'additionalProperty'> & {
14
+ provider?: {
15
+ credentials?: Pick<factory.service.paymentService.IProviderCredentials, 'shopId' | 'paymentUrl' | 'tokenizationCode'>;
16
+ };
17
+ };
4
18
  /**
5
19
  * 決済サービスプロバイダーリポジトリ
6
20
  */
@@ -27,8 +41,12 @@ export declare class MongoRepository {
27
41
  };
28
42
  };
29
43
  }): Promise<(Pick<factory.service.paymentService.IService, 'id' | 'name' | 'typeOf'> & {
30
- provider: Pick<factory.service.paymentService.IProvider, 'id' | 'name' | 'credentials'>;
44
+ provider: Pick<factory.service.paymentService.IProvider, 'id' | 'credentials'>;
31
45
  })[]>;
46
+ /**
47
+ * 販売者の提供決済サービス(公開情報のみ)検索
48
+ */
49
+ searchPublicPaymentServicesByProvider(params: Pick<ISearchConditions4paymentService, 'limit' | 'page' | 'sort' | 'project' | 'provider' | 'typeOf'>): Promise<IPublicPaymentServiceByProvider[]>;
32
50
  create(params: factory.service.paymentService.IProvider & {
33
51
  project: {
34
52
  id: string;
@@ -68,3 +86,4 @@ export declare class MongoRepository {
68
86
  };
69
87
  }): Promise<import("mongodb").UpdateResult>;
70
88
  }
89
+ export {};
@@ -53,7 +53,8 @@ class MongoRepository {
53
53
  _id: 0,
54
54
  provider: {
55
55
  id: '$provider.id',
56
- name: '$provider.name',
56
+ // name廃止(2023-12-21~)
57
+ // name: '$provider.name',
57
58
  credentials: '$provider.credentials'
58
59
  },
59
60
  id: { $toString: '$_id' },
@@ -71,6 +72,70 @@ class MongoRepository {
71
72
  .exec();
72
73
  });
73
74
  }
75
+ /**
76
+ * 販売者の提供決済サービス(公開情報のみ)検索
77
+ */
78
+ searchPublicPaymentServicesByProvider(params) {
79
+ var _a, _b, _c, _d, _e, _f;
80
+ return __awaiter(this, void 0, void 0, function* () {
81
+ const matchStages = [];
82
+ const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
83
+ if (typeof projectIdEq === 'string') {
84
+ matchStages.push({ $match: { 'project.id': { $eq: projectIdEq } } });
85
+ }
86
+ const typeOfEq = (_c = params.typeOf) === null || _c === void 0 ? void 0 : _c.$eq;
87
+ if (typeof typeOfEq === 'string') {
88
+ matchStages.push({ $match: { typeOf: { $eq: typeOfEq } } });
89
+ }
90
+ const providerIdEq = (_e = (_d = params.provider) === null || _d === void 0 ? void 0 : _d.id) === null || _e === void 0 ? void 0 : _e.$eq;
91
+ if (typeof providerIdEq === 'string') {
92
+ matchStages.push({ $match: { 'provider.id': { $exists: true, $eq: providerIdEq } } });
93
+ }
94
+ const aggregate = this.productModel.aggregate([
95
+ ...(typeof ((_f = params.sort) === null || _f === void 0 ? void 0 : _f.productID) === 'number')
96
+ ? [{ $sort: { productID: params.sort.productID } }]
97
+ : [],
98
+ {
99
+ $unwind: {
100
+ path: '$provider'
101
+ }
102
+ },
103
+ ...matchStages,
104
+ {
105
+ $project: {
106
+ _id: 0,
107
+ typeOf: '$typeOf',
108
+ productID: '$productID',
109
+ description: '$description',
110
+ name: '$name',
111
+ additionalProperty: '$additionalProperty',
112
+ serviceOutput: '$serviceOutput',
113
+ serviceType: '$serviceType',
114
+ id: { $toString: '$_id' },
115
+ // ↓セキュアな情報を隠蔽するように
116
+ provider: {
117
+ credentials: {
118
+ shopId: '$provider.credentials.shopId',
119
+ tokenizationCode: '$provider.credentials.tokenizationCode',
120
+ paymentUrl: {
121
+ expiresInSeconds: '$provider.credentials.paymentUrl.expiresInSeconds',
122
+ useCallback: '$provider.credentials.paymentUrl.useCallback',
123
+ useWebhook: '$provider.credentials.paymentUrl.useWebhook'
124
+ }
125
+ }
126
+ }
127
+ }
128
+ }
129
+ ]);
130
+ if (typeof params.limit === 'number' && params.limit > 0) {
131
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
132
+ aggregate.limit(params.limit * page)
133
+ .skip(params.limit * (page - 1));
134
+ }
135
+ return aggregate.option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
136
+ .exec();
137
+ });
138
+ }
74
139
  create(params) {
75
140
  return __awaiter(this, void 0, void 0, function* () {
76
141
  // 決済サービス存在確認
@@ -86,7 +151,8 @@ class MongoRepository {
86
151
  const creatingProvider = {
87
152
  credentials: params.credentials,
88
153
  id: params.id,
89
- name: params.name,
154
+ // name廃止(2023-12-21~)
155
+ // name: params.name,
90
156
  typeOf: params.typeOf
91
157
  };
92
158
  doc = yield this.productModel.findOneAndUpdate({
@@ -115,9 +181,7 @@ class MongoRepository {
115
181
  'project.id': { $eq: params.project.id },
116
182
  _id: { $eq: params.providesPaymentService.id },
117
183
  'provider.id': { $eq: params.id }
118
- }, Object.assign(Object.assign({ 'provider.$[seller].id': params.id }, (params.name !== undefined && params.name !== null)
119
- ? { 'provider.$[seller].name': params.name }
120
- : undefined), (params.credentials !== undefined && params.credentials !== null)
184
+ }, Object.assign({ 'provider.$[seller].id': params.id }, (params.credentials !== undefined && params.credentials !== null)
121
185
  ? { 'provider.$[seller].credentials': params.credentials }
122
186
  : undefined), {
123
187
  new: true,
@@ -25,6 +25,7 @@
25
25
  import type { Connection, FilterQuery } from 'mongoose';
26
26
  import * as factory from '../factory';
27
27
  type IKeyOfProjection4product = keyof factory.product.IProduct | '_id';
28
+ type IKeyOfProjection4paymentService = keyof factory.service.paymentService.IService | '_id';
28
29
  /**
29
30
  * プロダクト検索条件
30
31
  */
@@ -43,9 +44,6 @@ type ISearchConditions4paymentService = factory.product.ISearchConditions & {
43
44
  $in?: factory.service.paymentService.PaymentServiceType[];
44
45
  };
45
46
  };
46
- export type IPaymentServiceByProvider = Pick<factory.service.paymentService.IService, 'name' | 'description' | 'typeOf' | 'id' | 'productID' | 'serviceType' | 'serviceOutput' | 'additionalProperty'> & {
47
- provider?: Pick<factory.service.paymentService.IProvider, 'credentials'>;
48
- };
49
47
  type IUnsetKey = keyof Pick<factory.product.IProduct, 'additionalProperty' | 'availableChannel' | 'hasOfferCatalog' | 'serviceOutput' | 'serviceType'>;
50
48
  /**
51
49
  * プロダクトリポジトリ
@@ -61,7 +59,7 @@ export declare class MongoRepository {
61
59
  /**
62
60
  * 決済サービスを検索する
63
61
  */
64
- searchPaymentServices(conditions: ISearchConditions4paymentService, inclusion: string[], exclusion: string[]): Promise<factory.service.paymentService.IService[]>;
62
+ searchPaymentServices(conditions: ISearchConditions4paymentService, inclusion: IKeyOfProjection4paymentService[], exclusion: IKeyOfProjection4paymentService[]): Promise<factory.service.paymentService.IService[]>;
65
63
  deleteById(params: {
66
64
  id: string;
67
65
  }): Promise<void>;
@@ -75,7 +73,6 @@ export declare class MongoRepository {
75
73
  typeOf: factory.service.paymentService.PaymentServiceType;
76
74
  id: string;
77
75
  }): Promise<factory.product.IAvailableChannel>;
78
- searchPaymentServicesByProvider(params: Pick<ISearchConditions4paymentService, 'limit' | 'page' | 'sort' | 'project' | 'provider' | 'typeOf'>): Promise<IPaymentServiceByProvider[]>;
79
76
  /**
80
77
  * プロダクトを保管する
81
78
  */
@@ -84,7 +81,9 @@ export declare class MongoRepository {
84
81
  * idを指定すれば更新
85
82
  */
86
83
  id?: string;
87
- $set: factory.product.IProduct;
84
+ $set: factory.product.IProduct & {
85
+ offers?: never;
86
+ };
88
87
  $unset: {
89
88
  [key in IUnsetKey]?: 1;
90
89
  };
@@ -261,7 +261,9 @@ class MongoRepository {
261
261
  projection = {
262
262
  __v: 0,
263
263
  createdAt: 0,
264
- updatedAt: 0
264
+ updatedAt: 0,
265
+ offers: 0,
266
+ provider: 0 // paymentServiceProviderRepoへの完全移行につき除外(2023-12-20~)
265
267
  };
266
268
  if (Array.isArray(exclusion) && exclusion.length > 0) {
267
269
  exclusion.forEach((field) => {
@@ -325,68 +327,6 @@ class MongoRepository {
325
327
  return availableChannel;
326
328
  });
327
329
  }
328
- searchPaymentServicesByProvider(params) {
329
- var _a, _b, _c, _d, _e, _f;
330
- return __awaiter(this, void 0, void 0, function* () {
331
- const matchStages = [];
332
- const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
333
- if (typeof projectIdEq === 'string') {
334
- matchStages.push({ $match: { 'project.id': { $eq: projectIdEq } } });
335
- }
336
- const typeOfEq = (_c = params.typeOf) === null || _c === void 0 ? void 0 : _c.$eq;
337
- if (typeof typeOfEq === 'string') {
338
- matchStages.push({ $match: { typeOf: { $eq: typeOfEq } } });
339
- }
340
- const providerIdEq = (_e = (_d = params.provider) === null || _d === void 0 ? void 0 : _d.id) === null || _e === void 0 ? void 0 : _e.$eq;
341
- if (typeof providerIdEq === 'string') {
342
- matchStages.push({ $match: { 'provider.id': { $exists: true, $eq: providerIdEq } } });
343
- }
344
- const aggregate = this.productModel.aggregate([
345
- ...(typeof ((_f = params.sort) === null || _f === void 0 ? void 0 : _f.productID) === 'number')
346
- ? [{ $sort: { productID: params.sort.productID } }]
347
- : [],
348
- {
349
- $unwind: {
350
- path: '$provider'
351
- }
352
- },
353
- ...matchStages,
354
- {
355
- $project: {
356
- _id: 0,
357
- typeOf: '$typeOf',
358
- productID: '$productID',
359
- description: '$description',
360
- name: '$name',
361
- // provider: [ [Object] ],
362
- additionalProperty: '$additionalProperty',
363
- serviceOutput: '$serviceOutput',
364
- serviceType: '$serviceType',
365
- id: { $toString: '$_id' },
366
- // ↓セキュアな情報を隠蔽するように
367
- provider: {
368
- credentials: {
369
- shopId: '$provider.credentials.shopId',
370
- tokenizationCode: '$provider.credentials.tokenizationCode',
371
- paymentUrl: {
372
- expiresInSeconds: '$provider.credentials.paymentUrl.expiresInSeconds',
373
- useCallback: '$provider.credentials.paymentUrl.useCallback',
374
- useWebhook: '$provider.credentials.paymentUrl.useWebhook'
375
- }
376
- }
377
- }
378
- }
379
- }
380
- ]);
381
- if (typeof params.limit === 'number' && params.limit > 0) {
382
- const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
383
- aggregate.limit(params.limit * page)
384
- .skip(params.limit * (page - 1));
385
- }
386
- return aggregate.option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
387
- .exec();
388
- });
389
- }
390
330
  /**
391
331
  * プロダクトを保管する
392
332
  */
@@ -58,6 +58,7 @@ export type ICheckOperation<T> = (repos: {
58
58
  action: ActionRepo;
59
59
  event: EventRepo;
60
60
  paymentAccepted: PaymentAcceptedRepo;
61
+ paymentServiceProvider: PaymentServiceProviderRepo;
61
62
  product: ProductRepo;
62
63
  project: ProjectRepo;
63
64
  }) => Promise<T>;
@@ -78,9 +78,7 @@ exports.invalidatePaymentUrl = invalidatePaymentUrl;
78
78
  /**
79
79
  * 決済方法認証
80
80
  */
81
- function check(params
82
- // ): ICheckOperation<factory.action.check.paymentMethod.movieTicket.IAction> {
83
- ) {
81
+ function check(params) {
84
82
  return (repos) => __awaiter(this, void 0, void 0, function* () {
85
83
  var _a;
86
84
  let action;
@@ -9,6 +9,7 @@ import type { MongoRepository as OrderRepo } from '../../repo/order';
9
9
  import type { MongoRepository as PlaceRepo } from '../../repo/place';
10
10
  import type { MongoRepository as PriceSpecificationRepo } from '../../repo/priceSpecification';
11
11
  import type { MongoRepository as ProductRepo } from '../../repo/product';
12
+ import type { MongoRepository as ProductOfferRepo } from '../../repo/productOffer';
12
13
  import type { MongoRepository as ProjectRepo } from '../../repo/project';
13
14
  import type { RedisRepository as OfferRateLimitRepo } from '../../repo/rateLimit/offer';
14
15
  import type { MongoRepository as ReservationRepo } from '../../repo/reservation';
@@ -22,6 +23,7 @@ export interface IStartOperationRepos {
22
23
  offerCatalogItem: OfferCatalogItemRepo;
23
24
  offerRateLimit: OfferRateLimitRepo;
24
25
  product: ProductRepo;
26
+ productOffer: ProductOfferRepo;
25
27
  place: PlaceRepo;
26
28
  priceSpecification: PriceSpecificationRepo;
27
29
  project: ProjectRepo;
@@ -38,6 +40,7 @@ export interface IAddReservationsOperationRepos {
38
40
  offerCatalogItem: OfferCatalogItemRepo;
39
41
  offerRateLimit: OfferRateLimitRepo;
40
42
  product: ProductRepo;
43
+ productOffer: ProductOfferRepo;
41
44
  place: PlaceRepo;
42
45
  priceSpecification: PriceSpecificationRepo;
43
46
  reservation: ReservationRepo;
@@ -8,6 +8,7 @@ import type { MongoRepository as OfferCatalogItemRepo } from '../../../repo/offe
8
8
  import type { MongoRepository as PlaceRepo } from '../../../repo/place';
9
9
  import type { MongoRepository as PriceSpecificationRepo } from '../../../repo/priceSpecification';
10
10
  import type { MongoRepository as ProductRepo } from '../../../repo/product';
11
+ import type { MongoRepository as ProductOfferRepo } from '../../../repo/productOffer';
11
12
  import type { MongoRepository as ProjectRepo } from '../../../repo/project';
12
13
  import type { RedisRepository as OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
13
14
  import type { MongoRepository as ReservationRepo } from '../../../repo/reservation';
@@ -28,6 +29,7 @@ interface IAuthorizeRepos {
28
29
  place: PlaceRepo;
29
30
  priceSpecification: PriceSpecificationRepo;
30
31
  product: ProductRepo;
32
+ productOffer: ProductOfferRepo;
31
33
  project: ProjectRepo;
32
34
  reservation: ReservationRepo;
33
35
  task: TaskRepo;
@@ -8,6 +8,7 @@ import type { MongoRepository as OfferCatalogItemRepo } from '../../../repo/offe
8
8
  import type { MongoRepository as PlaceRepo } from '../../../repo/place';
9
9
  import type { MongoRepository as PriceSpecificationRepo } from '../../../repo/priceSpecification';
10
10
  import type { MongoRepository as ProductRepo } from '../../../repo/product';
11
+ import type { MongoRepository as ProductOfferRepo } from '../../../repo/productOffer';
11
12
  import type { MongoRepository as ProjectRepo } from '../../../repo/project';
12
13
  import type { RedisRepository as OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
13
14
  import type { MongoRepository as ReservationRepo } from '../../../repo/reservation';
@@ -37,6 +38,7 @@ declare function processStartReserve4chevre(params: {
37
38
  offerCatalogItem: OfferCatalogItemRepo;
38
39
  offerRateLimit: OfferRateLimitRepo;
39
40
  product: ProductRepo;
41
+ productOffer: ProductOfferRepo;
40
42
  place: PlaceRepo;
41
43
  priceSpecification: PriceSpecificationRepo;
42
44
  project: ProjectRepo;
@@ -7,6 +7,7 @@ import type { MongoRepository as OfferCatalogRepo } from '../../repo/offerCatalo
7
7
  import type { RedisRepository as OrderNumberRepo } from '../../repo/orderNumber';
8
8
  import type { MongoRepository as OwnershipInfoRepo } from '../../repo/ownershipInfo';
9
9
  import type { MongoRepository as ProductRepo } from '../../repo/product';
10
+ import type { MongoRepository as ProductOfferRepo } from '../../repo/productOffer';
10
11
  import type { MongoRepository as ProjectRepo } from '../../repo/project';
11
12
  import type { MongoRepository as ServiceOutputRepo } from '../../repo/serviceOutput';
12
13
  import type { RedisRepository as ServiceOutputIdentifierRepo } from '../../repo/serviceOutputIdentifier';
@@ -21,6 +22,7 @@ export interface IAuthorizeOperationRepos {
21
22
  orderNumber: OrderNumberRepo;
22
23
  ownershipInfo: OwnershipInfoRepo;
23
24
  product: ProductRepo;
25
+ productOffer: ProductOfferRepo;
24
26
  project: ProjectRepo;
25
27
  serviceOutput: ServiceOutputRepo;
26
28
  serviceOutputIdentifier: ServiceOutputIdentifierRepo;
@@ -61,9 +63,10 @@ export declare function search(params: {
61
63
  offer: OfferRepo;
62
64
  offerCatalog: OfferCatalogRepo;
63
65
  product: ProductRepo;
66
+ productOffer: ProductOfferRepo;
64
67
  }) => Promise<{
65
68
  offers: factory.product.ITicketOffer[];
66
- product: factory.product.IProduct;
69
+ product: Omit<factory.product.IProduct, "offers">;
67
70
  }>;
68
71
  export type IAuthorizeOfferAction = factory.action.authorize.offer.product.IAction;
69
72
  /**
@@ -39,14 +39,20 @@ function search(params) {
39
39
  // 販売者指定の場合、検証
40
40
  if (product.typeOf === factory.product.ProductType.MembershipService
41
41
  || product.typeOf === factory.product.ProductType.PaymentCard) {
42
- if (typeof ((_a = params.seller) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
43
- const productOffers = product.offers;
44
- if (!Array.isArray(productOffers)) {
45
- return { offers: [], product };
46
- }
42
+ const sellerId = (_a = params.seller) === null || _a === void 0 ? void 0 : _a.id;
43
+ if (typeof sellerId === 'string') {
44
+ // const productOffers = product.offers;
45
+ // if (!Array.isArray(productOffers)) {
46
+ // return { offers: [], product };
47
+ // }
48
+ const productOffers = yield repos.productOffer.search({
49
+ project: { id: { $eq: params.project.id } },
50
+ itemOffered: { id: { $eq: params.itemOffered.id } },
51
+ seller: { id: { $eq: sellerId } }
52
+ });
47
53
  const hasValidOffer = productOffers.some((o) => {
48
- var _a, _b;
49
- return ((_a = o.seller) === null || _a === void 0 ? void 0 : _a.id) === ((_b = params.seller) === null || _b === void 0 ? void 0 : _b.id)
54
+ var _a;
55
+ return ((_a = o.seller) === null || _a === void 0 ? void 0 : _a.id) === sellerId
50
56
  && o.validFrom !== undefined
51
57
  && moment(o.validFrom)
52
58
  .isSameOrBefore(now)
@@ -111,7 +117,7 @@ function authorize(params) {
111
117
  availableOffers,
112
118
  seller: transaction.seller,
113
119
  orderNumber
114
- })();
120
+ })(repos);
115
121
  acceptedOffer = yield createServiceOutputIdentifier({ acceptedOffer, product })(repos);
116
122
  let requestBody;
117
123
  let responseBody;
@@ -278,7 +284,7 @@ function processVoidRegisterServiceTransaction(params) {
278
284
  * 受け入れらたオファーの内容を検証
279
285
  */
280
286
  function validateAcceptedOffers(params) {
281
- return () => __awaiter(this, void 0, void 0, function* () {
287
+ return (repos) => __awaiter(this, void 0, void 0, function* () {
282
288
  let acceptedOfferWithoutDetail = params.object;
283
289
  if (!Array.isArray(acceptedOfferWithoutDetail)) {
284
290
  acceptedOfferWithoutDetail = [acceptedOfferWithoutDetail];
@@ -293,10 +299,15 @@ function validateAcceptedOffers(params) {
293
299
  typeOf: params.seller.typeOf
294
300
  };
295
301
  // 販売者を検証
296
- const productOffers = params.product.offers;
297
- if (!Array.isArray(productOffers)) {
298
- throw new factory.errors.Argument('Product', 'Product offers undefined');
299
- }
302
+ // const productOffers = params.product.offers;
303
+ // if (!Array.isArray(productOffers)) {
304
+ // throw new factory.errors.Argument('Product', 'Product offers undefined');
305
+ // }
306
+ const productOffers = yield repos.productOffer.search({
307
+ project: { id: { $eq: params.product.project.id } },
308
+ itemOffered: { id: { $eq: String(params.product.id) } },
309
+ seller: { id: { $eq: params.seller.id } }
310
+ });
300
311
  const hasValidOffer = productOffers.some((o) => {
301
312
  var _a;
302
313
  return ((_a = o.seller) === null || _a === void 0 ? void 0 : _a.id) === params.seller.id;
@@ -1,4 +1,5 @@
1
- import { IMinimizedIndividualEvent } from '../../../repo/event';
1
+ import type { IMinimizedIndividualEvent } from '../../../repo/event';
2
+ import type { MongoRepository as PaymentServiceProviderRepo } from '../../../repo/paymentServiceProvider';
2
3
  import type { MongoRepository as ProductRepo } from '../../../repo/product';
3
4
  import type { MongoRepository as ProjectRepo } from '../../../repo/project';
4
5
  import * as factory from '../../../factory';
@@ -16,6 +17,7 @@ interface ICheckByIdentifierParams {
16
17
  * MovieTicket認証
17
18
  */
18
19
  declare function checkByIdentifier(params: ICheckByIdentifierParams): (repos: {
20
+ paymentServiceProvider: PaymentServiceProviderRepo;
19
21
  product: ProductRepo;
20
22
  project: ProjectRepo;
21
23
  }) => Promise<ICheckResult>;
@@ -61,8 +61,8 @@ function checkByIdentifier(params) {
61
61
  skhnCd = `${eventCOAInfo.titleCode}${`00${eventCOAInfo.titleBranchNum}`.slice(DIGITS)}`;
62
62
  }
63
63
  const sellerCredentials = yield (0, getCredentials_1.getCredentials)({
64
- paymentMethodType,
65
- seller: params.seller,
64
+ // paymentMethodType,
65
+ seller: { id: String(params.seller.id), project: { id: params.seller.project.id } },
66
66
  paymentServiceId: params.paymentServiceId
67
67
  })(repos);
68
68
  purchaseNumberAuthIn = {
@@ -1,11 +1,20 @@
1
- import type { MongoRepository as ProductRepo } from '../../../repo/product';
2
- import * as factory from '../../../factory';
1
+ import type { MongoRepository as PaymentServiceProviderRepo } from '../../../repo/paymentServiceProvider';
3
2
  declare function getCredentials(params: {
4
- paymentMethodType: string;
5
- seller: Pick<factory.seller.ISeller, 'id' | 'project'>;
3
+ seller: {
4
+ /**
5
+ * 販売者ID
6
+ */
7
+ id: string;
8
+ project: {
9
+ id: string;
10
+ };
11
+ };
12
+ /**
13
+ * 決済サービスID
14
+ */
6
15
  paymentServiceId: string;
7
16
  }): (repos: {
8
- product: ProductRepo;
17
+ paymentServiceProvider: PaymentServiceProviderRepo;
9
18
  }) => Promise<{
10
19
  kgygishCd: string;
11
20
  stCd: string;
@@ -13,25 +13,43 @@ exports.getCredentials = void 0;
13
13
  const factory = require("../../../factory");
14
14
  function getCredentials(params) {
15
15
  return (repos) => __awaiter(this, void 0, void 0, function* () {
16
- var _a, _b, _c;
16
+ var _a, _b;
17
17
  // 決済サービスからcredentialsを取得する
18
- const paymentServices = yield repos.product.searchPaymentServices({
18
+ // const paymentServices = await repos.product.searchPaymentServices(
19
+ // {
20
+ // limit: 1,
21
+ // page: 1,
22
+ // project: { id: { $eq: params.seller.project.id } },
23
+ // typeOf: { $eq: factory.service.paymentService.PaymentServiceType.MovieTicket },
24
+ // id: { $eq: params.paymentServiceId }
25
+ // },
26
+ // [],
27
+ // []
28
+ // );
29
+ // const paymentService = paymentServices.shift();
30
+ // if (paymentService === undefined) {
31
+ // throw new factory.errors.NotFound('PaymentService');
32
+ // }
33
+ // const provider = paymentService.provider?.find((p) => p.id === params.seller.id);
34
+ // if (provider === undefined) {
35
+ // throw new factory.errors.NotFound('PaymentService provider');
36
+ // }
37
+ const paymentService = (yield repos.paymentServiceProvider.search({
19
38
  limit: 1,
20
39
  page: 1,
21
40
  project: { id: { $eq: params.seller.project.id } },
22
- typeOf: { $eq: factory.service.paymentService.PaymentServiceType.MovieTicket },
41
+ provider: { id: { $eq: params.seller.id } },
23
42
  id: { $eq: params.paymentServiceId }
24
- }, [], []);
25
- const paymentService = paymentServices.shift();
43
+ })).shift();
26
44
  if (paymentService === undefined) {
27
45
  throw new factory.errors.NotFound('PaymentService');
28
46
  }
29
- const provider = (_a = paymentService.provider) === null || _a === void 0 ? void 0 : _a.find((p) => p.id === params.seller.id);
47
+ const provider = paymentService.provider;
30
48
  if (provider === undefined) {
31
49
  throw new factory.errors.NotFound('PaymentService provider');
32
50
  }
33
- const kgygishCd = (_b = provider.credentials) === null || _b === void 0 ? void 0 : _b.kgygishCd;
34
- const stCd = (_c = provider.credentials) === null || _c === void 0 ? void 0 : _c.stCd;
51
+ const kgygishCd = (_a = provider.credentials) === null || _a === void 0 ? void 0 : _a.kgygishCd;
52
+ const stCd = (_b = provider.credentials) === null || _b === void 0 ? void 0 : _b.stCd;
35
53
  if (typeof kgygishCd !== 'string' || typeof stCd !== 'string') {
36
54
  throw new factory.errors.Argument('transaction', 'Provider credentials not enough');
37
55
  }
@@ -1,6 +1,7 @@
1
1
  import * as factory from '../../../factory';
2
2
  import type { MongoRepository as ActionRepo } from '../../../repo/action';
3
3
  import type { MongoRepository as EventRepo } from '../../../repo/event';
4
+ import type { MongoRepository as PaymentServiceProviderRepo } from '../../../repo/paymentServiceProvider';
4
5
  import type { MongoRepository as ProductRepo } from '../../../repo/product';
5
6
  import type { MongoRepository as ProjectRepo } from '../../../repo/project';
6
7
  import type { MongoRepository as PaymentAcceptedRepo } from '../../../repo/sellerPaymentAccepted';
@@ -8,6 +9,7 @@ export declare function validateMovieTicket(params: factory.assetTransaction.pay
8
9
  action: ActionRepo;
9
10
  event: EventRepo;
10
11
  paymentAccepted: PaymentAcceptedRepo;
12
+ paymentServiceProvider: PaymentServiceProviderRepo;
11
13
  product: ProductRepo;
12
14
  project: ProjectRepo;
13
15
  }) => Promise<{
@@ -1,6 +1,7 @@
1
1
  import type { MongoRepository as AccountingReportRepo } from '../../repo/accountingReport';
2
2
  import type { MongoRepository as ActionRepo } from '../../repo/action';
3
- import { MongoRepository as EventRepo } from '../../repo/event';
3
+ import type { MongoRepository as EventRepo } from '../../repo/event';
4
+ import type { MongoRepository as PaymentServiceProviderRepo } from '../../repo/paymentServiceProvider';
4
5
  import type { MongoRepository as ProductRepo } from '../../repo/product';
5
6
  import type { MongoRepository as ProjectRepo } from '../../repo/project';
6
7
  import type { MongoRepository as PaymentAcceptedRepo } from '../../repo/sellerPaymentAccepted';
@@ -11,6 +12,7 @@ interface ICheckOperationRepos {
11
12
  action: ActionRepo;
12
13
  event: EventRepo;
13
14
  paymentAccepted: PaymentAcceptedRepo;
15
+ paymentServiceProvider: PaymentServiceProviderRepo;
14
16
  product: ProductRepo;
15
17
  project: ProjectRepo;
16
18
  }
@@ -20,6 +22,7 @@ interface IPayOperationRepos {
20
22
  accountingReport: AccountingReportRepo;
21
23
  event: EventRepo;
22
24
  paymentAccepted: PaymentAcceptedRepo;
25
+ paymentServiceProvider: PaymentServiceProviderRepo;
23
26
  product: ProductRepo;
24
27
  project: ProjectRepo;
25
28
  task: TaskRepo;
@@ -53,6 +56,7 @@ declare function authorize(params: factory.assetTransaction.pay.IStartParamsWith
53
56
  accountingReport: AccountingReportRepo;
54
57
  event: EventRepo;
55
58
  paymentAccepted: PaymentAcceptedRepo;
59
+ paymentServiceProvider: PaymentServiceProviderRepo;
56
60
  product: ProductRepo;
57
61
  project: ProjectRepo;
58
62
  task: TaskRepo;
@@ -23,7 +23,6 @@ const validation_1 = require("./movieTicket/validation");
23
23
  const errorHandler_1 = require("../../errorHandler");
24
24
  const onPaid_1 = require("./any/onPaid");
25
25
  const onRefund_1 = require("./any/onRefund");
26
- // type ICheckMovieTicketAction = factory.action.check.paymentMethod.movieTicket.IAction;
27
26
  /**
28
27
  * MovieTicket認証
29
28
  */
@@ -314,8 +313,8 @@ function payActionParams2seatInfoSyncIn(params) {
314
313
  // 全購入管理番号のMovieTicketをマージ
315
314
  const movieTickets = params.object.reduce((a, b) => [...a, ...(Array.isArray(b.movieTickets)) ? b.movieTickets : []], []);
316
315
  const sellerCredentials = yield (0, getCredentials_1.getCredentials)({
317
- paymentMethodType,
318
- seller: { id: sellerId, project: { id: event.project.id, typeOf: factory.organizationType.Project } },
316
+ // paymentMethodType,
317
+ seller: { id: sellerId, project: { id: event.project.id } },
319
318
  paymentServiceId
320
319
  })(repos);
321
320
  const paymentAccepted = yield repos.paymentAccepted.isAcceptedBySeller({
@@ -64,11 +64,6 @@ function onResourceDeleted(params) {
64
64
  project: { id: params.project.id },
65
65
  ids: params.id
66
66
  })(repos);
67
- // case factory.offerType.Offer:
68
- // await deleteResourcesByOffer({
69
- // project: { id: params.project.id },
70
- // ids: params.id
71
- // })(repos);
72
67
  break;
73
68
  case 'OfferCatalog':
74
69
  yield deleteResourcesByOfferCatalog({
@@ -86,6 +81,8 @@ function onResourceDeleted(params) {
86
81
  case factory.product.ProductType.EventService:
87
82
  case factory.product.ProductType.Product:
88
83
  case factory.product.ProductType.Transportation:
84
+ case factory.product.ProductType.MembershipService:
85
+ case factory.product.ProductType.PaymentCard:
89
86
  yield deleteResourcesByProduct({
90
87
  project: { id: params.project.id },
91
88
  ids: params.id,
package/package.json CHANGED
@@ -10,8 +10,8 @@
10
10
  ],
11
11
  "dependencies": {
12
12
  "@aws-sdk/credential-providers": "3.433.0",
13
- "@chevre/factory": "4.347.0-alpha.12",
14
- "@cinerino/sdk": "5.4.0-alpha.7",
13
+ "@chevre/factory": "4.347.0-alpha.14",
14
+ "@cinerino/sdk": "5.5.0-alpha.3",
15
15
  "@motionpicture/coa-service": "9.2.0",
16
16
  "@motionpicture/gmo-service": "5.2.0",
17
17
  "@sendgrid/mail": "6.4.0",
@@ -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": "21.18.0-alpha.42"
118
+ "version": "21.18.0-alpha.44"
119
119
  }