@chevre/domain 22.14.0-alpha.14 → 22.14.0-alpha.16

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.
@@ -22,7 +22,6 @@ async function main() {
22
22
 
23
23
  await (await chevre.service.reserve.createService()).verifyToken4reservation({
24
24
  project: { id: project.id },
25
- agent: { id: project.id, typeOf: chevre.factory.organizationType.Project },
26
25
  reservationId: RESERVATION_ID,
27
26
  ticket: {
28
27
  ticketToken: CODE
@@ -2,7 +2,7 @@ import { factory as surfrockFactory } from '@surfrock/sdk';
2
2
  import { Connection, FilterQuery, UpdateQuery } from 'mongoose';
3
3
  import * as factory from '../factory';
4
4
  export type IAction4transaction<T extends factory.actionType.AcceptAction | factory.actionType.AuthorizeAction> = T extends factory.actionType.AcceptAction ? factory.action.accept.coaOffer.IAction | factory.action.accept.pay.IAction : T extends factory.actionType.AuthorizeAction ? (factory.action.authorize.offer.eventService.IAction | factory.action.authorize.offer.moneyTransfer.IAction | factory.action.authorize.offer.product.IAction | factory.action.authorize.paymentMethod.any.IAction) : never;
5
- export type IAction<T extends factory.actionType> = T extends factory.actionType.OrderAction ? factory.action.trade.order.IAction : T extends factory.actionType.AcceptAction ? IAction4transaction<factory.actionType.AcceptAction> : T extends factory.actionType.AuthorizeAction ? factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>> : T extends factory.actionType.CheckAction ? (factory.action.check.paymentMethod.movieTicket.IAction | factory.action.check.token.IAction) : T extends factory.actionType.CreateAction ? factory.action.create.IAction : T extends factory.actionType.MoneyTransfer ? factory.action.transfer.moneyTransfer.IAction : T extends factory.actionType.AddAction ? factory.action.update.add.IAction : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IAction : T extends factory.actionType.UpdateAction ? factory.action.update.update.IAction : T extends factory.actionType.InformAction ? factory.action.interact.inform.IAction<factory.action.interact.inform.IAttributes<factory.action.interact.inform.IObject>> & {
5
+ export type IAction<T extends factory.actionType> = T extends factory.actionType.OrderAction ? factory.action.trade.order.IAction : T extends factory.actionType.AcceptAction ? IAction4transaction<factory.actionType.AcceptAction> : T extends factory.actionType.AuthorizeAction ? factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>> : T extends factory.actionType.CheckAction ? (factory.action.check.paymentMethod.movieTicket.IAction | factory.action.check.thing.IAction) : T extends factory.actionType.CreateAction ? factory.action.create.IAction : T extends factory.actionType.MoneyTransfer ? factory.action.transfer.moneyTransfer.IAction : T extends factory.actionType.AddAction ? factory.action.update.add.IAction : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IAction : T extends factory.actionType.UpdateAction ? factory.action.update.update.IAction : T extends factory.actionType.InformAction ? factory.action.interact.inform.IAction<factory.action.interact.inform.IAttributes<factory.action.interact.inform.IObject>> & {
6
6
  error?: any;
7
7
  purpose?: never;
8
8
  } : factory.action.IAction<factory.action.IAttributes<T, any, any>>;
@@ -1,77 +1,7 @@
1
1
  import { Connection } from 'mongoose';
2
- import * as factory from '../factory';
3
2
  /**
4
3
  * プロダクトオファーリポジトリ
5
4
  */
6
5
  export declare class ProductOfferRepo {
7
- private readonly productModel;
8
- constructor(connection: Connection);
9
- /**
10
- * プロダクトオファー検索
11
- */
12
- search(params: {
13
- limit?: number;
14
- page?: number;
15
- project?: {
16
- id?: {
17
- $eq?: string;
18
- };
19
- };
20
- itemOffered?: {
21
- id?: {
22
- $eq?: string;
23
- };
24
- };
25
- seller?: {
26
- id?: {
27
- $eq?: string;
28
- };
29
- };
30
- }): Promise<(Pick<factory.product.IOffer, 'availabilityEnds' | 'availabilityStarts' | 'seller' | 'validFrom' | 'validThrough'> & {
31
- itemOffered: Pick<factory.product.IProduct, 'id' | 'name' | 'typeOf'>;
32
- })[]>;
33
- create(params: factory.product.IOffer & {
34
- project: {
35
- id: string;
36
- };
37
- itemOffered: {
38
- /**
39
- * プロダクトID
40
- */
41
- id: string;
42
- };
43
- }): Promise<{
44
- id: string;
45
- }>;
46
- update(params: factory.product.IOffer & {
47
- project: {
48
- id: string;
49
- };
50
- itemOffered: {
51
- /**
52
- * プロダクトID
53
- */
54
- id: string;
55
- };
56
- }): Promise<{
57
- id: string;
58
- }>;
59
- deleteOne(params: Pick<factory.product.IOffer, 'seller'> & {
60
- project: {
61
- id: string;
62
- };
63
- itemOffered: {
64
- /**
65
- * プロダクトID
66
- */
67
- id: string;
68
- };
69
- }): Promise<{
70
- id: string;
71
- }>;
72
- deleteManyBySellerId(params: Pick<factory.product.IOffer, 'seller'> & {
73
- project: {
74
- id: string;
75
- };
76
- }): Promise<import("mongoose").UpdateWriteOpResult>;
6
+ constructor(__: Connection);
77
7
  }
@@ -1,201 +1,18 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.ProductOfferRepo = void 0;
13
- const mongoose_1 = require("mongoose");
14
- const product_1 = require("./mongoose/schemas/product");
15
- const factory = require("../factory");
16
- const settings_1 = require("../settings");
4
+ // import * as factory from '../factory';
5
+ // import { MONGO_MAX_TIME_MS } from '../settings';
6
+ // import { createSchema, IModel, modelName } from './mongoose/schemas/product';
7
+ // type IMatchStage = PipelineStage.Match;
17
8
  /**
18
9
  * プロダクトオファーリポジトリ
19
10
  */
11
+ // tslint:disable-next-line:no-unnecessary-class
20
12
  class ProductOfferRepo {
21
- constructor(connection) {
22
- this.productModel = connection.model(product_1.modelName, (0, product_1.createSchema)());
23
- }
24
- /**
25
- * プロダクトオファー検索
26
- */
27
- search(params) {
28
- return __awaiter(this, void 0, void 0, function* () {
29
- var _a, _b, _c, _d, _e, _f;
30
- const matchStages = [{
31
- $match: {
32
- typeOf: {
33
- $in: [
34
- factory.product.ProductType.MembershipService,
35
- factory.product.ProductType.PaymentCard
36
- ]
37
- }
38
- }
39
- }];
40
- const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
41
- if (typeof projectIdEq === 'string') {
42
- matchStages.push({ $match: { 'project.id': { $eq: projectIdEq } } });
43
- }
44
- const itemOfferedIdEq = (_d = (_c = params.itemOffered) === null || _c === void 0 ? void 0 : _c.id) === null || _d === void 0 ? void 0 : _d.$eq;
45
- if (typeof itemOfferedIdEq === 'string') {
46
- matchStages.push({ $match: { _id: { $eq: new mongoose_1.Types.ObjectId(itemOfferedIdEq) } } });
47
- }
48
- const sellerIdEq = (_f = (_e = params.seller) === null || _e === void 0 ? void 0 : _e.id) === null || _f === void 0 ? void 0 : _f.$eq;
49
- if (typeof sellerIdEq === 'string') {
50
- matchStages.push({ $match: { 'offers.seller.id': { $exists: true, $eq: sellerIdEq } } });
51
- }
52
- const aggregate = this.productModel.aggregate([
53
- { $sort: { productID: factory.sortType.Ascending } },
54
- {
55
- $unwind: {
56
- path: '$offers'
57
- }
58
- },
59
- ...matchStages,
60
- {
61
- $project: {
62
- _id: 0,
63
- itemOffered: {
64
- id: { $toString: '$_id' },
65
- name: '$name',
66
- typeOf: '$typeOf'
67
- },
68
- availabilityEnds: '$offers.availabilityEnds',
69
- availabilityStarts: '$offers.availabilityStarts',
70
- validFrom: '$offers.validFrom',
71
- validThrough: '$offers.validThrough',
72
- seller: '$offers.seller'
73
- }
74
- }
75
- ]);
76
- if (typeof params.limit === 'number' && params.limit > 0) {
77
- const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
78
- aggregate.limit(params.limit * page)
79
- .skip(params.limit * (page - 1));
80
- }
81
- return aggregate.option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
82
- .exec();
83
- });
84
- }
85
- create(params) {
86
- return __awaiter(this, void 0, void 0, function* () {
87
- var _a;
88
- const sellerId = (_a = params.seller) === null || _a === void 0 ? void 0 : _a.id;
89
- if (typeof sellerId !== 'string' || sellerId.length === 0) {
90
- throw new factory.errors.ArgumentNull('seller.id');
91
- }
92
- // プロダクト存在確認
93
- let doc = yield this.productModel.findOne({
94
- 'project.id': { $eq: params.project.id },
95
- _id: { $eq: params.itemOffered.id }
96
- }, { _id: 1 })
97
- .exec();
98
- if (doc === null) {
99
- throw new factory.errors.NotFound('Product');
100
- }
101
- const creatingOffer = {
102
- priceCurrency: factory.priceCurrency.JPY,
103
- availabilityEnds: params.availabilityEnds,
104
- availabilityStarts: params.availabilityStarts,
105
- validFrom: params.validFrom,
106
- validThrough: params.validThrough,
107
- seller: { id: sellerId },
108
- typeOf: factory.offerType.Offer
109
- };
110
- doc = yield this.productModel.findOneAndUpdate({
111
- 'project.id': { $eq: params.project.id },
112
- _id: { $eq: params.itemOffered.id },
113
- 'offers.seller.id': { $ne: sellerId }
114
- }, {
115
- $push: { offers: creatingOffer }
116
- }, {
117
- new: true,
118
- projection: { _id: 1 }
119
- })
120
- .exec();
121
- // 存在しなければプロバイダーID重複
122
- if (doc === null) {
123
- throw new factory.errors.AlreadyInUse('offers.seller', ['id']);
124
- }
125
- return doc.toObject();
126
- });
127
- }
128
- update(params) {
129
- return __awaiter(this, void 0, void 0, function* () {
130
- var _a;
131
- const sellerId = (_a = params.seller) === null || _a === void 0 ? void 0 : _a.id;
132
- if (typeof sellerId !== 'string' || sellerId.length === 0) {
133
- throw new factory.errors.ArgumentNull('seller.id');
134
- }
135
- const doc = yield this.productModel.findOneAndUpdate({
136
- 'project.id': { $eq: params.project.id },
137
- _id: { $eq: params.itemOffered.id },
138
- 'offers.seller.id': { $exists: true, $eq: sellerId }
139
- }, Object.assign(Object.assign(Object.assign(Object.assign({}, (params.availabilityEnds instanceof Date)
140
- ? { 'offers.$[offerBySeller].availabilityEnds': params.availabilityEnds }
141
- : undefined), (params.availabilityStarts instanceof Date)
142
- ? { 'offers.$[offerBySeller].availabilityStarts': params.availabilityStarts }
143
- : undefined), (params.validFrom instanceof Date)
144
- ? { 'offers.$[offerBySeller].validFrom': params.validFrom }
145
- : undefined), (params.validThrough instanceof Date)
146
- ? { 'offers.$[offerBySeller].validThrough': params.validThrough }
147
- : undefined), {
148
- new: true,
149
- arrayFilters: [
150
- { 'offerBySeller.seller.id': { $eq: sellerId } }
151
- ],
152
- projection: { _id: 1 }
153
- })
154
- .exec();
155
- if (doc === null) {
156
- throw new factory.errors.NotFound('Product');
157
- }
158
- return doc.toObject();
159
- });
160
- }
161
- deleteOne(params) {
162
- return __awaiter(this, void 0, void 0, function* () {
163
- var _a;
164
- const sellerId = (_a = params.seller) === null || _a === void 0 ? void 0 : _a.id;
165
- if (typeof sellerId !== 'string' || sellerId.length === 0) {
166
- throw new factory.errors.ArgumentNull('seller.id');
167
- }
168
- const doc = yield this.productModel.findOneAndUpdate({
169
- 'project.id': { $eq: params.project.id },
170
- _id: { $eq: params.itemOffered.id },
171
- 'offers.seller.id': { $exists: true, $eq: sellerId }
172
- }, {
173
- $pull: { offers: { 'seller.id': { $exists: true, $eq: sellerId } } }
174
- }, {
175
- projection: { _id: 1 }
176
- })
177
- .exec();
178
- if (doc === null) {
179
- throw new factory.errors.NotFound('Product');
180
- }
181
- return doc.toObject();
182
- });
183
- }
184
- deleteManyBySellerId(params) {
185
- return __awaiter(this, void 0, void 0, function* () {
186
- var _a;
187
- const sellerId = (_a = params.seller) === null || _a === void 0 ? void 0 : _a.id;
188
- if (typeof sellerId !== 'string' || sellerId.length === 0) {
189
- throw new factory.errors.ArgumentNull('seller.id');
190
- }
191
- return this.productModel.updateMany({
192
- 'project.id': { $eq: params.project.id },
193
- 'offers.seller.id': { $exists: true, $eq: sellerId }
194
- }, {
195
- $pull: { offers: { 'seller.id': { $exists: true, $eq: sellerId } } }
196
- })
197
- .exec();
198
- });
13
+ // private readonly productModel: IModel;
14
+ constructor(__) {
15
+ // this.productModel = connection.model(modelName, createSchema());
199
16
  }
200
17
  }
201
18
  exports.ProductOfferRepo = ProductOfferRepo;
@@ -5,7 +5,6 @@ import type { OfferRepo } from '../../../../repo/offer/unitPriceInCatalog';
5
5
  import type { OfferCatalogRepo } from '../../../../repo/offerCatalog';
6
6
  import type { PaymentServiceRepo } from '../../../../repo/paymentService';
7
7
  import type { ProductRepo } from '../../../../repo/product';
8
- import type { ProductOfferRepo } from '../../../../repo/productOffer';
9
8
  type IObjectSubReservation = factory.assetTransaction.reserve.IObjectSubReservation;
10
9
  declare function createSubReservations(params: {
11
10
  acceptedOffers: factory.assetTransaction.reserve.IAcceptedTicketOfferWithoutDetail[];
@@ -25,6 +24,5 @@ declare function createSubReservations(params: {
25
24
  offerCatalog: OfferCatalogRepo;
26
25
  paymentService: PaymentServiceRepo;
27
26
  product: ProductRepo;
28
- productOffer: ProductOfferRepo;
29
27
  }) => Promise<IObjectSubReservation[]>;
30
28
  export { createSubReservations };
@@ -14,7 +14,6 @@ import type { PaymentServiceRepo } from '../../../repo/paymentService';
14
14
  import { SeatRepo } from '../../../repo/place/seat';
15
15
  import type { PriceSpecificationRepo } from '../../../repo/priceSpecification';
16
16
  import type { ProductRepo } from '../../../repo/product';
17
- import type { ProductOfferRepo } from '../../../repo/productOffer';
18
17
  import type { ProjectRepo } from '../../../repo/project';
19
18
  import type { OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
20
19
  import type { SettingRepo } from '../../../repo/setting';
@@ -34,7 +33,6 @@ interface IStartOperationRepos {
34
33
  offerRateLimit: OfferRateLimitRepo;
35
34
  paymentService: PaymentServiceRepo;
36
35
  product: ProductRepo;
37
- productOffer: ProductOfferRepo;
38
36
  priceSpecification: PriceSpecificationRepo;
39
37
  project: ProjectRepo;
40
38
  seat: SeatRepo;
@@ -16,7 +16,6 @@ import type { PaymentServiceRepo } from '../../../../repo/paymentService';
16
16
  import type { SeatRepo } from '../../../../repo/place/seat';
17
17
  import type { PriceSpecificationRepo } from '../../../../repo/priceSpecification';
18
18
  import type { ProductRepo } from '../../../../repo/product';
19
- import type { ProductOfferRepo } from '../../../../repo/productOffer';
20
19
  import type { ProjectRepo } from '../../../../repo/project';
21
20
  import type { OfferRateLimitRepo } from '../../../../repo/rateLimit/offer';
22
21
  import type { SettingRepo } from '../../../../repo/setting';
@@ -63,7 +62,6 @@ declare function processStartReserve4chevre(params: {
63
62
  offerRateLimit: OfferRateLimitRepo;
64
63
  paymentService: PaymentServiceRepo;
65
64
  product: ProductRepo;
66
- productOffer: ProductOfferRepo;
67
65
  priceSpecification: PriceSpecificationRepo;
68
66
  project: ProjectRepo;
69
67
  seat: SeatRepo;
@@ -18,7 +18,6 @@ import type { PaymentServiceRepo } from '../../../repo/paymentService';
18
18
  import type { SeatRepo } from '../../../repo/place/seat';
19
19
  import type { PriceSpecificationRepo } from '../../../repo/priceSpecification';
20
20
  import type { ProductRepo } from '../../../repo/product';
21
- import type { ProductOfferRepo } from '../../../repo/productOffer';
22
21
  import type { ProjectRepo } from '../../../repo/project';
23
22
  import type { OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
24
23
  import type { SettingRepo } from '../../../repo/setting';
@@ -47,7 +46,6 @@ interface IAuthorizeRepos {
47
46
  paymentService: PaymentServiceRepo;
48
47
  priceSpecification: PriceSpecificationRepo;
49
48
  product: ProductRepo;
50
- productOffer: ProductOfferRepo;
51
49
  project: ProjectRepo;
52
50
  seat: SeatRepo;
53
51
  setting: SettingRepo;
@@ -8,7 +8,6 @@ import type { OrderInTransactionRepo } from '../../repo/orderInTransaction';
8
8
  import type { OrderNumberRepo } from '../../repo/orderNumber';
9
9
  import type { OwnershipInfoRepo } from '../../repo/ownershipInfo';
10
10
  import type { ProductRepo } from '../../repo/product';
11
- import type { ProductOfferRepo } from '../../repo/productOffer';
12
11
  import type { ProjectRepo } from '../../repo/project';
13
12
  import type { ServiceOutputRepo } from '../../repo/serviceOutput';
14
13
  import type { ServiceOutputIdentifierRepo } from '../../repo/serviceOutputIdentifier';
@@ -24,7 +23,6 @@ export interface IAuthorizeOperationRepos {
24
23
  orderNumber: OrderNumberRepo;
25
24
  ownershipInfo: OwnershipInfoRepo;
26
25
  product: ProductRepo;
27
- productOffer: ProductOfferRepo;
28
26
  project: ProjectRepo;
29
27
  serviceOutput: ServiceOutputRepo;
30
28
  serviceOutputIdentifier: ServiceOutputIdentifierRepo;
@@ -65,7 +63,6 @@ export declare function search(params: {
65
63
  offer: OfferRepo;
66
64
  offerCatalog: OfferCatalogRepo;
67
65
  product: ProductRepo;
68
- productOffer: ProductOfferRepo;
69
66
  }) => Promise<{
70
67
  offers: factory.product.ITicketOffer[];
71
68
  product: Pick<factory.product.IProduct, "id" | "productID" | "typeOf" | "name" | "project" | "serviceOutput" | "serviceType" | "description">;
@@ -13,7 +13,6 @@ exports.ERROR_MESSAGE_ALREADY_REGISTERED = void 0;
13
13
  exports.search = search;
14
14
  exports.authorize = authorize;
15
15
  exports.voidTransaction = voidTransaction;
16
- const moment = require("moment");
17
16
  const factory = require("../../factory");
18
17
  const accountTransactionIdentifier_1 = require("../../factory/accountTransactionIdentifier");
19
18
  const availableProductTypes_1 = require("../../factory/availableProductTypes");
@@ -28,8 +27,8 @@ exports.ERROR_MESSAGE_ALREADY_REGISTERED = 'Already registered';
28
27
  */
29
28
  function search(params) {
30
29
  return (repos) => __awaiter(this, void 0, void 0, function* () {
30
+ // const now = moment();
31
31
  var _a;
32
- const now = moment();
33
32
  const searchProductsResult = yield repos.product.projectFields({
34
33
  limit: 1,
35
34
  page: 1,
@@ -47,28 +46,24 @@ function search(params) {
47
46
  || product.typeOf === factory.product.ProductType.PaymentCard) {
48
47
  const sellerId = (_a = params.seller) === null || _a === void 0 ? void 0 : _a.id;
49
48
  if (typeof sellerId === 'string') {
50
- // const productOffers = product.offers;
51
- // if (!Array.isArray(productOffers)) {
49
+ // productsドキュメント参照のoffers検証は廃止(2025-09-22~)
50
+ // const productOffers = await repos.productOffer.search({
51
+ // project: { id: { $eq: params.project.id } },
52
+ // itemOffered: { id: { $eq: params.itemOffered.id } },
53
+ // seller: { id: { $eq: sellerId } }
54
+ // });
55
+ // const hasValidOffer = productOffers.some((o) => {
56
+ // return o.seller?.id === sellerId
57
+ // && o.validFrom !== undefined
58
+ // && moment(o.validFrom)
59
+ // .isSameOrBefore(now)
60
+ // && o.validThrough !== undefined
61
+ // && moment(o.validThrough)
62
+ // .isSameOrAfter(now);
63
+ // });
64
+ // if (!hasValidOffer) {
52
65
  // return { offers: [], product };
53
66
  // }
54
- const productOffers = yield repos.productOffer.search({
55
- project: { id: { $eq: params.project.id } },
56
- itemOffered: { id: { $eq: params.itemOffered.id } },
57
- seller: { id: { $eq: sellerId } }
58
- });
59
- const hasValidOffer = productOffers.some((o) => {
60
- var _a;
61
- return ((_a = o.seller) === null || _a === void 0 ? void 0 : _a.id) === sellerId
62
- && o.validFrom !== undefined
63
- && moment(o.validFrom)
64
- .isSameOrBefore(now)
65
- && o.validThrough !== undefined
66
- && moment(o.validThrough)
67
- .isSameOrAfter(now);
68
- });
69
- if (!hasValidOffer) {
70
- return { offers: [], product };
71
- }
72
67
  }
73
68
  }
74
69
  const offers = yield (0, searchProductOffers_1.searchProductOffers)({
@@ -282,7 +277,7 @@ function processVoidRegisterServiceTransaction(params) {
282
277
  * 受け入れらたオファーの内容を検証
283
278
  */
284
279
  function validateAcceptedOffers(params) {
285
- return (repos) => __awaiter(this, void 0, void 0, function* () {
280
+ return (__) => __awaiter(this, void 0, void 0, function* () {
286
281
  let acceptedOfferWithoutDetail = params.object;
287
282
  if (!Array.isArray(acceptedOfferWithoutDetail)) {
288
283
  acceptedOfferWithoutDetail = [acceptedOfferWithoutDetail];
@@ -297,22 +292,18 @@ function validateAcceptedOffers(params) {
297
292
  typeOf: params.seller.typeOf
298
293
  };
299
294
  // 販売者を検証
300
- // const productOffers = params.product.offers;
301
- // if (!Array.isArray(productOffers)) {
302
- // throw new factory.errors.Argument('Product', 'Product offers undefined');
295
+ // productsドキュメント参照のoffers検証は廃止(2025-09-22~)
296
+ // const productOffers = await repos.productOffer.search({
297
+ // project: { id: { $eq: params.product.project.id } },
298
+ // itemOffered: { id: { $eq: String(params.product.id) } },
299
+ // seller: { id: { $eq: params.seller.id } }
300
+ // });
301
+ // const hasValidOffer = productOffers.some((o) => {
302
+ // return o.seller?.id === params.seller.id;
303
+ // });
304
+ // if (!hasValidOffer) {
305
+ // throw new factory.errors.Argument('Product', 'Product has no valid offer');
303
306
  // }
304
- const productOffers = yield repos.productOffer.search({
305
- project: { id: { $eq: params.product.project.id } },
306
- itemOffered: { id: { $eq: String(params.product.id) } },
307
- seller: { id: { $eq: params.seller.id } }
308
- });
309
- const hasValidOffer = productOffers.some((o) => {
310
- var _a;
311
- return ((_a = o.seller) === null || _a === void 0 ? void 0 : _a.id) === params.seller.id;
312
- });
313
- if (!hasValidOffer) {
314
- throw new factory.errors.Argument('Product', 'Product has no valid offer');
315
- }
316
307
  // 利用可能なチケットオファーであれば受け入れる
317
308
  return Promise.all(acceptedOfferWithoutDetail.map((offerWithoutDetail) => {
318
309
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
@@ -127,7 +127,7 @@ function createCheckResourceTask(order) {
127
127
  orderNumber: order.orderNumber,
128
128
  typeOf: order.typeOf
129
129
  },
130
- project: order.project,
130
+ // project: order.project,
131
131
  typeOf: factory.actionType.CheckAction
132
132
  };
133
133
  const taskIdentifier = util.format('%s:%s:%s:%s', order.project.id, factory.taskName.CheckResource, order.typeOf, order.orderNumber);
@@ -28,8 +28,7 @@ function useReservation(params) {
28
28
  // const ticketToken = params?.instrument?.ticketToken;
29
29
  if (Array.isArray(params.instrument)) {
30
30
  for (const eachInstrument of params.instrument) {
31
- if (eachInstrument.typeOf === factory.action.check.token.ObjectType.Ticket
32
- && typeof eachInstrument.ticketToken === 'string') {
31
+ if (eachInstrument.typeOf === 'Ticket' && typeof eachInstrument.ticketToken === 'string') {
33
32
  ticketToken = eachInstrument.ticketToken;
34
33
  break;
35
34
  }
@@ -62,7 +61,7 @@ function useReservation(params) {
62
61
  };
63
62
  // extend instrument to array(2025-02-18~)
64
63
  const instrument = [
65
- Object.assign(Object.assign({}, (typeof ticketToken === 'string') ? { ticketToken } : undefined), { typeOf: factory.action.check.token.ObjectType.Ticket }),
64
+ Object.assign(Object.assign({}, (typeof ticketToken === 'string') ? { ticketToken } : undefined), { typeOf: 'Ticket' }),
66
65
  // support orderAsInstrument(2025-02-18~)
67
66
  ...(Array.isArray(params.instrument))
68
67
  ? params.instrument.filter(({ typeOf }) => typeOf === factory.order.OrderType.Order)
@@ -1,4 +1,3 @@
1
- import * as factory from '../../factory';
2
1
  import type { AuthorizationRepo } from '../../repo/authorization';
3
2
  import type { OrderRepo } from '../../repo/order';
4
3
  import type { TicketRepo } from '../../repo/ticket';
@@ -12,7 +11,6 @@ export declare function verifyToken4reservation(params: {
12
11
  seller?: {
13
12
  id?: string;
14
13
  };
15
- agent: factory.action.check.token.IAgent;
16
14
  reservationId: string;
17
15
  ticket: {
18
16
  /**
@@ -1,6 +1,6 @@
1
1
  import * as factory from '../../factory';
2
- import type { IOperationExecute } from '../taskHandler';
2
+ import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../taskHandler';
3
3
  /**
4
4
  * タスク実行関数
5
5
  */
6
- export declare function call(data: factory.task.checkResource.IData): IOperationExecute<void>;
6
+ export declare function call(params: Pick<factory.task.checkResource.ITask, IExecutableTaskKeys>): IOperationExecute<ICallResult>;
@@ -24,17 +24,19 @@ const validateOrder_1 = require("../validation/validateOrder");
24
24
  /**
25
25
  * タスク実行関数
26
26
  */
27
- function call(data) {
27
+ function call(params) {
28
28
  return (_a) => __awaiter(this, [_a], void 0, function* ({ connection, redisClient }) {
29
29
  if (redisClient === undefined) {
30
30
  throw new factory.errors.Argument('settings', 'redisClient required');
31
31
  }
32
32
  const actionRepo = new action_1.ActionRepo(connection);
33
+ const { data } = params;
33
34
  const actionAttributes = {
34
- agent: { id: data.project.id, typeOf: factory.organizationType.Project },
35
+ agent: { id: params.project.id, typeOf: factory.organizationType.Project },
35
36
  object: data.object,
36
- project: { id: data.project.id, typeOf: factory.organizationType.Project },
37
- typeOf: factory.actionType.CheckAction
37
+ project: { id: params.project.id, typeOf: factory.organizationType.Project },
38
+ typeOf: factory.actionType.CheckAction,
39
+ sameAs: { id: params.id, typeOf: 'Task' } // add sameAs(2025-09-22~)
38
40
  };
39
41
  const action = yield actionRepo.start(actionAttributes);
40
42
  const objectTypeOf = data.object.typeOf;
@@ -43,7 +45,7 @@ function call(data) {
43
45
  case factory.order.OrderType.Order:
44
46
  yield (0, validateOrder_1.validateOrder)({
45
47
  orderNumber: data.object.orderNumber,
46
- project: { id: data.project.id }
48
+ project: { id: params.project.id }
47
49
  })({
48
50
  acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
49
51
  assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
@@ -56,7 +58,7 @@ function call(data) {
56
58
  case factory.eventType.ScreeningEvent:
57
59
  yield (0, validateEvent_1.validateEvent)({
58
60
  id: data.object.id,
59
- project: { id: data.project.id }
61
+ project: { id: params.project.id }
60
62
  })({
61
63
  event: new event_1.EventRepo(connection),
62
64
  stockHolder: new stockHolder_1.StockHolderRepo({ connection })
@@ -17,7 +17,6 @@ import type { MovieTheaterRepo } from '../../../repo/place/movieTheater';
17
17
  import type { ScreeningRoomRepo } from '../../../repo/place/screeningRoom';
18
18
  import type { ProductRepo } from '../../../repo/product';
19
19
  import type { ProductModelRepo } from '../../../repo/productModel';
20
- import type { ProductOfferRepo } from '../../../repo/productOffer';
21
20
  import type { SettingRepo } from '../../../repo/setting';
22
21
  import type { TaskRepo } from '../../../repo/task';
23
22
  export declare function onResourceDeleted(params: factory.task.onResourceUpdated.IData): (repos: {
@@ -39,7 +38,6 @@ export declare function onResourceDeleted(params: factory.task.onResourceUpdated
39
38
  screeningRoom: ScreeningRoomRepo;
40
39
  product: ProductRepo;
41
40
  productModel: ProductModelRepo;
42
- productOffer: ProductOfferRepo;
43
41
  setting: SettingRepo;
44
42
  task: TaskRepo;
45
43
  }) => Promise<void>;
@@ -252,11 +252,12 @@ function deleteResourcesBySeller(params) {
252
252
  project: { id: params.project.id },
253
253
  id: sellerId
254
254
  });
255
+ // productsドキュメント参照のoffers検証は廃止(2025-09-22~)
255
256
  // プロダクトオファー削除
256
- const deleteProductOfferResult = yield repos.productOffer.deleteManyBySellerId({
257
- project: { id: params.project.id },
258
- seller: { id: sellerId }
259
- });
257
+ // const deleteProductOfferResult = await repos.productOffer.deleteManyBySellerId({
258
+ // project: { id: params.project.id },
259
+ // seller: { id: sellerId }
260
+ // });
260
261
  // イベント削除
261
262
  const deleteEventResult = yield repos.event.deleteManyEventByOrganizerId({
262
263
  project: { id: params.project.id },
@@ -278,7 +279,8 @@ function deleteResourcesBySeller(params) {
278
279
  parentOrganization: { id: sellerId }
279
280
  });
280
281
  deleteResult = {
281
- deleteMemberResult, deletePaymentServiceProviderResult, deleteProductOfferResult,
282
+ deleteMemberResult, deletePaymentServiceProviderResult,
283
+ // deleteProductOfferResult,
282
284
  deleteEventResult, deleteEventSeriesResult, deleteScreeningRoomResult, deleteMovieTheaterResult
283
285
  };
284
286
  }
@@ -29,7 +29,6 @@ const movieTheater_1 = require("../../repo/place/movieTheater");
29
29
  const screeningRoom_1 = require("../../repo/place/screeningRoom");
30
30
  const product_1 = require("../../repo/product");
31
31
  const productModel_1 = require("../../repo/productModel");
32
- const productOffer_1 = require("../../repo/productOffer");
33
32
  const setting_1 = require("../../repo/setting");
34
33
  const task_1 = require("../../repo/task");
35
34
  const onAggregateOfferUpdated_1 = require("./onResourceUpdated/onAggregateOfferUpdated");
@@ -61,7 +60,7 @@ function call(data) {
61
60
  screeningRoom: new screeningRoom_1.ScreeningRoomRepo(connection),
62
61
  product: new product_1.ProductRepo(connection),
63
62
  productModel: new productModel_1.ProductModelRepo(connection),
64
- productOffer: new productOffer_1.ProductOfferRepo(connection),
63
+ // productOffer: new ProductOfferRepo(connection),
65
64
  setting: new setting_1.SettingRepo(connection),
66
65
  task: new task_1.TaskRepo(connection)
67
66
  });
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.call = call;
13
- const factory = require("../../factory");
14
13
  const action_1 = require("../../repo/action");
15
14
  const assetTransaction_1 = require("../../repo/assetTransaction");
16
15
  const authorization_1 = require("../../repo/authorization");
@@ -31,7 +30,7 @@ function call(data) {
31
30
  instrument = data.instrument;
32
31
  }
33
32
  else {
34
- if (((_b = data.instrument) === null || _b === void 0 ? void 0 : _b.typeOf) === factory.action.check.token.ObjectType.Ticket) {
33
+ if (((_b = data.instrument) === null || _b === void 0 ? void 0 : _b.typeOf) === 'Ticket') {
35
34
  instrument = [data.instrument];
36
35
  }
37
36
  }
@@ -50,6 +50,7 @@ function executeTask(task, next) {
50
50
  case factory.taskName.AuthorizePayment:
51
51
  case factory.taskName.CancelPendingReservation:
52
52
  case factory.taskName.CheckMovieTicket:
53
+ case factory.taskName.CheckResource:
53
54
  case factory.taskName.CreateAccountingReport:
54
55
  case factory.taskName.DeletePerson:
55
56
  case factory.taskName.HandleNotification:
@@ -1,5 +1,4 @@
1
1
  import * as factory from '../../../../factory';
2
- export type IAction = factory.action.IAction<factory.action.IAttributes<factory.actionType, any, any>>;
3
2
  /**
4
3
  * ポイント特典返却アクションを作成する
5
4
  */
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": "4.399.0-alpha.15",
14
+ "@chevre/factory": "4.399.0-alpha.16",
15
15
  "@cinerino/sdk": "12.2.0",
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": "22.14.0-alpha.14"
118
+ "version": "22.14.0-alpha.16"
119
119
  }