@chevre/domain 25.2.0-alpha.3 → 25.2.0-alpha.5

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.
@@ -174,7 +174,7 @@ function acceptedOffers2programMembershipUsed(params) {
174
174
  }
175
175
  function acceptedOffers2authorizeResult(params) {
176
176
  const { acceptedOffers4result, noOfferSpecified, ticketOffers } = params;
177
- const priceCurrency = factory_1.factory.priceCurrency.JPY; // fix(2024-07-03~)
177
+ // const priceCurrency = factory.priceCurrency.JPY; // fix(2024-07-03~)
178
178
  let offers;
179
179
  let price;
180
180
  let programMembershipUsed = [];
@@ -213,8 +213,8 @@ function acceptedOffers2authorizeResult(params) {
213
213
  }
214
214
  return {
215
215
  typeOf: factory_1.factory.offerType.AggregateOffer,
216
- priceCurrency,
217
- amount: [],
216
+ // priceCurrency, // discontinue(2026-07-06~)
217
+ // amount: [], // discontinue(2026-07-06~)
218
218
  itemOffered: {
219
219
  serviceOutput: { programMembershipUsed } // add programMembershipUsed required(2024-08-15~)
220
220
  },
@@ -109,8 +109,8 @@ function authorize(params, options) {
109
109
  result = {
110
110
  typeOf: factory_2.factory.offerType.AggregateOffer, // add(2024-06-18~)
111
111
  price: price,
112
- priceCurrency: factory_2.factory.priceCurrency.JPY,
113
- amount: []
112
+ // priceCurrency: factory.priceCurrency.JPY, // discontinue(2026-07-06~)
113
+ // amount: [] // discontinue(2026-07-06~)
114
114
  };
115
115
  await (0, any_1.acceptOffer)({
116
116
  project: transaction.project,
@@ -133,7 +133,7 @@ function changeOffers(params) {
133
133
  const actionResult = {
134
134
  ...authorizeAction.result,
135
135
  price: price,
136
- amount: []
136
+ // amount: [] // discontinue(2026-07-06~)
137
137
  };
138
138
  // ActiveActionStatus->CompletedActionStatusで再実装(2024-01-15~)
139
139
  await repos.action.reStart({ id: authorizeAction.id, typeOf: authorizeAction.typeOf });
@@ -32,7 +32,7 @@ function acceptedOffers2authorizeResult(params) {
32
32
  };
33
33
  });
34
34
  return {
35
- amount: [],
35
+ // amount: [], // discontinue(2026-07-06~)
36
36
  itemOffered: {
37
37
  serviceOutput: { programMembershipUsed } // add programMembershipUsed required(2024-08-15~)
38
38
  },
@@ -93,7 +93,7 @@ function prepareUnitPriceOfferConditions(params) {
93
93
  id: authorizeEventServiceOfferAction.id,
94
94
  result: {
95
95
  typeOf: authorizeEventServiceOfferAction.result.typeOf,
96
- priceCurrency: authorizeEventServiceOfferAction.result.priceCurrency,
96
+ // priceCurrency: authorizeEventServiceOfferAction.result.priceCurrency,
97
97
  price: authorizeEventServiceOfferAction.result.price,
98
98
  ...acceptedOffers2authorizeResult({
99
99
  acceptedOffers4result: acceptedOffers4action,
@@ -106,9 +106,9 @@ function prepareUnitPriceOfferConditions(params) {
106
106
  for (const authorizeEventServiceOfferAction of params.authorizeEventServiceOfferActions) {
107
107
  const conditionExpected = conditions.find(({ id }) => id === authorizeEventServiceOfferAction.id);
108
108
  const resultMatched = (0, util_1.isDeepStrictEqual)(conditionExpected?.result, authorizeEventServiceOfferAction.result);
109
- console.log('resultMatched?', resultMatched, authorizeEventServiceOfferAction.id, authorizeEventServiceOfferAction.instrument.transactionNumber);
109
+ console.log('resultMatched?', resultMatched, params.project.id, authorizeEventServiceOfferAction.id, authorizeEventServiceOfferAction.instrument.transactionNumber);
110
110
  if (!resultMatched) {
111
- console.log(conditionExpected?.result, authorizeEventServiceOfferAction.result);
111
+ console.log('conditionExpected not matched!', params.project.id, authorizeEventServiceOfferAction.id, conditionExpected?.result, authorizeEventServiceOfferAction.result);
112
112
  }
113
113
  }
114
114
  return conditions;
@@ -29,8 +29,8 @@ eventReservationAcceptedOffers, payTransactions, customer) {
29
29
  (0, validatePrice_1.validatePrice)(authorizePaymentActions, authorizeEventServiceOfferActions);
30
30
  // 請求のreferencesOrder検証(2025-11-23~)
31
31
  (0, validateInvoiceReferencesOrder_1.validateInvoiceReferencesOrder)(authorizePaymentActions, eventReservationAcceptedOffers);
32
- // 利用可能な通貨単位に対して取引検証
33
- validateMonetaryAmount(authorizePaymentActions, authorizeEventServiceOfferActions);
32
+ // // 利用可能な通貨単位に対して取引検証
33
+ // validateMonetaryAmount(authorizePaymentActions, authorizeEventServiceOfferActions); // discontinue(2026-07-06~)
34
34
  // 利用可能なMovieTicketIF決済方法タイプに対して動的にコーディング
35
35
  const movieTicketPaymentMethodTypes = findMovieTicketPaymentMethodTypesFromTransaction(authorizePaymentActions, eventReservationAcceptedOffers);
36
36
  debug('processing validateMovieTicket... movieTicketPaymentMethodTypes:', movieTicketPaymentMethodTypes);
@@ -148,63 +148,63 @@ function validatePaymentUrl(transaction, acceptPayActions, authorizePaymentActio
148
148
  }
149
149
  }
150
150
  }
151
- /**
152
- * JPY以外の通貨について取引を検証する
153
- */
154
- function validateMonetaryAmount(_authorizePaymentActions, authorizeEventServiceOfferActions) {
155
- // PaymentCard決済を廃止したので、JPY以外の通貨に対しての承認はありえない(2026-04-18~)
156
- const authorizeMonetaryAmountActions = [];
157
- // const authorizeMonetaryAmountActions = authorizePaymentActions.filter(({ result }) => {
158
- // const resultAsInvoice = (Array.isArray(result))
159
- // // ? result.find(({ typeOf }) => typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
160
- // ? result[0]
161
- // : undefined;
162
- // // JPY以外の通貨に対して承認可能なのはPaymentServiceType.PaymentCardのみ
163
- // return resultAsInvoice?.issuedThrough.typeOf === factory.service.paymentService.PaymentServiceType.PaymentCard
164
- // && resultAsInvoice.totalPaymentDue?.currency !== factory.priceCurrency.JPY;
165
- // });
166
- const requiredMonetaryAmountByCurrencyType = [];
167
- authorizeEventServiceOfferActions.forEach((a) => {
168
- const amount = a.result?.amount;
169
- if (Array.isArray(amount)) {
170
- amount.forEach((monetaryAmount) => {
171
- if (typeof monetaryAmount.value === 'number') {
172
- requiredMonetaryAmountByCurrencyType.push({ currency: monetaryAmount.currency, value: monetaryAmount.value });
173
- }
174
- });
175
- }
176
- }, 0);
177
- const requiredCurrencyTypes = [...new Set(requiredMonetaryAmountByCurrencyType.map((m) => m.currency))];
178
- const authorizedCurrencyTypes = [...new Set(authorizeMonetaryAmountActions.map(({ result }) => {
179
- const resultAsInvoice = (Array.isArray(result))
180
- // ? result.find(({ typeOf }) => typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
181
- ? result[0]
182
- : undefined;
183
- return resultAsInvoice?.totalPaymentDue?.currency;
184
- }))];
185
- if (requiredCurrencyTypes.length !== authorizedCurrencyTypes.length) {
186
- throw new factory_1.factory.errors.Argument('Transaction', 'MonetaryAmount account types not matched');
187
- }
188
- const requireMonetaryAmountSatisfied = requiredCurrencyTypes.every((currencyType) => {
189
- const requiredMonetaryAmount = requiredMonetaryAmountByCurrencyType
190
- .filter((m) => m.currency === currencyType)
191
- .reduce((a, b) => a + b.value, 0);
192
- let authorizedMonetaryAmount = 0;
193
- authorizeMonetaryAmountActions.forEach(({ result }) => {
194
- const resultAsInvoice = (Array.isArray(result))
195
- // ? result.find(({ typeOf }) => typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
196
- ? result[0]
197
- : undefined;
198
- if (resultAsInvoice?.totalPaymentDue?.currency === currencyType) {
199
- authorizedMonetaryAmount += resultAsInvoice.totalPaymentDue.value;
200
- }
201
- });
202
- return requiredMonetaryAmount === authorizedMonetaryAmount;
203
- });
204
- if (!requireMonetaryAmountSatisfied) {
205
- throw new factory_1.factory.errors.Argument('Transaction', 'Required MonetaryAmount not satisfied');
206
- }
207
- }
151
+ // JPY以外の通貨決済はひとまず廃止(2026-07-06~)
152
+ // /**
153
+ // * JPY以外の通貨について取引を検証する
154
+ // */
155
+ // function validateMonetaryAmount(
156
+ // _authorizePaymentActions: IAuthorizePaymentAction[],
157
+ // authorizeEventServiceOfferActions: Pick<IAuthorizeEventServiceOffer, 'result'>[]
158
+ // ) {
159
+ // // PaymentCard決済を廃止したので、JPY以外の通貨に対しての承認はありえない(2026-04-18~)
160
+ // const authorizeMonetaryAmountActions: IAuthorizePaymentAction[] = [];
161
+ // const requiredMonetaryAmountByCurrencyType: {
162
+ // currency: string;
163
+ // value: number;
164
+ // }[] = [];
165
+ // authorizeEventServiceOfferActions.forEach(
166
+ // (a) => {
167
+ // const amount = a.result?.amount;
168
+ // if (Array.isArray(amount)) {
169
+ // amount.forEach((monetaryAmount) => {
170
+ // if (typeof monetaryAmount.value === 'number') {
171
+ // requiredMonetaryAmountByCurrencyType.push({ currency: monetaryAmount.currency, value: monetaryAmount.value });
172
+ // }
173
+ // });
174
+ // }
175
+ // },
176
+ // 0
177
+ // );
178
+ // const requiredCurrencyTypes = [...new Set(requiredMonetaryAmountByCurrencyType.map((m) => m.currency))];
179
+ // const authorizedCurrencyTypes = [...new Set(authorizeMonetaryAmountActions.map(({ result }) => {
180
+ // const resultAsInvoice = (Array.isArray(result))
181
+ // ? result[0]
182
+ // : undefined;
183
+ // return resultAsInvoice?.totalPaymentDue?.currency as string;
184
+ // }
185
+ // ))];
186
+ // if (requiredCurrencyTypes.length !== authorizedCurrencyTypes.length) {
187
+ // throw new factory.errors.Argument('Transaction', 'MonetaryAmount account types not matched');
188
+ // }
189
+ // const requireMonetaryAmountSatisfied = requiredCurrencyTypes.every((currencyType) => {
190
+ // const requiredMonetaryAmount = requiredMonetaryAmountByCurrencyType
191
+ // .filter((m) => m.currency === currencyType)
192
+ // .reduce((a, b) => a + b.value, 0);
193
+ // let authorizedMonetaryAmount = 0;
194
+ // authorizeMonetaryAmountActions.forEach(({ result }) => {
195
+ // const resultAsInvoice = (Array.isArray(result))
196
+ // ? result[0]
197
+ // : undefined;
198
+ // if (resultAsInvoice?.totalPaymentDue?.currency === currencyType) {
199
+ // authorizedMonetaryAmount += resultAsInvoice.totalPaymentDue.value;
200
+ // }
201
+ // });
202
+ // return requiredMonetaryAmount === authorizedMonetaryAmount;
203
+ // });
204
+ // if (!requireMonetaryAmountSatisfied) {
205
+ // throw new factory.errors.Argument('Transaction', 'Required MonetaryAmount not satisfied');
206
+ // }
207
+ // }
208
208
  /**
209
209
  * 注文オファー数検証
210
210
  */
@@ -41,6 +41,11 @@ interface IConfirmOptions {
41
41
  * 注文における最大CreditCardIF決済方法数
42
42
  */
43
43
  maxNumCreditCardPaymentMethod: number;
44
+ /**
45
+ * 2026-07-06~
46
+ * 実験的に
47
+ */
48
+ usePrepareUnitPriceOfferConditions?: boolean;
44
49
  }
45
50
  type IConfirmParams = PlaceOrderFactory.IConfirmParams;
46
51
  interface IConfirmResult {
@@ -116,7 +116,8 @@ function confirm(params, options) {
116
116
  }))
117
117
  .filter(({ serialNumber }) => typeof serialNumber === 'string' && serialNumbers.includes(serialNumber));
118
118
  // 単価オファーの全適用条件を検証するために、単価オファーを参照(2026-07-06~)
119
- if (transaction.project.id === 'cinerino') {
119
+ const { usePrepareUnitPriceOfferConditions } = options;
120
+ if (usePrepareUnitPriceOfferConditions === true) {
120
121
  await (0, prepareUnitPriceOfferConditions_1.prepareUnitPriceOfferConditions)({
121
122
  project: { id: transaction.project.id, },
122
123
  acceptedOffers,
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "dependencies": {
12
12
  "@aws-sdk/client-cognito-identity-provider": "3.600.0",
13
13
  "@aws-sdk/credential-providers": "3.600.0",
14
- "@chevre/factory": "9.5.0-alpha.2",
14
+ "@chevre/factory": "9.5.0-alpha.3",
15
15
  "@motionpicture/coa-service": "10.0.0",
16
16
  "@motionpicture/gmo-service": "6.1.0-alpha.0",
17
17
  "@sendgrid/client": "8.1.4",
@@ -91,5 +91,5 @@
91
91
  "postversion": "git push origin --tags",
92
92
  "prepublishOnly": "npm run clean && npm run build"
93
93
  },
94
- "version": "25.2.0-alpha.3"
94
+ "version": "25.2.0-alpha.5"
95
95
  }