@chevre/domain 24.1.0-alpha.56 → 24.1.0-alpha.57

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.
@@ -16,7 +16,10 @@ type IAcceptedOffer = factory.order.IAcceptedOffer & {
16
16
  /**
17
17
  * typeOf: Orderへドキュメント変換時の編集フィールド
18
18
  */
19
- export type IPlacingOrder = Pick<factory.order.IOrder, 'broker' | 'confirmationNumber' | 'identifier' | 'isGift' | 'name' | 'orderDate' | 'orderNumber' | 'orderStatus' | 'orderedItem' | 'paymentMethods' | 'price' | 'priceCurrency' | 'seller' | 'typeOf' | 'url'> & {
19
+ export type IPlacingOrder = Pick<factory.order.IOrder, 'broker' | 'confirmationNumber' | 'isGift' | 'orderDate' | 'orderNumber' | 'orderStatus' | 'orderedItem' | 'paymentMethods' | 'price' | 'priceCurrency' | 'seller' | 'typeOf'> & {
20
+ url?: never;
21
+ identifier?: never;
22
+ name?: never;
20
23
  /**
21
24
  * 上書きしてはいけない
22
25
  */
@@ -15,7 +15,6 @@ function createPaymentMethods(params) {
15
15
  // 決済方法をセット
16
16
  params.authorizePaymentActions.forEach((a) => {
17
17
  const resultAsInvoice = (Array.isArray(a.result))
18
- // ? a.result?.find(({ typeOf }) => typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
19
18
  ? a.result[0]
20
19
  : undefined;
21
20
  if (resultAsInvoice === undefined) {
@@ -42,16 +41,12 @@ function createPaymentMethods(params) {
42
41
  paymentStatus: resultAsInvoice.paymentStatus,
43
42
  paymentMethod: paymentMethodOfInvoice,
44
43
  ...(resultAsInvoice.totalPaymentDue !== undefined) ? { totalPaymentDue: resultAsInvoice.totalPaymentDue } : undefined
45
- // ...(USE_ORDER_PAYMENT_METHOD_TYPE_OF) // 完全廃止(2024-01-17~)
46
- // ? { typeOf: paymentMethodType }
47
- // : undefined
48
44
  });
49
45
  });
50
46
  // 決済方法から注文金額の計算
51
47
  price += params.authorizePaymentActions
52
48
  .reduce((a, b) => {
53
49
  const resultAsInvoice = (Array.isArray(b.result))
54
- // ? b.result?.find(({ typeOf }) => typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
55
50
  ? b.result[0]
56
51
  : undefined;
57
52
  const jpyAmount = (resultAsInvoice?.totalPaymentDue?.currency === factory_1.factory.priceCurrency.JPY)
@@ -78,32 +73,24 @@ function createPlacingOrder(params) {
78
73
  throw new factory_1.factory.errors.NotFound('transaction.result.order');
79
74
  }
80
75
  const seller = createSeller({ transaction });
81
- const name = (typeof transaction.object.name === 'string') ? transaction.object.name : undefined;
76
+ // discontinue(2026-06-11~)
77
+ // const name: string | undefined =
78
+ // (typeof transaction.object.name === 'string') ? transaction.object.name : undefined;
82
79
  const broker = (typeof transaction.object.broker?.typeOf === 'string') ? transaction.object.broker : undefined;
83
80
  const { paymentMethods, price } = createPaymentMethods({ authorizePaymentActions });
84
81
  const eventReservationAcceptedOffers = [];
85
- // const productAcceptedOffers: factory.order.IAcceptedOffer<factory.order.IPermit>[] = [];
86
- // const moneyTransferAcceptedOffers: factory.order.IAcceptedOffer<factory.order.IMoneyTransfer>[] = [];
87
82
  params.acceptedOffers.forEach((acceptedOffer) => {
88
83
  const itemOfferedTypeOf = acceptedOffer.itemOffered.typeOf;
89
84
  switch (itemOfferedTypeOf) {
90
85
  case factory_1.factory.reservationType.EventReservation:
91
86
  eventReservationAcceptedOffers.push(acceptedOffer);
92
87
  break;
93
- // case factory.permit.PermitType.Permit:
94
- // productAcceptedOffers.push((acceptedOffer as factory.order.IAcceptedOffer<factory.order.IPermit>));
95
- // break;
96
- // case factory.actionType.MoneyTransfer:
97
- // moneyTransferAcceptedOffers.push(<factory.order.IAcceptedOffer<factory.order.IMoneyTransfer>>acceptedOffer);
98
- // break;
99
88
  default:
100
89
  throw new factory_1.factory.errors.NotImplemented(`${itemOfferedTypeOf} not implemented`);
101
90
  }
102
91
  });
103
92
  const orderedItem = (0, orderedItem_1.acceptedOffers2orderedItem)({
104
93
  eventReservationAcceptedOffers,
105
- // productAcceptedOffers,
106
- // moneyTransferAcceptedOffers
107
94
  });
108
95
  return {
109
96
  ...orderByTransaction,
@@ -113,7 +100,7 @@ function createPlacingOrder(params) {
113
100
  orderDate: (0, moment_1.default)(orderByTransaction.orderDate)
114
101
  .toDate(),
115
102
  orderedItem, // 2024-06-18~
116
- ...(typeof name === 'string') ? { name } : undefined, // 2024-06-17~
103
+ // ...(typeof name === 'string') ? { name } : undefined, // discontinue(2026-06-11~)
117
104
  ...(typeof broker?.typeOf === 'string') ? { broker } : undefined // 2024-06-17~
118
105
  };
119
106
  }
@@ -31,15 +31,7 @@ function placeOrder(params) {
31
31
  }
32
32
  const simpleOrder = {
33
33
  typeOf: order.typeOf,
34
- // seller: {
35
- // id: order.seller.id,
36
- // typeOf: order.seller.typeOf,
37
- // name: order.seller.name
38
- // }, // 廃止(2024-03-06~)
39
- // customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id }, // 廃止(2024-03-06~)
40
34
  orderNumber: order.orderNumber,
41
- // price: order.price,
42
- // priceCurrency: order.priceCurrency,
43
35
  orderDate: order.orderDate
44
36
  };
45
37
  const orderActionPurpose = {
@@ -48,7 +40,6 @@ function placeOrder(params) {
48
40
  const orderActionAttributes = {
49
41
  agent: (typeof params.agent?.typeOf === 'string') ? params.agent : placeOrderTransaction.project,
50
42
  object: simpleOrder,
51
- // potentialActions: {}, // discontinue(2024-06-28~)
52
43
  project: placeOrderTransaction.project,
53
44
  purpose: orderActionPurpose,
54
45
  typeOf: factory_1.factory.actionType.OrderAction
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createOrderAsResult = createOrderAsResult;
4
4
  const factory_1 = require("../../../../../factory");
5
- // import { acceptedOffers2orderedItem } from './result/orderedItem';
6
5
  /**
7
6
  * 注文取引結果としての注文を生成する
8
7
  */
@@ -12,20 +11,11 @@ function createOrderAsResult(params) {
12
11
  typeOf: factory_1.factory.order.OrderType.Order,
13
12
  price,
14
13
  priceCurrency: factory_1.factory.priceCurrency.JPY,
15
- // discounts: discounts, // 廃止(2024-04-16~)
16
14
  confirmationNumber: '',
17
15
  orderNumber,
18
- url: '',
16
+ // url: '', // discontinue(2026-06-11~)
19
17
  orderStatus,
20
18
  orderDate,
21
- identifier: []
22
- // orderedItem: params.orderedItem, // discontinue(2024-06-20~)
23
- // paymentMethods: params.paymentMethods, // discontinue(2024-06-20~)
24
- // customer, // discontinue(2024-06-20~)
25
- // project: params.transaction.project, // discontinue(2024-06-20~)
26
- // seller, // discontinue(2024-06-20~)
27
- // isGift: params.isGift, // discontinue(2024-06-20~)
28
- // ...(typeof name === 'string') ? { name } : undefined, // discontinue(2024-06-20~)
29
- // ...(typeof broker?.typeOf === 'string') ? { broker } : undefined // discontinue(2024-06-20~)
19
+ // identifier: [] // discontinue(2026-06-11~)
30
20
  };
31
21
  }
@@ -335,14 +335,17 @@ function createResult(params, options) {
335
335
  });
336
336
  (0, validation_1.validatePaymentMethods)({ order: { paymentMethods } }, options);
337
337
  // 確認番号を発行
338
- const { confirmationNumber, identifier, url } = createConfirmationNumber({
338
+ const { confirmationNumber,
339
+ // identifier,
340
+ // url
341
+ } = createConfirmationNumber({
339
342
  order: orderAsResult,
340
343
  transaction: transaction,
341
344
  result: params.result
342
345
  });
343
346
  orderAsResult.confirmationNumber = confirmationNumber;
344
- orderAsResult.identifier = identifier;
345
- orderAsResult.url = url;
347
+ // orderAsResult.identifier = identifier; // discontinue(2026-06-11~)
348
+ // orderAsResult.url = url; // discontinue(2026-06-11~)
346
349
  const authorizeActions = [
347
350
  ...params.authorizePaymentActions.map(({ id }) => ({ id })),
348
351
  ...params.authorizeEventServiceOfferActions.map(({ id }) => ({ id })),
@@ -443,26 +446,29 @@ function searchAuthorizeActions(params) {
443
446
  }
444
447
  function createConfirmationNumber(params) {
445
448
  const confirmationNumber = params.transaction.object.confirmationNumber;
446
- let url = '';
449
+ // let url = '';
447
450
  // 取引に確認番号が保管されていなければ、確認番号を発行
448
451
  if (typeof confirmationNumber !== 'string') {
449
452
  // 事前に発行済なはずなので、ありえないフロー
450
453
  throw new factory_1.factory.errors.Internal('object.confirmationNumber undefined');
451
454
  }
452
- // URLの指定があれば上書き
453
- /* istanbul ignore if */
454
- if (typeof params.result.order.url === 'string') {
455
- url = params.result.order.url;
456
- }
457
- else /* istanbul ignore next */ if (typeof params.result.order.url === 'function') {
458
- /* istanbul ignore next */
459
- url = params.result.order.url(params.order);
460
- }
461
- // 識別子の指定があれば上書き
462
- const identifier = [
463
- ...(Array.isArray(params.result.order.identifier)) ? params.result.order.identifier : [],
464
- // 取引に指定があれば追加
465
- ...(Array.isArray(params.transaction.object.identifier)) ? params.transaction.object.identifier : []
466
- ];
467
- return { confirmationNumber, url, identifier };
455
+ // // URLの指定があれば上書き
456
+ // /* istanbul ignore if */
457
+ // if (typeof params.result.order.url === 'string') {
458
+ // url = params.result.order.url;
459
+ // } else /* istanbul ignore next */ if (typeof params.result.order.url === 'function') {
460
+ // /* istanbul ignore next */
461
+ // url = (params.result.order.url as IOrderURLGenerator)(params.order);
462
+ // }
463
+ // // 識別子の指定があれば上書き
464
+ // const identifier: factory.order.IIdentifier = [
465
+ // ...(Array.isArray(params.result.order.identifier)) ? params.result.order.identifier : [],
466
+ // // 取引に指定があれば追加
467
+ // ...(Array.isArray(params.transaction.object.identifier)) ? params.transaction.object.identifier : []
468
+ // ];
469
+ return {
470
+ confirmationNumber,
471
+ // url,
472
+ // identifier
473
+ };
468
474
  }
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": "8.2.0-alpha.9",
14
+ "@chevre/factory": "8.2.0-alpha.10",
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": "24.1.0-alpha.56"
94
+ "version": "24.1.0-alpha.57"
95
95
  }