@chevre/domain 21.6.0-alpha.5 → 21.6.0-alpha.7

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.
@@ -7,7 +7,7 @@ exports.createStartParams = void 0;
7
7
  const factory = require("../../../factory");
8
8
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
9
9
  function createStartParams(params) {
10
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
10
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
11
11
  const paymentServiceId = (params.paymentService !== undefined)
12
12
  ? String(params.paymentService.id)
13
13
  : '';
@@ -36,15 +36,14 @@ function createStartParams(params) {
36
36
  };
37
37
  break;
38
38
  case factory.service.paymentService.PaymentServiceType.MovieTicket:
39
+ const specifiedMovieTickets = (_c = params.object.paymentMethod) === null || _c === void 0 ? void 0 : _c.movieTickets;
39
40
  totalPaymentDue = {
40
41
  typeOf: 'MonetaryAmount',
41
42
  currency: factory.unitCode.C62,
42
- value: (Array.isArray((_c = params.object.paymentMethod) === null || _c === void 0 ? void 0 : _c.movieTickets))
43
- ? (_d = params.object.paymentMethod) === null || _d === void 0 ? void 0 : _d.movieTickets.length
44
- : 0
43
+ value: (Array.isArray(specifiedMovieTickets)) ? specifiedMovieTickets.length : 0
45
44
  };
46
45
  // 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;
46
+ const totalPaymentDueMaxValue = (_f = (_e = (_d = params.paymentService) === null || _d === void 0 ? void 0 : _d.availableChannel) === null || _e === void 0 ? void 0 : _e.totalPaymentDue) === null || _f === void 0 ? void 0 : _f.maxValue;
48
47
  const totalPaymentDueValue = totalPaymentDue.value;
49
48
  if (typeof totalPaymentDueValue === 'number' && typeof totalPaymentDueMaxValue === 'number') {
50
49
  if (totalPaymentDueValue > totalPaymentDueMaxValue) {
@@ -56,34 +55,35 @@ function createStartParams(params) {
56
55
  // no op
57
56
  }
58
57
  const informPaymentParams = createInformPaymentParams({ paymentService: params.paymentService });
59
- const accountId = (_h = params.object.paymentMethod) === null || _h === void 0 ? void 0 : _h.accountId;
60
- const creditCardAsPaymentServiceOutputCurrency = (_l = (_k = (_j = params.paymentService) === null || _j === void 0 ? void 0 : _j.serviceOutput) === null || _k === void 0 ? void 0 : _k.amount) === null || _l === void 0 ? void 0 : _l.currency;
61
- const object = {
58
+ const accountId = (_g = params.object.paymentMethod) === null || _g === void 0 ? void 0 : _g.accountId;
59
+ const creditCardAsPaymentServiceOutputCurrency = (_k = (_j = (_h = params.paymentService) === null || _h === void 0 ? void 0 : _h.serviceOutput) === null || _j === void 0 ? void 0 : _j.amount) === null || _k === void 0 ? void 0 : _k.currency;
60
+ const paymentMethod = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ additionalProperty: (Array.isArray((_l = params.object.paymentMethod) === null || _l === void 0 ? void 0 : _l.additionalProperty))
61
+ ? (_m = params.object.paymentMethod) === null || _m === void 0 ? void 0 : _m.additionalProperty
62
+ : [], name: (typeof ((_o = params.object.paymentMethod) === null || _o === void 0 ? void 0 : _o.name) === 'string')
63
+ ? params.object.paymentMethod.name
64
+ : paymentMethodType, amount: params.amount, paymentMethodId: params.transactionNumber, typeOf: paymentMethodType }, (typeof ((_p = params.object.paymentMethod) === null || _p === void 0 ? void 0 : _p.description) === 'string')
65
+ ? { description: (_q = params.object.paymentMethod) === null || _q === void 0 ? void 0 : _q.description }
66
+ : undefined), (totalPaymentDue !== undefined)
67
+ ? { totalPaymentDue: totalPaymentDue }
68
+ : undefined), (typeof accountId === 'string') ? { accountId: accountId } : undefined), (typeof ((_r = params.object.paymentMethod) === null || _r === void 0 ? void 0 : _r.method) === 'string')
69
+ ? { method: (_s = params.object.paymentMethod) === null || _s === void 0 ? void 0 : _s.method }
70
+ : undefined), (((_t = params.object.paymentMethod) === null || _t === void 0 ? void 0 : _t.creditCard) !== undefined)
71
+ ? { creditCard: (_u = params.object.paymentMethod) === null || _u === void 0 ? void 0 : _u.creditCard }
72
+ : undefined), (Array.isArray((_v = params.object.paymentMethod) === null || _v === void 0 ? void 0 : _v.movieTickets))
73
+ ? { movieTickets: (_w = params.object.paymentMethod) === null || _w === void 0 ? void 0 : _w.movieTickets }
74
+ : undefined);
75
+ const serviceOutput = (typeof creditCardAsPaymentServiceOutputCurrency === 'string')
76
+ ? {
77
+ amount: {
78
+ currency: creditCardAsPaymentServiceOutputCurrency,
79
+ value: paymentMethod.amount // 通貨区分としての金額
80
+ }
81
+ }
82
+ : undefined;
83
+ const object = Object.assign({
62
84
  // パラメータから必要なもののみ取り込む
63
- accountId: (typeof accountId === 'string') ? accountId : '',
64
- paymentMethodId: params.transactionNumber,
65
- typeOf: params.paymentServiceType,
66
- id: paymentServiceId,
67
- onPaymentStatusChanged: { informPayment: informPaymentParams },
68
- paymentMethod: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ additionalProperty: (Array.isArray((_m = params.object.paymentMethod) === null || _m === void 0 ? void 0 : _m.additionalProperty))
69
- ? (_o = params.object.paymentMethod) === null || _o === void 0 ? void 0 : _o.additionalProperty
70
- : [], name: (typeof ((_p = params.object.paymentMethod) === null || _p === void 0 ? void 0 : _p.name) === 'string')
71
- ? params.object.paymentMethod.name
72
- : paymentMethodType, amount: params.amount, paymentMethodId: params.transactionNumber, typeOf: paymentMethodType }, (typeof ((_q = params.object.paymentMethod) === null || _q === void 0 ? void 0 : _q.description) === 'string')
73
- ? { description: (_r = params.object.paymentMethod) === null || _r === void 0 ? void 0 : _r.description }
74
- : undefined), (totalPaymentDue !== undefined)
75
- ? { totalPaymentDue: totalPaymentDue }
76
- : undefined), (typeof accountId === 'string') ? { accountId: accountId } : undefined), (typeof ((_s = params.object.paymentMethod) === null || _s === void 0 ? void 0 : _s.method) === 'string')
77
- ? { method: (_t = params.object.paymentMethod) === null || _t === void 0 ? void 0 : _t.method }
78
- : undefined), (((_u = params.object.paymentMethod) === null || _u === void 0 ? void 0 : _u.creditCard) !== undefined)
79
- ? { creditCard: (_v = params.object.paymentMethod) === null || _v === void 0 ? void 0 : _v.creditCard }
80
- : undefined), (Array.isArray((_w = params.object.paymentMethod) === null || _w === void 0 ? void 0 : _w.movieTickets))
81
- ? { movieTickets: (_x = params.object.paymentMethod) === null || _x === void 0 ? void 0 : _x.movieTickets }
82
- : undefined), (typeof creditCardAsPaymentServiceOutputCurrency === 'string')
83
- ? { serviceOutput: { amount: { currency: creditCardAsPaymentServiceOutputCurrency } } }
84
- : undefined)
85
- };
86
- 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, expires: params.expires }, (typeof ((_y = params.location) === null || _y === void 0 ? void 0 : _y.typeOf) === 'string')
85
+ accountId: (typeof accountId === 'string') ? accountId : '', paymentMethodId: params.transactionNumber, typeOf: params.paymentServiceType, id: paymentServiceId, onPaymentStatusChanged: { informPayment: informPaymentParams }, paymentMethod }, (typeof serviceOutput !== undefined) ? { serviceOutput } : undefined);
86
+ 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, expires: params.expires }, (typeof ((_x = params.location) === null || _x === void 0 ? void 0 : _x.typeOf) === 'string')
87
87
  ? { location: params.location }
88
88
  : undefined);
89
89
  }
@@ -42,6 +42,7 @@ function createPayActions(params) {
42
42
  }
43
43
  return payActions;
44
44
  }
45
+ // tslint:disable-next-line:cyclomatic-complexity
45
46
  function createPayObject(params) {
46
47
  var _a;
47
48
  const transaction = params.transaction;
@@ -81,15 +82,11 @@ function createPayObject(params) {
81
82
  };
82
83
  break;
83
84
  case factory.service.paymentService.PaymentServiceType.CreditCard:
84
- payObject = {
85
- typeOf: transaction.object.typeOf,
86
- id: (typeof transaction.object.id === 'string') ? transaction.object.id : '',
87
- paymentMethod: Object.assign({ additionalProperty: (Array.isArray(additionalProperty)) ? additionalProperty : [], name: paymentMethodName, paymentMethodId: paymentMethodId, totalPaymentDue: {
85
+ payObject = Object.assign({ typeOf: transaction.object.typeOf, id: (typeof transaction.object.id === 'string') ? transaction.object.id : '', paymentMethod: Object.assign({ additionalProperty: (Array.isArray(additionalProperty)) ? additionalProperty : [], name: paymentMethodName, paymentMethodId: paymentMethodId, totalPaymentDue: {
88
86
  typeOf: 'MonetaryAmount',
89
87
  currency: factory.priceCurrency.JPY,
90
88
  value: Number(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.amount)
91
- }, typeOf: paymentMethodType }, (typeof (paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.accountId) === 'string') ? { accountId: paymentMethod.accountId } : undefined)
92
- };
89
+ }, typeOf: paymentMethodType }, (typeof (paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.accountId) === 'string') ? { accountId: paymentMethod.accountId } : undefined) }, (paymentServiceOutput !== undefined) ? { serviceOutput: paymentServiceOutput } : undefined);
93
90
  break;
94
91
  case factory.service.paymentService.PaymentServiceType.MovieTicket:
95
92
  payObject = Object.assign({ typeOf: transaction.object.typeOf, id: (typeof transaction.object.id === 'string') ? transaction.object.id : '', paymentMethod: {
@@ -123,7 +120,12 @@ function createPayObjectServiceOutput(params) {
123
120
  case factory.service.paymentService.PaymentServiceType.CreditCard:
124
121
  // CreditCardIFのカード通貨区分を追加(2023-08-07~)
125
122
  const creditCardAsPaymentServiceOutput = (typeof ((_b = (_a = transaction.object.serviceOutput) === null || _a === void 0 ? void 0 : _a.amount) === null || _b === void 0 ? void 0 : _b.currency) === 'string')
126
- ? { amount: { currency: transaction.object.serviceOutput.amount.currency } }
123
+ ? {
124
+ amount: {
125
+ currency: transaction.object.serviceOutput.amount.currency,
126
+ value: transaction.object.paymentMethod.amount
127
+ }
128
+ }
127
129
  : undefined;
128
130
  if (creditCardAsPaymentServiceOutput !== undefined) {
129
131
  paymentServiceOutput = creditCardAsPaymentServiceOutput;
@@ -86,9 +86,8 @@ function createAuthorizeResult(params) {
86
86
  if (typeof (totalPaymentDue === null || totalPaymentDue === void 0 ? void 0 : totalPaymentDue.typeOf) !== 'string') {
87
87
  throw new factory.errors.ServiceUnavailable('payTransaction.object.paymentMethod.totalPaymentDue undefined');
88
88
  }
89
- const creditCardAsPaymentServiceOutputCurrency = (_c = (_b = payTransactionObject.serviceOutput) === null || _b === void 0 ? void 0 : _b.amount) === null || _c === void 0 ? void 0 : _c.currency;
90
- const issuedThrough = Object.assign({ typeOf: payTransactionObject.typeOf, id: (typeof payTransactionObject.id === 'string') ? payTransactionObject.id : '' }, (typeof creditCardAsPaymentServiceOutputCurrency === 'string')
91
- ? { serviceOutput: { amount: { currency: creditCardAsPaymentServiceOutputCurrency } } }
89
+ const issuedThrough = Object.assign({ typeOf: payTransactionObject.typeOf, id: (typeof payTransactionObject.id === 'string') ? payTransactionObject.id : '' }, (typeof ((_c = (_b = payTransactionObject.serviceOutput) === null || _b === void 0 ? void 0 : _b.amount) === null || _c === void 0 ? void 0 : _c.currency) === 'string')
90
+ ? { serviceOutput: payTransactionObject.serviceOutput }
92
91
  : undefined);
93
92
  return {
94
93
  accountId: (typeof ((_d = payTransactionObject.paymentMethod) === null || _d === void 0 ? void 0 : _d.accountId) === 'string')
package/package.json CHANGED
@@ -9,8 +9,8 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.324.0-alpha.2",
13
- "@cinerino/sdk": "3.162.2",
12
+ "@chevre/factory": "4.324.0-alpha.3",
13
+ "@cinerino/sdk": "3.162.3",
14
14
  "@motionpicture/coa-service": "9.2.0",
15
15
  "@motionpicture/gmo-service": "5.2.0",
16
16
  "@sendgrid/mail": "6.4.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.6.0-alpha.5"
120
+ "version": "21.6.0-alpha.7"
121
121
  }