@chevre/domain 20.12.0-alpha.2 → 20.13.0-alpha.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.
@@ -5,8 +5,9 @@ exports.createStartParams = void 0;
5
5
  * 決済取引ファクトリー
6
6
  */
7
7
  const factory = require("../../../factory");
8
+ // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
8
9
  function createStartParams(params) {
9
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
10
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
10
11
  const paymentServiceId = (params.paymentService !== undefined)
11
12
  ? String(params.paymentService.id)
12
13
  : '';
@@ -42,12 +43,20 @@ function createStartParams(params) {
42
43
  ? (_d = params.object.paymentMethod) === null || _d === void 0 ? void 0 : _d.movieTickets.length
43
44
  : 0
44
45
  };
46
+ // MovieTicketIFの決済取引において最大同時着券数を設定可能にする(2023-03-27~)
47
+ const totalPaymentDueMaxValue = (_g = (_f = (_e = params.paymentService) === null || _e === void 0 ? void 0 : _e.availableChannel) === null || _f === void 0 ? void 0 : _f.totalPaymentDue) === null || _g === void 0 ? void 0 : _g.maxValue;
48
+ const totalPaymentDueValue = totalPaymentDue.value;
49
+ if (typeof totalPaymentDueValue === 'number' && typeof totalPaymentDueMaxValue === 'number') {
50
+ if (totalPaymentDueValue > totalPaymentDueMaxValue) {
51
+ throw new factory.errors.Argument('paymentMethod.movieTickets', `Number of movieTickets must be less than or equal to ${totalPaymentDueMaxValue}`);
52
+ }
53
+ }
45
54
  break;
46
55
  default:
47
56
  // no op
48
57
  }
49
58
  const informPaymentParams = createInformPaymentParams({ paymentService: params.paymentService });
50
- const accountId = (_e = params.object.paymentMethod) === null || _e === void 0 ? void 0 : _e.accountId;
59
+ const accountId = (_h = params.object.paymentMethod) === null || _h === void 0 ? void 0 : _h.accountId;
51
60
  return Object.assign({ project: { typeOf: factory.organizationType.Project, id: params.project.id }, transactionNumber: params.transactionNumber, typeOf: factory.assetTransactionType.Pay, agent: params.agent, recipient: params.recipient, object: {
52
61
  // パラメータから必要なもののみ取り込む
53
62
  accountId: (typeof accountId === 'string') ? accountId : '',
@@ -55,22 +64,22 @@ function createStartParams(params) {
55
64
  typeOf: params.paymentServiceType,
56
65
  id: paymentServiceId,
57
66
  onPaymentStatusChanged: { informPayment: informPaymentParams },
58
- paymentMethod: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ additionalProperty: (Array.isArray((_f = params.object.paymentMethod) === null || _f === void 0 ? void 0 : _f.additionalProperty))
59
- ? (_g = params.object.paymentMethod) === null || _g === void 0 ? void 0 : _g.additionalProperty
60
- : [], name: (typeof ((_h = params.object.paymentMethod) === null || _h === void 0 ? void 0 : _h.name) === 'string')
67
+ paymentMethod: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ additionalProperty: (Array.isArray((_j = params.object.paymentMethod) === null || _j === void 0 ? void 0 : _j.additionalProperty))
68
+ ? (_k = params.object.paymentMethod) === null || _k === void 0 ? void 0 : _k.additionalProperty
69
+ : [], name: (typeof ((_l = params.object.paymentMethod) === null || _l === void 0 ? void 0 : _l.name) === 'string')
61
70
  ? params.object.paymentMethod.name
62
- : paymentMethodType, amount: params.amount, paymentMethodId: params.transactionNumber, typeOf: paymentMethodType }, (typeof ((_j = params.object.paymentMethod) === null || _j === void 0 ? void 0 : _j.description) === 'string')
63
- ? { description: (_k = params.object.paymentMethod) === null || _k === void 0 ? void 0 : _k.description }
71
+ : paymentMethodType, amount: params.amount, paymentMethodId: params.transactionNumber, typeOf: paymentMethodType }, (typeof ((_m = params.object.paymentMethod) === null || _m === void 0 ? void 0 : _m.description) === 'string')
72
+ ? { description: (_o = params.object.paymentMethod) === null || _o === void 0 ? void 0 : _o.description }
64
73
  : undefined), (totalPaymentDue !== undefined)
65
74
  ? { totalPaymentDue: totalPaymentDue }
66
- : undefined), (typeof accountId === 'string') ? { accountId: accountId } : undefined), (typeof ((_l = params.object.paymentMethod) === null || _l === void 0 ? void 0 : _l.method) === 'string')
67
- ? { method: (_m = params.object.paymentMethod) === null || _m === void 0 ? void 0 : _m.method }
68
- : undefined), (((_o = params.object.paymentMethod) === null || _o === void 0 ? void 0 : _o.creditCard) !== undefined)
69
- ? { creditCard: (_p = params.object.paymentMethod) === null || _p === void 0 ? void 0 : _p.creditCard }
70
- : undefined), (Array.isArray((_q = params.object.paymentMethod) === null || _q === void 0 ? void 0 : _q.movieTickets))
71
- ? { movieTickets: (_r = params.object.paymentMethod) === null || _r === void 0 ? void 0 : _r.movieTickets }
75
+ : undefined), (typeof accountId === 'string') ? { accountId: accountId } : undefined), (typeof ((_p = params.object.paymentMethod) === null || _p === void 0 ? void 0 : _p.method) === 'string')
76
+ ? { method: (_q = params.object.paymentMethod) === null || _q === void 0 ? void 0 : _q.method }
77
+ : undefined), (((_r = params.object.paymentMethod) === null || _r === void 0 ? void 0 : _r.creditCard) !== undefined)
78
+ ? { creditCard: (_s = params.object.paymentMethod) === null || _s === void 0 ? void 0 : _s.creditCard }
79
+ : undefined), (Array.isArray((_t = params.object.paymentMethod) === null || _t === void 0 ? void 0 : _t.movieTickets))
80
+ ? { movieTickets: (_u = params.object.paymentMethod) === null || _u === void 0 ? void 0 : _u.movieTickets }
72
81
  : undefined)
73
- }, expires: params.expires }, (typeof ((_s = params.location) === null || _s === void 0 ? void 0 : _s.typeOf) === 'string')
82
+ }, expires: params.expires }, (typeof ((_v = params.location) === null || _v === void 0 ? void 0 : _v.typeOf) === 'string')
74
83
  ? { location: params.location }
75
84
  : undefined);
76
85
  }
@@ -78,11 +87,6 @@ exports.createStartParams = createStartParams;
78
87
  function createInformPaymentParams(params) {
79
88
  var _a, _b, _c;
80
89
  const informPaymentParams = [];
81
- // 廃止(2022-10-29~)
82
- // const informPaymentParamsByGlobalSettings = settings.onPaymentStatusChanged?.informPayment;
83
- // if (Array.isArray(informPaymentParamsByGlobalSettings)) {
84
- // informPaymentParams.push(...informPaymentParamsByGlobalSettings);
85
- // }
86
90
  // プロダクト設定を適用
87
91
  const informPaymentParamsByProduct = (_c = (_b = (_a = params.paymentService) === null || _a === void 0 ? void 0 : _a.availableChannel) === null || _b === void 0 ? void 0 : _b.onPaymentStatusChanged) === null || _c === void 0 ? void 0 : _c.informPayment;
88
92
  if (Array.isArray(informPaymentParamsByProduct)) {
@@ -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
  }
@@ -87,9 +87,9 @@ function checkMovieTicket(params) {
87
87
  }
88
88
  const result = {
89
89
  purchaseNumberAuthIn: checkResult.purchaseNumberAuthIn,
90
- purchaseNumberAuthResult: checkResult.purchaseNumberAuthResult,
90
+ purchaseNumberAuthResult: checkResult.purchaseNumberAuthResult
91
91
  // action.resultへの保管を廃止(2023-03-24~)
92
- movieTickets: []
92
+ // movieTickets: []
93
93
  };
94
94
  yield repos.action.complete({ typeOf: actionAttributes.typeOf, id: action.id, result });
95
95
  return {
package/package.json CHANGED
@@ -9,8 +9,8 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.307.0",
13
- "@cinerino/sdk": "3.151.0",
12
+ "@chevre/factory": "4.308.0-alpha.0",
13
+ "@cinerino/sdk": "3.152.0-alpha.1",
14
14
  "@motionpicture/coa-service": "9.2.0",
15
15
  "@motionpicture/gmo-service": "5.2.0",
16
16
  "@sendgrid/mail": "6.4.0",
@@ -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.2"
123
+ "version": "20.13.0-alpha.0"
124
124
  }