@chevre/domain 25.2.0-alpha.7 → 25.2.0-alpha.9

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.
@@ -19,9 +19,9 @@ exports.AVAILABLE_PROJECT_FIELDS = [
19
19
  'endDate',
20
20
  'purpose',
21
21
  'potentialActions',
22
- 'amount',
23
- 'fromLocation',
24
- 'toLocation',
22
+ // 'amount', // discontinue(2026-07-08~)
23
+ // 'fromLocation', // discontinue(2026-07-08~)
24
+ // 'toLocation', // discontinue(2026-07-08~)
25
25
  'instrument',
26
26
  'location',
27
27
  'replacer',
@@ -322,60 +322,60 @@ class ActionProcessRepo {
322
322
  startDate: { $lte: startDateLte }
323
323
  });
324
324
  }
325
- const fromLocationTypeOfIn = params.fromLocation?.typeOf?.$in;
326
- if (Array.isArray(fromLocationTypeOfIn)) {
327
- andConditions.push({
328
- 'fromLocation.typeOf': {
329
- $exists: true,
330
- $in: fromLocationTypeOfIn
331
- }
332
- });
333
- }
334
- const fromLocationAccountNumberIn = params.fromLocation?.accountNumber?.$in;
335
- if (Array.isArray(fromLocationAccountNumberIn)) {
336
- andConditions.push({
337
- 'fromLocation.accountNumber': {
338
- $exists: true,
339
- $in: fromLocationAccountNumberIn
340
- }
341
- });
342
- }
343
- const fromLocationAccountTypeIn = params.fromLocation?.accountType?.$in;
344
- if (Array.isArray(fromLocationAccountTypeIn)) {
345
- andConditions.push({
346
- 'fromLocation.accountType': {
347
- $exists: true,
348
- $in: fromLocationAccountTypeIn
349
- }
350
- });
351
- }
352
- const toLocationTypeOfIn = params.toLocation?.typeOf?.$in;
353
- if (Array.isArray(toLocationTypeOfIn)) {
354
- andConditions.push({
355
- 'toLocation.typeOf': {
356
- $exists: true,
357
- $in: toLocationTypeOfIn
358
- }
359
- });
360
- }
361
- const toLocationAccountNumberIn = params.toLocation?.accountNumber?.$in;
362
- if (Array.isArray(toLocationAccountNumberIn)) {
363
- andConditions.push({
364
- 'toLocation.accountNumber': {
365
- $exists: true,
366
- $in: toLocationAccountNumberIn
367
- }
368
- });
369
- }
370
- const toLocationAccountTypeIn = params.toLocation?.accountType?.$in;
371
- if (Array.isArray(toLocationAccountTypeIn)) {
372
- andConditions.push({
373
- 'toLocation.accountType': {
374
- $exists: true,
375
- $in: toLocationAccountTypeIn
376
- }
377
- });
378
- }
325
+ // const fromLocationTypeOfIn = params.fromLocation?.typeOf?.$in;
326
+ // if (Array.isArray(fromLocationTypeOfIn)) {
327
+ // andConditions.push({
328
+ // 'fromLocation.typeOf': {
329
+ // $exists: true,
330
+ // $in: fromLocationTypeOfIn
331
+ // }
332
+ // });
333
+ // }
334
+ // const fromLocationAccountNumberIn = params.fromLocation?.accountNumber?.$in;
335
+ // if (Array.isArray(fromLocationAccountNumberIn)) {
336
+ // andConditions.push({
337
+ // 'fromLocation.accountNumber': {
338
+ // $exists: true,
339
+ // $in: fromLocationAccountNumberIn
340
+ // }
341
+ // });
342
+ // }
343
+ // const fromLocationAccountTypeIn = params.fromLocation?.accountType?.$in;
344
+ // if (Array.isArray(fromLocationAccountTypeIn)) {
345
+ // andConditions.push({
346
+ // 'fromLocation.accountType': {
347
+ // $exists: true,
348
+ // $in: fromLocationAccountTypeIn
349
+ // }
350
+ // });
351
+ // }
352
+ // const toLocationTypeOfIn = params.toLocation?.typeOf?.$in;
353
+ // if (Array.isArray(toLocationTypeOfIn)) {
354
+ // andConditions.push({
355
+ // 'toLocation.typeOf': {
356
+ // $exists: true,
357
+ // $in: toLocationTypeOfIn
358
+ // }
359
+ // });
360
+ // }
361
+ // const toLocationAccountNumberIn = params.toLocation?.accountNumber?.$in;
362
+ // if (Array.isArray(toLocationAccountNumberIn)) {
363
+ // andConditions.push({
364
+ // 'toLocation.accountNumber': {
365
+ // $exists: true,
366
+ // $in: toLocationAccountNumberIn
367
+ // }
368
+ // });
369
+ // }
370
+ // const toLocationAccountTypeIn = params.toLocation?.accountType?.$in;
371
+ // if (Array.isArray(toLocationAccountTypeIn)) {
372
+ // andConditions.push({
373
+ // 'toLocation.accountType': {
374
+ // $exists: true,
375
+ // $in: toLocationAccountTypeIn
376
+ // }
377
+ // });
378
+ // }
379
379
  const purposeTypeOfIn = params.purpose?.typeOf?.$in;
380
380
  if (Array.isArray(purposeTypeOfIn)) {
381
381
  andConditions.push({
@@ -21,9 +21,9 @@ const schemaDefinition = {
21
21
  endDate: Date,
22
22
  purpose: mongoose_1.SchemaTypes.Mixed,
23
23
  potentialActions: mongoose_1.SchemaTypes.Mixed,
24
- amount: mongoose_1.SchemaTypes.Mixed,
25
- fromLocation: mongoose_1.SchemaTypes.Mixed,
26
- toLocation: mongoose_1.SchemaTypes.Mixed,
24
+ // amount: SchemaTypes.Mixed, // discontinue(2026-07-08~)
25
+ // fromLocation: SchemaTypes.Mixed, // discontinue(2026-07-08~)
26
+ // toLocation: SchemaTypes.Mixed, // discontinue(2026-07-08~)
27
27
  instrument: mongoose_1.SchemaTypes.Mixed,
28
28
  location: mongoose_1.SchemaTypes.Mixed, // add location(2022-11-11~)
29
29
  replacer: mongoose_1.SchemaTypes.Mixed, // add replacer(2024-03-19~)
@@ -330,60 +330,60 @@ const indexes = [
330
330
  }
331
331
  }
332
332
  ],
333
- [
334
- { 'fromLocation.typeOf': 1, startDate: -1 },
335
- {
336
- name: 'searchByFromLocationTypeOf',
337
- partialFilterExpression: {
338
- 'fromLocation.typeOf': { $exists: true }
339
- }
340
- }
341
- ],
342
- [
343
- { 'fromLocation.accountNumber': 1, startDate: -1 },
344
- {
345
- name: 'searchByFromLocationAccountNumber',
346
- partialFilterExpression: {
347
- 'fromLocation.accountNumber': { $exists: true }
348
- }
349
- }
350
- ],
351
- [
352
- { 'fromLocation.accountType': 1, startDate: -1 },
353
- {
354
- name: 'searchByFromLocationAccountType',
355
- partialFilterExpression: {
356
- 'fromLocation.accountType': { $exists: true }
357
- }
358
- }
359
- ],
360
- [
361
- { 'toLocation.typeOf': 1, startDate: -1 },
362
- {
363
- name: 'searchByToLocationTypeOf',
364
- partialFilterExpression: {
365
- 'toLocation.typeOf': { $exists: true }
366
- }
367
- }
368
- ],
369
- [
370
- { 'toLocation.accountNumber': 1, startDate: -1 },
371
- {
372
- name: 'searchByToLocationAccountNumber',
373
- partialFilterExpression: {
374
- 'toLocation.accountNumber': { $exists: true }
375
- }
376
- }
377
- ],
378
- [
379
- { 'toLocation.accountType': 1, startDate: -1 },
380
- {
381
- name: 'searchByToLocationAccountType',
382
- partialFilterExpression: {
383
- 'toLocation.accountType': { $exists: true }
384
- }
385
- }
386
- ],
333
+ // [
334
+ // { 'fromLocation.typeOf': 1, startDate: -1 },
335
+ // {
336
+ // name: 'searchByFromLocationTypeOf',
337
+ // partialFilterExpression: {
338
+ // 'fromLocation.typeOf': { $exists: true }
339
+ // }
340
+ // }
341
+ // ],
342
+ // [
343
+ // { 'fromLocation.accountNumber': 1, startDate: -1 },
344
+ // {
345
+ // name: 'searchByFromLocationAccountNumber',
346
+ // partialFilterExpression: {
347
+ // 'fromLocation.accountNumber': { $exists: true }
348
+ // }
349
+ // }
350
+ // ],
351
+ // [
352
+ // { 'fromLocation.accountType': 1, startDate: -1 },
353
+ // {
354
+ // name: 'searchByFromLocationAccountType',
355
+ // partialFilterExpression: {
356
+ // 'fromLocation.accountType': { $exists: true }
357
+ // }
358
+ // }
359
+ // ],
360
+ // [
361
+ // { 'toLocation.typeOf': 1, startDate: -1 },
362
+ // {
363
+ // name: 'searchByToLocationTypeOf',
364
+ // partialFilterExpression: {
365
+ // 'toLocation.typeOf': { $exists: true }
366
+ // }
367
+ // }
368
+ // ],
369
+ // [
370
+ // { 'toLocation.accountNumber': 1, startDate: -1 },
371
+ // {
372
+ // name: 'searchByToLocationAccountNumber',
373
+ // partialFilterExpression: {
374
+ // 'toLocation.accountNumber': { $exists: true }
375
+ // }
376
+ // }
377
+ // ],
378
+ // [
379
+ // { 'toLocation.accountType': 1, startDate: -1 },
380
+ // {
381
+ // name: 'searchByToLocationAccountType',
382
+ // partialFilterExpression: {
383
+ // 'toLocation.accountType': { $exists: true }
384
+ // }
385
+ // }
386
+ // ],
387
387
  [
388
388
  { 'instrument.transactionNumber': 1, startDate: -1 },
389
389
  {
@@ -209,40 +209,14 @@ function authorize(params) {
209
209
  * 承認しようとしているobjectからaccountIdを決定する
210
210
  */
211
211
  function fixAccountIdIfPossible(params) {
212
- return async (
213
- // repos: {
214
- // action: ActionRepo;
215
- // authorization: AuthorizationRepo;
216
- // ticket: TicketRepo;
217
- // }
218
- // credentials: {
219
- // jwt: JWTCredentials;
220
- // }
221
- ) => {
212
+ return async () => {
222
213
  let accountId = '';
223
- const fromLocation = params.object?.fromLocation;
214
+ // const fromLocation = params.object?.fromLocation;
224
215
  const movieTickets = params.object?.movieTickets;
225
- // discontinue token as fromLocation(ticketTokenへ移行するべき)(2024-12-18~)
226
- if (typeof fromLocation === 'string') {
227
- throw new factory_1.factory.errors.NotImplemented('object.fromLocation as string not implemented');
228
- // トークン化されたペイメントカード情報でリクエストされた場合、実ペイメントカード情報へ変換する
229
- // const { authorizedObject } = await verifyToken({
230
- // project: { id: params.project.id },
231
- // agent: { id: params.project.id, typeOf: factory.organizationType.Project },
232
- // token: fromLocation
233
- // })(repos);
234
- // const paymentCardOwnershipInfo = authorizedObject;
235
- // if (Array.isArray(paymentCardOwnershipInfo)) {
236
- // throw new factory.errors.NotImplemented('fromLocation as an array not implemented');
237
- // }
238
- // if (paymentCardOwnershipInfo.typeOf !== 'OwnershipInfo') {
239
- // throw new factory.errors.Argument('fromLocation', 'must be OwnershipInfo');
240
- // }
241
- // if (paymentCardOwnershipInfo.typeOfGood.typeOf !== factory.permit.PermitType.Permit) {
242
- // throw new factory.errors.Argument('fromLocation', 'must be Permit');
243
- // }
244
- // accountId = paymentCardOwnershipInfo.typeOfGood.identifier;
245
- }
216
+ // // discontinue token as fromLocation(ticketTokenへ移行するべき)(2024-12-18~)
217
+ // if (typeof fromLocation === 'string') {
218
+ // throw new factory.errors.NotImplemented('object.fromLocation as string not implemented');
219
+ // }
246
220
  // 購入番号管理番号をaccountIdにセット(2024-03-24~)
247
221
  if (Array.isArray(movieTickets) && movieTickets.length > 0) {
248
222
  accountId = movieTickets[0].identifier; // 決済カードidentifierは1つのみ許可の前提
@@ -140,7 +140,7 @@ function creatPayTransactionStartParams(params) {
140
140
  ...(typeof params.object.name === 'string') ? { name: params.object.name } : undefined,
141
141
  ...(typeof accountId === 'string') ? { accountId } : undefined,
142
142
  ...(typeof params.object.description === 'string') ? { description: params.object.description } : undefined,
143
- ...(typeof params.object.fromLocation === 'string') ? { fromLocation: params.object.fromLocation } : undefined,
143
+ // ...(typeof params.object.fromLocation === 'string') ? { fromLocation: params.object.fromLocation } : undefined, // discontinue(2026-07-08~)
144
144
  ...(params.object.creditCard !== undefined) ? { creditCard: params.object.creditCard } : undefined,
145
145
  ...(Array.isArray(movieTickets)) ? { movieTickets } : undefined
146
146
  },
@@ -76,6 +76,11 @@ function createAuthorizeOfferResultsExpected(params) {
76
76
  }
77
77
  function prepareUnitPriceOfferConditions(params) {
78
78
  return async (repos) => {
79
+ // COAの場合は単価オファーを参照せずにそのまま返す
80
+ const isCOA = params.authorizeEventServiceOfferActions.some((action) => action.instrument.typeOf === factory_1.factory.assetTransactionType.COAReserveTransaction);
81
+ if (isCOA) {
82
+ return params.authorizeEventServiceOfferActions.map(({ id, result }) => ({ id, result }));
83
+ }
79
84
  const conditions = [];
80
85
  const offerIds = [...new Set(params.acceptedOffers.map((o) => String(o.id)))];
81
86
  const unitPriceOffers = await repos.offer.search({
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": "9.5.0-alpha.4",
14
+ "@chevre/factory": "9.5.0-alpha.5",
15
15
  "@motionpicture/coa-service": "10.0.0",
16
16
  "@motionpicture/gmo-service": "6.1.0-alpha.0",
17
17
  "@sendgrid/client": "8.1.4",
@@ -91,5 +91,5 @@
91
91
  "postversion": "git push origin --tags",
92
92
  "prepublishOnly": "npm run clean && npm run build"
93
93
  },
94
- "version": "25.2.0-alpha.7"
94
+ "version": "25.2.0-alpha.9"
95
95
  }