@chevre/domain 20.12.0-alpha.1 → 20.12.0

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.
@@ -13,6 +13,7 @@ import { MongoRepository as ProductRepo } from '../../repo/product';
13
13
  import { MongoRepository as ProjectRepo } from '../../repo/project';
14
14
  import { MongoRepository as SellerRepo } from '../../repo/seller';
15
15
  import { MongoRepository as TaskRepo } from '../../repo/task';
16
+ import * as MovieTicketPayment from '../payment/movieTicket';
16
17
  export interface IStartOperationRepos {
17
18
  accountingReport: AccountingReportRepo;
18
19
  action: ActionRepo;
@@ -89,7 +90,9 @@ export declare function invalidatePaymentUrl(params: factory.task.refund.IData):
89
90
  /**
90
91
  * 決済方法認証
91
92
  */
92
- export declare function check(params: factory.action.check.paymentMethod.movieTicket.IAttributes): ICheckOperation<factory.action.check.paymentMethod.movieTicket.IAction>;
93
+ export declare function check(params: factory.action.check.paymentMethod.movieTicket.IAttributes): ICheckOperation<{
94
+ result: MovieTicketPayment.ICheckResult;
95
+ }>;
93
96
  /**
94
97
  * 取引開始
95
98
  */
@@ -80,7 +80,9 @@ exports.invalidatePaymentUrl = invalidatePaymentUrl;
80
80
  /**
81
81
  * 決済方法認証
82
82
  */
83
- function check(params) {
83
+ function check(params
84
+ // ): ICheckOperation<factory.action.check.paymentMethod.movieTicket.IAction> {
85
+ ) {
84
86
  return (repos) => __awaiter(this, void 0, void 0, function* () {
85
87
  var _a;
86
88
  let action;
@@ -59,9 +59,9 @@ function processVoidTransaction4coa(params) {
59
59
  const action = params.action;
60
60
  // COAの場合、resultに連携内容情報が記録されているので、その情報を元に仮予約を取り消す
61
61
  if (action.result !== undefined) {
62
- const updTmpReserveSeatArgs = action.result.requestBody;
63
- const updTmpReserveSeatResult = action.result.responseBody;
64
- if (updTmpReserveSeatArgs !== undefined && updTmpReserveSeatResult !== undefined) {
62
+ const coaRequestBody = action.result.requestBody;
63
+ const coaResponseBody = action.result.responseBody;
64
+ if (coaRequestBody !== undefined && coaResponseBody !== undefined) {
65
65
  // COAで仮予約取消
66
66
  try {
67
67
  const reserveService = new COA.service.Reserve({
@@ -69,12 +69,12 @@ function processVoidTransaction4coa(params) {
69
69
  auth: coaAuthClient
70
70
  }, { timeout: credentials_1.credentials.coa.timeout });
71
71
  yield reserveService.delTmpReserve({
72
- theaterCode: updTmpReserveSeatArgs.theaterCode,
73
- dateJouei: updTmpReserveSeatArgs.dateJouei,
74
- titleCode: updTmpReserveSeatArgs.titleCode,
75
- titleBranchNum: updTmpReserveSeatArgs.titleBranchNum,
76
- timeBegin: updTmpReserveSeatArgs.timeBegin,
77
- tmpReserveNum: updTmpReserveSeatResult.tmpReserveNum
72
+ theaterCode: coaRequestBody.theaterCode,
73
+ dateJouei: coaRequestBody.dateJouei,
74
+ titleCode: coaRequestBody.titleCode,
75
+ titleBranchNum: coaRequestBody.titleBranchNum,
76
+ timeBegin: coaRequestBody.timeBegin,
77
+ tmpReserveNum: coaResponseBody.tmpReserveNum
78
78
  });
79
79
  }
80
80
  catch (error) {
@@ -88,9 +88,6 @@ function processVoidTransaction4coa(params) {
88
88
  if (error.message === '座席取消失敗') {
89
89
  deleted = true;
90
90
  }
91
- // if (action.actionStatus === factory.actionStatusType.CanceledActionStatus) {
92
- // deleted = true;
93
- // }
94
91
  }
95
92
  }
96
93
  if (!deleted) {
@@ -53,8 +53,6 @@ function authorize(params) {
53
53
  seatingTypes,
54
54
  videoFormatTypes
55
55
  })(repos);
56
- const updTmpReserveSeatArgs = params.result.requestBody;
57
- const updTmpReserveSeatResult = params.result.responseBody;
58
56
  // 承認アクションを開始
59
57
  const actionAttributes = (0, factory_1.createAuthorizeSeatReservationActionAttributes)({
60
58
  acceptedOffers,
@@ -78,7 +76,7 @@ function authorize(params) {
78
76
  // 座席仮予約からオファー情報を生成する
79
77
  const { price, eligibleMonetaryAmount } = (0, factory_1.offers2resultPrice)(acceptedOffers);
80
78
  const acceptedOffers4result = (0, factory_1.responseBody2acceptedOffers4result)({
81
- responseBody: updTmpReserveSeatResult,
79
+ responseBody: params.result.responseBody,
82
80
  object: action.object,
83
81
  event: screeningEvent,
84
82
  seller: transaction.seller,
@@ -86,7 +84,9 @@ function authorize(params) {
86
84
  .toDate(),
87
85
  totalPrice: price
88
86
  });
89
- const result = Object.assign({ price: price, priceCurrency: factory.priceCurrency.JPY,
87
+ const result = {
88
+ price: price,
89
+ priceCurrency: factory.priceCurrency.JPY,
90
90
  // eligibleMonetaryAmountを使用(2023-03-08~)
91
91
  // amount: (requiredPoint > 0)
92
92
  // ? [{
@@ -95,8 +95,13 @@ function authorize(params) {
95
95
  // value: requiredPoint
96
96
  // }]
97
97
  // : [],
98
- amount: eligibleMonetaryAmount, requestBody: updTmpReserveSeatArgs, responseBody: updTmpReserveSeatResult, acceptedOffers: acceptedOffers4result }, { updTmpReserveSeatArgs, updTmpReserveSeatResult } // 互換性維持のため
99
- );
98
+ amount: eligibleMonetaryAmount,
99
+ requestBody: params.result.requestBody,
100
+ responseBody: params.result.responseBody,
101
+ acceptedOffers: acceptedOffers4result
102
+ // 不要なので廃止(2023-03-27~)
103
+ // ...{ updTmpReserveSeatArgs, updTmpReserveSeatResult } // 互換性維持のため
104
+ };
100
105
  return yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: result });
101
106
  });
102
107
  }
@@ -34,11 +34,12 @@ interface IRefundOperationRepos {
34
34
  task: TaskRepo;
35
35
  }
36
36
  declare type IRefundOperation<T> = (repos: IRefundOperationRepos) => Promise<T>;
37
- declare type ICheckMovieTicketAction = factory.action.check.paymentMethod.movieTicket.IAction;
38
37
  /**
39
38
  * MovieTicket認証
40
39
  */
41
- declare function checkMovieTicket(params: factory.action.check.paymentMethod.movieTicket.IAttributes): ICheckOperation<ICheckMovieTicketAction>;
40
+ declare function checkMovieTicket(params: factory.action.check.paymentMethod.movieTicket.IAttributes): ICheckOperation<{
41
+ result: ICheckResult;
42
+ }>;
42
43
  interface IAuthorizeResult {
43
44
  accountId: string;
44
45
  checkResult?: ICheckResult;
@@ -23,6 +23,7 @@ const validation_1 = require("./movieTicket/validation");
23
23
  const errorHandler_1 = require("../../errorHandler");
24
24
  const onPaid_1 = require("./any/onPaid");
25
25
  const onRefund_1 = require("./any/onRefund");
26
+ // type ICheckMovieTicketAction = factory.action.check.paymentMethod.movieTicket.IAction;
26
27
  /**
27
28
  * MovieTicket認証
28
29
  */
@@ -84,8 +85,16 @@ function checkMovieTicket(params) {
84
85
  error = (0, errorHandler_1.handleMvtkReserveError)(error);
85
86
  throw error;
86
87
  }
87
- const result = checkResult;
88
- return repos.action.complete({ typeOf: actionAttributes.typeOf, id: action.id, result: result });
88
+ const result = {
89
+ purchaseNumberAuthIn: checkResult.purchaseNumberAuthIn,
90
+ purchaseNumberAuthResult: checkResult.purchaseNumberAuthResult,
91
+ // action.resultへの保管を廃止(2023-03-24~)
92
+ movieTickets: []
93
+ };
94
+ yield repos.action.complete({ typeOf: actionAttributes.typeOf, id: action.id, result });
95
+ return {
96
+ result: checkResult
97
+ };
89
98
  });
90
99
  }
91
100
  exports.checkMovieTicket = checkMovieTicket;
package/package.json CHANGED
@@ -120,5 +120,5 @@
120
120
  "postversion": "git push origin --tags",
121
121
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
122
122
  },
123
- "version": "20.12.0-alpha.1"
123
+ "version": "20.12.0"
124
124
  }