@chevre/domain 21.20.0-alpha.74 → 21.20.0-alpha.76

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.
@@ -114,7 +114,7 @@ function authorize(params) {
114
114
  exports.authorize = authorize;
115
115
  function validateCreateRequest(params) {
116
116
  return (repos) => __awaiter(this, void 0, void 0, function* () {
117
- var _a, _b;
117
+ var _a, _b, _c;
118
118
  const transaction = yield repos.transaction.findInProgressById({
119
119
  typeOf: factory.transactionType.PlaceOrder,
120
120
  id: params.transaction.id
@@ -122,7 +122,11 @@ function validateCreateRequest(params) {
122
122
  if (transaction.agent.id !== params.agent.id) {
123
123
  throw new factory.errors.Forbidden('Transaction not yours');
124
124
  }
125
- if (typeof ((_a = params.object.reservationFor) === null || _a === void 0 ? void 0 : _a.id) !== 'string' || params.object.reservationFor.id.length === 0) {
125
+ // クライアント検証(2024-02-07~)
126
+ if (((_a = transaction.object.clientUser) === null || _a === void 0 ? void 0 : _a.client_id) !== params.store.id) {
127
+ throw new factory.errors.Forbidden('client not match that of the transaction');
128
+ }
129
+ if (typeof ((_b = params.object.reservationFor) === null || _b === void 0 ? void 0 : _b.id) !== 'string' || params.object.reservationFor.id.length === 0) {
126
130
  throw new factory.errors.ArgumentNull('object.reservationFor.id');
127
131
  }
128
132
  // イベント取得属性最適化(2023-01-23~)
@@ -130,7 +134,7 @@ function validateCreateRequest(params) {
130
134
  const event = yield repos.event.findMinimizedIndividualEventById({
131
135
  id: params.object.reservationFor.id
132
136
  });
133
- let offeredThrough = (_b = event.offers) === null || _b === void 0 ? void 0 : _b.offeredThrough;
137
+ let offeredThrough = (_c = event.offers) === null || _c === void 0 ? void 0 : _c.offeredThrough;
134
138
  if (offeredThrough === undefined) {
135
139
  offeredThrough = { typeOf: 'WebAPI', identifier: factory.service.webAPI.Identifier.Chevre };
136
140
  }
@@ -38,6 +38,12 @@ export declare function authorize(params: {
38
38
  transaction: {
39
39
  id: string;
40
40
  };
41
+ store: {
42
+ /**
43
+ * 販売アプリケーションID
44
+ */
45
+ id: string;
46
+ };
41
47
  result: {
42
48
  requestBody: factory.action.authorize.offer.eventService.IRequestBody<WebAPIIdentifier.COA>;
43
49
  responseBody: factory.action.authorize.offer.eventService.IResponseBody<WebAPIIdentifier.COA>;
@@ -22,6 +22,7 @@ exports.WebAPIIdentifier = factory.service.webAPI.Identifier;
22
22
  function authorize(params) {
23
23
  // tslint:disable-next-line:max-func-body-length
24
24
  return (repos) => __awaiter(this, void 0, void 0, function* () {
25
+ var _a;
25
26
  const transaction = yield repos.transaction.findInProgressById({
26
27
  typeOf: factory.transactionType.PlaceOrder,
27
28
  id: params.transaction.id
@@ -29,6 +30,10 @@ function authorize(params) {
29
30
  if (transaction.agent.id !== params.agent.id) {
30
31
  throw new factory.errors.Forbidden('Transaction not yours');
31
32
  }
33
+ // クライアント検証(2024-02-07~)
34
+ if (((_a = transaction.object.clientUser) === null || _a === void 0 ? void 0 : _a.client_id) !== params.store.id) {
35
+ throw new factory.errors.Forbidden('client not match that of the transaction');
36
+ }
32
37
  let screeningEvent;
33
38
  let acceptedOffers;
34
39
  const pendingTransaction = {
@@ -113,7 +113,7 @@ function authorize(params, paymentServiceId, options) {
113
113
  }
114
114
  exports.authorize = authorize;
115
115
  function processAuthorizeCreditCard(params) {
116
- // tslint:disable-next-line:max-func-body-length
116
+ // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
117
117
  return () => __awaiter(this, void 0, void 0, function* () {
118
118
  var _a, _b, _c, _d, _e, _f;
119
119
  // GMOオーソリ取得
@@ -126,22 +126,12 @@ function processAuthorizeCreditCard(params) {
126
126
  useFetch: credentials_1.credentials.gmo.useFetch
127
127
  }, { timeout: credentials_1.credentials.gmo.timeout });
128
128
  const creditCard = params.object.creditCard;
129
- const memberId = creditCard.memberId;
130
- const cardSeq = creditCard.cardSeq;
129
+ const { cardSeq, memberId } = creditCard;
131
130
  if (typeof memberId === 'string' && memberId.length > 0 && typeof cardSeq === 'number') {
132
131
  // 決済承認時のuseUsernameAsGMOMemberId判定を廃止(2024-01-04~)
133
- // 特殊なプロジェクトのみユーザーネームに自動変換(新旧会員互換性維持対応)
134
- // memberIdはPersonIDが指定されてくる想定
135
- // const useUsernameAsGMOMemberId = params.projectSettings?.useUsernameAsGMOMemberId === true;
136
- // if (useUsernameAsGMOMemberId) {
137
- // try {
138
- // const customer = await repos.person.findById({ userId: memberId });
139
- // memberId = await person2username(customer);
140
- // } catch (error) {
141
- // throw error;
142
- // }
143
- // }
144
132
  }
133
+ const { cardNo, cardPass, expire } = creditCard;
134
+ const { token } = creditCard;
145
135
  const retUrl = creditCard === null || creditCard === void 0 ? void 0 : creditCard.retUrl;
146
136
  // 3DS拡張(2024-01-02~)
147
137
  if (params.processPublishPaymentUrl === true && typeof retUrl === 'string' && retUrl.length > 0) {
@@ -171,23 +161,7 @@ function processAuthorizeCreditCard(params) {
171
161
  tds2Type: GMO.utils.util.Tds2Type.Error
172
162
  };
173
163
  entryTranResult = yield creditCardService.entryTran(entryTranArgs);
174
- execTranArgs = {
175
- accessId: entryTranResult.accessId,
176
- accessPass: entryTranResult.accessPass,
177
- orderId: params.orderId,
178
- method: params.object.method,
179
- siteId: (_a = params.availableChannel.credentials) === null || _a === void 0 ? void 0 : _a.siteId,
180
- sitePass: (_b = params.availableChannel.credentials) === null || _b === void 0 ? void 0 : _b.sitePass,
181
- cardNo: creditCard.cardNo,
182
- cardPass: creditCard.cardPass,
183
- expire: creditCard.expire,
184
- token: creditCard.token,
185
- memberId: memberId,
186
- cardSeq: cardSeq,
187
- seqMode: GMO.utils.util.SeqMode.Physics,
188
- retUrl,
189
- callbackType: (params.callbackType3ds === 'GET') ? GMO.utils.util.CallbackType.Get : GMO.utils.util.CallbackType.Post
190
- };
164
+ execTranArgs = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ accessId: entryTranResult.accessId, accessPass: entryTranResult.accessPass, orderId: params.orderId, method: params.object.method, siteId: (_a = params.availableChannel.credentials) === null || _a === void 0 ? void 0 : _a.siteId, sitePass: (_b = params.availableChannel.credentials) === null || _b === void 0 ? void 0 : _b.sitePass, seqMode: GMO.utils.util.SeqMode.Physics, retUrl, callbackType: (params.callbackType3ds === 'GET') ? GMO.utils.util.CallbackType.Get : GMO.utils.util.CallbackType.Post }, (typeof cardNo === 'string') ? { cardNo } : undefined), (typeof cardPass === 'string') ? { cardPass } : undefined), (typeof expire === 'string') ? { expire } : undefined), (typeof token === 'string') ? { token } : undefined), (typeof memberId === 'string') ? { memberId } : undefined), (typeof cardSeq === 'number') ? { cardSeq } : undefined);
191
165
  execTranResult = yield creditCardService.execTran3ds(execTranArgs);
192
166
  }
193
167
  else {
@@ -203,21 +177,7 @@ function processAuthorizeCreditCard(params) {
203
177
  sitePass: (_d = params.availableChannel.credentials) === null || _d === void 0 ? void 0 : _d.sitePass
204
178
  };
205
179
  entryTranResult = yield creditCardService.entryTran(entryTranArgs);
206
- execTranArgs = {
207
- accessId: entryTranResult.accessId,
208
- accessPass: entryTranResult.accessPass,
209
- orderId: params.orderId,
210
- method: params.object.method,
211
- siteId: (_e = params.availableChannel.credentials) === null || _e === void 0 ? void 0 : _e.siteId,
212
- sitePass: (_f = params.availableChannel.credentials) === null || _f === void 0 ? void 0 : _f.sitePass,
213
- cardNo: creditCard.cardNo,
214
- cardPass: creditCard.cardPass,
215
- expire: creditCard.expire,
216
- token: creditCard.token,
217
- memberId: memberId,
218
- cardSeq: cardSeq,
219
- seqMode: GMO.utils.util.SeqMode.Physics
220
- };
180
+ execTranArgs = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ accessId: entryTranResult.accessId, accessPass: entryTranResult.accessPass, orderId: params.orderId, method: params.object.method, siteId: (_e = params.availableChannel.credentials) === null || _e === void 0 ? void 0 : _e.siteId, sitePass: (_f = params.availableChannel.credentials) === null || _f === void 0 ? void 0 : _f.sitePass, seqMode: GMO.utils.util.SeqMode.Physics }, (typeof cardNo === 'string') ? { cardNo } : undefined), (typeof cardPass === 'string') ? { cardPass } : undefined), (typeof expire === 'string') ? { expire } : undefined), (typeof token === 'string') ? { token } : undefined), (typeof memberId === 'string') ? { memberId } : undefined), (typeof cardSeq === 'number') ? { cardSeq } : undefined);
221
181
  execTranResult = yield creditCardService.execTran(execTranArgs);
222
182
  }
223
183
  return { entryTranArgs, entryTranResult, execTranArgs, execTranResult };
package/package.json CHANGED
@@ -111,5 +111,5 @@
111
111
  "postversion": "git push origin --tags",
112
112
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
113
113
  },
114
- "version": "21.20.0-alpha.74"
114
+ "version": "21.20.0-alpha.76"
115
115
  }