@chevre/domain 21.17.0-alpha.0 → 21.17.0-alpha.2

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.
@@ -11,7 +11,6 @@ export declare namespace placeOrder {
11
11
  type IStartParams = factory.transaction.placeOrder.IStartParamsWithoutDetail & {
12
12
  passportValidator?: IPassportValidator;
13
13
  broker?: factory.order.IBroker;
14
- validateSeller?: boolean;
15
14
  };
16
15
  type IOrderURLGenerator = (order: factory.order.IOrder) => string;
17
16
  type IResultOrderParams = factory.transaction.placeOrder.IResultOrderParams & {
@@ -1,2 +1,2 @@
1
1
  import * as factory from '../../../factory';
2
- export declare function createStartParams(params: factory.transaction.placeOrder.IStartParamsWithoutDetail, passport: factory.waiter.passport.IPassport | undefined, seller: Pick<factory.seller.ISeller, 'id' | 'name' | 'typeOf' | 'project' | 'additionalProperty'>, broker?: factory.order.IBroker): factory.transaction.placeOrder.IStartParams;
2
+ export declare function createStartParams(params: factory.transaction.placeOrder.IStartParamsWithoutDetail & {}, expiresInSeconds: number, passport: factory.waiter.passport.IPassport | undefined, seller: Pick<factory.seller.ISeller, 'id' | 'name' | 'typeOf' | 'project' | 'additionalProperty'>, broker?: factory.order.IBroker): factory.transaction.placeOrder.IStartParams;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createStartParams = void 0;
4
4
  const factory = require("../../../factory");
5
- function createStartParams(params, passport, seller, broker) {
5
+ function createStartParams(params, expiresInSeconds, passport, seller, broker) {
6
6
  var _a, _b, _c, _d;
7
7
  const transactionObject = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ passportToken: (typeof ((_a = params.object.passport) === null || _a === void 0 ? void 0 : _a.token) === 'string') ? params.object.passport.token : undefined }, (passport !== undefined) ? { passport } : undefined), (params.object.clientUser !== undefined && params.object.clientUser !== null)
8
8
  ? { clientUser: params.object.clientUser }
@@ -10,7 +10,7 @@ function createStartParams(params, passport, seller, broker) {
10
10
  if (typeof seller.id !== 'string') {
11
11
  throw new factory.errors.NotFound('seller.id');
12
12
  }
13
- if (typeof params.expiresInSeconds !== 'number') {
13
+ if (typeof expiresInSeconds !== 'number') {
14
14
  throw new factory.errors.ArgumentNull('expiresInSeconds');
15
15
  }
16
16
  return {
@@ -25,7 +25,7 @@ function createStartParams(params, passport, seller, broker) {
25
25
  additionalProperty: (Array.isArray(seller.additionalProperty)) ? seller.additionalProperty : []
26
26
  },
27
27
  object: transactionObject,
28
- expiresInSeconds: params.expiresInSeconds
28
+ expiresInSeconds: expiresInSeconds
29
29
  };
30
30
  }
31
31
  exports.createStartParams = createStartParams;
@@ -256,9 +256,13 @@ exports.validatePaymentMethods = validatePaymentMethods;
256
256
  /**
257
257
  * 興行オファー適用条件確認
258
258
  */
259
+ // tslint:disable-next-line:max-func-body-length
259
260
  function validateEventOffers(params) {
260
261
  var _a, _b;
261
- const firstOrderPaymentMethodIdentifier = (_b = (_a = params.order.paymentMethods[0]) === null || _a === void 0 ? void 0 : _a.paymentMethod) === null || _b === void 0 ? void 0 : _b.identifier;
262
+ const firstCreditCardPaymentMethodIdentifier = (_b = (_a = params.order.paymentMethods.find((referenceInvoice) => {
263
+ return referenceInvoice.issuedThrough.typeOf === factory.service.paymentService.PaymentServiceType.CreditCard
264
+ || referenceInvoice.issuedThrough.typeOf === factory.service.paymentService.PaymentServiceType.FaceToFace;
265
+ })) === null || _a === void 0 ? void 0 : _a.paymentMethod) === null || _b === void 0 ? void 0 : _b.identifier;
262
266
  const numCreditCardOrFaceToFacePaymentMethod = params.order.paymentMethods.filter((referenceInvoice) => {
263
267
  return referenceInvoice.issuedThrough.typeOf === factory.service.paymentService.PaymentServiceType.CreditCard
264
268
  || referenceInvoice.issuedThrough.typeOf === factory.service.paymentService.PaymentServiceType.FaceToFace;
@@ -316,8 +320,8 @@ function validateEventOffers(params) {
316
320
  if (Array.isArray(acceptedOffer.acceptedPaymentMethod)) {
317
321
  const acceptedPaymentMethodTypes = acceptedOffer.acceptedPaymentMethod.map((paymentMethod) => paymentMethod.identifier);
318
322
  const satisfyAcceptedPaymentMethod = numCreditCardOrFaceToFacePaymentMethod === 1
319
- && typeof firstOrderPaymentMethodIdentifier === 'string'
320
- && acceptedPaymentMethodTypes.includes(firstOrderPaymentMethodIdentifier);
323
+ && typeof firstCreditCardPaymentMethodIdentifier === 'string'
324
+ && acceptedPaymentMethodTypes.includes(firstCreditCardPaymentMethodIdentifier);
321
325
  if (!satisfyAcceptedPaymentMethod) {
322
326
  throw new factory.errors.Argument('Transaction', `acceptedPaymentMethod requirement not satisfied`);
323
327
  }
@@ -40,25 +40,15 @@ function start(params) {
40
40
  throw new factory.errors.NotFound(factory.organizationType.Corporation);
41
41
  }
42
42
  let makesOfferFromClient;
43
- // 販売者オファー検証(2022-10-14~)
44
- if (params.validateSeller === true) {
45
- const validateSellerResult = (0, validateSeller_1.validateSeller)({ seller, clientUser: params.object.clientUser });
46
- makesOfferFromClient = validateSellerResult.makesOfferFromClient;
47
- }
43
+ const validateSellerResult = (0, validateSeller_1.validateSeller)({ seller, clientUser: params.object.clientUser }); // 販売者オファー検証(2022-10-14~)
44
+ makesOfferFromClient = validateSellerResult.makesOfferFromClient;
48
45
  const passport = yield (0, validation_2.validateWaiterPassport)(params);
49
- // fix expiresInSeconds(2022-11-29~)
50
- let expiresInSeconds;
51
- if (typeof ((_a = makesOfferFromClient === null || makesOfferFromClient === void 0 ? void 0 : makesOfferFromClient.eligibleTransactionDuration) === null || _a === void 0 ? void 0 : _a.maxValue) === 'number') {
52
- expiresInSeconds = makesOfferFromClient.eligibleTransactionDuration.maxValue;
53
- }
54
- else if (typeof params.expiresInSeconds === 'number') {
55
- expiresInSeconds = params.expiresInSeconds;
56
- }
57
- else {
58
- throw new factory.errors.ArgumentNull('expiresInSeconds');
46
+ const expiresInSeconds = (_a = makesOfferFromClient === null || makesOfferFromClient === void 0 ? void 0 : makesOfferFromClient.eligibleTransactionDuration) === null || _a === void 0 ? void 0 : _a.maxValue;
47
+ if (typeof expiresInSeconds !== 'number') {
48
+ throw new factory.errors.NotFound('eligibleTransactionDuration.maxValue');
59
49
  }
60
50
  // 取引ファクトリーで新しい進行中取引オブジェクトを作成
61
- const startParams = (0, factory_1.createStartParams)(Object.assign(Object.assign({}, params), { expiresInSeconds }), passport, seller, params.broker);
51
+ const startParams = (0, factory_1.createStartParams)(params, expiresInSeconds, passport, seller, params.broker);
62
52
  let transaction;
63
53
  try {
64
54
  transaction = yield repos.transaction.start(startParams);
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  ],
11
11
  "dependencies": {
12
12
  "@aws-sdk/credential-providers": "3.433.0",
13
- "@chevre/factory": "4.343.0-alpha.0",
13
+ "@chevre/factory": "4.343.0-alpha.1",
14
14
  "@cinerino/sdk": "5.0.0",
15
15
  "@motionpicture/coa-service": "9.2.0",
16
16
  "@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.17.0-alpha.0"
120
+ "version": "21.17.0-alpha.2"
121
121
  }