@chevre/domain 21.25.0-alpha.8 → 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.
- package/example/src/chevre/migrateDeleteTransactionTasks.ts +2 -2
- package/example/src/chevre/migrateScreeningEventSeriesOffers.ts +87 -0
- package/example/src/chevre/searchScreeningEventSeries.ts +35 -0
- package/example/src/chevre/unsetUnnecessaryFields.ts +7 -8
- package/example/src/chevre/upsertScreeningEventSeriesByVersion.ts +0 -2
- package/lib/chevre/emailMessageBuilder.d.ts +0 -1
- package/lib/chevre/factory/event.js +7 -4
- package/lib/chevre/factory/order.d.ts +0 -8
- package/lib/chevre/factory/order.js +1 -26
- package/lib/chevre/repo/event.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/event.js +18 -15
- package/lib/chevre/service/aggregation/event/findEventOffers.d.ts +1 -1
- package/lib/chevre/service/aggregation/event/findEventOffers.js +1 -1
- package/lib/chevre/service/assetTransaction/reserve/factory/price.js +1 -1
- package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserve.js +1 -6
- package/lib/chevre/service/delivery.js +9 -18
- package/lib/chevre/service/event/createEvent.js +2 -1
- package/lib/chevre/service/event.js +33 -24
- package/lib/chevre/service/offer/event/authorize.d.ts +3 -2
- package/lib/chevre/service/offer/event/authorize.js +10 -20
- package/lib/chevre/service/offer/event/cancel.d.ts +1 -1
- package/lib/chevre/service/offer/event/cancel.js +1 -1
- package/lib/chevre/service/offer/event/factory.d.ts +6 -5
- package/lib/chevre/service/offer/event/factory.js +22 -36
- package/lib/chevre/service/offer/event/processStartReserve4chevre.d.ts +3 -3
- package/lib/chevre/service/offer/event/processStartReserve4chevre.js +6 -13
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +1 -1
- package/lib/chevre/service/offer/event/voidTransaction.js +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +1 -0
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +7 -4
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.d.ts +1 -0
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +3 -2
- package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +2 -1
- package/lib/chevre/service/offer/eventServiceByCOA/factory.js +19 -10
- package/lib/chevre/service/offer/product/factory.js +11 -13
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.js +8 -8
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +8 -8
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +8 -8
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +18 -116
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +8 -8
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +8 -8
- package/lib/chevre/service/order/placeOrder.js +14 -15
- package/lib/chevre/service/order/returnOrder.js +7 -7
- package/lib/chevre/service/order/sendOrder.js +8 -8
- package/lib/chevre/service/payment/any/factory.js +11 -10
- package/lib/chevre/service/task/createAccountingReport.js +6 -6
- package/lib/chevre/service/task/returnPayTransaction.js +7 -7
- package/lib/chevre/service/task/returnReserveTransaction.js +3 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/givePointAward.js +13 -8
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/sendEmailMessage.js +8 -8
- package/lib/chevre/service/transaction/placeOrderInProgress/result/orderedItem.d.ts +10 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/result/orderedItem.js +112 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -16
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +41 -26
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.js +10 -11
- package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +7 -7
- package/lib/chevre/service/transaction/returnOrder/potentialActions.js +7 -7
- package/lib/chevre/settings.d.ts +0 -1
- package/lib/chevre/settings.js +1 -2
- package/package.json +4 -4
- package/example/src/chevre/migrateMovieAvailabilityStarts.ts +0 -83
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.d.ts +0 -16
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +0 -144
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.acceptedOffers2orderedItem = void 0;
|
|
4
|
+
const factory = require("../../../../factory");
|
|
5
|
+
/**
|
|
6
|
+
* 受入オファーを注文アイテムに変換する
|
|
7
|
+
*/
|
|
8
|
+
function acceptedOffers2orderedItem(params) {
|
|
9
|
+
// 予約がある場合
|
|
10
|
+
const { reservationOrderItems } = createReservationAcceptedOffers(params);
|
|
11
|
+
// 通貨転送がある場合
|
|
12
|
+
const { moneyTransferOrderItems } = createMoneyTransferAcceptedOffers(params);
|
|
13
|
+
// プロダクトがある場合
|
|
14
|
+
const { productOrderItems } = createProductItems(params);
|
|
15
|
+
return [...reservationOrderItems, ...moneyTransferOrderItems, ...productOrderItems];
|
|
16
|
+
}
|
|
17
|
+
exports.acceptedOffers2orderedItem = acceptedOffers2orderedItem;
|
|
18
|
+
function createReservationAcceptedOffers(params) {
|
|
19
|
+
const orderedItems = [];
|
|
20
|
+
const eventIds = [];
|
|
21
|
+
params.eventReservationAcceptedOffers.forEach(({ itemOffered }) => {
|
|
22
|
+
// reservationFor.id単位でユニーク化
|
|
23
|
+
const reservationFor = itemOffered.reservationFor;
|
|
24
|
+
const issuedThrough = itemOffered.issuedThrough;
|
|
25
|
+
if (typeof reservationFor.id !== 'string' || reservationFor.id.length === 0) {
|
|
26
|
+
throw new factory.errors.NotFound('acceptedOffers.itemOffered.reservationFor.id');
|
|
27
|
+
}
|
|
28
|
+
if (typeof issuedThrough.typeOf === 'string') {
|
|
29
|
+
if (!eventIds.includes(reservationFor.id)) {
|
|
30
|
+
eventIds.push(reservationFor.id);
|
|
31
|
+
const orderedItem = reservationOffers2orderedItem({ reservationFor, issuedThrough });
|
|
32
|
+
orderedItems.push({ typeOf: 'OrderItem', orderedItem });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
return {
|
|
37
|
+
reservationOrderItems: orderedItems
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function reservationOffers2orderedItem(params) {
|
|
41
|
+
var _a, _b;
|
|
42
|
+
const reservationFor = params.reservationFor;
|
|
43
|
+
const issuedThrough = params.issuedThrough;
|
|
44
|
+
if (reservationFor.typeOf === factory.eventType.ScreeningEvent
|
|
45
|
+
&& issuedThrough.typeOf === factory.product.ProductType.EventService) {
|
|
46
|
+
const reservationFor4orderedItem = {
|
|
47
|
+
location: {
|
|
48
|
+
branchCode: reservationFor.location.branchCode,
|
|
49
|
+
name: reservationFor.location.name,
|
|
50
|
+
typeOf: reservationFor.location.typeOf
|
|
51
|
+
},
|
|
52
|
+
typeOf: reservationFor.typeOf,
|
|
53
|
+
id: reservationFor.id,
|
|
54
|
+
name: reservationFor.name,
|
|
55
|
+
startDate: reservationFor.startDate,
|
|
56
|
+
endDate: reservationFor.endDate
|
|
57
|
+
};
|
|
58
|
+
return Object.assign(Object.assign({ typeOf: issuedThrough.typeOf, id: issuedThrough.id }, (typeof ((_a = issuedThrough.serviceType) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
|
|
59
|
+
? { serviceType: issuedThrough.serviceType }
|
|
60
|
+
: undefined), { serviceOutput: {
|
|
61
|
+
typeOf: factory.reservationType.EventReservation,
|
|
62
|
+
reservationFor: reservationFor4orderedItem
|
|
63
|
+
} });
|
|
64
|
+
}
|
|
65
|
+
else if (reservationFor.typeOf === factory.tripType.BusTrip
|
|
66
|
+
&& issuedThrough.typeOf === factory.product.ProductType.Transportation) {
|
|
67
|
+
const reservationFor4orderedItem = {
|
|
68
|
+
typeOf: reservationFor.typeOf,
|
|
69
|
+
id: reservationFor.id,
|
|
70
|
+
departureTime: reservationFor.departureTime,
|
|
71
|
+
arrivalTime: reservationFor.arrivalTime
|
|
72
|
+
};
|
|
73
|
+
return Object.assign(Object.assign({ typeOf: issuedThrough.typeOf, id: issuedThrough.id }, (typeof ((_b = issuedThrough.serviceType) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string')
|
|
74
|
+
? { serviceType: issuedThrough.serviceType }
|
|
75
|
+
: undefined), { serviceOutput: {
|
|
76
|
+
typeOf: factory.reservationType.ReservationPackage,
|
|
77
|
+
reservationFor: reservationFor4orderedItem
|
|
78
|
+
} });
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
throw new factory.errors.ServiceUnavailable('unexpected params on reservationOffers2orderedItem');
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function createProductItems(params) {
|
|
85
|
+
var _a;
|
|
86
|
+
const orderedItems = [];
|
|
87
|
+
const productIds = [];
|
|
88
|
+
if (Array.isArray(params.productAcceptedOffers) && params.productAcceptedOffers.length > 0) {
|
|
89
|
+
// プロダクトIDで最適化する
|
|
90
|
+
const issuedThrough = params.productAcceptedOffers[0].itemOffered.issuedThrough;
|
|
91
|
+
if (typeof (issuedThrough === null || issuedThrough === void 0 ? void 0 : issuedThrough.id) === 'string') {
|
|
92
|
+
if (!productIds.includes(issuedThrough.id)) {
|
|
93
|
+
productIds.push(issuedThrough.id);
|
|
94
|
+
orderedItems.push({
|
|
95
|
+
typeOf: 'OrderItem',
|
|
96
|
+
orderedItem: Object.assign({ id: String(issuedThrough.id), typeOf: issuedThrough.typeOf }, (typeof ((_a = issuedThrough.serviceType) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
|
|
97
|
+
? { serviceType: issuedThrough.serviceType }
|
|
98
|
+
: undefined)
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
productOrderItems: orderedItems
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function createMoneyTransferAcceptedOffers(__) {
|
|
108
|
+
const orderedItems = [];
|
|
109
|
+
return {
|
|
110
|
+
moneyTransferOrderItems: orderedItems
|
|
111
|
+
};
|
|
112
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createOrder = void 0;
|
|
4
4
|
const factory = require("../../../factory");
|
|
5
|
-
const
|
|
5
|
+
const orderedItem_1 = require("./result/orderedItem");
|
|
6
6
|
/**
|
|
7
7
|
* 注文を生成する
|
|
8
8
|
*/
|
|
@@ -10,21 +10,7 @@ function createOrder(params) {
|
|
|
10
10
|
var _a;
|
|
11
11
|
const seller = createSeller({ transaction: params.transaction });
|
|
12
12
|
const customer = createCustomer({ transaction: params.transaction });
|
|
13
|
-
|
|
14
|
-
// const { reservationAcceptedOffers, reservationOrderItems } = createReservationAcceptedOffers(params);
|
|
15
|
-
const { reservationOrderItems } = (0, acceptedOffers_1.createReservationAcceptedOffers)(params);
|
|
16
|
-
// 通貨転送がある場合
|
|
17
|
-
// const { moneyTransferAcceptedOffers, moneyTransferOrderItems } = createMoneyTransferAcceptedOffers({ ...params, seller: seller });
|
|
18
|
-
const { moneyTransferOrderItems } = (0, acceptedOffers_1.createMoneyTransferAcceptedOffers)(params);
|
|
19
|
-
// プロダクトがある場合
|
|
20
|
-
// const { productAcceptedOffers, productOrderItems } = createProductItems(params);
|
|
21
|
-
const { productOrderItems } = (0, acceptedOffers_1.createProductItems)(params);
|
|
22
|
-
// const acceptedOffers: factory.order.IAcceptedOffer<factory.order.IItemOffered>[] = [
|
|
23
|
-
// ...reservationAcceptedOffers,
|
|
24
|
-
// ...moneyTransferAcceptedOffers,
|
|
25
|
-
// ...productAcceptedOffers
|
|
26
|
-
// ];
|
|
27
|
-
const orderedItems = [...reservationOrderItems, ...moneyTransferOrderItems, ...productOrderItems];
|
|
13
|
+
const orderedItems = (0, orderedItem_1.acceptedOffers2orderedItem)(params);
|
|
28
14
|
// 決済方法をセット
|
|
29
15
|
const { paymentMethods, price } = createPaymentMethods({
|
|
30
16
|
authorizePaymentActions: params.authorizePaymentActions
|
|
@@ -8,11 +8,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
11
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
23
|
exports.createReturnPaymentMethodActions = void 0;
|
|
13
24
|
const emailMessageBuilder = require("../../../../emailMessageBuilder");
|
|
14
25
|
const factory = require("../../../../factory");
|
|
15
|
-
|
|
26
|
+
// import { createMaskedCustomer } from '../../../../factory/order';
|
|
16
27
|
function createReturnPaymentMethodPotentialActions(params) {
|
|
17
28
|
var _a, _b, _c, _d;
|
|
18
29
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -36,18 +47,18 @@ function createReturnPaymentMethodPotentialActions(params) {
|
|
|
36
47
|
if (emailCustomization !== undefined && emailCustomization !== null) {
|
|
37
48
|
const emailMessage = yield emailMessageBuilder.createRefundMessage({
|
|
38
49
|
order,
|
|
39
|
-
paymentMethods: [params.paymentMethod],
|
|
50
|
+
// paymentMethods: [params.paymentMethod],
|
|
40
51
|
email: emailCustomization
|
|
41
52
|
});
|
|
42
53
|
const sendActionPurpose = {
|
|
43
54
|
typeOf: order.typeOf,
|
|
44
|
-
seller: {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
},
|
|
55
|
+
// seller: {
|
|
56
|
+
// id: order.seller.id,
|
|
57
|
+
// typeOf: order.seller.typeOf,
|
|
58
|
+
// name: order.seller.name
|
|
59
|
+
// }, // 廃止(2024-03-06~)
|
|
49
60
|
// mask
|
|
50
|
-
customer:
|
|
61
|
+
// customer: createMaskedCustomer(order, { noProfile: true }), // 廃止(2024-03-06~)
|
|
51
62
|
orderNumber: order.orderNumber,
|
|
52
63
|
price: order.price,
|
|
53
64
|
priceCurrency: order.priceCurrency,
|
|
@@ -78,13 +89,13 @@ function createReturnPaymentMethodActions(params) {
|
|
|
78
89
|
const returnPaymentMethodActions = [];
|
|
79
90
|
const returnPaymentMethodPurpose = {
|
|
80
91
|
typeOf: order.typeOf,
|
|
81
|
-
seller: {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
},
|
|
92
|
+
// seller: {
|
|
93
|
+
// id: order.seller.id,
|
|
94
|
+
// typeOf: order.seller.typeOf,
|
|
95
|
+
// name: order.seller.name
|
|
96
|
+
// }, // 廃止(2024-03-06~)
|
|
86
97
|
// mask
|
|
87
|
-
customer:
|
|
98
|
+
// customer: createMaskedCustomer(order, { noProfile: true }), // 廃止(2024-03-06~)
|
|
88
99
|
orderNumber: order.orderNumber,
|
|
89
100
|
price: order.price,
|
|
90
101
|
priceCurrency: order.priceCurrency,
|
|
@@ -103,16 +114,18 @@ function createReturnPaymentMethodActions(params) {
|
|
|
103
114
|
.filter((paymentMethod) => {
|
|
104
115
|
return paymentMethod.issuedThrough.typeOf !== factory.service.paymentService.PaymentServiceType.MovieTicket;
|
|
105
116
|
})
|
|
106
|
-
.map((
|
|
117
|
+
.map((referencedInvoice) => __awaiter(this, void 0, void 0, function* () {
|
|
107
118
|
const potentialActionsOnRefund = yield createReturnPaymentMethodPotentialActions({
|
|
108
|
-
paymentMethod:
|
|
119
|
+
paymentMethod: { paymentMethodId: referencedInvoice.paymentMethodId },
|
|
109
120
|
order: params.order,
|
|
110
121
|
returnOrderActionParams: params.returnOrderActionParams
|
|
111
122
|
});
|
|
123
|
+
const { paymentStatus } = referencedInvoice, referencedInvoiceAsObject = __rest(referencedInvoice, ["paymentStatus"]);
|
|
124
|
+
const object = Object.assign(Object.assign({}, referencedInvoiceAsObject), { typeOf: 'Invoice' });
|
|
112
125
|
return {
|
|
113
126
|
project: order.project,
|
|
114
127
|
typeOf: factory.actionType.ReturnAction,
|
|
115
|
-
object
|
|
128
|
+
object,
|
|
116
129
|
agent: order.project,
|
|
117
130
|
recipient: {
|
|
118
131
|
typeOf: order.customer.typeOf,
|
|
@@ -171,16 +184,18 @@ function createReturnPaymentMethodIssuedThroughMovieTicketActions(params) {
|
|
|
171
184
|
}
|
|
172
185
|
return returnPaymentMethod;
|
|
173
186
|
})
|
|
174
|
-
.map((
|
|
187
|
+
.map((referencedInvoice) => __awaiter(this, void 0, void 0, function* () {
|
|
175
188
|
const potentialActionsOnRefund = yield createReturnPaymentMethodPotentialActions({
|
|
176
|
-
paymentMethod:
|
|
189
|
+
paymentMethod: { paymentMethodId: referencedInvoice.paymentMethodId },
|
|
177
190
|
order: params.order,
|
|
178
191
|
returnOrderActionParams: params.returnOrderActionParams
|
|
179
192
|
});
|
|
193
|
+
const { paymentStatus } = referencedInvoice, referencedInvoiceAsObject = __rest(referencedInvoice, ["paymentStatus"]);
|
|
194
|
+
const object = Object.assign(Object.assign({}, referencedInvoiceAsObject), { typeOf: 'Invoice' });
|
|
180
195
|
return {
|
|
181
196
|
project: order.project,
|
|
182
197
|
typeOf: factory.actionType.ReturnAction,
|
|
183
|
-
object
|
|
198
|
+
object,
|
|
184
199
|
agent: order.project,
|
|
185
200
|
recipient: {
|
|
186
201
|
typeOf: order.customer.typeOf,
|
|
@@ -189,13 +204,13 @@ function createReturnPaymentMethodIssuedThroughMovieTicketActions(params) {
|
|
|
189
204
|
},
|
|
190
205
|
purpose: {
|
|
191
206
|
typeOf: order.typeOf,
|
|
192
|
-
seller: {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
},
|
|
207
|
+
// seller: {
|
|
208
|
+
// id: order.seller.id,
|
|
209
|
+
// typeOf: order.seller.typeOf,
|
|
210
|
+
// name: order.seller.name
|
|
211
|
+
// }, // 廃止(2024-03-06~)
|
|
197
212
|
// mask
|
|
198
|
-
customer:
|
|
213
|
+
// customer: createMaskedCustomer(order, { noProfile: true }), // 廃止(2024-03-06~)
|
|
199
214
|
orderNumber: order.orderNumber,
|
|
200
215
|
price: order.price,
|
|
201
216
|
priceCurrency: order.priceCurrency,
|
|
@@ -47,21 +47,22 @@ function createReturnPointAwardActions(params) {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
const order = params.order;
|
|
50
|
-
const maskedCustomer =
|
|
50
|
+
// const maskedCustomer = createMaskedCustomer(order, { noProfile: true });
|
|
51
51
|
const purpose = {
|
|
52
52
|
typeOf: order.typeOf,
|
|
53
|
-
seller: {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
},
|
|
53
|
+
// seller: {
|
|
54
|
+
// id: order.seller.id,
|
|
55
|
+
// typeOf: order.seller.typeOf,
|
|
56
|
+
// name: order.seller.name
|
|
57
|
+
// }, // 廃止(2024-03-06~)
|
|
58
58
|
// mask
|
|
59
|
-
customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id },
|
|
59
|
+
// customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id }, // 廃止(2024-03-06~)
|
|
60
60
|
orderNumber: order.orderNumber,
|
|
61
61
|
price: order.price,
|
|
62
62
|
priceCurrency: order.priceCurrency,
|
|
63
63
|
orderDate: order.orderDate
|
|
64
64
|
};
|
|
65
|
+
const agent = order.project;
|
|
65
66
|
const recipient = {
|
|
66
67
|
typeOf: order.seller.typeOf,
|
|
67
68
|
id: order.seller.id,
|
|
@@ -72,13 +73,11 @@ function createReturnPointAwardActions(params) {
|
|
|
72
73
|
return {
|
|
73
74
|
project: order.project,
|
|
74
75
|
typeOf: factory.actionType.ReturnAction,
|
|
75
|
-
// objectは何であるべき?入金資産取引か?
|
|
76
|
-
// object: a,
|
|
77
76
|
object: {
|
|
78
77
|
typeOf: factory.assetTransactionType.MoneyTransfer,
|
|
79
78
|
identifier: pointAwardIdentifier
|
|
80
79
|
},
|
|
81
|
-
agent
|
|
80
|
+
agent,
|
|
82
81
|
potentialActions: {},
|
|
83
82
|
purpose,
|
|
84
83
|
recipient
|
|
@@ -93,7 +92,7 @@ function createReturnPointAwardActions(params) {
|
|
|
93
92
|
typeOf: factory.assetTransactionType.MoneyTransfer,
|
|
94
93
|
object: { fromLocation: { identifier: awardAccountIdentifier } }
|
|
95
94
|
},
|
|
96
|
-
agent
|
|
95
|
+
agent,
|
|
97
96
|
potentialActions: {},
|
|
98
97
|
purpose,
|
|
99
98
|
recipient
|
|
@@ -12,20 +12,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.createSendEmailMessaegActionsOnReturn = void 0;
|
|
13
13
|
const emailMessageBuilder = require("../../../../emailMessageBuilder");
|
|
14
14
|
const factory = require("../../../../factory");
|
|
15
|
-
|
|
15
|
+
// import { createMaskedCustomer } from '../../../../factory/order';
|
|
16
16
|
function createSendEmailMessaegActionsOnReturn(params) {
|
|
17
17
|
var _a, _b;
|
|
18
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
19
|
const order = params.order;
|
|
20
20
|
const sendActionPurpose = {
|
|
21
21
|
typeOf: order.typeOf,
|
|
22
|
-
seller: {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
},
|
|
22
|
+
// seller: {
|
|
23
|
+
// id: order.seller.id,
|
|
24
|
+
// typeOf: order.seller.typeOf,
|
|
25
|
+
// name: order.seller.name
|
|
26
|
+
// }, // 廃止(2024-03-06~)
|
|
27
27
|
// mask
|
|
28
|
-
customer:
|
|
28
|
+
// customer: createMaskedCustomer(order, { noProfile: true }), // 廃止(2024-03-06~)
|
|
29
29
|
orderNumber: order.orderNumber,
|
|
30
30
|
price: order.price,
|
|
31
31
|
priceCurrency: order.priceCurrency,
|
|
@@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.createPotentialActions = void 0;
|
|
13
13
|
const factory = require("../../../factory");
|
|
14
|
-
|
|
14
|
+
// import { createMaskedCustomer } from '../../../factory/order';
|
|
15
15
|
// import { createReturnMoneyTransferActions } from './potentialActions/returnMoneyTransfer';
|
|
16
16
|
const returnPaymentMethod_1 = require("./potentialActions/returnPaymentMethod");
|
|
17
17
|
const returnPointAward_1 = require("./potentialActions/returnPointAward");
|
|
@@ -50,13 +50,13 @@ function createPotentialActions(params) {
|
|
|
50
50
|
};
|
|
51
51
|
const returnOrderObject = {
|
|
52
52
|
typeOf: order.typeOf,
|
|
53
|
-
seller: {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
},
|
|
53
|
+
// seller: {
|
|
54
|
+
// id: order.seller.id,
|
|
55
|
+
// typeOf: order.seller.typeOf,
|
|
56
|
+
// name: order.seller.name
|
|
57
|
+
// }, // 廃止(2024-03-06~)
|
|
58
58
|
// mask
|
|
59
|
-
customer:
|
|
59
|
+
// customer: createMaskedCustomer(order, { noProfile: true }), // 廃止(2024-03-06~)
|
|
60
60
|
orderNumber: order.orderNumber,
|
|
61
61
|
price: order.price,
|
|
62
62
|
priceCurrency: order.priceCurrency,
|
package/lib/chevre/settings.d.ts
CHANGED
|
@@ -41,7 +41,6 @@ export declare const USE_FETCH_API: boolean;
|
|
|
41
41
|
export declare const USE_INFORM_ORDER_IN_TRANSIT: boolean;
|
|
42
42
|
export declare const USE_SEND_EMAIL_MESSAGE_ON_ORDER_PROCESSING: boolean;
|
|
43
43
|
export declare const USE_MINIMIZED_PAY_TASK: boolean;
|
|
44
|
-
export declare const USE_KANA_NAME_IN_ACCEPTED_OFFER: boolean;
|
|
45
44
|
export declare const USE_VALIDATE_PROJECT_MAKES_OFFER: boolean;
|
|
46
45
|
export declare const USE_OWNERSHIP_INFO_BY_WEB_APPLICATION: boolean;
|
|
47
46
|
export declare const MONGO_MAX_TIME_MS: number;
|
package/lib/chevre/settings.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.settings = exports.DELIVER_ORDER_LIMIT = exports.MONGO_AUTO_INDEX = exports.MONGO_READ_PREFERENCE = exports.MONGO_MAX_TIME_MS = exports.USE_OWNERSHIP_INFO_BY_WEB_APPLICATION = exports.USE_VALIDATE_PROJECT_MAKES_OFFER = exports.
|
|
3
|
+
exports.settings = exports.DELIVER_ORDER_LIMIT = exports.MONGO_AUTO_INDEX = exports.MONGO_READ_PREFERENCE = exports.MONGO_MAX_TIME_MS = exports.USE_OWNERSHIP_INFO_BY_WEB_APPLICATION = exports.USE_VALIDATE_PROJECT_MAKES_OFFER = exports.USE_MINIMIZED_PAY_TASK = exports.USE_SEND_EMAIL_MESSAGE_ON_ORDER_PROCESSING = exports.USE_INFORM_ORDER_IN_TRANSIT = exports.USE_FETCH_API = exports.USE_OPTIMIZE_TICKET_OFFER = exports.USE_DELETE_EVENT_BY_ORDER = 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.MAX_NUM_CREDIT_CARD_PAYMENT_METHOD = exports.ABORTED_TASKS_WITHOUT_REPORT = exports.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS = exports.TRIGGER_WEBHOOK_MAX_RETRY_COUNT = void 0;
|
|
4
4
|
const factory = require("./factory");
|
|
5
5
|
const transactionWebhookUrls = (typeof process.env.INFORM_TRANSACTION_URL === 'string')
|
|
6
6
|
? process.env.INFORM_TRANSACTION_URL.split(' ')
|
|
@@ -65,7 +65,6 @@ exports.USE_FETCH_API = process.env.USE_FETCH_API === '1';
|
|
|
65
65
|
exports.USE_INFORM_ORDER_IN_TRANSIT = process.env.USE_INFORM_ORDER_IN_TRANSIT === '1';
|
|
66
66
|
exports.USE_SEND_EMAIL_MESSAGE_ON_ORDER_PROCESSING = process.env.USE_SEND_EMAIL_MESSAGE_ON_ORDER_PROCESSING === '1';
|
|
67
67
|
exports.USE_MINIMIZED_PAY_TASK = process.env.USE_MINIMIZED_PAY_TASK === '1';
|
|
68
|
-
exports.USE_KANA_NAME_IN_ACCEPTED_OFFER = process.env.USE_KANA_NAME_IN_ACCEPTED_OFFER === '1';
|
|
69
68
|
exports.USE_VALIDATE_PROJECT_MAKES_OFFER = process.env.USE_VALIDATE_PROJECT_MAKES_OFFER === '1';
|
|
70
69
|
exports.USE_OWNERSHIP_INFO_BY_WEB_APPLICATION = process.env.USE_OWNERSHIP_INFO_BY_WEB_APPLICATION === '1';
|
|
71
70
|
exports.MONGO_MAX_TIME_MS = (typeof process.env.MONGO_MAX_TIME_MS === 'string')
|
package/package.json
CHANGED
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/credential-providers": "3.433.0",
|
|
13
|
-
"@chevre/factory": "4.
|
|
14
|
-
"@cinerino/sdk": "5.
|
|
15
|
-
"@motionpicture/coa-service": "9.
|
|
13
|
+
"@chevre/factory": "4.360.0",
|
|
14
|
+
"@cinerino/sdk": "5.13.0",
|
|
15
|
+
"@motionpicture/coa-service": "9.4.0",
|
|
16
16
|
"@motionpicture/gmo-service": "5.3.0",
|
|
17
17
|
"@sendgrid/mail": "6.4.0",
|
|
18
18
|
"@surfrock/sdk": "1.2.0",
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"postversion": "git push origin --tags",
|
|
111
111
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
112
112
|
},
|
|
113
|
-
"version": "21.25.0
|
|
113
|
+
"version": "21.25.0"
|
|
114
114
|
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as moment from 'moment-timezone';
|
|
3
|
-
import * as mongoose from 'mongoose';
|
|
4
|
-
|
|
5
|
-
import { chevre } from '../../../lib/index';
|
|
6
|
-
|
|
7
|
-
// const project = { id: String(process.env.PROJECT_ID) };
|
|
8
|
-
// const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
|
|
9
|
-
|
|
10
|
-
// tslint:disable-next-line:max-func-body-length
|
|
11
|
-
async function main() {
|
|
12
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
|
-
|
|
14
|
-
const creativeWorkRepo = await chevre.repository.CreativeWork.createInstance(mongoose.connection);
|
|
15
|
-
|
|
16
|
-
const cursor = creativeWorkRepo.getCursor(
|
|
17
|
-
{
|
|
18
|
-
// 'offers.availabilityEnds': { $exists: true }
|
|
19
|
-
},
|
|
20
|
-
{}
|
|
21
|
-
);
|
|
22
|
-
console.log('creativeWorks found');
|
|
23
|
-
|
|
24
|
-
let i = 0;
|
|
25
|
-
let updateCount = 0;
|
|
26
|
-
// let datePublishedUndefinedCount = 0;
|
|
27
|
-
// let datePublishedIsAfterNowCount = 0;
|
|
28
|
-
await cursor.eachAsync(async (doc) => {
|
|
29
|
-
i += 1;
|
|
30
|
-
const movie: chevre.factory.creativeWork.movie.ICreativeWork = doc.toObject();
|
|
31
|
-
|
|
32
|
-
const availabilityEnds = movie.offers.availabilityEnds;
|
|
33
|
-
let availabilityStarts = movie.offers.availabilityStarts;
|
|
34
|
-
const createdAt: Date = (<any>movie).createdAt;
|
|
35
|
-
if (!(createdAt instanceof Date)) {
|
|
36
|
-
throw new Error('createdAt not Date');
|
|
37
|
-
}
|
|
38
|
-
const alreadyMigrated = availabilityStarts instanceof Date
|
|
39
|
-
&& moment(availabilityStarts)
|
|
40
|
-
.isSame(moment(createdAt)
|
|
41
|
-
.tz('Asia/Tokyo')
|
|
42
|
-
.startOf('day')
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
if (alreadyMigrated) {
|
|
46
|
-
console.log(
|
|
47
|
-
'already exist...', movie.project.id, movie.id, movie.identifier, availabilityStarts, availabilityEnds, createdAt, i);
|
|
48
|
-
|
|
49
|
-
// if (moment(movie.datePublished)
|
|
50
|
-
// .isAfter(moment())) {
|
|
51
|
-
// datePublishedIsAfterNowCount += 1;
|
|
52
|
-
// }
|
|
53
|
-
} else {
|
|
54
|
-
// if (movie.datePublished === undefined) {
|
|
55
|
-
// console.error('movie.datePublished undefined', movie.project.id, movie.id, movie.identifier, i);
|
|
56
|
-
// // throw new Error('movie.datePublished undefined');
|
|
57
|
-
// datePublishedUndefinedCount += 1;
|
|
58
|
-
// }
|
|
59
|
-
|
|
60
|
-
availabilityStarts = moment(createdAt)
|
|
61
|
-
.tz('Asia/Tokyo')
|
|
62
|
-
.startOf('day')
|
|
63
|
-
.toDate();
|
|
64
|
-
console.log('updating movie...', movie.project.id, movie.id, movie.identifier, availabilityStarts, availabilityEnds, i);
|
|
65
|
-
await creativeWorkRepo.saveMovie(<any>{
|
|
66
|
-
id: String(movie.id),
|
|
67
|
-
'offers.availabilityStarts': availabilityStarts
|
|
68
|
-
});
|
|
69
|
-
updateCount += 1;
|
|
70
|
-
console.log('updated.', movie.project.id, movie.id, movie.identifier, availabilityStarts, availabilityEnds, i);
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
console.log(i, 'creativeWorks checked');
|
|
75
|
-
console.log(updateCount, 'creativeWorks updated');
|
|
76
|
-
// console.log(datePublishedUndefinedCount, 'datePublishedUndefinedCount');
|
|
77
|
-
// console.log(datePublishedIsAfterNowCount, 'datePublishedIsAfterNowCount');
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
main()
|
|
82
|
-
.then()
|
|
83
|
-
.catch(console.error);
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import * as factory from '../../../../factory';
|
|
2
|
-
export declare function createReservationAcceptedOffers(params: {
|
|
3
|
-
eventReservationAcceptedOffers: factory.order.IAcceptedOffer<factory.order.IReservation>[];
|
|
4
|
-
}): {
|
|
5
|
-
reservationOrderItems: factory.order.IOrderedItem[];
|
|
6
|
-
};
|
|
7
|
-
export declare function createProductItems(params: {
|
|
8
|
-
productAcceptedOffers: factory.order.IAcceptedOffer<factory.order.IPermit>[];
|
|
9
|
-
}): {
|
|
10
|
-
productOrderItems: factory.order.IOrderedItem[];
|
|
11
|
-
};
|
|
12
|
-
export declare function createMoneyTransferAcceptedOffers(__: {
|
|
13
|
-
moneyTransferAcceptedOffers: factory.order.IAcceptedOffer<factory.order.IMoneyTransfer>[];
|
|
14
|
-
}): {
|
|
15
|
-
moneyTransferOrderItems: factory.order.IOrderedItem[];
|
|
16
|
-
};
|