@chevre/domain 25.0.0-alpha.18 → 25.0.0-alpha.19

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.
@@ -20,7 +20,6 @@ interface IOptions {
20
20
  secret: string;
21
21
  passportValidator?: IPassportValidator;
22
22
  }
23
- type IStartParams = (factory.transaction.placeOrder.IStartParamsWithoutDetail) & {};
24
23
  /**
25
24
  * 取引許可証リポジトリ
26
25
  */
@@ -34,7 +33,11 @@ export declare class PassportRepo {
34
33
  /**
35
34
  * 許可証トークンがあれば検証する
36
35
  */
37
- validatePassportTokenIfExist(params: Pick<IStartParams, 'object'>): Promise<{
36
+ validatePassportTokenIfExist(params: {
37
+ object?: {
38
+ passport?: factory.transaction.IPassportBeforeStart;
39
+ };
40
+ }): Promise<{
38
41
  passport?: IVerifiedPassport;
39
42
  customerType?: string;
40
43
  }>;
@@ -122,16 +122,18 @@ class PlaceOrderRepo {
122
122
  if (Array.isArray(sellerIdIn)) {
123
123
  andConditions.push({ 'seller.id': { $exists: true, $in: sellerIdIn } });
124
124
  }
125
- const resultOrderNumberIn = params.result?.order?.orderNumbers;
126
- if (Array.isArray(resultOrderNumberIn)) {
127
- andConditions.push({ 'result.order.orderNumber': { $exists: true, $in: resultOrderNumberIn } });
128
- }
129
- const resultOrderConfirmationNumberEq = params.result?.order?.confirmationNumber?.$eq;
130
- if (typeof resultOrderConfirmationNumberEq === 'string') {
131
- andConditions.push({
132
- 'result.order.confirmationNumber': { $exists: true, $eq: resultOrderConfirmationNumberEq }
133
- });
134
- }
125
+ // result.orderは完全に廃止したので検索条件としても廃止(2026-06-26~)
126
+ // const resultOrderNumberIn = params.result?.order?.orderNumbers;
127
+ // if (Array.isArray(resultOrderNumberIn)) {
128
+ // andConditions.push({ 'result.order.orderNumber': { $exists: true, $in: resultOrderNumberIn } });
129
+ // }
130
+ // result.orderは完全に廃止したので検索条件としても廃止(2026-06-26~)
131
+ // const resultOrderConfirmationNumberEq = params.result?.order?.confirmationNumber?.$eq;
132
+ // if (typeof resultOrderConfirmationNumberEq === 'string') {
133
+ // andConditions.push({
134
+ // 'result.order.confirmationNumber': { $exists: true, $eq: resultOrderConfirmationNumberEq }
135
+ // });
136
+ // }
135
137
  const objectOrderNumberEq = params.object?.orderNumber?.$eq;
136
138
  if (typeof objectOrderNumberEq === 'string') {
137
139
  andConditions.push({ 'object.orderNumber': { $exists: true, $eq: objectOrderNumberEq } });
@@ -79,7 +79,7 @@ function createPlacingOrder(params) {
79
79
  throw new factory_1.factory.errors.Internal('object.orderNumber undefined');
80
80
  }
81
81
  if (orderDate === undefined) {
82
- orderDateByTransaction = transaction.result?.order?.orderDate;
82
+ // orderDateByTransaction = transaction.result?.order?.orderDate
83
83
  }
84
84
  else {
85
85
  orderDateByTransaction = orderDate;
@@ -1,4 +1,9 @@
1
1
  import { factory } from '../../../../../factory';
2
+ type IOrderAsResult = Pick<factory.order.IOrder, 'confirmationNumber' | 'orderDate' | 'orderNumber' | 'price' | 'priceCurrency' | 'typeOf'> & {
3
+ orderStatus: factory.orderStatus.OrderPaymentDue;
4
+ identifier?: never;
5
+ url?: never;
6
+ };
2
7
  /**
3
8
  * 注文取引結果としての注文を生成する
4
9
  */
@@ -6,5 +11,5 @@ declare function createOrderAsResult(params: {
6
11
  orderNumber: string;
7
12
  orderDate: Date;
8
13
  price: number;
9
- }): factory.transaction.placeOrder.IOrderAsResult;
10
- export { createOrderAsResult };
14
+ }): IOrderAsResult;
15
+ export { createOrderAsResult, IOrderAsResult };
@@ -1,7 +1,8 @@
1
1
  import { factory } from '../../../../../factory';
2
2
  import type { ISetting } from '../../../../../repo/setting';
3
+ import type { IOrderAsResult } from '../factory/result';
3
4
  export declare function createSendEmailMessageActions(params: {
4
- order: factory.transaction.placeOrder.IOrderAsResult & {
5
+ order: IOrderAsResult & {
5
6
  confirmationNumber: string;
6
7
  orderStatus: factory.orderStatus;
7
8
  price: number;
@@ -1,10 +1,11 @@
1
1
  import { factory } from '../../../../factory';
2
2
  import type { ISetting } from '../../../../repo/setting';
3
+ import { IOrderAsResult } from './factory/result';
3
4
  /**
4
5
  * 取引のポストアクションを作成する
5
6
  */
6
7
  export declare function createPotentialActions(params: {
7
- order: factory.transaction.placeOrder.IOrderAsResult & {
8
+ order: IOrderAsResult & {
8
9
  confirmationNumber: string;
9
10
  orderStatus: factory.orderStatus.OrderPaymentDue;
10
11
  price: number;
@@ -11,6 +11,7 @@ import type { SettingRepo } from '../../../repo/setting';
11
11
  import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
12
12
  import { factory } from '../../../factory';
13
13
  import { PlaceOrderFactory } from '../../../factory/transaction';
14
+ import { IOrderAsResult } from './confirm/factory/result';
14
15
  interface IConfirmOperationRepos {
15
16
  acceptPayAction: AcceptPayActionRepo;
16
17
  authorizePaymentMethodAction: AuthorizePaymentMethodActionRepo;
@@ -45,7 +46,7 @@ interface IConfirmOptions {
45
46
  }
46
47
  type IConfirmParams = PlaceOrderFactory.IConfirmParams;
47
48
  interface IConfirmResult {
48
- order: Pick<factory.transaction.placeOrder.IOrderAsResult, 'confirmationNumber' | 'orderNumber'>;
49
+ order: Pick<IOrderAsResult, 'confirmationNumber' | 'orderNumber'>;
49
50
  customer: factory.order.ICustomer;
50
51
  code?: string;
51
52
  /**
@@ -375,10 +375,10 @@ function createResult(params, options) {
375
375
  result: {
376
376
  authorizeActions, // 追加(2024-01-17~)
377
377
  ...(typeof params.code === 'string') ? { code: params.code } : undefined,
378
- ...((!options.disableResultOrder) && { order: orderAsResult }), // support disableResultOrder(2026-06-15~)
379
- ...((!options.disableResultOrder) && {
380
- numAcceptedOffers: params.acceptedOffers.length, // 追加(2024-01-17~)
381
- }) // support disableResultOrder(2026-06-17~)
378
+ // ...((!options.disableResultOrder) && { order: orderAsResult }), // 完全廃止(2026-06-26~)
379
+ // ...((!options.disableResultOrder) && {
380
+ // numAcceptedOffers: params.acceptedOffers.length,
381
+ // }) // 完全廃止(2026-06-26~)
382
382
  },
383
383
  ...(typeof eventId === 'string') ? { eventId } : undefined,
384
384
  ...(Array.isArray(reservationIds)) ? { reservationIds } : undefined
@@ -6,19 +6,29 @@ type IVerifiedPassport = factory.waiter.passport.IPassport & {
6
6
  */
7
7
  identifier: string;
8
8
  };
9
- type IStartPlaceOrderParams = factory.transaction.placeOrder.IStartParamsWithoutDetail & {
10
- object: factory.transaction.placeOrder.IStartParamsWithoutDetail['object'] & {
9
+ type ICustomerInObject = Pick<factory.order.ICustomer, 'id' | 'identifier' | 'typeOf'>;
10
+ interface IStartPlaceOrderParams {
11
+ project: Pick<factory.project.IProject, 'id' | 'typeOf'>;
12
+ agent: factory.transaction.placeOrder.IAgent;
13
+ seller: {
14
+ id: string;
15
+ };
16
+ object: {
11
17
  /**
12
18
  * api経由で取引が開始されれば必ず存在するはず
13
19
  */
14
20
  clientUser: factory.transaction.placeOrder.IClientUserBeforeStart;
21
+ /**
22
+ * 注文ドキュメントに保管するcustomer
23
+ */
24
+ customer?: ICustomerInObject;
25
+ passport?: factory.transaction.IPassportBeforeStart;
26
+ name?: never;
15
27
  };
16
28
  /**
17
29
  * 注文ドキュメントに保管する代理人
18
30
  */
19
31
  broker?: factory.order.IBroker;
20
- };
21
- declare function createStartParams(params: IStartPlaceOrderParams, expiresInSeconds: number, passport: IVerifiedPassport | undefined, seller: Pick<factory.seller.ISeller, 'id' | 'name' | 'typeOf' | 'project' | 'additionalProperty'>, options: {
22
- minimizeStartPlaceOrderParams: boolean;
23
- }, customerType?: string): factory.transaction.placeOrder.IStartParams;
32
+ }
33
+ declare function createStartParams(params: IStartPlaceOrderParams, expiresInSeconds: number, passport: IVerifiedPassport | undefined, seller: Pick<factory.seller.ISeller, 'id' | 'name' | 'typeOf' | 'project'>, customerType?: string): factory.transaction.placeOrder.IStartParams;
24
34
  export { AGENT_IDENTIFIER_NAME_PASSPORT, createStartParams, IStartPlaceOrderParams };
@@ -5,8 +5,8 @@ exports.createStartParams = createStartParams;
5
5
  const factory_1 = require("../../../../factory");
6
6
  const AGENT_IDENTIFIER_NAME_PASSPORT = 'passport';
7
7
  exports.AGENT_IDENTIFIER_NAME_PASSPORT = AGENT_IDENTIFIER_NAME_PASSPORT;
8
- function createStartParams(params, expiresInSeconds, passport, seller, options, customerType) {
9
- const { minimizeStartPlaceOrderParams } = options;
8
+ ;
9
+ function createStartParams(params, expiresInSeconds, passport, seller, customerType) {
10
10
  // const { broker } = params;
11
11
  // let clientUser: Omit<factory.clientUser.IClientUser, 'scope' | 'scopes'> | undefined;
12
12
  let instrument;
@@ -21,7 +21,7 @@ function createStartParams(params, expiresInSeconds, passport, seller, options,
21
21
  // ...(typeof clientUser?.client_id === 'string') ? { clientUser } : undefined, // discontinue(2026-06-10~)
22
22
  // ...(typeof params.object?.name === 'string') ? { name: params.object?.name } : undefined, // discontinue(2026-06-11~)
23
23
  // ...(typeof broker?.typeOf === 'string') ? { broker: broker } : undefined, // discontinue(2026-06-22~)
24
- ...(!minimizeStartPlaceOrderParams && typeof params.object.customer?.typeOf === 'string') ? { customer: params.object.customer } : undefined,
24
+ // ...(!minimizeStartPlaceOrderParams && typeof params.object.customer?.typeOf === 'string') ? { customer: params.object.customer } : undefined, // discontinue(2026-06-26~)
25
25
  ...(typeof customerType === 'string') ? { customerType } : undefined
26
26
  };
27
27
  if (typeof seller.id !== 'string') {
@@ -40,22 +40,28 @@ function createStartParams(params, expiresInSeconds, passport, seller, options,
40
40
  // ...(memeberOfPayload !== undefined) ? { memeberOfPayload } : undefined, // discontinue(2026-06-10~)
41
41
  identifier: agentIdentifier
42
42
  };
43
+ const sellerOfPlaceOrder = {
44
+ id: seller.id,
45
+ name: { ja: String(seller.name.ja) },
46
+ typeOf: seller.typeOf
47
+ };
43
48
  return {
44
49
  project: { typeOf: seller.project.typeOf, id: seller.project.id },
45
50
  typeOf: factory_1.factory.transactionType.PlaceOrder,
46
51
  agent,
47
- seller: (minimizeStartPlaceOrderParams)
48
- ? {
49
- id: seller.id,
50
- name: { ja: String(seller.name.ja) },
51
- typeOf: seller.typeOf
52
- }
53
- : {
54
- id: seller.id,
55
- name: seller.name,
56
- typeOf: seller.typeOf,
57
- additionalProperty: (Array.isArray(seller.additionalProperty)) ? seller.additionalProperty : [] // 追加特性を追加(2023-08-08~)
58
- },
52
+ seller: sellerOfPlaceOrder, // sellerを最小化(2026-06-26~)
53
+ // seller: (minimizeStartPlaceOrderParams)
54
+ // ? {
55
+ // id: seller.id,
56
+ // name: { ja: String(seller.name.ja) },
57
+ // typeOf: seller.typeOf
58
+ // }
59
+ // : {
60
+ // id: seller.id,
61
+ // name: seller.name,
62
+ // typeOf: seller.typeOf,
63
+ // additionalProperty: (Array.isArray(seller.additionalProperty)) ? seller.additionalProperty : [] // 追加特性を追加(2023-08-08~)
64
+ // },
59
65
  object: transactionObject,
60
66
  expiresInSeconds,
61
67
  ...(typeof instrument?.id === 'string') ? { instrument } : undefined
@@ -22,11 +22,8 @@ interface IStartOperationRepos {
22
22
  orderNumber: OrderNumberRepo;
23
23
  }
24
24
  type IStartOperation<T> = (repos: IStartOperationRepos) => Promise<T>;
25
- interface IStartOptions {
26
- minimizeStartPlaceOrderParams: boolean;
27
- }
28
25
  /**
29
26
  * 取引開始
30
27
  */
31
- declare function start(params: IStartPlaceOrderParams, options: IStartOptions): IStartOperation<IStartedPlaceOrder>;
28
+ declare function start(params: IStartPlaceOrderParams): IStartOperation<IStartedPlaceOrder>;
32
29
  export { start, IStartPlaceOrderParams };
@@ -8,7 +8,7 @@ const issueOrderNumberIfNotExist_1 = require("./issueOrderNumberIfNotExist");
8
8
  /**
9
9
  * 取引開始
10
10
  */
11
- function start(params, options) {
11
+ function start(params) {
12
12
  return async (repos) => {
13
13
  const { passport, customerType } = await repos.passport.validatePassportTokenIfExist(params);
14
14
  const { sellerMakesOffer, seller } = await (0, validateStartRequest_1.validateStartRequest)({
@@ -23,8 +23,7 @@ function start(params, options) {
23
23
  throw new factory_1.factory.errors.NotFound('eligibleTransactionDuration.maxValue');
24
24
  }
25
25
  // 取引ファクトリーで新しい進行中取引オブジェクトを作成
26
- const { minimizeStartPlaceOrderParams } = options;
27
- const startParams = (0, factory_2.createStartParams)(params, expiresInSeconds, passport, seller, { minimizeStartPlaceOrderParams }, customerType);
26
+ const startParams = (0, factory_2.createStartParams)(params, expiresInSeconds, passport, seller, customerType);
28
27
  let transaction;
29
28
  // lock passport(2024-07-05~)
30
29
  if (passport !== undefined) {
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.0.0-alpha.3",
14
+ "@chevre/factory": "9.0.0",
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.0.0-alpha.18"
94
+ "version": "25.0.0-alpha.19"
95
95
  }