@chevre/domain 21.2.0-alpha.55 → 21.2.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.
@@ -26,32 +26,10 @@ function getOrderWithToken(params) {
26
26
  if (typeof credentials_1.credentials.hub.clientId !== 'string') {
27
27
  return params.order;
28
28
  }
29
- // 冗長な個人情報をマスク(最低限の情報に)
30
- // const customer4orderToken: factory.order.ISimpleCustomer =
31
- // (params.order.customer.typeOf === factory.organizationType.Organization)
32
- // ? {
33
- // id: params.order.customer.id,
34
- // name: '****',
35
- // // project: params.order.customer.project,
36
- // typeOf: params.order.customer.typeOf
37
- // }
38
- // : {
39
- // id: params.order.customer.id,
40
- // typeOf: params.order.customer.typeOf
41
- // };
42
- // const seller4orderToken: Omit<factory.order.ISeller, 'name'> = {
43
- // id: params.order.seller.id,
44
- // typeOf: params.order.seller.typeOf
45
- // };
46
29
  // 最適化(2023-01-31~)
47
30
  const order4token = {
48
31
  typeOf: params.order.typeOf,
49
- // seller: seller4orderToken,
50
- // customer: customer4orderToken,
51
32
  orderNumber: params.order.orderNumber
52
- // price: params.order.price,
53
- // priceCurrency: params.order.priceCurrency,
54
- // orderDate: params.order.orderDate
55
33
  };
56
34
  const token = yield new Promise((resolve, reject) => {
57
35
  // 所有権を暗号化する
@@ -163,26 +141,31 @@ const ORDER_STORAGE_PERIOD_IN_DAYS = (typeof process.env.ORDER_STORAGE_PERIOD_IN
163
141
  // tslint:disable-next-line:no-magic-numbers
164
142
  365;
165
143
  function createDeleteTasks(order) {
166
- return [{
167
- project: order.project,
168
- name: factory.taskName.DeleteOrder,
169
- status: factory.taskStatus.Ready,
170
- runsAt: moment(order.orderDate)
171
- .add(ORDER_STORAGE_PERIOD_IN_DAYS, 'days')
172
- .toDate(),
173
- remainingNumberOfTries: 10,
174
- numberOfTried: 0,
175
- executionResults: [],
176
- data: {
177
- object: {
178
- confirmationNumber: order.confirmationNumber,
179
- orderDate: order.orderDate,
180
- orderNumber: order.orderNumber,
181
- project: order.project,
182
- typeOf: order.typeOf
144
+ if (settings_1.USE_DELETE_ORDER_TASK) {
145
+ return [{
146
+ project: order.project,
147
+ name: factory.taskName.DeleteOrder,
148
+ status: factory.taskStatus.Ready,
149
+ runsAt: moment(order.orderDate)
150
+ .add(ORDER_STORAGE_PERIOD_IN_DAYS, 'days')
151
+ .toDate(),
152
+ remainingNumberOfTries: 10,
153
+ numberOfTried: 0,
154
+ executionResults: [],
155
+ data: {
156
+ object: {
157
+ confirmationNumber: order.confirmationNumber,
158
+ orderDate: order.orderDate,
159
+ orderNumber: order.orderNumber,
160
+ project: order.project,
161
+ typeOf: order.typeOf
162
+ }
183
163
  }
184
- }
185
- }];
164
+ }];
165
+ }
166
+ else {
167
+ return [];
168
+ }
186
169
  }
187
170
  exports.createDeleteTasks = createDeleteTasks;
188
171
  function createConfirmReservationActionObject4ChevreByOrder(params) {
@@ -35,6 +35,10 @@ function call(data) {
35
35
  offer: offerRepo,
36
36
  masterService
37
37
  });
38
+ yield OfferService.event.importCategoryCodesFromCOA(data)({
39
+ categoryCode: categoryCodeRepo,
40
+ masterService
41
+ });
38
42
  });
39
43
  }
40
44
  exports.call = call;
@@ -7,6 +7,7 @@ const settings_1 = require("../../../../settings");
7
7
  /**
8
8
  * 取引のタスクを作成する
9
9
  */
10
+ // tslint:disable-next-line:max-func-body-length
10
11
  function createTasks(params) {
11
12
  const taskAttributes = [];
12
13
  const transaction = params.transaction;
@@ -38,6 +39,9 @@ function createTasks(params) {
38
39
  object: {
39
40
  endDate: transaction.endDate,
40
41
  id: transaction.id,
42
+ object: Object.assign({}, (transaction.object.pendingTransaction !== undefined)
43
+ ? { pendingTransaction: transaction.object.pendingTransaction }
44
+ : undefined),
41
45
  project: transaction.project,
42
46
  startDate: transaction.startDate,
43
47
  typeOf: transaction.typeOf
@@ -17,7 +17,9 @@ function createStartParams(params, passport, seller, amount, fromLocation, toLoc
17
17
  // ↓最適化(2022-05-24~)
18
18
  // ...{ project: seller.project }
19
19
  },
20
- object: Object.assign(Object.assign({ amount: amount, fromLocation: fromLocation, toLocation: toLocation, authorizeActions: [], pendingTransaction: Object.assign({ transactionNumber }, (typeof ((_a = params.object.pendingTransaction) === null || _a === void 0 ? void 0 : _a.identifier) === 'string')
20
+ object: Object.assign(Object.assign({ amount: amount, fromLocation: fromLocation, toLocation: toLocation,
21
+ // authorizeActions: [],
22
+ pendingTransaction: Object.assign({ transactionNumber }, (typeof ((_a = params.object.pendingTransaction) === null || _a === void 0 ? void 0 : _a.identifier) === 'string')
21
23
  ? { identifier: params.object.pendingTransaction.identifier }
22
24
  : undefined) }, (passport !== undefined) ? { passport } : undefined), (typeof params.object.description === 'string') ? { description: params.object.description } : undefined),
23
25
  expires: params.expires
@@ -4,5 +4,6 @@ export type IAuthorizeMoneyTransferOffer = factory.action.authorize.offer.moneyT
4
4
  * 取引のポストアクションを作成する
5
5
  */
6
6
  export declare function createPotentialActions(params: {
7
+ authorizeActions: factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>>[];
7
8
  transaction: factory.transaction.ITransaction<factory.transactionType.MoneyTransfer>;
8
9
  }): Promise<factory.transaction.IPotentialActions<factory.transactionType.MoneyTransfer>>;
@@ -13,7 +13,7 @@ exports.createPotentialActions = void 0;
13
13
  const factory = require("../../../factory");
14
14
  function createMoneyTransferActions(params) {
15
15
  const moneyTransferActions = [];
16
- const authorizeMoneyTransferActions = params.transaction.object.authorizeActions
16
+ const authorizeMoneyTransferActions = params.authorizeActions
17
17
  .filter((a) => a.actionStatus === factory.actionStatusType.CompletedActionStatus)
18
18
  .filter((a) => a.object.typeOf === factory.offerType.Offer)
19
19
  .filter((a) => { var _a; return ((_a = a.object.itemOffered) === null || _a === void 0 ? void 0 : _a.typeOf) === factory.actionType.MoneyTransfer; });
@@ -519,19 +519,17 @@ function confirm(params) {
519
519
  // throw new factory.errors.Forbidden('Transaction not yours');
520
520
  // }
521
521
  // 取引に対する全ての承認アクションをマージ
522
- transaction.object.authorizeActions = yield searchAuthorizeActions({
522
+ const authorizeActions = yield searchAuthorizeActions({
523
523
  transaction: transaction,
524
524
  now: now
525
525
  })(repos);
526
526
  // ポストアクションを作成
527
- const potentialActions = yield (0, potentialActions_1.createPotentialActions)({
528
- transaction: transaction
529
- });
527
+ const potentialActions = yield (0, potentialActions_1.createPotentialActions)({ authorizeActions, transaction });
530
528
  // 取引確定
531
529
  yield repos.transaction.confirm({
532
530
  typeOf: factory.transactionType.MoneyTransfer,
533
531
  id: transaction.id,
534
- authorizeActions: transaction.object.authorizeActions,
532
+ authorizeActions: [],
535
533
  result: {},
536
534
  potentialActions: potentialActions
537
535
  });
@@ -551,9 +549,8 @@ function searchAuthorizeActions(params) {
551
549
  });
552
550
  // 万が一このプロセス中に他処理が発生してもそれらを無視するように、endDateでフィルタリング
553
551
  authorizeActions = authorizeActions.filter((a) => {
554
- return a.endDate !== undefined
555
- && moment(a.endDate)
556
- .toDate() < params.now;
552
+ return (a.endDate instanceof Date) && moment(a.endDate)
553
+ .isBefore(moment(params.now));
557
554
  });
558
555
  return authorizeActions;
559
556
  });
@@ -78,6 +78,11 @@ function createTasks(params) {
78
78
  object: {
79
79
  endDate: transaction.endDate,
80
80
  id: transaction.id,
81
+ object: Object.assign(Object.assign({}, (typeof transaction.object.confirmationNumber === 'string')
82
+ ? { confirmationNumber: transaction.object.confirmationNumber }
83
+ : undefined), (typeof transaction.object.orderNumber === 'string')
84
+ ? { orderNumber: transaction.object.orderNumber }
85
+ : undefined),
81
86
  project: transaction.project,
82
87
  startDate: transaction.startDate,
83
88
  typeOf: transaction.typeOf
@@ -1,6 +1,3 @@
1
- /**
2
- * 進行中注文取引サービス
3
- */
4
1
  import * as factory from '../../factory';
5
2
  import { MongoRepository as ActionRepo } from '../../repo/action';
6
3
  import { RedisRepository as ConfirmationNumberRepo } from '../../repo/confirmationNumber';
@@ -13,6 +13,7 @@ exports.voidAward = exports.authorizeAward = exports.publishOrderNumberIfNotExis
13
13
  /**
14
14
  * 進行中注文取引サービス
15
15
  */
16
+ const moment = require("moment");
16
17
  const factory = require("../../factory");
17
18
  const factory_1 = require("./placeOrderInProgress/factory");
18
19
  const potentialActions_1 = require("./placeOrderInProgress/potentialActions");
@@ -262,7 +263,10 @@ function searchAuthorizeActions(params) {
262
263
  actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
263
264
  });
264
265
  // 万が一このプロセス中に他処理が発生してもそれらを無視するように、endDateでフィルタリング
265
- authorizeActions = authorizeActions.filter((a) => (a.endDate !== undefined && a.endDate < params.result.order.orderDate));
266
+ authorizeActions = authorizeActions.filter((a) => {
267
+ return (a.endDate instanceof Date) && moment(a.endDate)
268
+ .isBefore(moment(params.result.order.orderDate));
269
+ });
266
270
  return authorizeActions;
267
271
  });
268
272
  }
@@ -39,6 +39,9 @@ function createTasks(params) {
39
39
  object: {
40
40
  endDate: transaction.endDate,
41
41
  id: transaction.id,
42
+ object: {
43
+ order: transaction.object.order
44
+ },
42
45
  project: transaction.project,
43
46
  startDate: transaction.startDate,
44
47
  typeOf: transaction.typeOf
@@ -33,6 +33,7 @@ export declare const DEFAULT_TASKS_EXPORT_AGENT_NAME: string;
33
33
  export declare const USE_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
34
34
  export declare const USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
35
35
  export declare const USE_NEW_EVENT_AVAILABILITY_KEY_FROM: moment.Moment;
36
+ export declare const USE_DELETE_ORDER_TASK: boolean;
36
37
  export declare const INFORM_RESERVATION_TASK_DELAY_IN_SECONDS: number;
37
38
  /**
38
39
  * グローバル設定
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.settings = exports.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS = exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.ABORTED_TASKS_WITHOUT_REPORT = exports.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS = exports.TRIGGER_WEBHOOK_MAX_RETRY_COUNT = void 0;
3
+ exports.settings = exports.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS = exports.USE_DELETE_ORDER_TASK = exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.ABORTED_TASKS_WITHOUT_REPORT = exports.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS = exports.TRIGGER_WEBHOOK_MAX_RETRY_COUNT = void 0;
4
4
  const moment = require("moment");
5
5
  const factory = require("./factory");
6
6
  const transactionWebhookUrls = (typeof process.env.INFORM_TRANSACTION_URL === 'string')
@@ -59,6 +59,7 @@ exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = process.env.USE_PAY_ASSET_TR
59
59
  exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = (typeof process.env.USE_NEW_EVENT_AVAILABILITY_KEY_FROM === 'string')
60
60
  ? moment(process.env.USE_NEW_EVENT_AVAILABILITY_KEY_FROM)
61
61
  : moment('2023-08-31T15:00:00Z');
62
+ exports.USE_DELETE_ORDER_TASK = process.env.USE_DELETE_ORDER_TASK === '1';
62
63
  exports.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS = (typeof process.env.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS === 'string')
63
64
  ? Number(process.env.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS)
64
65
  : 0;
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.313.0-alpha.2",
12
+ "@chevre/factory": "4.313.0-alpha.3",
13
13
  "@cinerino/sdk": "3.156.0",
14
14
  "@motionpicture/coa-service": "9.2.0",
15
15
  "@motionpicture/gmo-service": "5.2.0",
@@ -117,5 +117,5 @@
117
117
  "postversion": "git push origin --tags",
118
118
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
119
119
  },
120
- "version": "21.2.0-alpha.55"
120
+ "version": "21.2.0-alpha.57"
121
121
  }