@chevre/domain 21.6.0-alpha.2 → 21.6.0-alpha.3

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.
@@ -43,7 +43,7 @@ function createPayActions(params) {
43
43
  return payActions;
44
44
  }
45
45
  function createPayObject(params) {
46
- var _a, _b;
46
+ var _a;
47
47
  const transaction = params.transaction;
48
48
  const paymentMethod = transaction.object.paymentMethod;
49
49
  const paymentMethodType = String(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.typeOf);
@@ -100,7 +100,7 @@ function createPayObject(params) {
100
100
  totalPaymentDue: {
101
101
  typeOf: 'MonetaryAmount',
102
102
  currency: factory.unitCode.C62,
103
- value: (_b = paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.movieTickets) === null || _b === void 0 ? void 0 : _b.length
103
+ value: (Array.isArray(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.movieTickets)) ? paymentMethod.movieTickets.length : 0
104
104
  },
105
105
  typeOf: paymentMethodType
106
106
  }, movieTickets: paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.movieTickets }, (Array.isArray(paymentServiceOutput)) ? { serviceOutput: paymentServiceOutput } : undefined);
@@ -243,9 +243,6 @@ function processAuthorizeAccount(params, transaction, paymentServiceId) {
243
243
  typeOf: 'MonetaryAmount',
244
244
  currency,
245
245
  value: amount
246
- // value: (typeof pendingTransaction.object.amount === 'number')
247
- // ? pendingTransaction.object.amount
248
- // : pendingTransaction.object.amount.value
249
246
  };
250
247
  const savingPendingTransaction = {
251
248
  typeOf: pendingTransaction.typeOf,
@@ -113,7 +113,7 @@ exports.checkMovieTicket = checkMovieTicket;
113
113
  */
114
114
  function authorize(params, transaction, paymentServiceId, useCheckMovieTicketBeforePay, useCheckByIdentifierIfNotYet) {
115
115
  return (repos) => __awaiter(this, void 0, void 0, function* () {
116
- var _a, _b;
116
+ var _a;
117
117
  let accountId;
118
118
  let payAction;
119
119
  let accountsReceivablesByServiceType = [];
@@ -138,7 +138,7 @@ function authorize(params, transaction, paymentServiceId, useCheckMovieTicketBef
138
138
  paymentMethod: Object.assign({ additionalProperty: (Array.isArray(additionalProperty)) ? additionalProperty : [], name: paymentMethodName, paymentMethodId: paymentMethodId, totalPaymentDue: {
139
139
  typeOf: 'MonetaryAmount',
140
140
  currency: factory.unitCode.C62,
141
- value: (_b = paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.movieTickets) === null || _b === void 0 ? void 0 : _b.length
141
+ value: (Array.isArray(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.movieTickets)) ? paymentMethod.movieTickets.length : 0
142
142
  }, typeOf: paymentMethodType }, (typeof accountId === 'string') ? { accountId } : undefined),
143
143
  movieTickets: paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.movieTickets
144
144
  };
@@ -82,11 +82,18 @@ function createPaymentMethods(params) {
82
82
  });
83
83
  });
84
84
  // 決済方法から注文金額の計算
85
+ // price += authorizePaymentActions
86
+ // .filter((a) => {
87
+ // return a.result?.totalPaymentDue?.currency === factory.priceCurrency.JPY;
88
+ // })
89
+ // .reduce((a, b) => a + (<IAuthorizeAnyPaymentResult>b.result).amount, 0);
85
90
  price += authorizePaymentActions
86
- .filter((a) => {
91
+ .reduce((a, b) => {
87
92
  var _a, _b;
88
- return ((_b = (_a = a.result) === null || _a === void 0 ? void 0 : _a.totalPaymentDue) === null || _b === void 0 ? void 0 : _b.currency) === factory.priceCurrency.JPY;
89
- })
90
- .reduce((a, b) => a + b.result.amount, 0);
93
+ const jpyAmount = (((_b = (_a = b.result) === null || _a === void 0 ? void 0 : _a.totalPaymentDue) === null || _b === void 0 ? void 0 : _b.currency) === factory.priceCurrency.JPY)
94
+ ? b.result.totalPaymentDue.value
95
+ : 0;
96
+ return a + jpyAmount;
97
+ }, 0);
91
98
  return { paymentMethods, price };
92
99
  }
@@ -99,9 +99,17 @@ function validatePrice(transaction, authorizeActions) {
99
99
  return a.actionStatus === factory.actionStatusType.CompletedActionStatus
100
100
  && ((_a = a.result) === null || _a === void 0 ? void 0 : _a.typeOf) === factory.action.authorize.paymentMethod.any.ResultType.Payment;
101
101
  });
102
+ // priceByAgent += authorizePaymentActions
103
+ // .filter((a) => a.result?.totalPaymentDue?.currency === factory.priceCurrency.JPY)
104
+ // .reduce((a, b) => a + (<IAuthorizeAnyPaymentResult>b.result).amount, 0);
102
105
  priceByAgent += authorizePaymentActions
103
- .filter((a) => { var _a, _b; return ((_b = (_a = a.result) === null || _a === void 0 ? void 0 : _a.totalPaymentDue) === null || _b === void 0 ? void 0 : _b.currency) === factory.priceCurrency.JPY; })
104
- .reduce((a, b) => a + b.result.amount, 0);
106
+ .reduce((a, b) => {
107
+ var _a, _b;
108
+ const jpyAmount = (((_b = (_a = b.result) === null || _a === void 0 ? void 0 : _a.totalPaymentDue) === null || _b === void 0 ? void 0 : _b.currency) === factory.priceCurrency.JPY)
109
+ ? b.result.totalPaymentDue.value
110
+ : 0;
111
+ return a + jpyAmount;
112
+ }, 0);
105
113
  // 販売者が提供するアイテムの発生金額
106
114
  priceBySeller += authorizeActions
107
115
  .filter((authorizeAction) => authorizeAction.actionStatus === factory.actionStatusType.CompletedActionStatus)
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.323.0",
12
+ "@chevre/factory": "4.324.0-alpha.0",
13
13
  "@cinerino/sdk": "3.162.2",
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.6.0-alpha.2"
120
+ "version": "21.6.0-alpha.3"
121
121
  }