@chevre/domain 21.12.0-alpha.0 → 21.13.0-alpha.0

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.
Files changed (118) hide show
  1. package/README.md +0 -5
  2. package/lib/chevre/repo/account.js +1 -1
  3. package/lib/chevre/repo/accountTitle.js +1 -1
  4. package/lib/chevre/repo/accountTransaction.js +1 -1
  5. package/lib/chevre/repo/accountingReport.js +1 -1
  6. package/lib/chevre/repo/action.js +1 -1
  7. package/lib/chevre/repo/additionalProperty.js +1 -1
  8. package/lib/chevre/repo/aggregateOffer.js +1 -1
  9. package/lib/chevre/repo/aggregation.js +1 -1
  10. package/lib/chevre/repo/assetTransaction.js +1 -1
  11. package/lib/chevre/repo/categoryCode.js +1 -1
  12. package/lib/chevre/repo/code.js +1 -1
  13. package/lib/chevre/repo/comment.js +1 -1
  14. package/lib/chevre/repo/creativeWork.js +1 -1
  15. package/lib/chevre/repo/customer.js +1 -1
  16. package/lib/chevre/repo/emailMessage.js +1 -1
  17. package/lib/chevre/repo/event.js +1 -1
  18. package/lib/chevre/repo/member.js +1 -1
  19. package/lib/chevre/repo/merchantReturnPolicy.js +1 -1
  20. package/lib/chevre/repo/mongoose/schemas/account.d.ts +4 -56
  21. package/lib/chevre/repo/mongoose/schemas/account.js +80 -32
  22. package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +4 -90
  23. package/lib/chevre/repo/mongoose/schemas/accountTitle.js +81 -44
  24. package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +4 -95
  25. package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +129 -62
  26. package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +4 -68
  27. package/lib/chevre/repo/mongoose/schemas/accountingReport.js +108 -63
  28. package/lib/chevre/repo/mongoose/schemas/action.d.ts +4 -113
  29. package/lib/chevre/repo/mongoose/schemas/action.js +345 -215
  30. package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +4 -74
  31. package/lib/chevre/repo/mongoose/schemas/additionalProperty.js +65 -32
  32. package/lib/chevre/repo/mongoose/schemas/aggregateOffer.d.ts +4 -73
  33. package/lib/chevre/repo/mongoose/schemas/aggregateOffer.js +258 -155
  34. package/lib/chevre/repo/mongoose/schemas/aggregation.d.ts +4 -56
  35. package/lib/chevre/repo/mongoose/schemas/aggregation.js +28 -10
  36. package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +4 -113
  37. package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +258 -146
  38. package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +4 -77
  39. package/lib/chevre/repo/mongoose/schemas/authorization.js +110 -61
  40. package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +4 -86
  41. package/lib/chevre/repo/mongoose/schemas/categoryCode.js +85 -46
  42. package/lib/chevre/repo/mongoose/schemas/comments.d.ts +4 -89
  43. package/lib/chevre/repo/mongoose/schemas/comments.js +59 -28
  44. package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +4 -104
  45. package/lib/chevre/repo/mongoose/schemas/creativeWork.js +121 -70
  46. package/lib/chevre/repo/mongoose/schemas/customer.d.ts +4 -86
  47. package/lib/chevre/repo/mongoose/schemas/customer.js +56 -26
  48. package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +4 -80
  49. package/lib/chevre/repo/mongoose/schemas/emailMessages.js +41 -17
  50. package/lib/chevre/repo/mongoose/schemas/event.d.ts +4 -158
  51. package/lib/chevre/repo/mongoose/schemas/event.js +307 -193
  52. package/lib/chevre/repo/mongoose/schemas/member.d.ts +4 -68
  53. package/lib/chevre/repo/mongoose/schemas/member.js +65 -37
  54. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +4 -80
  55. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.js +29 -11
  56. package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +4 -91
  57. package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +85 -45
  58. package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.d.ts +4 -91
  59. package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.js +29 -10
  60. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.d.ts +4 -73
  61. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.js +37 -12
  62. package/lib/chevre/repo/mongoose/schemas/order.d.ts +4 -128
  63. package/lib/chevre/repo/mongoose/schemas/order.js +407 -259
  64. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +4 -86
  65. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +187 -111
  66. package/lib/chevre/repo/mongoose/schemas/place.d.ts +4 -128
  67. package/lib/chevre/repo/mongoose/schemas/place.js +159 -93
  68. package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +4 -92
  69. package/lib/chevre/repo/mongoose/schemas/priceSpecification.js +94 -49
  70. package/lib/chevre/repo/mongoose/schemas/product.d.ts +4 -95
  71. package/lib/chevre/repo/mongoose/schemas/product.js +109 -61
  72. package/lib/chevre/repo/mongoose/schemas/project.d.ts +4 -83
  73. package/lib/chevre/repo/mongoose/schemas/project.js +20 -9
  74. package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +4 -143
  75. package/lib/chevre/repo/mongoose/schemas/reservation.js +377 -229
  76. package/lib/chevre/repo/mongoose/schemas/role.d.ts +4 -65
  77. package/lib/chevre/repo/mongoose/schemas/role.js +43 -19
  78. package/lib/chevre/repo/mongoose/schemas/seller.d.ts +4 -95
  79. package/lib/chevre/repo/mongoose/schemas/seller.js +96 -51
  80. package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +4 -65
  81. package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +112 -63
  82. package/lib/chevre/repo/mongoose/schemas/task.d.ts +4 -95
  83. package/lib/chevre/repo/mongoose/schemas/task.js +214 -126
  84. package/lib/chevre/repo/mongoose/schemas/telemetry.d.ts +4 -80
  85. package/lib/chevre/repo/mongoose/schemas/telemetry.js +44 -24
  86. package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +4 -107
  87. package/lib/chevre/repo/mongoose/schemas/transaction.js +291 -176
  88. package/lib/chevre/repo/mongoose/schemas/trip.d.ts +4 -65
  89. package/lib/chevre/repo/mongoose/schemas/trip.js +20 -9
  90. package/lib/chevre/repo/offer.js +3 -3
  91. package/lib/chevre/repo/offerCatalog.js +1 -1
  92. package/lib/chevre/repo/offerCatalogItem.js +1 -1
  93. package/lib/chevre/repo/offerItemCondition.js +1 -1
  94. package/lib/chevre/repo/order.js +1 -1
  95. package/lib/chevre/repo/ownershipInfo.js +1 -1
  96. package/lib/chevre/repo/paymentServiceProvider.js +1 -1
  97. package/lib/chevre/repo/permit.js +1 -1
  98. package/lib/chevre/repo/place/hasPOS.js +1 -1
  99. package/lib/chevre/repo/place.js +1 -1
  100. package/lib/chevre/repo/priceSpecification.js +1 -1
  101. package/lib/chevre/repo/product.js +1 -1
  102. package/lib/chevre/repo/productOffer.js +1 -1
  103. package/lib/chevre/repo/project.js +1 -1
  104. package/lib/chevre/repo/reservation.js +1 -1
  105. package/lib/chevre/repo/role.js +1 -1
  106. package/lib/chevre/repo/seller.js +1 -1
  107. package/lib/chevre/repo/serviceOutput.js +1 -1
  108. package/lib/chevre/repo/task.js +1 -1
  109. package/lib/chevre/repo/telemetry.js +1 -1
  110. package/lib/chevre/repo/transaction.js +1 -1
  111. package/lib/chevre/repo/trip.js +1 -1
  112. package/lib/chevre/service/assetTransaction/reserve.js +6 -8
  113. package/lib/chevre/settings.d.ts +1 -1
  114. package/lib/chevre/settings.js +2 -2
  115. package/package.json +2 -4
  116. package/example/src/chevre/transaction/findCreditCard.ts +0 -31
  117. package/lib/chevre/service/transaction/orderProgramMembership/findCreditCard.d.ts +0 -23
  118. package/lib/chevre/service/transaction/orderProgramMembership/findCreditCard.js +0 -136
@@ -17,7 +17,7 @@ const factory = require("../factory");
17
17
  */
18
18
  class MongoRepository {
19
19
  constructor(connection) {
20
- this.serviceOutputModel = connection.model(serviceOutput_1.modelName, serviceOutput_1.schema);
20
+ this.serviceOutputModel = connection.model(serviceOutput_1.modelName, (0, serviceOutput_1.createSchema)());
21
21
  }
22
22
  findByIdentifier(params, projection) {
23
23
  var _a, _b;
@@ -19,7 +19,7 @@ const settings_1 = require("../../settings");
19
19
  */
20
20
  class MongoRepository {
21
21
  constructor(connection, operater) {
22
- this.placeModel = connection.model(place_1.modelName, place_1.schema);
22
+ this.placeModel = connection.model(place_1.modelName, (0, place_1.createSchema)());
23
23
  this.operator = operater;
24
24
  }
25
25
  search(params) {
@@ -30,7 +30,7 @@ const settings_1 = require("../settings");
30
30
  */
31
31
  class MongoRepository {
32
32
  constructor(connection) {
33
- this.placeModel = connection.model(place_1.modelName, place_1.schema);
33
+ this.placeModel = connection.model(place_1.modelName, (0, place_1.createSchema)());
34
34
  }
35
35
  // tslint:disable-next-line:max-func-body-length
36
36
  static CREATE_BUS_STOP_MONGO_CONDITIONS(params) {
@@ -29,7 +29,7 @@ const settings_1 = require("../settings");
29
29
  */
30
30
  class MongoRepository {
31
31
  constructor(connection) {
32
- this.priceSpecificationModel = connection.model(priceSpecification_1.modelName, priceSpecification_1.schema);
32
+ this.priceSpecificationModel = connection.model(priceSpecification_1.modelName, (0, priceSpecification_1.createSchema)());
33
33
  }
34
34
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
35
35
  static CREATE_MONGO_CONDITIONS(params) {
@@ -29,7 +29,7 @@ const settings_1 = require("../settings");
29
29
  */
30
30
  class MongoRepository {
31
31
  constructor(connection) {
32
- this.productModel = connection.model(product_1.modelName, product_1.schema);
32
+ this.productModel = connection.model(product_1.modelName, (0, product_1.createSchema)());
33
33
  }
34
34
  // tslint:disable-next-line:max-func-body-length
35
35
  static CREATE_MONGO_CONDITIONS(params) {
@@ -19,7 +19,7 @@ const settings_1 = require("../settings");
19
19
  */
20
20
  class MongoRepository {
21
21
  constructor(connection) {
22
- this.productModel = connection.model(product_1.modelName, product_1.schema);
22
+ this.productModel = connection.model(product_1.modelName, (0, product_1.createSchema)());
23
23
  }
24
24
  /**
25
25
  * プロダクトオファー検索
@@ -18,7 +18,7 @@ const settings_1 = require("../settings");
18
18
  */
19
19
  class MongoRepository {
20
20
  constructor(connection) {
21
- this.projectModel = connection.model(project_1.modelName, project_1.schema);
21
+ this.projectModel = connection.model(project_1.modelName, (0, project_1.createSchema)());
22
22
  }
23
23
  static CREATE_MONGO_CONDITIONS(params) {
24
24
  // MongoDB検索条件
@@ -18,7 +18,7 @@ const settings_1 = require("../settings");
18
18
  */
19
19
  class MongoRepository {
20
20
  constructor(connection) {
21
- this.reservationModel = connection.model(reservation_1.modelName, reservation_1.schema);
21
+ this.reservationModel = connection.model(reservation_1.modelName, (0, reservation_1.createSchema)());
22
22
  }
23
23
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
24
24
  static CREATE_MONGO_CONDITIONS(params) {
@@ -21,7 +21,7 @@ var RoleType;
21
21
  */
22
22
  class MongoRepository {
23
23
  constructor(connection) {
24
- this.roleModel = connection.model(role_1.modelName, role_1.schema);
24
+ this.roleModel = connection.model(role_1.modelName, (0, role_1.createSchema)());
25
25
  }
26
26
  static CREATE_MONGO_CONDITIONS(params) {
27
27
  var _a, _b, _c;
@@ -30,7 +30,7 @@ const settings_1 = require("../settings");
30
30
  */
31
31
  class MongoRepository {
32
32
  constructor(connection) {
33
- this.organizationModel = connection.model(seller_1.modelName, seller_1.schema);
33
+ this.organizationModel = connection.model(seller_1.modelName, (0, seller_1.createSchema)());
34
34
  }
35
35
  // tslint:disable-next-line:max-func-body-length
36
36
  static CREATE_MONGO_CONDITIONS(params) {
@@ -18,7 +18,7 @@ const settings_1 = require("../settings");
18
18
  */
19
19
  class MongoRepository {
20
20
  constructor(connection) {
21
- this.serviceOutputModel = connection.model(serviceOutput_1.modelName, serviceOutput_1.schema);
21
+ this.serviceOutputModel = connection.model(serviceOutput_1.modelName, (0, serviceOutput_1.createSchema)());
22
22
  }
23
23
  // tslint:disable-next-line:max-func-body-length
24
24
  static CREATE_MONGO_CONDITIONS(params) {
@@ -27,7 +27,7 @@ const sortOrder4executionOfTasks = {
27
27
  */
28
28
  class MongoRepository {
29
29
  constructor(connection) {
30
- this.taskModel = connection.model(task_1.modelName, task_1.schema);
30
+ this.taskModel = connection.model(task_1.modelName, (0, task_1.createSchema)());
31
31
  }
32
32
  // tslint:disable-next-line:max-func-body-length
33
33
  static CREATE_MONGO_CONDITIONS(params) {
@@ -7,7 +7,7 @@ const telemetry_1 = require("./mongoose/schemas/telemetry");
7
7
  */
8
8
  class MongoRepository {
9
9
  constructor(connection) {
10
- this.telemetryModel = connection.model(telemetry_1.modelName, telemetry_1.schema);
10
+ this.telemetryModel = connection.model(telemetry_1.modelName, (0, telemetry_1.createSchema)());
11
11
  }
12
12
  }
13
13
  exports.MongoRepository = MongoRepository;
@@ -20,7 +20,7 @@ const settings_1 = require("../settings");
20
20
  */
21
21
  class MongoRepository {
22
22
  constructor(connection) {
23
- this.transactionModel = connection.model(transaction_1.modelName, transaction_1.schema);
23
+ this.transactionModel = connection.model(transaction_1.modelName, (0, transaction_1.createSchema)());
24
24
  }
25
25
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
26
26
  static CREATE_MONGO_CONDITIONS(params) {
@@ -29,7 +29,7 @@ const settings_1 = require("../settings");
29
29
  */
30
30
  class MongoRepository {
31
31
  constructor(connection) {
32
- this.tripModel = connection.model(trip_1.modelName, trip_1.schema);
32
+ this.tripModel = connection.model(trip_1.modelName, (0, trip_1.createSchema)());
33
33
  }
34
34
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
35
35
  static CREATE_MONGO_CONDITIONS(conditions) {
@@ -342,14 +342,12 @@ function createReservations4transactionObject(params) {
342
342
  if (ticketType === undefined) {
343
343
  throw new factory.errors.NotFound(ticketOffer.typeOf);
344
344
  }
345
- if (settings_1.USE_ADVANCE_BOOKING_REQUIREMENT) {
346
- // 事前予約要件検証(2023-08-10~)
347
- validateAdvanceBookingRequirement({
348
- unitPriceOffer: ticketType,
349
- now: params.now,
350
- reservationFor: params.event
351
- });
352
- }
345
+ // 事前予約要件検証(2023-08-10~)
346
+ validateAdvanceBookingRequirement({
347
+ unitPriceOffer: ticketType,
348
+ now: params.now,
349
+ reservationFor: params.event
350
+ });
353
351
  const programMembershipUsed = yield validateProgramMembershipUsed({
354
352
  acceptedOffer,
355
353
  project: params.transaction.project
@@ -37,7 +37,6 @@ export type ISettings = factory.project.ISettings & {
37
37
  export declare const DEFAULT_TASKS_EXPORT_AGENT_NAME: string;
38
38
  export declare const USE_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
39
39
  export declare const USE_NEW_EVENT_AVAILABILITY_KEY_FROM: moment.Moment;
40
- export declare const USE_ADVANCE_BOOKING_REQUIREMENT: boolean;
41
40
  export declare const USE_OBJECT_AS_PAY_TRANSACTION_AMOUNT: boolean;
42
41
  export declare const USE_DELETE_EVENT_BY_ORDER: boolean;
43
42
  export declare const USE_ORDER_PAYMENT_DUE_ON_PLACED: boolean;
@@ -45,6 +44,7 @@ export declare const USE_AUTHORIZE_PAYMENT_RESULT_AS_ARRAY: boolean;
45
44
  export declare const USE_OPTIMIZE_TICKET_OFFER: boolean;
46
45
  export declare const MONGO_MAX_TIME_MS: number;
47
46
  export declare const MONGO_READ_PREFERENCE: string;
47
+ export declare const MONGO_AUTO_INDEX: boolean;
48
48
  /**
49
49
  * グローバル設定
50
50
  */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.settings = exports.MONGO_READ_PREFERENCE = exports.MONGO_MAX_TIME_MS = exports.USE_OPTIMIZE_TICKET_OFFER = exports.USE_AUTHORIZE_PAYMENT_RESULT_AS_ARRAY = exports.USE_ORDER_PAYMENT_DUE_ON_PLACED = exports.USE_DELETE_EVENT_BY_ORDER = exports.USE_OBJECT_AS_PAY_TRANSACTION_AMOUNT = exports.USE_ADVANCE_BOOKING_REQUIREMENT = exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.ABORTED_TASKS_WITHOUT_REPORT = exports.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS = exports.TRIGGER_WEBHOOK_MAX_RETRY_COUNT = void 0;
3
+ exports.settings = exports.MONGO_AUTO_INDEX = exports.MONGO_READ_PREFERENCE = exports.MONGO_MAX_TIME_MS = exports.USE_OPTIMIZE_TICKET_OFFER = exports.USE_AUTHORIZE_PAYMENT_RESULT_AS_ARRAY = exports.USE_ORDER_PAYMENT_DUE_ON_PLACED = exports.USE_DELETE_EVENT_BY_ORDER = exports.USE_OBJECT_AS_PAY_TRANSACTION_AMOUNT = exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.ABORTED_TASKS_WITHOUT_REPORT = exports.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS = exports.TRIGGER_WEBHOOK_MAX_RETRY_COUNT = void 0;
4
4
  const moment = require("moment");
5
5
  const factory = require("./factory");
6
6
  const transactionWebhookUrls = (typeof process.env.INFORM_TRANSACTION_URL === 'string')
@@ -63,7 +63,6 @@ exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = process.env.USE_ASSET_TRANSACTIO
63
63
  exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = (typeof process.env.USE_NEW_EVENT_AVAILABILITY_KEY_FROM === 'string')
64
64
  ? moment(process.env.USE_NEW_EVENT_AVAILABILITY_KEY_FROM)
65
65
  : moment('2023-08-31T15:00:00Z');
66
- exports.USE_ADVANCE_BOOKING_REQUIREMENT = process.env.USE_ADVANCE_BOOKING_REQUIREMENT === '1';
67
66
  exports.USE_OBJECT_AS_PAY_TRANSACTION_AMOUNT = process.env.USE_OBJECT_AS_PAY_TRANSACTION_AMOUNT === '1';
68
67
  exports.USE_DELETE_EVENT_BY_ORDER = process.env.USE_DELETE_EVENT_BY_ORDER === '1';
69
68
  exports.USE_ORDER_PAYMENT_DUE_ON_PLACED = process.env.USE_ORDER_PAYMENT_DUE_ON_PLACED === '1';
@@ -76,6 +75,7 @@ exports.MONGO_MAX_TIME_MS = (typeof process.env.MONGO_MAX_TIME_MS === 'string')
76
75
  exports.MONGO_READ_PREFERENCE = (typeof process.env.MONGO_READ_PREFERENCE === 'string')
77
76
  ? process.env.MONGO_READ_PREFERENCE
78
77
  : 'primaryPreferred';
78
+ exports.MONGO_AUTO_INDEX = process.env.MONGO_AUTO_INDEX === '1';
79
79
  /**
80
80
  * グローバル設定
81
81
  */
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  ],
11
11
  "dependencies": {
12
12
  "@chevre/factory": "4.334.0",
13
- "@cinerino/sdk": "3.170.0",
13
+ "@cinerino/sdk": "3.172.0",
14
14
  "@motionpicture/coa-service": "9.2.0",
15
15
  "@motionpicture/gmo-service": "5.2.0",
16
16
  "@sendgrid/mail": "6.4.0",
@@ -24,7 +24,6 @@
24
24
  "jsonwebtoken": "9.0.0",
25
25
  "lodash.difference": "^4.5.0",
26
26
  "moment": "^2.29.1",
27
- "moment-range": "^4.0.2",
28
27
  "moment-timezone": "^0.5.33",
29
28
  "node-fpe": "1.0.0",
30
29
  "pug": "^2.0.4",
@@ -82,7 +81,6 @@
82
81
  "npm": ">=6.0.0"
83
82
  },
84
83
  "keywords": [],
85
- "license": "ISC",
86
84
  "main": "./lib/index.js",
87
85
  "types": "./lib/index.d.ts",
88
86
  "files": [
@@ -117,5 +115,5 @@
117
115
  "postversion": "git push origin --tags",
118
116
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
119
117
  },
120
- "version": "21.12.0-alpha.0"
118
+ "version": "21.13.0-alpha.0"
121
119
  }
@@ -1,31 +0,0 @@
1
- // tslint:disable:no-console
2
- import * as mongoose from 'mongoose';
3
-
4
- import { chevre } from '../../../../lib/index';
5
-
6
- import { findCreditCard } from '../../../../lib/chevre/service/transaction/orderProgramMembership/findCreditCard';
7
-
8
- const project = { id: String(process.env.PROJECT_ID) };
9
- async function main() {
10
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
11
-
12
- const projectRepo = new chevre.repository.Project(mongoose.connection);
13
- const productRepo = new chevre.repository.Product(mongoose.connection);
14
- const personRepo = new chevre.repository.Person({ userPoolId: chevre.settings.settings.userPoolIdNew });
15
-
16
- const result = await findCreditCard({
17
- project: { id: project.id },
18
- customer: { id: 'a7909268-a584-425e-8212-d7d10f344093' },
19
- // iss: '',
20
- paymentMethodType: 'CreditCard'
21
- })({
22
- product: productRepo,
23
- person: personRepo,
24
- project: projectRepo
25
- });
26
- console.log(result);
27
- }
28
-
29
- main()
30
- .then(console.log)
31
- .catch(console.error);
@@ -1,23 +0,0 @@
1
- /**
2
- * findCreditCard
3
- */
4
- import * as GMO from '@motionpicture/gmo-service';
5
- import { CognitoRepository as PersonRepo } from '../../../repo/person';
6
- import { MongoRepository as ProductRepo } from '../../../repo/product';
7
- import { MongoRepository as ProjectRepo } from '../../../repo/project';
8
- /**
9
- * 所有クレジットカード検索
10
- */
11
- export declare function findCreditCard(params: {
12
- project: {
13
- id: string;
14
- };
15
- customer: {
16
- id: string;
17
- };
18
- paymentMethodType: string;
19
- }): (repos: {
20
- project: ProjectRepo;
21
- person: PersonRepo;
22
- product: ProductRepo;
23
- }) => Promise<GMO.factory.card.ISearchCardResult>;
@@ -1,136 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.findCreditCard = void 0;
13
- /**
14
- * findCreditCard
15
- */
16
- const GMO = require("@motionpicture/gmo-service");
17
- const createDebug = require("debug");
18
- const creditCard_1 = require("../../../repo/paymentMethod/creditCard");
19
- const person_1 = require("../../../repo/person");
20
- const factory = require("../../../factory");
21
- const credentials_1 = require("../../../credentials");
22
- const settings_1 = require("../../../settings");
23
- const debug = createDebug('chevre-domain:orderProgramMembership');
24
- /**
25
- * 所有クレジットカード検索
26
- */
27
- function findCreditCard(params) {
28
- return (repos) => __awaiter(this, void 0, void 0, function* () {
29
- // 会員クレジットカード検索
30
- // const creditCards = await repos.creditCard.searchCreditCards({ id: params.customer.id, iss: params.iss });
31
- // // creditCards = creditCards.filter((c) => c.defaultFlag === '1');
32
- // const creditCard = creditCards.shift();
33
- // if (creditCard === undefined) {
34
- // throw new factory.errors.NotFound('CreditCard');
35
- // }
36
- var _a;
37
- const project = yield repos.project.findById({
38
- id: params.project.id,
39
- inclusion: ['settings'],
40
- exclusion: []
41
- });
42
- // const userPoolId: string = params.iss;
43
- // checkUseMyCreditCards(project);
44
- let memberId = params.customer.id;
45
- const useUsernameAsGMOMemberId = ((_a = project.settings) === null || _a === void 0 ? void 0 : _a.useUsernameAsGMOMemberId) === true;
46
- debug('useUsernameAsGMOMemberId:', useUsernameAsGMOMemberId);
47
- if (useUsernameAsGMOMemberId) {
48
- const person = yield repos.person.findById({ userId: params.customer.id });
49
- memberId = yield person2username(person);
50
- }
51
- const creditCardPaymentCredentials = yield getCreditCardPaymentServiceChannel({
52
- project: { id: params.project.id },
53
- paymentMethodType: params.paymentMethodType
54
- })(repos);
55
- const creditCardRepo = new creditCard_1.GMORepository({
56
- siteId: creditCardPaymentCredentials.siteId,
57
- sitePass: creditCardPaymentCredentials.sitePass,
58
- cardService: new GMO.service.Card({ endpoint: creditCardPaymentCredentials.endpoint }, { timeout: credentials_1.credentials.gmo.timeout })
59
- });
60
- const searchCardResults = yield creditCardRepo.search({ personId: memberId });
61
- const creditCard = searchCardResults.shift();
62
- if (creditCard === undefined) {
63
- throw new factory.errors.NotFound('CreditCard');
64
- }
65
- return creditCard;
66
- });
67
- }
68
- exports.findCreditCard = findCreditCard;
69
- const SSKTS_PROVIDER_NAME = 'SSKTS';
70
- function person2username(person) {
71
- var _a, _b, _c, _d;
72
- return __awaiter(this, void 0, void 0, function* () {
73
- let username = (_a = person.memberOf) === null || _a === void 0 ? void 0 : _a.membershipNumber;
74
- // ユーザープールが本家の場合とsskstの場合に対応
75
- // 本家にssktsをプロバイダーとしてログインしている場合、追加特性に以下のような値のidentitiesがあるはず
76
- // [{"userId":"xxxx","providerName":"SSKTS","providerType":"OIDC"}]
77
- const userIdentitiesStr = (_c = (_b = person.additionalProperty) === null || _b === void 0 ? void 0 : _b.find((p) => p.name === 'identities')) === null || _c === void 0 ? void 0 : _c.value;
78
- if (typeof userIdentitiesStr === 'string' && userIdentitiesStr.length > 0) {
79
- debug('userIdentitiesStr:', userIdentitiesStr);
80
- try {
81
- const identities = JSON.parse(userIdentitiesStr);
82
- if (Array.isArray(identities) && identities.length > 0) {
83
- const providerName = identities[0].providerName;
84
- const userIdByIdentities = identities[0].userId;
85
- if (providerName === SSKTS_PROVIDER_NAME) {
86
- if (typeof userIdByIdentities === 'string' && userIdByIdentities.length > 0) {
87
- const personRepo = new person_1.CognitoRepository({
88
- userPoolId: settings_1.settings.userPoolIdOld
89
- });
90
- // oldUserは必ず存在するはず
91
- const oldUser = yield personRepo.findById({ userId: userIdByIdentities });
92
- username = String((_d = oldUser.memberOf) === null || _d === void 0 ? void 0 : _d.membershipNumber);
93
- debug('oldUser found. username:', username);
94
- }
95
- }
96
- }
97
- }
98
- catch (error) {
99
- throw error;
100
- }
101
- }
102
- return username;
103
- });
104
- }
105
- function getCreditCardPaymentServiceChannel(params) {
106
- return (repos) => __awaiter(this, void 0, void 0, function* () {
107
- var _a, _b;
108
- const paymentServices = yield repos.product.search({
109
- limit: 1,
110
- project: { id: { $eq: params.project.id } },
111
- typeOf: { $eq: factory.service.paymentService.PaymentServiceType.CreditCard },
112
- serviceType: { codeValue: { $eq: params.paymentMethodType } }
113
- }, [], []);
114
- const paymentServiceSetting = paymentServices.shift();
115
- if (paymentServiceSetting === undefined) {
116
- throw new factory.errors.NotFound('PaymentService');
117
- }
118
- // IDで検索いないとavailableChannelを取得できない
119
- const paymentService = yield repos.product.findById({ id: String(paymentServiceSetting.id) }, ['availableChannel'], []);
120
- const availableChannel = paymentService === null || paymentService === void 0 ? void 0 : paymentService.availableChannel;
121
- if (typeof (availableChannel === null || availableChannel === void 0 ? void 0 : availableChannel.serviceUrl) !== 'string') {
122
- throw new factory.errors.NotFound('paymentService.availableChannel.serviceUrl');
123
- }
124
- if (typeof ((_a = availableChannel === null || availableChannel === void 0 ? void 0 : availableChannel.credentials) === null || _a === void 0 ? void 0 : _a.siteId) !== 'string') {
125
- throw new factory.errors.NotFound('paymentService.availableChannel.credentials.siteId');
126
- }
127
- if (typeof ((_b = availableChannel === null || availableChannel === void 0 ? void 0 : availableChannel.credentials) === null || _b === void 0 ? void 0 : _b.sitePass) !== 'string') {
128
- throw new factory.errors.NotFound('paymentService.availableChannel.credentials.sitePass');
129
- }
130
- return {
131
- endpoint: availableChannel.serviceUrl,
132
- siteId: availableChannel.credentials.siteId,
133
- sitePass: availableChannel.credentials.sitePass
134
- };
135
- });
136
- }