@chevre/domain 21.8.0-alpha.9 → 21.9.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 (132) 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/searchAvaialbleAppliesToMovieTicketByOfferCatalogId.ts +26 -0
  14. package/example/src/chevre/searchEventTicketOffers.ts +5 -1
  15. package/example/src/chevre/searchEvents.ts +9 -7
  16. package/example/src/chevre/searchOfferCatalogs.ts +7 -3
  17. package/example/src/chevre/searchOffers.ts +5 -2
  18. package/example/src/chevre/searchOffersByCatalog.ts +15 -9
  19. package/example/src/chevre/searchOffersFromAggregateOffer.ts +168 -0
  20. package/example/src/chevre/searchOrders.ts +9 -7
  21. package/example/src/chevre/syncCatalogs2aggregateOffers.ts +85 -0
  22. package/lib/chevre/emailMessageBuilder.js +6 -5
  23. package/lib/chevre/repo/aggregateOffer.d.ts +62 -0
  24. package/lib/chevre/repo/aggregateOffer.js +562 -0
  25. package/lib/chevre/repo/assetTransaction.d.ts +16 -1
  26. package/lib/chevre/repo/assetTransaction.js +54 -2
  27. package/lib/chevre/repo/mongoose/schemas/aggregateOffer.d.ts +74 -0
  28. package/lib/chevre/repo/mongoose/schemas/aggregateOffer.js +189 -0
  29. package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +3 -3
  30. package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +3 -3
  31. package/lib/chevre/repo/mongoose/schemas/event.d.ts +3 -3
  32. package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +3 -0
  33. package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +10 -1
  34. package/lib/chevre/repo/mongoose/schemas/order.d.ts +3 -0
  35. package/lib/chevre/repo/mongoose/schemas/order.js +7 -0
  36. package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +9 -9
  37. package/lib/chevre/repo/mongoose/schemas/product.d.ts +3 -3
  38. package/lib/chevre/repo/mongoose/schemas/project.d.ts +3 -3
  39. package/lib/chevre/repo/mongoose/schemas/task.d.ts +3 -0
  40. package/lib/chevre/repo/mongoose/schemas/task.js +8 -0
  41. package/lib/chevre/repo/offer.d.ts +106 -51
  42. package/lib/chevre/repo/offer.js +555 -283
  43. package/lib/chevre/repo/offerCatalog.d.ts +32 -3
  44. package/lib/chevre/repo/offerCatalog.js +97 -10
  45. package/lib/chevre/repo/order.d.ts +15 -0
  46. package/lib/chevre/repo/order.js +58 -26
  47. package/lib/chevre/repo/task.d.ts +6 -2
  48. package/lib/chevre/repo/task.js +58 -4
  49. package/lib/chevre/repository.d.ts +3 -0
  50. package/lib/chevre/repository.js +5 -1
  51. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +3 -41
  52. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.d.ts +2 -0
  53. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +2 -40
  54. package/lib/chevre/service/aggregation/event/findEventOffers.d.ts +16 -0
  55. package/lib/chevre/service/aggregation/event/findEventOffers.js +58 -0
  56. package/lib/chevre/service/assetTransaction/pay/account/validation.js +2 -2
  57. package/lib/chevre/service/assetTransaction/pay/factory.js +26 -18
  58. package/lib/chevre/service/assetTransaction/pay/potentialActions.js +3 -3
  59. package/lib/chevre/service/assetTransaction/pay.js +65 -46
  60. package/lib/chevre/service/assetTransaction/refund/factory.js +8 -2
  61. package/lib/chevre/service/assetTransaction/registerService.js +2 -1
  62. package/lib/chevre/service/assetTransaction/reserve.js +111 -35
  63. package/lib/chevre/service/offer/event/authorize.js +39 -35
  64. package/lib/chevre/service/offer/event/factory.d.ts +1 -1
  65. package/lib/chevre/service/offer/event/factory.js +8 -8
  66. package/lib/chevre/service/offer/event/importFromCOA.d.ts +2 -0
  67. package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +3 -0
  68. package/lib/chevre/service/offer/event/searchEventTicketOffers.js +48 -17
  69. package/lib/chevre/service/offer/event/voidTransaction.js +57 -36
  70. package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +2 -1
  71. package/lib/chevre/service/offer/eventServiceByCOA/factory.js +7 -11
  72. package/lib/chevre/service/offer/eventServiceByCOA.js +55 -27
  73. package/lib/chevre/service/offer/factory.d.ts +12 -4
  74. package/lib/chevre/service/offer/factory.js +9 -11
  75. package/lib/chevre/service/offer/product/searchProductOffers.d.ts +10 -1
  76. package/lib/chevre/service/offer/product/searchProductOffers.js +51 -12
  77. package/lib/chevre/service/offer/product.d.ts +2 -0
  78. package/lib/chevre/service/offer/product.js +3 -2
  79. package/lib/chevre/service/offer.d.ts +1 -0
  80. package/lib/chevre/service/offer.js +7 -1
  81. package/lib/chevre/service/order/confirmPayTransaction.d.ts +0 -2
  82. package/lib/chevre/service/order/confirmPayTransaction.js +20 -46
  83. package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +27 -0
  84. package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +226 -0
  85. package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +8 -6
  86. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +80 -57
  87. package/lib/chevre/service/order/onOrderStatusChanged.js +49 -9
  88. package/lib/chevre/service/order/payOrder.js +4 -45
  89. package/lib/chevre/service/order/placeOrder.js +11 -24
  90. package/lib/chevre/service/order.d.ts +3 -1
  91. package/lib/chevre/service/order.js +6 -2
  92. package/lib/chevre/service/payment/any/factory.js +33 -8
  93. package/lib/chevre/service/payment/any.js +30 -21
  94. package/lib/chevre/service/payment/creditCard.js +12 -12
  95. package/lib/chevre/service/payment/movieTicket/validation.js +2 -2
  96. package/lib/chevre/service/payment/movieTicket.js +10 -11
  97. package/lib/chevre/service/payment/paymentCard.js +9 -12
  98. package/lib/chevre/service/project.js +1 -1
  99. package/lib/chevre/service/reserve/checkInReservation.d.ts +8 -0
  100. package/lib/chevre/service/reserve/checkInReservation.js +3 -2
  101. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +3 -0
  102. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +4 -5
  103. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.d.ts +8 -0
  104. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +16 -11
  105. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -1
  106. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.d.ts +3 -0
  107. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +3 -5
  108. package/lib/chevre/service/task/aggregateUseActionsOnEvent.js +2 -0
  109. package/lib/chevre/service/task/confirmPayTransaction.js +1 -3
  110. package/lib/chevre/service/task/importOffersFromCOA.js +3 -0
  111. package/lib/chevre/service/task/onAssetTransactionStatusChanged.d.ts +6 -0
  112. package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +37 -0
  113. package/lib/chevre/service/task/onAuthorizationCreated.js +5 -1
  114. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +2 -0
  115. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +7 -0
  116. package/lib/chevre/service/task/onResourceUpdated/syncOfferCatalog.d.ts +17 -0
  117. package/lib/chevre/service/task/onResourceUpdated/syncOfferCatalog.js +78 -0
  118. package/lib/chevre/service/task/onResourceUpdated.js +12 -0
  119. package/lib/chevre/service/task/returnPayTransaction.js +8 -3
  120. package/lib/chevre/service/transaction/placeOrderInProgress/result.js +32 -16
  121. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +13 -11
  122. package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +53 -17
  123. package/lib/chevre/service/transaction/placeOrderInProgress.js +4 -1
  124. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +7 -6
  125. package/lib/chevre/service/transaction/returnOrder.js +5 -1
  126. package/lib/chevre/settings.d.ts +3 -3
  127. package/lib/chevre/settings.js +4 -12
  128. package/package.json +3 -3
  129. package/example/src/chevre/migrateAuthorizePaymentActionResult.ts +0 -83
  130. package/example/src/chevre/migrateEventOrganizer.ts +0 -154
  131. package/lib/chevre/repo/mongoose/schemas/offer.d.ts +0 -149
  132. 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: Omit<factory.unitPriceOffer.ISearchConditions, 'limit' | 'page' | 'sort'>): 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,50 @@ 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
+ /**
96
+ * カタログに記載されたオファーにおいて利用可能な決済方法区分を検索する
97
+ */
98
+ searchAvaialbleAppliesToMovieTicketByOfferCatalogId(params: {
99
+ subOfferCatalog: {
100
+ /**
101
+ * サブカタログID
102
+ */
103
+ id: string;
104
+ };
105
+ availableAtOrFrom?: {
106
+ id?: string;
107
+ };
108
+ unacceptedPaymentMethod?: string[];
109
+ excludeAppliesToMovieTicket: boolean;
110
+ onlyValid?: boolean;
111
+ limit?: number;
112
+ page?: number;
113
+ }): Promise<Pick<factory.priceSpecification.unitPrice.IAppliesToMovieTicket, 'serviceOutput'>[]>;
114
+ findAggregateOfferById(params: {
115
+ project: {
116
+ id: string;
117
+ };
65
118
  id: string;
119
+ }): Promise<factory.aggregateOffer.IAggregateOffer>;
120
+ count(params: Omit<factory.unitPriceOffer.ISearchConditions, 'limit' | 'page' | 'sort'>): Promise<number>;
121
+ search(params: factory.unitPriceOffer.ISearchConditions, projection?: IProjection): Promise<IUnitPriceOfferFromAggregateOffer[]>;
122
+ save(params: factory.unitPriceOffer.IUnitPriceOffer & {
123
+ $unset?: any;
66
124
  }): 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>;
125
+ /**
126
+ * sskts専用オファー保管
127
+ */
70
128
  saveManyByIdentifier(params: {
71
129
  attributes: factory.unitPriceOffer.IUnitPriceOffer;
72
130
  upsert?: boolean;
@@ -87,17 +145,14 @@ export declare class MongoRepository {
87
145
  };
88
146
  }): Promise<import("mongodb").UpdateResult | undefined>;
89
147
  deleteById(params: {
90
- id: string;
91
- }): Promise<void>;
92
- deleteByProject(params: {
93
148
  project: {
94
149
  id: string;
95
150
  };
151
+ id: string;
96
152
  }): 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>;
153
+ /**
154
+ * サブカタログから集計オファーIDリストを検索する
155
+ */
156
+ private searchAggregateOfferIdsBySubOfferCatalog;
102
157
  }
103
158
  export {};