@chevre/domain 21.8.0-alpha.8 → 21.8.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 (131) hide show
  1. package/example/src/chevre/countOffers.ts +32 -0
  2. package/example/src/chevre/findItemListElementByCatalogId.ts +30 -0
  3. package/example/src/chevre/importOffersFromCOA.ts +7 -1
  4. package/example/src/chevre/migrateOrderPaymentMethodIdentifier.ts +81 -0
  5. package/example/src/chevre/migratePayTransactionPaymentMethodId.ts +72 -0
  6. package/example/src/chevre/migratePayTransactionPaymentMethodIdentifier.ts +78 -0
  7. package/example/src/chevre/optimizeCatalogs.ts +54 -0
  8. package/example/src/chevre/processPay.ts +3 -4
  9. package/example/src/chevre/publishPermitOwnershipInfoToken.ts +56 -0
  10. package/example/src/chevre/pullAddOnsFromOffer.ts +26 -0
  11. package/example/src/chevre/pushIncludedInDataCatalog.ts +47 -0
  12. package/example/src/chevre/searchAggregateOffers.ts +48 -0
  13. package/example/src/chevre/searchEventTicketOffers.ts +5 -1
  14. package/example/src/chevre/searchEvents.ts +9 -7
  15. package/example/src/chevre/searchOfferCatalogs.ts +7 -3
  16. package/example/src/chevre/searchOffers.ts +5 -2
  17. package/example/src/chevre/searchOffersByCatalog.ts +15 -9
  18. package/example/src/chevre/searchOffersFromAggregateOffer.ts +168 -0
  19. package/example/src/chevre/searchOrders.ts +9 -7
  20. package/example/src/chevre/syncCatalogs2aggregateOffers.ts +85 -0
  21. package/lib/chevre/emailMessageBuilder.js +6 -5
  22. package/lib/chevre/repo/aggregateOffer.d.ts +62 -0
  23. package/lib/chevre/repo/aggregateOffer.js +562 -0
  24. package/lib/chevre/repo/assetTransaction.d.ts +16 -1
  25. package/lib/chevre/repo/assetTransaction.js +54 -2
  26. package/lib/chevre/repo/mongoose/schemas/aggregateOffer.d.ts +74 -0
  27. package/lib/chevre/repo/mongoose/schemas/aggregateOffer.js +189 -0
  28. package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +3 -3
  29. package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +3 -3
  30. package/lib/chevre/repo/mongoose/schemas/event.d.ts +3 -3
  31. package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +3 -0
  32. package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +10 -1
  33. package/lib/chevre/repo/mongoose/schemas/order.d.ts +3 -0
  34. package/lib/chevre/repo/mongoose/schemas/order.js +7 -0
  35. package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +9 -9
  36. package/lib/chevre/repo/mongoose/schemas/product.d.ts +3 -3
  37. package/lib/chevre/repo/mongoose/schemas/project.d.ts +3 -3
  38. package/lib/chevre/repo/mongoose/schemas/task.d.ts +3 -0
  39. package/lib/chevre/repo/mongoose/schemas/task.js +8 -0
  40. package/lib/chevre/repo/offer.d.ts +87 -51
  41. package/lib/chevre/repo/offer.js +513 -283
  42. package/lib/chevre/repo/offerCatalog.d.ts +32 -3
  43. package/lib/chevre/repo/offerCatalog.js +97 -10
  44. package/lib/chevre/repo/order.d.ts +15 -0
  45. package/lib/chevre/repo/order.js +58 -26
  46. package/lib/chevre/repo/task.d.ts +6 -2
  47. package/lib/chevre/repo/task.js +58 -4
  48. package/lib/chevre/repository.d.ts +3 -0
  49. package/lib/chevre/repository.js +5 -1
  50. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +3 -41
  51. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.d.ts +2 -0
  52. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +2 -40
  53. package/lib/chevre/service/aggregation/event/findEventOffers.d.ts +16 -0
  54. package/lib/chevre/service/aggregation/event/findEventOffers.js +58 -0
  55. package/lib/chevre/service/assetTransaction/pay/account/validation.js +2 -2
  56. package/lib/chevre/service/assetTransaction/pay/factory.js +26 -18
  57. package/lib/chevre/service/assetTransaction/pay/potentialActions.js +3 -3
  58. package/lib/chevre/service/assetTransaction/pay.js +65 -46
  59. package/lib/chevre/service/assetTransaction/refund/factory.js +8 -2
  60. package/lib/chevre/service/assetTransaction/registerService.js +2 -1
  61. package/lib/chevre/service/assetTransaction/reserve.js +111 -35
  62. package/lib/chevre/service/offer/event/authorize.js +39 -35
  63. package/lib/chevre/service/offer/event/factory.d.ts +1 -1
  64. package/lib/chevre/service/offer/event/factory.js +8 -8
  65. package/lib/chevre/service/offer/event/importFromCOA.d.ts +2 -0
  66. package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +3 -0
  67. package/lib/chevre/service/offer/event/searchEventTicketOffers.js +48 -17
  68. package/lib/chevre/service/offer/event/voidTransaction.js +57 -36
  69. package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +2 -1
  70. package/lib/chevre/service/offer/eventServiceByCOA/factory.js +7 -11
  71. package/lib/chevre/service/offer/eventServiceByCOA.js +55 -27
  72. package/lib/chevre/service/offer/factory.d.ts +12 -4
  73. package/lib/chevre/service/offer/factory.js +9 -11
  74. package/lib/chevre/service/offer/product/searchProductOffers.d.ts +10 -1
  75. package/lib/chevre/service/offer/product/searchProductOffers.js +51 -12
  76. package/lib/chevre/service/offer/product.d.ts +2 -0
  77. package/lib/chevre/service/offer/product.js +3 -2
  78. package/lib/chevre/service/offer.d.ts +1 -0
  79. package/lib/chevre/service/offer.js +7 -1
  80. package/lib/chevre/service/order/confirmPayTransaction.d.ts +0 -2
  81. package/lib/chevre/service/order/confirmPayTransaction.js +20 -42
  82. package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +27 -0
  83. package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +226 -0
  84. package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +8 -6
  85. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +80 -57
  86. package/lib/chevre/service/order/onOrderStatusChanged.js +52 -9
  87. package/lib/chevre/service/order/payOrder.js +4 -45
  88. package/lib/chevre/service/order/placeOrder.js +11 -24
  89. package/lib/chevre/service/order.d.ts +3 -1
  90. package/lib/chevre/service/order.js +6 -2
  91. package/lib/chevre/service/payment/any/factory.js +33 -8
  92. package/lib/chevre/service/payment/any.js +30 -21
  93. package/lib/chevre/service/payment/creditCard.js +12 -12
  94. package/lib/chevre/service/payment/movieTicket/validation.js +2 -2
  95. package/lib/chevre/service/payment/movieTicket.js +10 -11
  96. package/lib/chevre/service/payment/paymentCard.js +9 -12
  97. package/lib/chevre/service/project.js +1 -1
  98. package/lib/chevre/service/reserve/checkInReservation.d.ts +8 -0
  99. package/lib/chevre/service/reserve/checkInReservation.js +3 -2
  100. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +3 -0
  101. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +4 -5
  102. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.d.ts +8 -0
  103. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +16 -11
  104. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -1
  105. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.d.ts +3 -0
  106. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +3 -5
  107. package/lib/chevre/service/task/aggregateUseActionsOnEvent.js +2 -0
  108. package/lib/chevre/service/task/confirmPayTransaction.js +1 -3
  109. package/lib/chevre/service/task/importOffersFromCOA.js +3 -0
  110. package/lib/chevre/service/task/onAssetTransactionStatusChanged.d.ts +6 -0
  111. package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +37 -0
  112. package/lib/chevre/service/task/onAuthorizationCreated.js +5 -1
  113. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +2 -0
  114. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +7 -0
  115. package/lib/chevre/service/task/onResourceUpdated/syncOfferCatalog.d.ts +17 -0
  116. package/lib/chevre/service/task/onResourceUpdated/syncOfferCatalog.js +78 -0
  117. package/lib/chevre/service/task/onResourceUpdated.js +12 -0
  118. package/lib/chevre/service/task/returnPayTransaction.js +8 -3
  119. package/lib/chevre/service/transaction/placeOrderInProgress/result.js +32 -16
  120. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +13 -11
  121. package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +53 -17
  122. package/lib/chevre/service/transaction/placeOrderInProgress.js +4 -1
  123. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +7 -6
  124. package/lib/chevre/service/transaction/returnOrder.js +5 -1
  125. package/lib/chevre/settings.d.ts +3 -3
  126. package/lib/chevre/settings.js +4 -12
  127. package/package.json +3 -3
  128. package/example/src/chevre/migrateAuthorizePaymentActionResult.ts +0 -83
  129. package/example/src/chevre/migrateEventOrganizer.ts +0 -154
  130. package/lib/chevre/repo/mongoose/schemas/offer.d.ts +0 -149
  131. package/lib/chevre/repo/mongoose/schemas/offer.js +0 -210
@@ -1,50 +1,78 @@
1
- /// <reference types="mongoose/types/aggregate" />
2
- /// <reference types="mongoose/types/callback" />
3
- /// <reference types="mongoose/types/collection" />
4
- /// <reference types="mongoose/types/connection" />
5
- /// <reference types="mongoose/types/cursor" />
6
- /// <reference types="mongoose/types/document" />
7
- /// <reference types="mongoose/types/error" />
8
- /// <reference types="mongoose/types/expressions" />
9
- /// <reference types="mongoose/types/helpers" />
10
- /// <reference types="mongoose/types/middlewares" />
11
- /// <reference types="mongoose/types/indexes" />
12
- /// <reference types="mongoose/types/models" />
13
- /// <reference types="mongoose/types/mongooseoptions" />
14
- /// <reference types="mongoose/types/pipelinestage" />
15
- /// <reference types="mongoose/types/populate" />
16
- /// <reference types="mongoose/types/query" />
17
- /// <reference types="mongoose/types/schemaoptions" />
18
- /// <reference types="mongoose/types/schematypes" />
19
- /// <reference types="mongoose/types/session" />
20
- /// <reference types="mongoose/types/types" />
21
- /// <reference types="mongoose/types/utility" />
22
- /// <reference types="mongoose/types/validation" />
23
- /// <reference types="mongoose/types/virtuals" />
24
- /// <reference types="mongoose/types/inferschematype" />
25
- import { Connection } from 'mongoose';
1
+ import { AnyExpression, Connection, PipelineStage } from 'mongoose';
26
2
  import * as factory from '../factory';
27
- interface IProjection {
28
- [key: string]: 0 | 1;
29
- }
3
+ type IMatchStage = PipelineStage.Match;
4
+ type KeyOfUnitPriceOffer = keyof factory.unitPriceOffer.IUnitPriceOffer;
5
+ type IProjection = {
6
+ [key in KeyOfUnitPriceOffer]?: 0 | 1;
7
+ };
8
+ export type IUnitPriceOfferFromAggregateOffer = factory.unitPriceOffer.IUnitPriceOffer & {
9
+ offerIndex?: number;
10
+ parentOffer?: {
11
+ id: string;
12
+ };
13
+ };
30
14
  /**
31
- * オファーリポジトリ
15
+ * 単価オファーリポジトリ
32
16
  */
33
17
  export declare class MongoRepository {
34
- private readonly offerModel;
18
+ private readonly aggregateOfferModel;
35
19
  private readonly offerCatalogModel;
36
20
  constructor(connection: Connection);
37
- static CREATE_OFFER_MONGO_CONDITIONS(params: factory.unitPriceOffer.ISearchConditions): any[];
21
+ static CREATE_AGGREGATE_OFFERS_MATCH_CONDITIONS(params: factory.unitPriceOffer.ISearchConditions): IMatchStage[];
22
+ static CREATE_AGGREGATE_OFFERS_PROJECTION(params: IProjection): {
23
+ [field: string]: AnyExpression;
24
+ };
25
+ /**
26
+ * カタログIDで単価オファーを全て検索する
27
+ * 必ずカタログデータから単価オファーIDを参照する
28
+ */
29
+ searchAllByOfferCatalogId(params: {
30
+ subOfferCatalog: {
31
+ /**
32
+ * サブカタログID
33
+ */
34
+ id: string;
35
+ };
36
+ projection?: IProjection;
37
+ }): Promise<{
38
+ offers: IUnitPriceOfferFromAggregateOffer[];
39
+ }>;
38
40
  /**
39
- * カタログに含まれるオファーを検索する
40
- * カタログに登録されたオファーの順序は保証される
41
+ * 単価オファーIDとカタログIDで単価オファーを検索する
42
+ * 必ずカタログデータから単価オファーIDを参照する
41
43
  */
42
- findOffersByOfferCatalogId(params: {
44
+ searchByIdsAndOfferCatalogId(params: {
43
45
  /**
44
- * 指定したIDのオファーだけ取得する場合
46
+ * 指定したIDの単価オファーだけ取得
45
47
  */
46
- ids?: string[];
47
- offerCatalog: {
48
+ ids: string[];
49
+ subOfferCatalog: {
50
+ /**
51
+ * サブカタログID
52
+ */
53
+ id: string;
54
+ };
55
+ availableAtOrFrom?: {
56
+ id?: string;
57
+ };
58
+ unacceptedPaymentMethod?: string[];
59
+ excludeAppliesToMovieTicket: boolean;
60
+ onlyValid?: boolean;
61
+ limit?: number;
62
+ page?: number;
63
+ projection?: IProjection;
64
+ }): Promise<{
65
+ offers: IUnitPriceOfferFromAggregateOffer[];
66
+ }>;
67
+ /**
68
+ * カタログに含まれるオファーを検索する(カタログ内ソートは保証しない)
69
+ * カタログ内ソートインデックスはsortedOfferIdsで判断する
70
+ */
71
+ searchByOfferCatalogIdWithSortIndex(params: {
72
+ subOfferCatalog: {
73
+ /**
74
+ * サブカタログID
75
+ */
48
76
  id: string;
49
77
  };
50
78
  availableAtOrFrom?: {
@@ -53,20 +81,31 @@ export declare class MongoRepository {
53
81
  unacceptedPaymentMethod?: string[];
54
82
  excludeAppliesToMovieTicket: boolean;
55
83
  onlyValid?: boolean;
84
+ useIncludeInDataCatalog: boolean;
56
85
  limit?: number;
57
86
  page?: number;
58
- sort: boolean;
59
87
  projection?: IProjection;
60
88
  }): Promise<{
61
- offers: factory.unitPriceOffer.IUnitPriceOffer[];
89
+ offers: IUnitPriceOfferFromAggregateOffer[];
90
+ /**
91
+ * カタログ内ソートされた集計オファーIDリスト
92
+ */
62
93
  sortedOfferIds: string[];
63
94
  }>;
64
- findById(params: {
95
+ findAggregateOfferById(params: {
96
+ project: {
97
+ id: string;
98
+ };
65
99
  id: string;
100
+ }): Promise<factory.aggregateOffer.IAggregateOffer>;
101
+ count(params: Omit<factory.unitPriceOffer.ISearchConditions, 'limit' | 'page' | 'sort'>): Promise<number>;
102
+ search(params: factory.unitPriceOffer.ISearchConditions, projection?: IProjection): Promise<IUnitPriceOfferFromAggregateOffer[]>;
103
+ save(params: factory.unitPriceOffer.IUnitPriceOffer & {
104
+ $unset?: any;
66
105
  }): Promise<factory.unitPriceOffer.IUnitPriceOffer>;
67
- count(params: factory.unitPriceOffer.ISearchConditions): Promise<number>;
68
- search(params: factory.unitPriceOffer.ISearchConditions, projection?: IProjection): Promise<factory.unitPriceOffer.IUnitPriceOffer[]>;
69
- save(params: factory.unitPriceOffer.IUnitPriceOffer): Promise<factory.unitPriceOffer.IUnitPriceOffer>;
106
+ /**
107
+ * sskts専用オファー保管
108
+ */
70
109
  saveManyByIdentifier(params: {
71
110
  attributes: factory.unitPriceOffer.IUnitPriceOffer;
72
111
  upsert?: boolean;
@@ -87,17 +126,14 @@ export declare class MongoRepository {
87
126
  };
88
127
  }): Promise<import("mongodb").UpdateResult | undefined>;
89
128
  deleteById(params: {
90
- id: string;
91
- }): Promise<void>;
92
- deleteByProject(params: {
93
129
  project: {
94
130
  id: string;
95
131
  };
132
+ id: string;
96
133
  }): Promise<void>;
97
- getCursor(conditions: any, projection: any): import("mongoose").Cursor<any, import("mongoose").QueryOptions<any>>;
98
- unsetUnnecessaryFields(params: {
99
- filter: any;
100
- $unset: any;
101
- }): Promise<import("mongodb").UpdateResult>;
134
+ /**
135
+ * サブカタログから集計オファーIDリストを検索する
136
+ */
137
+ private searchAggregateOfferIdsBySubOfferCatalog;
102
138
  }
103
139
  export {};