@chevre/domain 21.11.0 → 21.12.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 (42) hide show
  1. package/README.md +0 -5
  2. package/lib/chevre/repo/assetTransaction.d.ts +1 -1
  3. package/lib/chevre/repo/mongoose/schemas/account.js +2 -1
  4. package/lib/chevre/repo/mongoose/schemas/accountTitle.js +2 -1
  5. package/lib/chevre/repo/mongoose/schemas/accountingReport.js +2 -1
  6. package/lib/chevre/repo/mongoose/schemas/additionalProperty.js +2 -1
  7. package/lib/chevre/repo/mongoose/schemas/aggregateOffer.d.ts +3 -3
  8. package/lib/chevre/repo/mongoose/schemas/aggregateOffer.js +2 -1
  9. package/lib/chevre/repo/mongoose/schemas/aggregation.js +2 -1
  10. package/lib/chevre/repo/mongoose/schemas/categoryCode.js +2 -1
  11. package/lib/chevre/repo/mongoose/schemas/comments.d.ts +3 -3
  12. package/lib/chevre/repo/mongoose/schemas/creativeWork.js +2 -1
  13. package/lib/chevre/repo/mongoose/schemas/customer.js +2 -1
  14. package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +3 -3
  15. package/lib/chevre/repo/mongoose/schemas/emailMessages.js +2 -1
  16. package/lib/chevre/repo/mongoose/schemas/event.d.ts +3 -3
  17. package/lib/chevre/repo/mongoose/schemas/event.js +2 -1
  18. package/lib/chevre/repo/mongoose/schemas/member.js +2 -1
  19. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.js +2 -1
  20. package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +3 -3
  21. package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +2 -1
  22. package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.js +2 -1
  23. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.d.ts +3 -3
  24. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.js +2 -1
  25. package/lib/chevre/repo/mongoose/schemas/place.js +2 -1
  26. package/lib/chevre/repo/mongoose/schemas/priceSpecification.js +2 -1
  27. package/lib/chevre/repo/mongoose/schemas/product.js +2 -1
  28. package/lib/chevre/repo/mongoose/schemas/project.d.ts +3 -3
  29. package/lib/chevre/repo/mongoose/schemas/project.js +2 -1
  30. package/lib/chevre/repo/mongoose/schemas/role.js +2 -1
  31. package/lib/chevre/repo/mongoose/schemas/seller.js +2 -1
  32. package/lib/chevre/repo/mongoose/schemas/telemetry.js +2 -1
  33. package/lib/chevre/repo/mongoose/schemas/trip.js +2 -1
  34. package/lib/chevre/repo/task.d.ts +1 -1
  35. package/lib/chevre/repo/transaction.d.ts +1 -1
  36. package/lib/chevre/service/assetTransaction/reserve.js +6 -8
  37. package/lib/chevre/settings.d.ts +1 -1
  38. package/lib/chevre/settings.js +4 -2
  39. package/package.json +2 -4
  40. package/example/src/chevre/transaction/findCreditCard.ts +0 -31
  41. package/lib/chevre/service/transaction/orderProgramMembership/findCreditCard.d.ts +0 -23
  42. package/lib/chevre/service/transaction/orderProgramMembership/findCreditCard.js +0 -136
package/README.md CHANGED
@@ -11,14 +11,9 @@
11
11
  - [Chevre Domain Library for Node.js](#chevre-domain-library-for-nodejs)
12
12
  - [Table of contents](#table-of-contents)
13
13
  - [Usage](#usage)
14
- - [License](#license)
15
14
 
16
15
  ## Usage
17
16
 
18
17
  ```shell
19
18
  npm install @chevre/domain
20
19
  ```
21
-
22
- ## License
23
-
24
- ISC
@@ -131,7 +131,7 @@ export declare class MongoRepository {
131
131
  status: {
132
132
  $in: factory.transactionStatusType[];
133
133
  };
134
- }): Promise<Pick<import("@chevre/factory/lib/assetTransaction/cancelReservation").ITransaction | import("@chevre/factory/lib/assetTransaction/moneyTransfer").ITransaction | import("@chevre/factory/lib/assetTransaction/reserve").ITransaction | import("@chevre/factory/lib/assetTransaction/pay").ITransaction | import("@chevre/factory/lib/assetTransaction/refund").ITransaction | import("@chevre/factory/lib/assetTransaction/registerService").ITransaction, "id" | "typeOf" | "status">[]>;
134
+ }): Promise<Pick<import("@chevre/factory/lib/assetTransaction/cancelReservation").ITransaction | import("@chevre/factory/lib/assetTransaction/moneyTransfer").ITransaction | import("@chevre/factory/lib/assetTransaction/reserve").ITransaction | import("@chevre/factory/lib/assetTransaction/pay").ITransaction | import("@chevre/factory/lib/assetTransaction/refund").ITransaction | import("@chevre/factory/lib/assetTransaction/registerService").ITransaction, "typeOf" | "id" | "status">[]>;
135
135
  /**
136
136
  * set task status exported by transaction id
137
137
  * IDでタスクをエクスポート済に変更する
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'Account';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -11,7 +12,7 @@ exports.modelName = modelName;
11
12
  const schema = new mongoose_1.Schema({}, {
12
13
  collection: 'accounts',
13
14
  id: true,
14
- read: 'primaryPreferred',
15
+ read: settings_1.MONGO_READ_PREFERENCE,
15
16
  writeConcern: writeConcern_1.writeConcern,
16
17
  strict: false,
17
18
  strictQuery: false,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'AccountTitle';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -26,7 +27,7 @@ const schema = new mongoose_1.Schema({
26
27
  }, {
27
28
  collection: 'accountTitles',
28
29
  id: true,
29
- read: 'primaryPreferred',
30
+ read: settings_1.MONGO_READ_PREFERENCE,
30
31
  writeConcern: writeConcern_1.writeConcern,
31
32
  strictQuery: false,
32
33
  timestamps: {
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'AccountingReport';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -15,7 +16,7 @@ const schema = new mongoose_1.Schema({
15
16
  }, {
16
17
  collection: 'accountingReports',
17
18
  id: true,
18
- read: 'primaryPreferred',
19
+ read: settings_1.MONGO_READ_PREFERENCE,
19
20
  writeConcern: writeConcern_1.writeConcern,
20
21
  strict: false,
21
22
  strictQuery: false,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'AdditionalProperty';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -23,7 +24,7 @@ const schema = new mongoose_1.Schema({
23
24
  }, {
24
25
  collection: 'additionalProperties',
25
26
  id: true,
26
- read: 'primaryPreferred',
27
+ read: settings_1.MONGO_READ_PREFERENCE,
27
28
  writeConcern: writeConcern_1.writeConcern,
28
29
  strict: true,
29
30
  strictQuery: false,
@@ -53,20 +53,20 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
53
53
  }, {
54
54
  offers: any[];
55
55
  includedInDataCatalog: any[];
56
- _id?: string | undefined;
57
56
  typeOf?: string | undefined;
57
+ _id?: string | undefined;
58
58
  project?: any;
59
59
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
60
60
  offers: any[];
61
61
  includedInDataCatalog: any[];
62
- _id?: string | undefined;
63
62
  typeOf?: string | undefined;
63
+ _id?: string | undefined;
64
64
  project?: any;
65
65
  }>> & Omit<import("mongoose").FlatRecord<{
66
66
  offers: any[];
67
67
  includedInDataCatalog: any[];
68
- _id?: string | undefined;
69
68
  typeOf?: string | undefined;
69
+ _id?: string | undefined;
70
70
  project?: any;
71
71
  }> & Required<{
72
72
  _id: string;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'AggregateOffer';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -17,7 +18,7 @@ const schema = new mongoose_1.Schema({
17
18
  }, {
18
19
  collection: 'aggregateOffers',
19
20
  id: true,
20
- read: 'primaryPreferred',
21
+ read: settings_1.MONGO_READ_PREFERENCE,
21
22
  writeConcern: writeConcern_1.writeConcern,
22
23
  strict: true,
23
24
  strictQuery: false,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'Aggregation';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -11,7 +12,7 @@ exports.modelName = modelName;
11
12
  const schema = new mongoose_1.Schema({}, {
12
13
  collection: 'aggregations',
13
14
  id: true,
14
- read: 'primaryPreferred',
15
+ read: settings_1.MONGO_READ_PREFERENCE,
15
16
  writeConcern: writeConcern_1.writeConcern,
16
17
  strict: false,
17
18
  strictQuery: false,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'CategoryCode';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -27,7 +28,7 @@ const schema = new mongoose_1.Schema({
27
28
  }, {
28
29
  collection: 'categoryCodes',
29
30
  id: true,
30
- read: 'primaryPreferred',
31
+ read: settings_1.MONGO_READ_PREFERENCE,
31
32
  writeConcern: writeConcern_1.writeConcern,
32
33
  strict: true,
33
34
  strictQuery: false,
@@ -52,8 +52,8 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
52
52
  versionKey: false;
53
53
  };
54
54
  }, {
55
- text: string;
56
55
  typeOf: string;
56
+ text: string;
57
57
  additionalProperty: any[];
58
58
  commentCount: number;
59
59
  mentions: any[];
@@ -63,8 +63,8 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
63
63
  dateCreated?: Date | undefined;
64
64
  dateModified?: Date | undefined;
65
65
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
66
- text: string;
67
66
  typeOf: string;
67
+ text: string;
68
68
  additionalProperty: any[];
69
69
  commentCount: number;
70
70
  mentions: any[];
@@ -74,8 +74,8 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
74
74
  dateCreated?: Date | undefined;
75
75
  dateModified?: Date | undefined;
76
76
  }>> & Omit<import("mongoose").FlatRecord<{
77
- text: string;
78
77
  typeOf: string;
78
+ text: string;
79
79
  additionalProperty: any[];
80
80
  commentCount: number;
81
81
  mentions: any[];
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'CreativeWork';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -33,7 +34,7 @@ const schema = new mongoose_1.Schema({
33
34
  }, {
34
35
  collection: 'creativeWorks',
35
36
  id: true,
36
- read: 'primaryPreferred',
37
+ read: settings_1.MONGO_READ_PREFERENCE,
37
38
  writeConcern: writeConcern_1.writeConcern,
38
39
  strict: true,
39
40
  strictQuery: false,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'Customer';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -24,7 +25,7 @@ const schema = new mongoose_1.Schema({
24
25
  }, {
25
26
  collection: 'customers',
26
27
  id: true,
27
- read: 'primaryPreferred',
28
+ read: settings_1.MONGO_READ_PREFERENCE,
28
29
  writeConcern: writeConcern_1.writeConcern,
29
30
  strict: true,
30
31
  strictQuery: false,
@@ -53,24 +53,24 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
53
53
  };
54
54
  }, {
55
55
  typeOf: string;
56
- text?: string | undefined;
57
56
  name?: any;
57
+ text?: string | undefined;
58
58
  project?: any;
59
59
  identifier?: string | undefined;
60
60
  about?: any;
61
61
  sender?: any;
62
62
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
63
63
  typeOf: string;
64
- text?: string | undefined;
65
64
  name?: any;
65
+ text?: string | undefined;
66
66
  project?: any;
67
67
  identifier?: string | undefined;
68
68
  about?: any;
69
69
  sender?: any;
70
70
  }>> & Omit<import("mongoose").FlatRecord<{
71
71
  typeOf: string;
72
- text?: string | undefined;
73
72
  name?: any;
73
+ text?: string | undefined;
74
74
  project?: any;
75
75
  identifier?: string | undefined;
76
76
  about?: any;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'EmailMessage';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -22,7 +23,7 @@ const schema = new mongoose_1.Schema({
22
23
  }, {
23
24
  collection: 'emailMessages',
24
25
  id: true,
25
- read: 'primaryPreferred',
26
+ read: settings_1.MONGO_READ_PREFERENCE,
26
27
  writeConcern: writeConcern_1.writeConcern,
27
28
  strict: true,
28
29
  strictQuery: false,
@@ -57,8 +57,8 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
57
57
  organizer: any;
58
58
  checkInCount: number;
59
59
  attendeeCount: number;
60
- _id?: string | undefined;
61
60
  name?: any;
61
+ _id?: string | undefined;
62
62
  alternateName?: any;
63
63
  description?: any;
64
64
  additionalProperty?: any;
@@ -91,8 +91,8 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
91
91
  organizer: any;
92
92
  checkInCount: number;
93
93
  attendeeCount: number;
94
- _id?: string | undefined;
95
94
  name?: any;
95
+ _id?: string | undefined;
96
96
  alternateName?: any;
97
97
  description?: any;
98
98
  additionalProperty?: any;
@@ -125,8 +125,8 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
125
125
  organizer: any;
126
126
  checkInCount: number;
127
127
  attendeeCount: number;
128
- _id?: string | undefined;
129
128
  name?: any;
129
+ _id?: string | undefined;
130
130
  alternateName?: any;
131
131
  description?: any;
132
132
  additionalProperty?: any;
@@ -4,6 +4,7 @@ exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
6
  const factory = require("../../../factory");
7
+ const settings_1 = require("../../../settings");
7
8
  const modelName = 'Event';
8
9
  exports.modelName = modelName;
9
10
  /**
@@ -57,7 +58,7 @@ const schema = new mongoose_1.Schema({
57
58
  }, {
58
59
  collection: 'events',
59
60
  id: true,
60
- read: 'primaryPreferred',
61
+ read: settings_1.MONGO_READ_PREFERENCE,
61
62
  writeConcern: writeConcern_1.writeConcern,
62
63
  strict: true,
63
64
  strictQuery: false,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'Member';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -24,7 +25,7 @@ const schema = new mongoose_1.Schema({
24
25
  }, {
25
26
  collection: 'members',
26
27
  id: true,
27
- read: 'primaryPreferred',
28
+ read: settings_1.MONGO_READ_PREFERENCE,
28
29
  writeConcern: writeConcern_1.writeConcern,
29
30
  strict: true,
30
31
  strictQuery: false,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'MerchantReturnPolicy';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -22,7 +23,7 @@ const schema = new mongoose_1.Schema({
22
23
  }, {
23
24
  collection: 'merchantReturnPolicies',
24
25
  id: true,
25
- read: 'primaryPreferred',
26
+ read: settings_1.MONGO_READ_PREFERENCE,
26
27
  writeConcern: writeConcern_1.writeConcern,
27
28
  strict: true,
28
29
  strictQuery: false,
@@ -55,8 +55,8 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
55
55
  additionalProperty: any[];
56
56
  identifier: string;
57
57
  itemListElement: any[];
58
- _id?: string | undefined;
59
58
  name?: any;
59
+ _id?: string | undefined;
60
60
  project?: any;
61
61
  alternateName?: any;
62
62
  description?: any;
@@ -67,8 +67,8 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
67
67
  additionalProperty: any[];
68
68
  identifier: string;
69
69
  itemListElement: any[];
70
- _id?: string | undefined;
71
70
  name?: any;
71
+ _id?: string | undefined;
72
72
  project?: any;
73
73
  alternateName?: any;
74
74
  description?: any;
@@ -79,8 +79,8 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
79
79
  additionalProperty: any[];
80
80
  identifier: string;
81
81
  itemListElement: any[];
82
- _id?: string | undefined;
83
82
  name?: any;
83
+ _id?: string | undefined;
84
84
  project?: any;
85
85
  alternateName?: any;
86
86
  description?: any;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'OfferCatalog';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -31,7 +32,7 @@ const schema = new mongoose_1.Schema({
31
32
  }, {
32
33
  collection: 'offerCatalogs',
33
34
  id: true,
34
- read: 'primaryPreferred',
35
+ read: settings_1.MONGO_READ_PREFERENCE,
35
36
  writeConcern: writeConcern_1.writeConcern,
36
37
  strict: true,
37
38
  strictQuery: false,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'OfferCatalogItem';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -29,7 +30,7 @@ const schema = new mongoose_1.Schema({
29
30
  }, {
30
31
  collection: 'offerCatalogItems',
31
32
  id: true,
32
- read: 'primaryPreferred',
33
+ read: settings_1.MONGO_READ_PREFERENCE,
33
34
  writeConcern: writeConcern_1.writeConcern,
34
35
  strict: true,
35
36
  strictQuery: false,
@@ -51,20 +51,20 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
51
51
  versionKey: false;
52
52
  };
53
53
  }, {
54
- name?: any;
55
54
  typeOf?: string | undefined;
55
+ name?: any;
56
56
  project?: any;
57
57
  identifier?: string | undefined;
58
58
  itemOffered?: any;
59
59
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
60
- name?: any;
61
60
  typeOf?: string | undefined;
61
+ name?: any;
62
62
  project?: any;
63
63
  identifier?: string | undefined;
64
64
  itemOffered?: any;
65
65
  }>> & Omit<import("mongoose").FlatRecord<{
66
- name?: any;
67
66
  typeOf?: string | undefined;
67
+ name?: any;
68
68
  project?: any;
69
69
  identifier?: string | undefined;
70
70
  itemOffered?: any;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'OfferItemCondition';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -17,7 +18,7 @@ const schema = new mongoose_1.Schema({
17
18
  }, {
18
19
  collection: 'offerItemConditions',
19
20
  id: true,
20
- read: 'primaryPreferred',
21
+ read: settings_1.MONGO_READ_PREFERENCE,
21
22
  writeConcern: writeConcern_1.writeConcern,
22
23
  strict: true,
23
24
  strictQuery: false,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'Place';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -46,7 +47,7 @@ const schema = new mongoose_1.Schema({
46
47
  }, {
47
48
  collection: 'places',
48
49
  id: true,
49
- read: 'primaryPreferred',
50
+ read: settings_1.MONGO_READ_PREFERENCE,
50
51
  writeConcern: writeConcern_1.writeConcern,
51
52
  strict: true,
52
53
  strictQuery: false,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'PriceSpecification';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -25,7 +26,7 @@ const schema = new mongoose_1.Schema({
25
26
  }, {
26
27
  collection: 'priceSpecifications',
27
28
  id: true,
28
- read: 'primaryPreferred',
29
+ read: settings_1.MONGO_READ_PREFERENCE,
29
30
  writeConcern: writeConcern_1.writeConcern,
30
31
  strict: true,
31
32
  strictQuery: false,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'Product';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -30,7 +31,7 @@ const schema = new mongoose_1.Schema({
30
31
  }, {
31
32
  collection: 'products',
32
33
  id: true,
33
- read: 'primaryPreferred',
34
+ read: settings_1.MONGO_READ_PREFERENCE,
34
35
  writeConcern: writeConcern_1.writeConcern,
35
36
  strict: true,
36
37
  strictQuery: false,
@@ -53,8 +53,8 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
53
53
  };
54
54
  }, {
55
55
  typeOf: string;
56
- _id?: string | undefined;
57
56
  name?: string | undefined;
57
+ _id?: string | undefined;
58
58
  logo?: string | undefined;
59
59
  alternateName?: string | undefined;
60
60
  settings?: any;
@@ -62,8 +62,8 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
62
62
  subscription?: any;
63
63
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
64
64
  typeOf: string;
65
- _id?: string | undefined;
66
65
  name?: string | undefined;
66
+ _id?: string | undefined;
67
67
  logo?: string | undefined;
68
68
  alternateName?: string | undefined;
69
69
  settings?: any;
@@ -71,8 +71,8 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
71
71
  subscription?: any;
72
72
  }>> & Omit<import("mongoose").FlatRecord<{
73
73
  typeOf: string;
74
- _id?: string | undefined;
75
74
  name?: string | undefined;
75
+ _id?: string | undefined;
76
76
  logo?: string | undefined;
77
77
  alternateName?: string | undefined;
78
78
  settings?: any;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'Project';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -23,7 +24,7 @@ const schema = new mongoose_1.Schema({
23
24
  }, {
24
25
  collection: 'projects',
25
26
  id: true,
26
- read: 'primaryPreferred',
27
+ read: settings_1.MONGO_READ_PREFERENCE,
27
28
  writeConcern: writeConcern_1.writeConcern,
28
29
  strict: true,
29
30
  strictQuery: false,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'Role';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -14,7 +15,7 @@ const schema = new mongoose_1.Schema({
14
15
  }, {
15
16
  collection: 'roles',
16
17
  id: true,
17
- read: 'primaryPreferred',
18
+ read: settings_1.MONGO_READ_PREFERENCE,
18
19
  writeConcern: writeConcern_1.writeConcern,
19
20
  strict: false,
20
21
  strictQuery: false,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'Seller';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -27,7 +28,7 @@ const schema = new mongoose_1.Schema({
27
28
  }, {
28
29
  collection: 'sellers',
29
30
  id: true,
30
- read: 'primaryPreferred',
31
+ read: settings_1.MONGO_READ_PREFERENCE,
31
32
  writeConcern: writeConcern_1.writeConcern,
32
33
  strict: true,
33
34
  strictQuery: false,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'Telemetry';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -19,7 +20,7 @@ const schema = new mongoose_1.Schema({
19
20
  }, {
20
21
  collection: 'telemetries',
21
22
  id: true,
22
- read: 'primaryPreferred',
23
+ read: settings_1.MONGO_READ_PREFERENCE,
23
24
  writeConcern: writeConcern_1.writeConcern,
24
25
  strict: true,
25
26
  strictQuery: false,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'Trip';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -17,7 +18,7 @@ const schema = new mongoose_1.Schema({
17
18
  }, {
18
19
  collection: 'trips',
19
20
  id: true,
20
- read: 'primaryPreferred',
21
+ read: settings_1.MONGO_READ_PREFERENCE,
21
22
  writeConcern: writeConcern_1.writeConcern,
22
23
  strict: false,
23
24
  strictQuery: false,
@@ -74,7 +74,7 @@ export declare class MongoRepository {
74
74
  */
75
75
  $nin?: factory.taskName[];
76
76
  };
77
- }): Promise<Pick<import("@chevre/factory/lib/task").ITask | import("@chevre/factory/lib/task/confirmMoneyTransfer").ITask | import("@chevre/factory/lib/task/confirmRegisterService").ITask | import("@chevre/factory/lib/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/task/createEvent").ITask | import("@chevre/factory/lib/task/deleteTransaction").ITask | import("@chevre/factory/lib/task/givePointAward").ITask | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").ITask | import("@chevre/factory/lib/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/task/onEventChanged").ITask | import("@chevre/factory/lib/task/onResourceUpdated").ITask | import("@chevre/factory/lib/task/onOrderPaymentCompleted").ITask | import("@chevre/factory/lib/task/placeOrder").ITask | import("@chevre/factory/lib/task/returnOrder").ITask | import("@chevre/factory/lib/task/returnMoneyTransfer").ITask | import("@chevre/factory/lib/task/returnPayTransaction").ITask | import("@chevre/factory/lib/task/returnPointAward").ITask | import("@chevre/factory/lib/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/task/sendEmailMessage").ITask | import("@chevre/factory/lib/task/sendOrder").ITask | import("@chevre/factory/lib/task/syncScreeningRooms").ITask | import("@chevre/factory/lib/task/triggerWebhook").ITask | import("@chevre/factory/lib/task/useReservation").ITask | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").ITask | import("@chevre/factory/lib/task/voidPayTransaction").ITask | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/voidReserveTransaction").ITask, "id" | "name" | "status">[]>;
77
+ }): Promise<Pick<import("@chevre/factory/lib/task").ITask | import("@chevre/factory/lib/task/confirmMoneyTransfer").ITask | import("@chevre/factory/lib/task/confirmRegisterService").ITask | import("@chevre/factory/lib/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/task/createEvent").ITask | import("@chevre/factory/lib/task/deleteTransaction").ITask | import("@chevre/factory/lib/task/givePointAward").ITask | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").ITask | import("@chevre/factory/lib/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/task/onEventChanged").ITask | import("@chevre/factory/lib/task/onResourceUpdated").ITask | import("@chevre/factory/lib/task/onOrderPaymentCompleted").ITask | import("@chevre/factory/lib/task/placeOrder").ITask | import("@chevre/factory/lib/task/returnOrder").ITask | import("@chevre/factory/lib/task/returnMoneyTransfer").ITask | import("@chevre/factory/lib/task/returnPayTransaction").ITask | import("@chevre/factory/lib/task/returnPointAward").ITask | import("@chevre/factory/lib/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/task/sendEmailMessage").ITask | import("@chevre/factory/lib/task/sendOrder").ITask | import("@chevre/factory/lib/task/syncScreeningRooms").ITask | import("@chevre/factory/lib/task/triggerWebhook").ITask | import("@chevre/factory/lib/task/useReservation").ITask | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").ITask | import("@chevre/factory/lib/task/voidPayTransaction").ITask | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/voidReserveTransaction").ITask, "name" | "id" | "status">[]>;
78
78
  retry(params: {
79
79
  intervalInMinutes: number;
80
80
  }): Promise<void>;
@@ -159,7 +159,7 @@ export declare class MongoRepository {
159
159
  status: {
160
160
  $in: factory.transactionStatusType[];
161
161
  };
162
- }): Promise<Pick<import("@chevre/factory/lib/transaction/moneyTransfer").ITransaction | import("@chevre/factory/lib/transaction/placeOrder").ITransaction | import("@chevre/factory/lib/transaction/returnOrder").ITransaction, "id" | "typeOf" | "status">[]>;
162
+ }): Promise<Pick<import("@chevre/factory/lib/transaction/moneyTransfer").ITransaction | import("@chevre/factory/lib/transaction/placeOrder").ITransaction | import("@chevre/factory/lib/transaction/returnOrder").ITransaction, "typeOf" | "id" | "status">[]>;
163
163
  /**
164
164
  * set task status exported by transaction id
165
165
  * IDでタスクをエクスポート済に変更する
@@ -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,13 +37,13 @@ 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;
44
43
  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;
46
+ export declare const MONGO_READ_PREFERENCE: string;
47
47
  /**
48
48
  * グローバル設定
49
49
  */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.settings = 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_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';
@@ -73,6 +72,9 @@ exports.MONGO_MAX_TIME_MS = (typeof process.env.MONGO_MAX_TIME_MS === 'string')
73
72
  ? Number(process.env.MONGO_MAX_TIME_MS)
74
73
  // tslint:disable-next-line:no-magic-numbers
75
74
  : 10000;
75
+ exports.MONGO_READ_PREFERENCE = (typeof process.env.MONGO_READ_PREFERENCE === 'string')
76
+ ? process.env.MONGO_READ_PREFERENCE
77
+ : 'primaryPreferred';
76
78
  /**
77
79
  * グローバル設定
78
80
  */
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.11.0"
118
+ "version": "21.12.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
- }