@chevre/domain 22.2.0-alpha.25 → 22.2.0-alpha.26

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.
@@ -224,11 +224,11 @@ export declare class ActionRepo {
224
224
  id: string;
225
225
  };
226
226
  }): Promise<void>;
227
- updateAuthorizeEventOfferAction(params: {
227
+ reCompleteAuthorizeEventOfferAction(params: {
228
228
  id: string;
229
229
  object: factory.action.authorize.offer.eventService.IObject;
230
230
  result: factory.action.authorize.offer.eventService.IResult;
231
- }): Promise<factory.action.authorize.offer.eventService.IAction<factory.service.webAPI.Identifier.COA>>;
231
+ }): Promise<void>;
232
232
  updateById(params: {
233
233
  id: string;
234
234
  update: any;
@@ -823,7 +823,7 @@ class ActionRepo {
823
823
  .exec();
824
824
  });
825
825
  }
826
- updateAuthorizeEventOfferAction(params) {
826
+ reCompleteAuthorizeEventOfferAction(params) {
827
827
  return __awaiter(this, void 0, void 0, function* () {
828
828
  return this.actionModel.findOneAndUpdate({
829
829
  // typeOf: factory.actionType.AuthorizeAction,
@@ -838,13 +838,13 @@ class ActionRepo {
838
838
  result: params.result,
839
839
  endDate: new Date()
840
840
  }
841
- }, { new: true })
841
+ }, { new: true, projection: { _id: 1 } })
842
+ .lean()
842
843
  .exec()
843
844
  .then((doc) => {
844
845
  if (doc === null) {
845
846
  throw new factory.errors.NotFound(this.actionModel.modelName);
846
847
  }
847
- return doc.toObject();
848
848
  });
849
849
  });
850
850
  }
@@ -86,5 +86,7 @@ declare function authorize(params: {
86
86
  */
87
87
  id: string;
88
88
  };
89
- }, options: IAuthorizeOptions): IAuthorizeOperation<Pick<IAuthorizeOfferAction, 'id'>>;
89
+ }, options: IAuthorizeOptions): IAuthorizeOperation<Pick<IAuthorizeOfferAction, 'id'> & {
90
+ result: IAuthorizeOfferAction['result'];
91
+ }>;
90
92
  export { authorize };
@@ -68,7 +68,7 @@ function authorize(params, options) {
68
68
  }
69
69
  const result = (0, factory_1.acceptedOffers2authorizeResult)({ acceptedOffers, acceptedOffers4result, noOfferSpecified, ticketOffers });
70
70
  yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: result });
71
- return { id: action.id };
71
+ return { id: action.id, result };
72
72
  });
73
73
  }
74
74
  exports.authorize = authorize;
@@ -57,4 +57,6 @@ export declare function authorize(params: {
57
57
  responseBody: IResponseBody;
58
58
  };
59
59
  options: {};
60
- }): IAuthorizeOperation<Pick<IAuthorizeOfferAction, 'id'>>;
60
+ }): IAuthorizeOperation<Pick<IAuthorizeOfferAction, 'id' | 'instrument'> & {
61
+ result: IAuthorizeOfferAction['result'];
62
+ }>;
@@ -140,7 +140,11 @@ function authorize(params) {
140
140
  throw error;
141
141
  }
142
142
  yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result });
143
- return { id: action.id };
143
+ return {
144
+ id: action.id,
145
+ instrument: actionAttributes.instrument,
146
+ result
147
+ };
144
148
  });
145
149
  }
146
150
  exports.authorize = authorize;
@@ -26,5 +26,7 @@ export declare function authorizeByAcceptAction(params: {
26
26
  */
27
27
  id: string;
28
28
  };
29
- }): IAuthorizeOperation<Pick<IAuthorizeOfferAction, 'id'>>;
29
+ }): IAuthorizeOperation<Pick<IAuthorizeOfferAction, 'id' | 'instrument'> & {
30
+ result: IAuthorizeOfferAction['result'];
31
+ }>;
30
32
  export {};
@@ -20,4 +20,6 @@ export declare function changeOffers(params: {
20
20
  id: string;
21
21
  };
22
22
  options: {};
23
- }): IAuthorizeOperation<IAuthorizeOfferAction>;
23
+ }): IAuthorizeOperation<Pick<IAuthorizeOfferAction, 'id' | 'instrument'> & {
24
+ result: IAuthorizeOfferAction['result'];
25
+ }>;
@@ -40,6 +40,9 @@ function changeOffers(params) {
40
40
  if (authorizeAction.purpose.typeOf !== transaction.typeOf || authorizeAction.purpose.id !== transaction.id) {
41
41
  throw new factory.errors.Argument('Transaction', 'Action not found in the transaction');
42
42
  }
43
+ if (authorizeAction.result === undefined) {
44
+ throw new factory.errors.NotFound('authorizeAction.result');
45
+ }
43
46
  const originalAcceptActionId = authorizeAction.object.id;
44
47
  if (typeof originalAcceptActionId !== 'string' || originalAcceptActionId === '') {
45
48
  throw new factory.errors.NotFound('authorizeAction.object.id');
@@ -153,12 +156,17 @@ function changeOffers(params) {
153
156
  }
154
157
  throw error;
155
158
  }
156
- // 座席予約承認アクションの供給情報を変更する
157
- return repos.action.updateAuthorizeEventOfferAction({
159
+ // 承認アクションを再完了
160
+ yield repos.action.reCompleteAuthorizeEventOfferAction({
158
161
  id: params.id,
159
162
  object: authorizeAction.object,
160
163
  result: actionResult
161
164
  });
165
+ return {
166
+ id: params.id,
167
+ instrument: authorizeAction.instrument,
168
+ result: actionResult
169
+ };
162
170
  });
163
171
  }
164
172
  exports.changeOffers = changeOffers;
@@ -93,7 +93,9 @@ export declare function authorize(params: {
93
93
  transaction: {
94
94
  id: string;
95
95
  };
96
- }): IAuthorizeOperation<Pick<IAuthorizeOfferAction, 'id'>>;
96
+ }): IAuthorizeOperation<Pick<IAuthorizeOfferAction, 'id'> & {
97
+ result: IAuthorizeOfferAction['result'];
98
+ }>;
97
99
  export declare function voidTransaction(params: factory.task.IData<factory.taskName.VoidRegisterServiceTransaction>): (repos: {
98
100
  action: ActionRepo;
99
101
  assetTransaction: AssetTransactionRepo;
@@ -164,7 +164,7 @@ function authorize(params) {
164
164
  throw error;
165
165
  }
166
166
  yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: result });
167
- return { id: action.id };
167
+ return { id: action.id, result };
168
168
  });
169
169
  }
170
170
  exports.authorize = authorize;
package/package.json CHANGED
@@ -110,5 +110,5 @@
110
110
  "postversion": "git push origin --tags",
111
111
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
112
112
  },
113
- "version": "22.2.0-alpha.25"
113
+ "version": "22.2.0-alpha.26"
114
114
  }