@chevre/domain 22.7.0-alpha.9 → 22.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/example/src/chevre/aggregateOfferCatalogItemList.ts +36 -0
  2. package/example/src/chevre/aggregation/aggregateOffersOnEvent.ts +1 -1
  3. package/example/src/chevre/aggregation/searchAggregateReservations.ts +1 -1
  4. package/example/src/chevre/deleteDiscontinuedPeople.ts +153 -0
  5. package/example/src/chevre/deleteDiscontinuedPeopleByFetch.ts +38 -0
  6. package/example/src/chevre/findJWTSetting.ts +19 -0
  7. package/example/src/chevre/person/checkUserPoolClients.ts +119 -0
  8. package/example/src/chevre/person/cleanUpCognitoUsers.ts +73 -23
  9. package/example/src/chevre/person/cleanUpCognitoUsersByFetch.ts +162 -0
  10. package/example/src/chevre/person/cleanUpCreditCard.ts +113 -0
  11. package/example/src/chevre/unsetUnnecessaryFields.ts +3 -29
  12. package/example/src/chevre/upsertManyEventsByAdditionalProperty.ts +152 -150
  13. package/lib/chevre/credentials.d.ts +0 -5
  14. package/lib/chevre/credentials.js +0 -13
  15. package/lib/chevre/repo/action.d.ts +4 -20
  16. package/lib/chevre/repo/action.js +61 -160
  17. package/lib/chevre/repo/additionalProperty.js +1 -1
  18. package/lib/chevre/repo/aggregateOffer.js +1 -1
  19. package/lib/chevre/repo/aggregateReservation.d.ts +2 -2
  20. package/lib/chevre/repo/aggregateReservation.js +1 -1
  21. package/lib/chevre/repo/categoryCode.d.ts +6 -2
  22. package/lib/chevre/repo/categoryCode.js +15 -8
  23. package/lib/chevre/repo/comment.js +1 -1
  24. package/lib/chevre/repo/creativeWork.js +1 -1
  25. package/lib/chevre/repo/customer.js +1 -1
  26. package/lib/chevre/repo/emailMessage.js +1 -1
  27. package/lib/chevre/repo/event.d.ts +10 -7
  28. package/lib/chevre/repo/event.js +40 -80
  29. package/lib/chevre/repo/mongoose/schemas/account.js +4 -12
  30. package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +1 -1
  31. package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +18 -23
  32. package/lib/chevre/repo/mongoose/schemas/aggregateReservation.d.ts +0 -1
  33. package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +1 -1
  34. package/lib/chevre/repo/mongoose/schemas/event.js +0 -1
  35. package/lib/chevre/repo/mongoose/schemas/setting.d.ts +26 -0
  36. package/lib/chevre/repo/mongoose/schemas/setting.js +1 -0
  37. package/lib/chevre/repo/offerCatalog.d.ts +9 -0
  38. package/lib/chevre/repo/offerCatalog.js +37 -3
  39. package/lib/chevre/repo/offerCatalogItem.d.ts +9 -0
  40. package/lib/chevre/repo/offerCatalogItem.js +37 -1
  41. package/lib/chevre/repo/offerItemCondition.js +1 -1
  42. package/lib/chevre/repo/ownershipInfo.js +1 -1
  43. package/lib/chevre/repo/person.d.ts +5 -3
  44. package/lib/chevre/repo/person.js +0 -1
  45. package/lib/chevre/repo/priceSpecification.js +1 -1
  46. package/lib/chevre/repo/seller.js +1 -1
  47. package/lib/chevre/repo/setting/jwt.d.ts +10 -0
  48. package/lib/chevre/repo/setting/jwt.js +65 -0
  49. package/lib/chevre/repo/task.js +1 -1
  50. package/lib/chevre/repository.d.ts +7 -0
  51. package/lib/chevre/repository.js +17 -1
  52. package/lib/chevre/service/aggregation/event.d.ts +1 -2
  53. package/lib/chevre/service/aggregation/event.js +1 -3
  54. package/lib/chevre/service/assetTransaction/pay.d.ts +1 -1
  55. package/lib/chevre/service/assetTransaction/pay.js +12 -17
  56. package/lib/chevre/service/assetTransaction/reserve/start/factory/price.js +8 -19
  57. package/lib/chevre/service/code.d.ts +3 -34
  58. package/lib/chevre/service/code.js +18 -136
  59. package/lib/chevre/service/offer/event/authorize/factory.js +19 -14
  60. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.d.ts +0 -5
  61. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.js +43 -39
  62. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +1 -4
  63. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.js +12 -4
  64. package/lib/chevre/service/offer/event/authorize.d.ts +1 -4
  65. package/lib/chevre/service/offer/event/authorize.js +6 -2
  66. package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.d.ts +2 -1
  67. package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +10 -4
  68. package/lib/chevre/service/offer/factory.js +22 -5
  69. package/lib/chevre/service/offer.d.ts +7 -9
  70. package/lib/chevre/service/offer.js +25 -24
  71. package/lib/chevre/service/order/deleteOrder.d.ts +4 -0
  72. package/lib/chevre/service/order/deleteOrder.js +48 -5
  73. package/lib/chevre/service/payment/any/factory.d.ts +1 -1
  74. package/lib/chevre/service/payment/any.d.ts +1 -4
  75. package/lib/chevre/service/payment/any.js +35 -22
  76. package/lib/chevre/service/payment/factory/createPayObjectServiceOutput.js +32 -26
  77. package/lib/chevre/service/payment/movieTicket/validation.js +1 -22
  78. package/lib/chevre/service/report/telemetry.js +3 -3
  79. package/lib/chevre/service/reserve/verifyToken4reservation.js +1 -16
  80. package/lib/chevre/service/task/acceptCOAOffer.js +24 -14
  81. package/lib/chevre/service/task/authorizePayment.js +7 -5
  82. package/lib/chevre/service/task/createEvent/createEventSeries.js +5 -2
  83. package/lib/chevre/service/task/deletePerson.js +57 -56
  84. package/lib/chevre/service/task/deleteTransaction.js +2 -0
  85. package/lib/chevre/service/task.d.ts +0 -2
  86. package/lib/chevre/service/transaction/deleteTransaction.d.ts +2 -0
  87. package/lib/chevre/service/transaction/moneyTransfer.d.ts +1 -6
  88. package/lib/chevre/service/transaction/moneyTransfer.js +57 -36
  89. package/package.json +9 -5
  90. package/example/src/chevre/findValidAuthorization.ts +0 -56
  91. package/example/src/chevre/saveAggregateReservation.ts +0 -43
  92. package/lib/chevre/credentials/jwt.d.ts +0 -23
  93. package/lib/chevre/credentials/jwt.js +0 -18
  94. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.d.ts +0 -19
  95. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +0 -145
  96. package/lib/chevre/service/task/aggregateUseActionsOnEvent.d.ts +0 -6
  97. package/lib/chevre/service/task/aggregateUseActionsOnEvent.js +0 -37
@@ -11,51 +11,55 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.requestedProgramMembershipUsed2permit = void 0;
13
13
  const factory = require("../../../../../factory");
14
- const CodeService = require("../../../../code");
15
14
  /**
16
15
  * チケット化された適用メンバーシップをPermitに変換する
17
16
  */
18
17
  function requestedProgramMembershipUsed2permit(params) {
19
18
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
20
- return (repos, credentials) => __awaiter(this, void 0, void 0, function* () {
21
- var _a, _b, _c, _d;
19
+ return (repos
20
+ // credentials: {
21
+ // jwt: JWTCredentials;
22
+ // }
23
+ ) => __awaiter(this, void 0, void 0, function* () {
24
+ var _a, _b;
22
25
  let programMembershipUsedAsPermit;
23
26
  const { programMembershipUsed, placeOrder } = params;
24
- // トークン化されたメンバーシップがリクエストされた場合、実メンバーシップ情報へ変換する
27
+ // discontinue token as fromLocation(ticketTokenへ移行するべき)(2024-12-18~)
25
28
  if (typeof programMembershipUsed === 'string') {
26
- const { authorizedObject } = yield CodeService.verifyToken({
27
- project: { id: params.project.id },
28
- agent: { id: params.project.id, typeOf: factory.organizationType.Project },
29
- token: String(programMembershipUsed)
30
- })(repos, credentials);
31
- const permitOwnershipInfo = authorizedObject;
32
- if (Array.isArray(permitOwnershipInfo)) {
33
- throw new factory.errors.NotImplemented('programMembershipUsed as an array not implemented');
34
- }
35
- if (permitOwnershipInfo.typeOf !== 'OwnershipInfo') {
36
- throw new factory.errors.Argument('programMembershipUsed', 'must be OwnershipInfo');
37
- }
38
- const typeOfGood = permitOwnershipInfo.typeOfGood;
39
- if (typeOfGood.typeOf !== factory.permit.PermitType.Permit) {
40
- throw new factory.errors.Argument('programMembershipUsed', 'must be Permit');
41
- }
42
- const issuedThroughTypeOf = (_a = typeOfGood.issuedThrough) === null || _a === void 0 ? void 0 : _a.typeOf;
43
- if (issuedThroughTypeOf !== factory.product.ProductType.MembershipService) {
44
- throw new factory.errors.Argument('programMembershipUsed', 'must be issued through MembershipService');
45
- }
46
- if (typeof ((_b = typeOfGood.issuedThrough) === null || _b === void 0 ? void 0 : _b.id) !== 'string') {
47
- throw new factory.errors.NotFound('itemOffered.serviceOutput.programMembershipUsed.issuedThrough.id');
48
- }
49
- if (issuedThroughTypeOf === factory.product.ProductType.MembershipService) {
50
- programMembershipUsedAsPermit = {
51
- identifier: typeOfGood.identifier,
52
- issuedThrough: { id: typeOfGood.issuedThrough.id, typeOf: issuedThroughTypeOf },
53
- typeOf: factory.permit.PermitType.Permit
54
- };
55
- }
56
- else {
57
- throw new factory.errors.Argument('programMembershipUsed', `invalid issuedThrough.typeOf: ${issuedThroughTypeOf}`);
58
- }
29
+ throw new factory.errors.NotImplemented('programMembershipUsed as string not implemented');
30
+ // トークン化されたメンバーシップがリクエストされた場合、実メンバーシップ情報へ変換する
31
+ // const { authorizedObject } = await CodeService.verifyToken({
32
+ // project: { id: params.project.id },
33
+ // agent: { id: params.project.id, typeOf: factory.organizationType.Project },
34
+ // token: String(programMembershipUsed)
35
+ // })(repos);
36
+ // const permitOwnershipInfo = authorizedObject;
37
+ // if (Array.isArray(permitOwnershipInfo)) {
38
+ // throw new factory.errors.NotImplemented('programMembershipUsed as an array not implemented');
39
+ // }
40
+ // if (permitOwnershipInfo.typeOf !== 'OwnershipInfo') {
41
+ // throw new factory.errors.Argument('programMembershipUsed', 'must be OwnershipInfo');
42
+ // }
43
+ // const typeOfGood = permitOwnershipInfo.typeOfGood;
44
+ // if (typeOfGood.typeOf !== factory.permit.PermitType.Permit) {
45
+ // throw new factory.errors.Argument('programMembershipUsed', 'must be Permit');
46
+ // }
47
+ // const issuedThroughTypeOf = typeOfGood.issuedThrough?.typeOf;
48
+ // if (issuedThroughTypeOf !== factory.product.ProductType.MembershipService) {
49
+ // throw new factory.errors.Argument('programMembershipUsed', 'must be issued through MembershipService');
50
+ // }
51
+ // if (typeof typeOfGood.issuedThrough?.id !== 'string') {
52
+ // throw new factory.errors.NotFound('itemOffered.serviceOutput.programMembershipUsed.issuedThrough.id');
53
+ // }
54
+ // if (issuedThroughTypeOf === factory.product.ProductType.MembershipService) {
55
+ // programMembershipUsedAsPermit = {
56
+ // identifier: typeOfGood.identifier,
57
+ // issuedThrough: { id: typeOfGood.issuedThrough.id, typeOf: issuedThroughTypeOf },
58
+ // typeOf: factory.permit.PermitType.Permit
59
+ // };
60
+ // } else {
61
+ // throw new factory.errors.Argument('programMembershipUsed', `invalid issuedThrough.typeOf: ${issuedThroughTypeOf}`);
62
+ // }
59
63
  }
60
64
  else if ((programMembershipUsed === null || programMembershipUsed === void 0 ? void 0 : programMembershipUsed.typeOf) === 'Ticket') {
61
65
  const { ticketToken } = programMembershipUsed;
@@ -97,7 +101,7 @@ function requestedProgramMembershipUsed2permit(params) {
97
101
  if (permitOwnershipInfo.typeOfGood.typeOf !== factory.permit.PermitType.Permit) {
98
102
  throw new factory.errors.Argument('programMembershipUsed', 'ownershipInfo.typeOfGood.typeOf must be Permit');
99
103
  }
100
- const issuedThroughTypeOf = (_c = permitOwnershipInfo.typeOfGood.issuedThrough) === null || _c === void 0 ? void 0 : _c.typeOf;
104
+ const issuedThroughTypeOf = (_a = permitOwnershipInfo.typeOfGood.issuedThrough) === null || _a === void 0 ? void 0 : _a.typeOf;
101
105
  if (issuedThroughTypeOf === factory.service.paymentService.PaymentServiceType.FaceToFace) {
102
106
  programMembershipUsedAsPermit = {
103
107
  identifier: permitOwnershipInfo.typeOfGood.identifier,
@@ -107,7 +111,7 @@ function requestedProgramMembershipUsed2permit(params) {
107
111
  }
108
112
  else if (issuedThroughTypeOf === factory.product.ProductType.MembershipService
109
113
  || issuedThroughTypeOf === factory.service.paymentService.PaymentServiceType.CreditCard) {
110
- if (typeof ((_d = permitOwnershipInfo.typeOfGood.issuedThrough) === null || _d === void 0 ? void 0 : _d.id) !== 'string') {
114
+ if (typeof ((_b = permitOwnershipInfo.typeOfGood.issuedThrough) === null || _b === void 0 ? void 0 : _b.id) !== 'string') {
111
115
  throw new factory.errors.Argument('programMembershipUsed', 'ownershipInfo.typeOfGood.issuedThrough.id undefined');
112
116
  }
113
117
  programMembershipUsedAsPermit = {
@@ -1,6 +1,5 @@
1
1
  import * as factory from '../../../../factory';
2
2
  import { Settings } from '../../../../settings';
3
- import type { JWTCredentials } from '../../../../credentials/jwt';
4
3
  import type { ActionRepo } from '../../../../repo/action';
5
4
  import type { AssetTransactionRepo } from '../../../../repo/assetTransaction';
6
5
  import type { AuthorizationRepo } from '../../../../repo/authorization';
@@ -59,9 +58,7 @@ declare function processStartReserve4chevre(params: {
59
58
  task: TaskRepo;
60
59
  ticket: TicketRepo;
61
60
  assetTransaction: AssetTransactionRepo;
62
- }, settings: Settings, credentials: {
63
- jwt: JWTCredentials;
64
- }) => Promise<{
61
+ }, settings: Settings) => Promise<{
65
62
  acceptedOffers4result: IResultAcceptedOffer[];
66
63
  }>;
67
64
  export { processStartReserve4chevre };
@@ -15,7 +15,11 @@ const ReserveTransactionService = require("../../../assetTransaction/reserve");
15
15
  const factory_1 = require("./factory");
16
16
  const requestedProgramMembershipUsed2permit_1 = require("./processStartReserve4chevre/requestedProgramMembershipUsed2permit");
17
17
  function processStartReserve4chevre(params, options) {
18
- return (repos, settings, credentials) => __awaiter(this, void 0, void 0, function* () {
18
+ return (repos, settings
19
+ // credentials: {
20
+ // jwt: JWTCredentials;
21
+ // }
22
+ ) => __awaiter(this, void 0, void 0, function* () {
19
23
  const { event, transaction, transactionNumber } = params;
20
24
  let acceptedOffers4result = [];
21
25
  // 予約取引開始
@@ -23,7 +27,7 @@ function processStartReserve4chevre(params, options) {
23
27
  // object: <IObjectWithDetail>action.object,
24
28
  acceptedOffers: params.acceptedOffers, event: { id: event.id }, transaction,
25
29
  transactionNumber }, (params.broker !== undefined) ? { broker: params.broker } : undefined));
26
- const startParamObject = yield validateObjectWithoutDetail(startParams, { id: params.transaction.id })(repos, credentials);
30
+ const startParamObject = yield validateObjectWithoutDetail(startParams, { id: params.transaction.id })(repos);
27
31
  const startReserveTransactionResult = yield ReserveTransactionService.start(Object.assign(Object.assign({}, startParams), { object: startParamObject,
28
32
  // discontinue preSearchedEvent(2024-07-17~)
29
33
  // preSearchedEvent: event,
@@ -43,7 +47,11 @@ function processStartReserve4chevre(params, options) {
43
47
  }
44
48
  exports.processStartReserve4chevre = processStartReserve4chevre;
45
49
  function validateObjectWithoutDetail(params, placeOrder) {
46
- return (repos, credentials) => __awaiter(this, void 0, void 0, function* () {
50
+ return (repos
51
+ // credentials: {
52
+ // jwt: JWTCredentials;
53
+ // }
54
+ ) => __awaiter(this, void 0, void 0, function* () {
47
55
  var _a, _b, _c;
48
56
  const objectWithoutDetail = params.object;
49
57
  if (Array.isArray(objectWithoutDetail.acceptedOffer)) {
@@ -53,7 +61,7 @@ function validateObjectWithoutDetail(params, placeOrder) {
53
61
  project: { id: params.project.id },
54
62
  programMembershipUsed: (_b = (_a = acceptedOffer.itemOffered) === null || _a === void 0 ? void 0 : _a.serviceOutput) === null || _b === void 0 ? void 0 : _b.programMembershipUsed,
55
63
  placeOrder: { id: placeOrder.id }
56
- })(repos, credentials);
64
+ })(repos);
57
65
  // 適用メンバーシップがあればacceptedOfferを強制的に上書き
58
66
  if (programMembershipUsedAsPermit !== undefined) {
59
67
  acceptedOffer = Object.assign(Object.assign({}, acceptedOffer), { itemOffered: Object.assign(Object.assign({}, acceptedOffer.itemOffered), { serviceOutput: Object.assign(Object.assign({}, (_c = acceptedOffer.itemOffered) === null || _c === void 0 ? void 0 : _c.serviceOutput), { typeOf: factory.reservationType.EventReservation, programMembershipUsed: programMembershipUsedAsPermit }) }) });
@@ -1,6 +1,5 @@
1
1
  import * as factory from '../../../factory';
2
2
  import { Settings } from '../../../settings';
3
- import type { JWTCredentials } from '../../../credentials/jwt';
4
3
  import type { ActionRepo } from '../../../repo/action';
5
4
  import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
6
5
  import type { AuthorizationRepo } from '../../../repo/authorization';
@@ -49,9 +48,7 @@ interface IAuthorizeRepos {
49
48
  transaction: TransactionRepo;
50
49
  transactionNumber: TransactionNumberRepo;
51
50
  }
52
- type IAuthorizeOperation<T> = (repos: IAuthorizeRepos, settings: Settings, credentials: {
53
- jwt: JWTCredentials;
54
- }) => Promise<T>;
51
+ type IAuthorizeOperation<T> = (repos: IAuthorizeRepos, settings: Settings) => Promise<T>;
55
52
  type IAuthorizeOfferAction = factory.action.authorize.offer.eventService.IAction<factory.service.webAPI.Identifier>;
56
53
  type IObjectWithoutDetail = factory.action.authorize.offer.eventService.IObjectWithoutDetail;
57
54
  interface IAuthorizeOptions {
@@ -20,7 +20,11 @@ const searchOffersByIds_1 = require("./searchOffersByIds");
20
20
  * 興行オファー承認
21
21
  */
22
22
  function authorize(params, options) {
23
- return (repos, settings, credentials) => __awaiter(this, void 0, void 0, function* () {
23
+ return (repos, settings
24
+ // credentials: {
25
+ // jwt: JWTCredentials;
26
+ // }
27
+ ) => __awaiter(this, void 0, void 0, function* () {
24
28
  var _a;
25
29
  const { noOfferSpecified } = options;
26
30
  const { transaction, event } = yield validateCreateRequest(params)(repos);
@@ -42,7 +46,7 @@ function authorize(params, options) {
42
46
  const action = yield repos.action.start(actionAttributes);
43
47
  try {
44
48
  const processStartReserveResult = yield (0, processStartReserve4chevre_1.processStartReserve4chevre)(Object.assign({ acceptedOffers, event,
45
- transactionNumber, transaction, availableAtOrFrom: { id: params.store.id }, ticketOffers, unitPriceOffers, validateEvent: params.validateEvent === true, validateEventOfferPeriod: params.validateEventOfferPeriod === true }, (typeof ((_a = params.object.broker) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { broker: params.object.broker } : undefined), options)(repos, settings, credentials);
49
+ transactionNumber, transaction, availableAtOrFrom: { id: params.store.id }, ticketOffers, unitPriceOffers, validateEvent: params.validateEvent === true, validateEventOfferPeriod: params.validateEventOfferPeriod === true }, (typeof ((_a = params.object.broker) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { broker: params.object.broker } : undefined), options)(repos, settings);
46
50
  acceptedOffers4result = processStartReserveResult.acceptedOffers4result;
47
51
  // add orderInTransaction(2024-01-15~)
48
52
  if (!noOfferSpecified) {
@@ -10,10 +10,11 @@ interface IAcceptRepos {
10
10
  reserveService: COA.service.Reserve;
11
11
  masterService: COA.service.Master;
12
12
  }
13
- type IAccepteOfferParams = Pick<factory.task.acceptCOAOffer.IData, 'object' | 'potentialActions' | 'purpose'> & {
13
+ type IAccepteOfferParams = Pick<factory.task.acceptCOAOffer.IData, 'object' | 'potentialActions' | 'purpose' | 'agent'> & {
14
14
  sameAs: {
15
15
  id: string;
16
16
  };
17
+ isMember: boolean;
17
18
  };
18
19
  /**
19
20
  * COA興行オファー採用
@@ -58,7 +58,8 @@ function acceptOffer(params) {
58
58
  project: transaction.project,
59
59
  typeOf: factory.actionType.AcceptAction,
60
60
  object: params.object,
61
- agent: { id: transaction.agent.id, typeOf: transaction.agent.typeOf },
61
+ // agent: { id: transaction.agent.id, typeOf: transaction.agent.typeOf },
62
+ agent: { id: params.agent.id, typeOf: params.agent.typeOf },
62
63
  purpose: { id: transaction.id, typeOf: transaction.typeOf },
63
64
  sameAs: { id: params.sameAs.id, typeOf: 'Task' },
64
65
  potentialActions: params.potentialActions,
@@ -76,7 +77,9 @@ function acceptOffer(params) {
76
77
  acceptedOffer = yield (0, authorize_1.validateOffers)(coaInfo, acceptedOffersWithoutDetails, {
77
78
  identifier: params.object.appliesToSurfrock.identifier,
78
79
  serviceOutput: { typeOf: params.object.appliesToSurfrock.serviceOutput.typeOf }
79
- }, params.object.flgMember)({
80
+ },
81
+ // params.object.flgMember
82
+ (params.isMember) ? factory.action.accept.coaOffer.FlgMember.Member : factory.action.accept.coaOffer.FlgMember.NonMember)({
80
83
  reserveService: repos.reserveService,
81
84
  masterService: repos.masterService
82
85
  });
@@ -132,7 +135,8 @@ function reAcceptOffer(params) {
132
135
  project: transaction.project,
133
136
  typeOf: factory.actionType.AcceptAction,
134
137
  object: params.object,
135
- agent: { id: transaction.agent.id, typeOf: transaction.agent.typeOf },
138
+ // agent: { id: transaction.agent.id, typeOf: transaction.agent.typeOf },
139
+ agent: { id: params.agent.id, typeOf: params.agent.typeOf },
136
140
  purpose: { id: transaction.id, typeOf: transaction.typeOf },
137
141
  sameAs: { id: params.sameAs.id, typeOf: 'Task' },
138
142
  potentialActions: params.potentialActions,
@@ -148,7 +152,9 @@ function reAcceptOffer(params) {
148
152
  acceptedOffer = yield (0, authorize_1.validateOffers)(coaInfo, acceptedOffersWithoutDetails, {
149
153
  identifier: params.object.appliesToSurfrock.identifier,
150
154
  serviceOutput: { typeOf: params.object.appliesToSurfrock.serviceOutput.typeOf }
151
- }, params.object.flgMember)({
155
+ },
156
+ // params.object.flgMember
157
+ (params.isMember) ? factory.action.accept.coaOffer.FlgMember.Member : factory.action.accept.coaOffer.FlgMember.NonMember)({
152
158
  reserveService: repos.reserveService,
153
159
  masterService: repos.masterService
154
160
  });
@@ -3,12 +3,29 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createCompoundPriceSpec4event = void 0;
4
4
  const factory = require("../../factory");
5
5
  function categoryCodeChargePriceSpec2component(params) {
6
- var _a;
7
- return Object.assign({ id: params.id, typeOf: params.typeOf, name: params.name, price: params.price, priceCurrency: params.priceCurrency, valueAddedTaxIncluded: params.valueAddedTaxIncluded, appliesToCategoryCode: params.appliesToCategoryCode }, (typeof ((_a = params.accounting) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { accounting: params.accounting } : undefined);
6
+ return {
7
+ id: params.id,
8
+ typeOf: params.typeOf,
9
+ name: params.name,
10
+ price: params.price,
11
+ priceCurrency: params.priceCurrency,
12
+ valueAddedTaxIncluded: params.valueAddedTaxIncluded,
13
+ appliesToCategoryCode: params.appliesToCategoryCode
14
+ // ...(typeof params.accounting?.typeOf === 'string') ? { accounting: params.accounting } : undefined // 不要(2024-12-15~)
15
+ };
8
16
  }
9
17
  function mvtkChargePriceSpec2component(params) {
10
- var _a;
11
- return Object.assign({ id: params.id, typeOf: params.typeOf, name: params.name, price: params.price, priceCurrency: params.priceCurrency, valueAddedTaxIncluded: params.valueAddedTaxIncluded, appliesToVideoFormat: params.appliesToVideoFormat, appliesToMovieTicket: params.appliesToMovieTicket }, (typeof ((_a = params.accounting) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { accounting: params.accounting } : undefined);
18
+ return {
19
+ id: params.id,
20
+ typeOf: params.typeOf,
21
+ name: params.name,
22
+ price: params.price,
23
+ priceCurrency: params.priceCurrency,
24
+ valueAddedTaxIncluded: params.valueAddedTaxIncluded,
25
+ appliesToVideoFormat: params.appliesToVideoFormat,
26
+ appliesToMovieTicket: params.appliesToMovieTicket
27
+ // ...(typeof params.accounting?.typeOf === 'string') ? { accounting: params.accounting } : undefined // 不要(2024-12-15~)
28
+ };
12
29
  }
13
30
  // tslint:disable-next-line:max-func-body-length
14
31
  function createCompoundPriceSpec4event(params) {
@@ -17,7 +34,6 @@ function createCompoundPriceSpec4event(params) {
17
34
  if (params.offer.priceSpecification === undefined) {
18
35
  throw new factory.errors.NotFound(`priceSpecification of the offer: ${params.offer.id}`);
19
36
  }
20
- const unitPriceSpec = Object.assign(Object.assign({}, params.offer.priceSpecification), { name: params.offer.name });
21
37
  let videoFormatChargeSpecComponents = [];
22
38
  let soundFormatChargeSpecComponents = [];
23
39
  // 区分加算料金を適用しないオプションを追加(2023-01-26~)
@@ -26,6 +42,7 @@ function createCompoundPriceSpec4event(params) {
26
42
  videoFormatChargeSpecComponents = params.videoFormatChargeSpecs.map(categoryCodeChargePriceSpec2component);
27
43
  soundFormatChargeSpecComponents = params.soundFormatChargeSpecs.map(categoryCodeChargePriceSpec2component);
28
44
  }
45
+ const unitPriceSpec = Object.assign(Object.assign({}, params.offer.priceSpecification), { name: params.offer.name });
29
46
  const mvtkPriceComponents = [];
30
47
  // 複数決済カード対応(2022-07-11~)
31
48
  if (Array.isArray(unitPriceSpec.appliesToMovieTicket)) {
@@ -1,6 +1,5 @@
1
1
  import type { EventRepo } from '../repo/event';
2
2
  import type { SeatRepo } from '../repo/place/seat';
3
- import type { PriceSpecificationRepo } from '../repo/priceSpecification';
4
3
  import type { StockHolderRepo } from '../repo/stockHolder';
5
4
  import * as factory from '../factory';
6
5
  import * as EventOfferService from './offer/event';
@@ -20,7 +19,12 @@ export declare function addOffers2Seat(params: {
20
19
  */
21
20
  priceSpecs: ICategoryCodeChargeSpecification[];
22
21
  }): factory.place.seat.IPlaceWithOffer;
23
- type ISeatAsEventOffer = Pick<factory.place.seat.IPlaceWithOffer, 'branchCode' | 'containedInPlace' | 'offers' | 'seatingType' | 'typeOf' | 'name'>;
22
+ type ISeatAsEventOffer = Pick<factory.place.seat.IPlaceWithOffer, 'branchCode' | 'name' | 'seatingType'> & {
23
+ containedInPlace?: {
24
+ branchCode?: string;
25
+ };
26
+ offers?: Pick<factory.place.seat.IOffer, 'availability'>[];
27
+ };
24
28
  /**
25
29
  * イベントに対する座席オファーを検索する
26
30
  */
@@ -39,15 +43,9 @@ export declare function searchEventSeatOffersWithPaging(params: {
39
43
  id: string;
40
44
  };
41
45
  $projection?: factory.place.seat.IProjection;
42
- options: {
43
- /**
44
- * add option(2024-10-23~)
45
- */
46
- excludePriceSpecification: boolean;
47
- };
46
+ options: {};
48
47
  }): (repos: {
49
48
  event: EventRepo;
50
- priceSpecification: PriceSpecificationRepo;
51
49
  stockHolder: StockHolderRepo;
52
50
  seat: SeatRepo;
53
51
  }) => Promise<ISeatAsEventOffer[]>;
@@ -60,7 +60,7 @@ function searchEventSeatOffersWithPaging(params) {
60
60
  // tslint:disable-next-line:max-func-body-length
61
61
  return (repos) => __awaiter(this, void 0, void 0, function* () {
62
62
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
63
- const { excludePriceSpecification } = params.options;
63
+ // const { excludePriceSpecification } = params.options;
64
64
  let offers = [];
65
65
  // optimize(2024-07-18~)
66
66
  const event = yield repos.event.projectEventFieldsById({ id: params.event.id }, ['project', 'startDate', 'offers.itemOffered']);
@@ -99,36 +99,37 @@ function searchEventSeatOffersWithPaging(params) {
99
99
  })
100
100
  });
101
101
  // ルームに含まれる座席区分のみ加算料金を検索(2024-08-05~)
102
- const uniqueSeatingTypes = yield repos.seat.aggregateSeatingTypes({
103
- project: { id: { $eq: event.project.id } },
104
- containedInPlace: {
105
- containedInPlace: {
106
- branchCode: { $eq: roomBranchCode },
107
- containedInPlace: { branchCode: { $eq: movieTheaterBranchCode } }
108
- }
109
- }
110
- });
102
+ // const uniqueSeatingTypes = await repos.seat.aggregateSeatingTypes({
103
+ // project: { id: { $eq: event.project.id } },
104
+ // containedInPlace: {
105
+ // containedInPlace: {
106
+ // branchCode: { $eq: roomBranchCode },
107
+ // containedInPlace: { branchCode: { $eq: movieTheaterBranchCode } }
108
+ // }
109
+ // }
110
+ // });
111
111
  // 座席タイプ価格仕様を検索
112
- let priceSpecs = [];
113
- if (!excludePriceSpecification) {
114
- if (Array.isArray(uniqueSeatingTypes) && uniqueSeatingTypes.length > 0) {
115
- priceSpecs = yield repos.priceSpecification.search({
116
- project: { id: { $eq: event.project.id } },
117
- typeOf: factory.priceSpecificationType.CategoryCodeChargeSpecification,
118
- appliesToCategoryCode: {
119
- inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } },
120
- codeValue: { $in: uniqueSeatingTypes } // ルームに含まれる座席区分のみ加算料金を検索(2024-08-05~)
121
- }
122
- });
123
- }
124
- }
112
+ // let priceSpecs: ICategoryCodeChargeSpecification[] = [];
113
+ // if (!excludePriceSpecification) {
114
+ // if (Array.isArray(uniqueSeatingTypes) && uniqueSeatingTypes.length > 0) {
115
+ // priceSpecs =
116
+ // await repos.priceSpecification.search<factory.priceSpecificationType.CategoryCodeChargeSpecification>({
117
+ // project: { id: { $eq: event.project.id } },
118
+ // typeOf: factory.priceSpecificationType.CategoryCodeChargeSpecification,
119
+ // appliesToCategoryCode: {
120
+ // inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } },
121
+ // codeValue: { $in: uniqueSeatingTypes } // ルームに含まれる座席区分のみ加算料金を検索(2024-08-05~)
122
+ // }
123
+ // });
124
+ // }
125
+ // }
125
126
  offers = seats.map((seat, index) => {
126
127
  return addOffers2Seat({
127
128
  seat,
128
129
  availability: (typeof availabilities[index] === 'string')
129
130
  ? factory.itemAvailability.OutOfStock // ホルダーが存在すればOutOfStock
130
131
  : factory.itemAvailability.InStock,
131
- priceSpecs
132
+ priceSpecs: [] // priceSpecsをレスポンスから廃止(2024-12-22~)
132
133
  });
133
134
  });
134
135
  }
@@ -5,6 +5,8 @@ import type { NoteRepo } from '../../repo/note';
5
5
  import type { OrderRepo } from '../../repo/order';
6
6
  import type { OwnershipInfoRepo } from '../../repo/ownershipInfo';
7
7
  import type { ReservationRepo } from '../../repo/reservation';
8
+ import type { SettingRepo } from '../../repo/setting';
9
+ import type { TaskRepo } from '../../repo/task';
8
10
  import * as factory from '../../factory';
9
11
  /**
10
12
  * 注文に関わるリソースを削除する
@@ -20,5 +22,7 @@ declare function deleteOrder(params: {
20
22
  order: OrderRepo;
21
23
  ownershipInfo: OwnershipInfoRepo;
22
24
  reservation: ReservationRepo;
25
+ setting: SettingRepo;
26
+ task: TaskRepo;
23
27
  }) => Promise<void>;
24
28
  export { deleteOrder };
@@ -22,7 +22,7 @@ function deleteOrder(params) {
22
22
  limit: 1,
23
23
  page: 1,
24
24
  orderNumbers: [params.object.orderNumber]
25
- }, { inclusion: ['orderDate', 'project', 'customer', 'orderNumber', 'seller'] });
25
+ }, { inclusion: ['orderDate', 'project', 'customer', 'orderNumber', 'seller', 'broker'] });
26
26
  const order = orders.shift();
27
27
  if (order === undefined) {
28
28
  // すでに削除済
@@ -50,15 +50,58 @@ function deleteOrder(params) {
50
50
  typeOf: factory.order.OrderType.Order
51
51
  }
52
52
  });
53
- // 終了済の関連イベントを削除(2023-08-16~)
54
- // if (USE_DELETE_EVENT_BY_ORDER) {
55
- // await deleteEventsByOrder(order)(repos);
56
- // }
57
53
  // 注文削除
58
54
  yield repos.order.deleteByOrderNumber({ orderNumber: order.orderNumber });
55
+ // deletePerson(2024-12-25~)
56
+ yield deletePersonIfNecessary(order)(repos);
59
57
  });
60
58
  }
61
59
  exports.deleteOrder = deleteOrder;
60
+ function deletePersonIfNecessary(order) {
61
+ return (repos) => __awaiter(this, void 0, void 0, function* () {
62
+ var _a;
63
+ // 代理注文を除く
64
+ const isCustomerPerson = order.customer.typeOf === factory.personType.Person
65
+ && typeof ((_a = order.broker) === null || _a === void 0 ? void 0 : _a.typeOf) !== 'string';
66
+ if (isCustomerPerson) {
67
+ const ordersByPerson = yield repos.order.projectFields({
68
+ limit: 1,
69
+ page: 1,
70
+ customer: { ids: [order.customer.id] }
71
+ }, { inclusion: ['orderNumber'] });
72
+ if (ordersByPerson.length === 0) {
73
+ const setting = yield repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['userPoolIdNew']);
74
+ if (typeof (setting === null || setting === void 0 ? void 0 : setting.userPoolIdNew) !== 'string') {
75
+ throw new factory.errors.NotFound('setting.userPoolIdNew');
76
+ }
77
+ const deletePersonTask = {
78
+ project: { typeOf: factory.organizationType.Project, id: order.project.id },
79
+ name: factory.taskName.DeletePerson,
80
+ status: factory.taskStatus.Ready,
81
+ runsAt: new Date(),
82
+ remainingNumberOfTries: 10,
83
+ numberOfTried: 0,
84
+ executionResults: [],
85
+ data: {
86
+ id: order.customer.id,
87
+ agent: {
88
+ id: order.project.id,
89
+ typeOf: factory.organizationType.Project,
90
+ name: factory.organizationType.Project
91
+ },
92
+ physically: true,
93
+ userPoolId: setting.userPoolIdNew,
94
+ // project: { id: order.project.id },
95
+ migrate: false,
96
+ useUsernameAsGMOMemberId: false,
97
+ executeBackground: true
98
+ }
99
+ };
100
+ yield repos.task.saveMany([deletePersonTask], { emitImmediately: true });
101
+ }
102
+ }
103
+ });
104
+ }
62
105
  function deleteReservationsByOrder(order) {
63
106
  return (repos) => __awaiter(this, void 0, void 0, function* () {
64
107
  const acceptedOffers = yield repos.acceptedOffer.searchAcceptedOffersByOrderNumber({
@@ -27,7 +27,7 @@ export declare function creatPayTransactionStartParams(params: {
27
27
  export declare function createMovieTicket(params: factory.action.trade.pay.IMovieTicket): factory.action.trade.pay.IMovieTicket;
28
28
  export declare function createAuthorizeResult(params: {
29
29
  object: factory.action.authorize.paymentMethod.any.IObjectIncludingPaymentMethodDetails;
30
- payTransaction: factory.assetTransaction.pay.ITransaction;
30
+ payTransaction: Pick<factory.assetTransaction.pay.ITransaction, 'object'>;
31
31
  permit?: Pick<factory.ownershipInfo.IPermitAsGood, 'identifier'>;
32
32
  }): factory.action.authorize.paymentMethod.any.IResult;
33
33
  /**
@@ -3,7 +3,6 @@
3
3
  */
4
4
  import * as factory from '../../factory';
5
5
  import { Settings } from '../../settings';
6
- import type { JWTCredentials } from '../../credentials/jwt';
7
6
  import type { AccountingReportRepo } from '../../repo/accountingReport';
8
7
  import type { ActionRepo, IMinimizedPurchaseNumberAuthResult } from '../../repo/action';
9
8
  import type { AssetTransactionRepo } from '../../repo/assetTransaction';
@@ -91,9 +90,7 @@ interface IAuthorizeRepos {
91
90
  transactionNumber: TransactionNumberRepo;
92
91
  transactionProcess: TransactionProcessRepo;
93
92
  }
94
- type IAuthorizeOperation<T> = (repos: IAuthorizeRepos, settings: Settings, credentials: {
95
- jwt: JWTCredentials;
96
- }) => Promise<T>;
93
+ type IAuthorizeOperation<T> = (repos: IAuthorizeRepos, settings: Settings) => Promise<T>;
97
94
  interface IPublishPaymentUrlRepos {
98
95
  action: ActionRepo;
99
96
  assetTransaction: AssetTransactionRepo;