@chevre/domain 20.2.0-alpha.45 → 20.2.0-alpha.47

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.
@@ -55,7 +55,7 @@ async function main() {
55
55
  let updateCount = 0;
56
56
  await cursor.eachAsync(async (doc) => {
57
57
  i += 1;
58
- const ownershipInfo = <chevre.factory.ownershipInfo.IOwnershipInfo<chevre.factory.ownershipInfo.IPermit>>doc.toObject();
58
+ const ownershipInfo = <chevre.factory.ownershipInfo.IOwnershipInfo<chevre.factory.ownershipInfo.IPermitAsGood>>doc.toObject();
59
59
 
60
60
  const owner = <chevre.factory.person.IPerson>ownershipInfo.ownedBy;
61
61
  let iss =
@@ -132,7 +132,7 @@ function findAccount(params: {
132
132
  customer: { id: string };
133
133
  now: Date;
134
134
  }) {
135
- return async (): Promise<chevre.factory.ownershipInfo.IPermit | undefined> => {
135
+ return async (): Promise<chevre.factory.ownershipInfo.IPermitAsGood | undefined> => {
136
136
  const ownershipInfoRepo = new chevre.repository.OwnershipInfo(mongoose.connection);
137
137
 
138
138
  // let accountOwnershipInfos = await search({
@@ -171,7 +171,7 @@ function findAccount(params: {
171
171
  // throw new domain.factory.errors.NotFound('accountOwnershipInfos');
172
172
  }
173
173
 
174
- return <chevre.factory.ownershipInfo.IPermit>ownershipInfos[0].typeOfGood;
174
+ return <chevre.factory.ownershipInfo.IPermitAsGood>ownershipInfos[0].typeOfGood;
175
175
  };
176
176
  }
177
177
 
@@ -24,7 +24,8 @@ async function main() {
24
24
  const { ticketOffers } = await chevre.service.offer.event.searchEventTicketOffers({
25
25
  event: { id: 'al9ew43f5' },
26
26
  onlyValid: true,
27
- sort: true
27
+ sort: true,
28
+ validateOfferRateLimit: true
28
29
  // ...(typeof sellerId === 'string') ? { seller: { id: sellerId } } : undefined,
29
30
  // ...(typeof availableAtId === 'string') ? { store: { id: availableAtId } } : undefined
30
31
  })({
@@ -23,7 +23,7 @@ export declare function getToken(params: {
23
23
  }): (repos: {
24
24
  authorization: AuthorizationRepo;
25
25
  }) => Promise<IToken>;
26
- export declare function verifyToken<T = factory.authorization.IObject>(params: {
26
+ export declare function verifyToken(params: {
27
27
  project: {
28
28
  id: string;
29
29
  };
@@ -32,4 +32,4 @@ export declare function verifyToken<T = factory.authorization.IObject>(params: {
32
32
  audience?: string[];
33
33
  }): (repos: {
34
34
  action?: ActionRepo;
35
- }) => Promise<T>;
35
+ }) => Promise<factory.authorization.IObject>;
@@ -5,6 +5,7 @@ const moment = require("moment");
5
5
  const factory = require("../../../factory");
6
6
  const MAX_OWNED_THROUGH = '3000-01-01T00:00:00Z';
7
7
  function createProductOwnershipInfo(params) {
8
+ var _a, _b;
8
9
  let ownershipInfo;
9
10
  let ownedThrough;
10
11
  // どういう期間でいくらのオファーなのか
@@ -48,9 +49,14 @@ function createProductOwnershipInfo(params) {
48
49
  throw new factory.errors.NotFound('Order.acceptedOffers.priceSpecification.referenceQuantity.value');
49
50
  }
50
51
  const itemOffered = params.acceptedOffer.itemOffered;
51
- const typeOfGood = Object.assign(Object.assign({ project: itemOffered.project, identifier: itemOffered.identifier, issuedThrough: itemOffered.issuedThrough, typeOf: itemOffered.typeOf }, (itemOffered.validFor !== undefined) ? { validFor: itemOffered.validFor } : undefined), (itemOffered.name !== undefined) ? { name: itemOffered.name } : undefined
52
- // ...(itemOffered.dateIssued !== undefined) ? { dateIssued: itemOffered.dateIssued } : undefined
53
- );
52
+ // 最適化(2023-02-01~)
53
+ const issuedThrough = (typeof ((_a = itemOffered.issuedThrough) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
54
+ ? Object.assign({ id: itemOffered.issuedThrough.id, typeOf: itemOffered.issuedThrough.typeOf }, (typeof ((_b = itemOffered.issuedThrough.serviceType) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string')
55
+ ? { serviceType: itemOffered.issuedThrough.serviceType }
56
+ : undefined) : undefined;
57
+ const typeOfGood = Object.assign(Object.assign(Object.assign({
58
+ // project: itemOffered.project, // 最適化(2023-02-01~)
59
+ identifier: itemOffered.identifier, typeOf: itemOffered.typeOf }, (typeof (issuedThrough === null || issuedThrough === void 0 ? void 0 : issuedThrough.typeOf) === 'string') ? { issuedThrough } : undefined), (itemOffered.validFor !== undefined) ? { validFor: itemOffered.validFor } : undefined), (itemOffered.name !== undefined) ? { name: itemOffered.name } : undefined);
54
60
  ownershipInfo = {
55
61
  project: params.project,
56
62
  typeOf: 'OwnershipInfo',
@@ -187,6 +187,12 @@ function validateObjectWithoutDetail(params) {
187
187
  agent: params.project,
188
188
  token: String(programMembershipUsed)
189
189
  })({ action: repos.action });
190
+ if (permitOwnershipInfo.typeOf !== 'OwnershipInfo') {
191
+ throw new factory.errors.Argument('programMembershipUsed', 'must be OwnershipInfo');
192
+ }
193
+ if (permitOwnershipInfo.typeOfGood.typeOf !== factory.permit.PermitType.Permit) {
194
+ throw new factory.errors.Argument('programMembershipUsed', 'must be Permit');
195
+ }
190
196
  const typeOfGood = permitOwnershipInfo.typeOfGood;
191
197
  const issuedThroughId = (_c = typeOfGood.issuedThrough) === null || _c === void 0 ? void 0 : _c.id;
192
198
  if (typeof issuedThroughId !== 'string' || issuedThroughId.length === 0) {
@@ -30,34 +30,31 @@ function getOrderWithToken(params) {
30
30
  return params.order;
31
31
  }
32
32
  // 冗長な個人情報をマスク(最低限の情報に)
33
- const customer4orderToken = (params.order.customer.typeOf === factory.organizationType.Organization)
34
- ? {
35
- id: params.order.customer.id,
36
- name: '****',
37
- // project: params.order.customer.project,
38
- typeOf: params.order.customer.typeOf
39
- }
40
- : {
41
- id: params.order.customer.id,
42
- typeOf: params.order.customer.typeOf
43
- };
44
- const seller4orderToken = {
45
- id: params.order.seller.id,
46
- // 最適化(2022-11-15~)
47
- // project: params.order.seller.project,
48
- typeOf: params.order.seller.typeOf
49
- };
33
+ // const customer4orderToken: factory.order.ISimpleCustomer =
34
+ // (params.order.customer.typeOf === factory.organizationType.Organization)
35
+ // ? {
36
+ // id: params.order.customer.id,
37
+ // name: '****',
38
+ // // project: params.order.customer.project,
39
+ // typeOf: params.order.customer.typeOf
40
+ // }
41
+ // : {
42
+ // id: params.order.customer.id,
43
+ // typeOf: params.order.customer.typeOf
44
+ // };
45
+ // const seller4orderToken: Omit<factory.order.ISeller, 'name'> = {
46
+ // id: params.order.seller.id,
47
+ // typeOf: params.order.seller.typeOf
48
+ // };
49
+ // 最適化(2023-01-31~)
50
50
  const order4token = {
51
- // project: params.order.project,
52
51
  typeOf: params.order.typeOf,
53
- seller: seller4orderToken,
54
- customer: customer4orderToken,
55
- // IOrderへ移行(2022-11-17~)
56
- // confirmationNumber: params.order.confirmationNumber,
57
- orderNumber: params.order.orderNumber,
58
- price: params.order.price,
59
- priceCurrency: params.order.priceCurrency,
60
- orderDate: params.order.orderDate
52
+ // seller: seller4orderToken,
53
+ // customer: customer4orderToken,
54
+ orderNumber: params.order.orderNumber
55
+ // price: params.order.price,
56
+ // priceCurrency: params.order.priceCurrency,
57
+ // orderDate: params.order.orderDate
61
58
  };
62
59
  const token = yield new Promise((resolve, reject) => {
63
60
  // 所有権を暗号化する
@@ -288,6 +288,12 @@ function validateFromLocation(params) {
288
288
  agent: { id: params.project.id, typeOf: factory.organizationType.Project },
289
289
  token: fromLocation
290
290
  })(repos);
291
+ if (paymentCardOwnershipInfo.typeOf !== 'OwnershipInfo') {
292
+ throw new factory.errors.Argument('fromLocation', 'must be OwnershipInfo');
293
+ }
294
+ if (paymentCardOwnershipInfo.typeOfGood.typeOf !== factory.permit.PermitType.Permit) {
295
+ throw new factory.errors.Argument('fromLocation', 'must be Permit');
296
+ }
291
297
  accountId = paymentCardOwnershipInfo.typeOfGood.identifier;
292
298
  }
293
299
  return { accountId };
@@ -386,6 +386,12 @@ function validateFromLocation(project, fromLocationBeforeStart, issuedThrough) {
386
386
  agent: { id: project.id, typeOf: factory.organizationType.Project },
387
387
  token: fromLocation
388
388
  })({ action: repos.action });
389
+ if (paymentCardOwnershipInfo.typeOf !== 'OwnershipInfo') {
390
+ throw new factory.errors.Argument('fromLocation', 'must be OwnershipInfo');
391
+ }
392
+ if (paymentCardOwnershipInfo.typeOfGood.typeOf !== factory.permit.PermitType.Permit) {
393
+ throw new factory.errors.Argument('fromLocation', 'must be Permit');
394
+ }
389
395
  fromLocation = {
390
396
  typeOf: paymentCardOwnershipInfo.typeOfGood.typeOf,
391
397
  identifier: paymentCardOwnershipInfo.typeOfGood.identifier,
@@ -23,4 +23,4 @@ export declare function findPaymentCardPermit(params: {
23
23
  }): (repos: {
24
24
  ownershipInfo: OwnershipInfoRepo;
25
25
  product: ProductRepo;
26
- }) => Promise<factory.ownershipInfo.IPermit>;
26
+ }) => Promise<factory.ownershipInfo.IPermitAsGood>;
package/package.json CHANGED
@@ -9,8 +9,8 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.284.0-alpha.2",
13
- "@cinerino/sdk": "3.136.0",
12
+ "@chevre/factory": "4.284.0-alpha.4",
13
+ "@cinerino/sdk": "3.137.0-alpha.2",
14
14
  "@motionpicture/coa-service": "9.2.0",
15
15
  "@motionpicture/gmo-service": "5.2.0",
16
16
  "@sendgrid/mail": "6.4.0",
@@ -120,5 +120,5 @@
120
120
  "postversion": "git push origin --tags",
121
121
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
122
122
  },
123
- "version": "20.2.0-alpha.45"
123
+ "version": "20.2.0-alpha.47"
124
124
  }