@chevre/domain 21.25.0-alpha.9 → 21.25.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 (65) hide show
  1. package/example/src/chevre/migrateDeleteTransactionTasks.ts +2 -2
  2. package/example/src/chevre/migrateScreeningEventSeriesOffers.ts +87 -0
  3. package/example/src/chevre/searchScreeningEventSeries.ts +35 -0
  4. package/example/src/chevre/unsetUnnecessaryFields.ts +7 -8
  5. package/example/src/chevre/upsertScreeningEventSeriesByVersion.ts +0 -2
  6. package/lib/chevre/emailMessageBuilder.d.ts +0 -1
  7. package/lib/chevre/factory/event.js +7 -4
  8. package/lib/chevre/factory/order.d.ts +0 -8
  9. package/lib/chevre/factory/order.js +1 -26
  10. package/lib/chevre/repo/event.d.ts +3 -3
  11. package/lib/chevre/repo/mongoose/schemas/event.d.ts +1 -1
  12. package/lib/chevre/repo/mongoose/schemas/event.js +18 -15
  13. package/lib/chevre/service/aggregation/event/findEventOffers.d.ts +1 -1
  14. package/lib/chevre/service/aggregation/event/findEventOffers.js +1 -1
  15. package/lib/chevre/service/assetTransaction/reserve/factory/price.js +1 -1
  16. package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +1 -1
  17. package/lib/chevre/service/assetTransaction/reserve.js +1 -6
  18. package/lib/chevre/service/delivery.js +9 -18
  19. package/lib/chevre/service/event/createEvent.js +2 -1
  20. package/lib/chevre/service/event.js +2 -1
  21. package/lib/chevre/service/offer/event/authorize.d.ts +3 -2
  22. package/lib/chevre/service/offer/event/authorize.js +10 -20
  23. package/lib/chevre/service/offer/event/cancel.d.ts +1 -1
  24. package/lib/chevre/service/offer/event/cancel.js +1 -1
  25. package/lib/chevre/service/offer/event/factory.d.ts +6 -5
  26. package/lib/chevre/service/offer/event/factory.js +22 -36
  27. package/lib/chevre/service/offer/event/processStartReserve4chevre.d.ts +3 -3
  28. package/lib/chevre/service/offer/event/processStartReserve4chevre.js +6 -13
  29. package/lib/chevre/service/offer/event/voidTransaction.d.ts +1 -1
  30. package/lib/chevre/service/offer/event/voidTransaction.js +1 -1
  31. package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +1 -0
  32. package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +7 -4
  33. package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.d.ts +1 -0
  34. package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +3 -2
  35. package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +2 -1
  36. package/lib/chevre/service/offer/eventServiceByCOA/factory.js +19 -10
  37. package/lib/chevre/service/offer/product/factory.js +11 -13
  38. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.js +8 -8
  39. package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +8 -8
  40. package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +8 -8
  41. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +18 -116
  42. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +8 -8
  43. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +8 -8
  44. package/lib/chevre/service/order/placeOrder.js +14 -15
  45. package/lib/chevre/service/order/returnOrder.js +7 -7
  46. package/lib/chevre/service/order/sendOrder.js +8 -8
  47. package/lib/chevre/service/payment/any/factory.js +11 -10
  48. package/lib/chevre/service/task/createAccountingReport.js +6 -6
  49. package/lib/chevre/service/task/returnPayTransaction.js +7 -7
  50. package/lib/chevre/service/task/returnReserveTransaction.js +3 -4
  51. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/givePointAward.js +13 -8
  52. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/sendEmailMessage.js +8 -8
  53. package/lib/chevre/service/transaction/placeOrderInProgress/result/orderedItem.d.ts +10 -0
  54. package/lib/chevre/service/transaction/placeOrderInProgress/result/orderedItem.js +112 -0
  55. package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -16
  56. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +41 -26
  57. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.js +10 -11
  58. package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +7 -7
  59. package/lib/chevre/service/transaction/returnOrder/potentialActions.js +7 -7
  60. package/lib/chevre/settings.d.ts +0 -1
  61. package/lib/chevre/settings.js +1 -2
  62. package/package.json +4 -4
  63. package/example/src/chevre/migrateMovieAvailabilityStarts.ts +0 -83
  64. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.d.ts +0 -16
  65. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +0 -144
@@ -1,144 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createMoneyTransferAcceptedOffers = exports.createProductItems = exports.createReservationAcceptedOffers = void 0;
4
- const factory = require("../../../../factory");
5
- // import { availableProductTypes } from '../../../../factory/availableProductTypes';
6
- function createReservationAcceptedOffers(params) {
7
- // const acceptedOffers: factory.order.IAcceptedOffer<factory.order.IReservation>[] = [];
8
- const orderedItems = [];
9
- // 座席予約に対する承認アクション取り出す
10
- // const seatReservationAuthorizeActions = <IAuthorizeSeatReservationOffer[]>params.authorizeActions
11
- // .filter((a) => a.object.typeOf === factory.action.authorize.offer.eventService.ObjectType.SeatReservation);
12
- const eventIds = [];
13
- // seatReservationAuthorizeActions.forEach((authorizeSeatReservationAction) => {
14
- // const resultAcceptedOffers = authorizeSeatReservationAction.result?.acceptedOffers;
15
- // });
16
- if (Array.isArray(params.eventReservationAcceptedOffers) && params.eventReservationAcceptedOffers.length > 0) {
17
- // acceptedOffers.push(...resultAcceptedOffers);
18
- // プロダクトIDで最適化する
19
- const reservationFor = params.eventReservationAcceptedOffers[0].itemOffered.reservationFor;
20
- const issuedThrough = params.eventReservationAcceptedOffers[0].itemOffered.issuedThrough;
21
- if (typeof (issuedThrough === null || issuedThrough === void 0 ? void 0 : issuedThrough.typeOf) === 'string') {
22
- if (!eventIds.includes(String(reservationFor.id))) {
23
- eventIds.push(String(reservationFor.id));
24
- const orderedItem = reservationOffers2orderedItem({ reservationFor, issuedThrough });
25
- orderedItems.push({
26
- typeOf: 'OrderItem',
27
- orderedItem
28
- });
29
- }
30
- }
31
- }
32
- return {
33
- // reservationAcceptedOffers: acceptedOffers,
34
- reservationOrderItems: orderedItems
35
- };
36
- }
37
- exports.createReservationAcceptedOffers = createReservationAcceptedOffers;
38
- function reservationOffers2orderedItem(params) {
39
- var _a, _b, _c, _d, _e;
40
- const reservationFor = params.reservationFor;
41
- const issuedThrough = params.issuedThrough;
42
- if (reservationFor.typeOf === factory.eventType.ScreeningEvent
43
- && issuedThrough.typeOf === factory.product.ProductType.EventService) {
44
- const reservationFor4orderedItem = {
45
- location: {
46
- branchCode: (_a = reservationFor.location) === null || _a === void 0 ? void 0 : _a.branchCode,
47
- name: (_b = reservationFor.location) === null || _b === void 0 ? void 0 : _b.name,
48
- // 不要なので廃止(2022-12-19~)
49
- // project: reservationFor.location?.project,
50
- typeOf: (_c = reservationFor.location) === null || _c === void 0 ? void 0 : _c.typeOf
51
- },
52
- // 不要なので廃止(2022-12-19~)
53
- // project: reservationFor.project,
54
- typeOf: reservationFor.typeOf,
55
- id: reservationFor.id,
56
- name: reservationFor.name,
57
- startDate: reservationFor.startDate,
58
- endDate: reservationFor.endDate
59
- };
60
- return Object.assign(Object.assign({ typeOf: issuedThrough.typeOf }, (typeof ((_d = issuedThrough.serviceType) === null || _d === void 0 ? void 0 : _d.typeOf) === 'string')
61
- ? { serviceType: issuedThrough.serviceType }
62
- : undefined), { serviceOutput: {
63
- typeOf: factory.reservationType.EventReservation,
64
- reservationFor: reservationFor4orderedItem
65
- } });
66
- }
67
- else if (reservationFor.typeOf === factory.tripType.BusTrip
68
- && issuedThrough.typeOf === factory.product.ProductType.Transportation) {
69
- const reservationFor4orderedItem = {
70
- typeOf: reservationFor.typeOf,
71
- id: reservationFor.id,
72
- departureTime: reservationFor.departureTime,
73
- arrivalTime: reservationFor.arrivalTime
74
- };
75
- return Object.assign(Object.assign({ typeOf: issuedThrough.typeOf }, (typeof ((_e = issuedThrough.serviceType) === null || _e === void 0 ? void 0 : _e.typeOf) === 'string')
76
- ? { serviceType: issuedThrough.serviceType }
77
- : undefined), { serviceOutput: {
78
- typeOf: factory.reservationType.ReservationPackage,
79
- reservationFor: reservationFor4orderedItem
80
- } });
81
- }
82
- else {
83
- throw new factory.errors.ServiceUnavailable('unexpected params on reservationOffers2orderedItem');
84
- }
85
- }
86
- function createProductItems(params) {
87
- var _a;
88
- // const acceptedOffers: factory.order.IAcceptedOffer<factory.order.IPermit>[] = [];
89
- const orderedItems = [];
90
- // const authorizePaymentCardOfferActions = (<factory.action.authorize.offer.product.IAction[]>params.authorizeActions)
91
- // .filter((a) =>
92
- // Array.isArray(a.object)
93
- // && a.object.length > 0
94
- // && a.object[0].typeOf === factory.offerType.Offer
95
- // && availableProductTypes.indexOf(a.object[0].itemOffered.typeOf) >= 0
96
- // );
97
- const productIds = [];
98
- // authorizePaymentCardOfferActions.forEach((a) => {
99
- // const resultAcceptedOffers = a.result?.acceptedOffers;
100
- // });
101
- if (Array.isArray(params.productAcceptedOffers) && params.productAcceptedOffers.length > 0) {
102
- // acceptedOffers.push(...resultAcceptedOffers);
103
- // プロダクトIDで最適化する
104
- const issuedThrough = params.productAcceptedOffers[0].itemOffered.issuedThrough;
105
- if (typeof (issuedThrough === null || issuedThrough === void 0 ? void 0 : issuedThrough.id) === 'string') {
106
- if (!productIds.includes(issuedThrough.id)) {
107
- productIds.push(issuedThrough.id);
108
- orderedItems.push({
109
- typeOf: 'OrderItem',
110
- orderedItem: Object.assign({ id: String(issuedThrough.id), typeOf: issuedThrough.typeOf }, (typeof ((_a = issuedThrough.serviceType) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
111
- ? { serviceType: issuedThrough.serviceType }
112
- : undefined)
113
- });
114
- }
115
- }
116
- }
117
- return {
118
- // productAcceptedOffers: acceptedOffers,
119
- productOrderItems: orderedItems
120
- };
121
- }
122
- exports.createProductItems = createProductItems;
123
- function createMoneyTransferAcceptedOffers(__) {
124
- // 通貨転送承認アクション
125
- // const authorizeMoneyTansferActions = (<IAuthorizeMoneyTransferOffer[]>params.authorizeActions)
126
- // .filter((a) => a.object.typeOf === factory.offerType.Offer)
127
- // .filter((a) => a.object.itemOffered?.typeOf === factory.actionType.MoneyTransfer);
128
- // const acceptedOffers: factory.order.IAcceptedOffer<factory.order.IMoneyTransfer>[] = [];
129
- const orderedItems = [];
130
- // authorizeMoneyTansferActions.forEach((authorizeMoneyTansferAction) => {
131
- // if (authorizeMoneyTansferAction.result === undefined) {
132
- // throw new factory.errors.Argument('Transaction', 'authorize money transfer offer result does not exist');
133
- // }
134
- // const resultAcceptedOffers = authorizeMoneyTansferAction.result?.acceptedOffers;
135
- // if (Array.isArray(resultAcceptedOffers) && resultAcceptedOffers.length > 0) {
136
- // acceptedOffers.push(...resultAcceptedOffers);
137
- // }
138
- // });
139
- return {
140
- // moneyTransferAcceptedOffers: acceptedOffers,
141
- moneyTransferOrderItems: orderedItems
142
- };
143
- }
144
- exports.createMoneyTransferAcceptedOffers = createMoneyTransferAcceptedOffers;