@chevre/domain 28.0.0-alpha.4 → 28.0.0-alpha.41
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/lib/chevre/emailMessageBuilder.d.ts +9 -5
- package/lib/chevre/emailMessageBuilder.js +12 -11
- package/lib/chevre/factory/event.d.ts +1 -1
- package/lib/chevre/factory/event.js +1 -5
- package/lib/chevre/repo/acceptedOffer.d.ts +6 -5
- package/lib/chevre/repo/acceptedOffer.js +14 -9
- package/lib/chevre/repo/acceptedOfferInReserve.d.ts +6 -8
- package/lib/chevre/repo/acceptedOfferInReserve.js +13 -7
- package/lib/chevre/repo/adminAcceptedOffer.d.ts +25 -12
- package/lib/chevre/repo/adminAcceptedOffer.js +20 -10
- package/lib/chevre/repo/adminAccountTitle.d.ts +49 -0
- package/lib/chevre/repo/adminAccountTitle.js +212 -0
- package/lib/chevre/repo/adminAccountTitleCategory.d.ts +37 -0
- package/lib/chevre/repo/adminAccountTitleCategory.js +127 -0
- package/lib/chevre/repo/adminAccountTitleSet.d.ts +42 -0
- package/lib/chevre/repo/adminAccountTitleSet.js +149 -0
- package/lib/chevre/repo/adminEvent.d.ts +1 -7
- package/lib/chevre/repo/adminEvent.js +3 -9
- package/lib/chevre/repo/adminEventSeries.d.ts +67 -0
- package/lib/chevre/repo/adminEventSeries.js +178 -0
- package/lib/chevre/repo/{paymentServiceChannel.d.ts → adminPaymentServiceChannel.d.ts} +13 -11
- package/lib/chevre/repo/{paymentServiceChannel.js → adminPaymentServiceChannel.js} +20 -19
- package/lib/chevre/repo/adminTask.d.ts +2 -2
- package/lib/chevre/repo/adminTransaction.d.ts +20 -30
- package/lib/chevre/repo/aggregateEvent.js +0 -1
- package/lib/chevre/repo/categoryCode.js +0 -21
- package/lib/chevre/repo/event.d.ts +2 -2
- package/lib/chevre/repo/event.js +71 -110
- package/lib/chevre/repo/eventSeries.d.ts +5 -84
- package/lib/chevre/repo/eventSeries.js +21 -212
- package/lib/chevre/repo/factory/acceptedOffer/reserveTransaction2itemOffered.d.ts +1 -1
- package/lib/chevre/repo/issuer.d.ts +2 -6
- package/lib/chevre/repo/memberProgram.d.ts +1 -38
- package/lib/chevre/repo/memberProgram.js +1 -62
- package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/accountTitle.js +21 -25
- package/lib/chevre/repo/mongoose/schemas/civicStructure.d.ts +1 -0
- package/lib/chevre/repo/mongoose/schemas/event.js +0 -13
- package/lib/chevre/repo/mongoose/schemas/eventSeries.js +1 -18
- package/lib/chevre/repo/mongoose/schemas/issuer.d.ts +1 -3
- package/lib/chevre/repo/mongoose/schemas/issuer.js +0 -10
- package/lib/chevre/repo/mongoose/schemas/message.d.ts +5 -1
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +0 -1
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +3 -12
- package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.d.ts +1 -2
- package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.js +6 -15
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +22 -1
- package/lib/chevre/repo/mongoose/schemas/paymentServiceChannel.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/place.js +0 -9
- package/lib/chevre/repo/mongoose/schemas/project.d.ts +1 -2
- package/lib/chevre/repo/mongoose/schemas/project.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/seller.d.ts +3 -1
- package/lib/chevre/repo/mongoose/schemas/seller.js +0 -2
- package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/transaction.js +51 -52
- package/lib/chevre/repo/offerCatalog.d.ts +0 -2
- package/lib/chevre/repo/offerCatalogItem.d.ts +13 -20
- package/lib/chevre/repo/offerCatalogItem.js +8 -86
- package/lib/chevre/repo/order.d.ts +2 -2
- package/lib/chevre/repo/order.js +0 -31
- package/lib/chevre/repo/orderInTransaction.d.ts +5 -25
- package/lib/chevre/repo/place/movieTheater.d.ts +3 -1
- package/lib/chevre/repo/place/movieTheater.js +3 -1
- package/lib/chevre/repo/place/{hasPOS.d.ts → pos.d.ts} +13 -20
- package/lib/chevre/repo/place/{hasPOS.js → pos.js} +66 -29
- package/lib/chevre/repo/place/screeningRoom.d.ts +24 -3
- package/lib/chevre/repo/place/screeningRoom.js +28 -17
- package/lib/chevre/repo/priceSpecification.d.ts +8 -8
- package/lib/chevre/repo/project.d.ts +13 -19
- package/lib/chevre/repo/project.js +27 -43
- package/lib/chevre/repo/projectMakesOffer.js +2 -2
- package/lib/chevre/repo/role.d.ts +1 -1
- package/lib/chevre/repo/role.js +1 -30
- package/lib/chevre/repo/seller.d.ts +11 -4
- package/lib/chevre/repo/seller.js +31 -58
- package/lib/chevre/repo/sellerPaymentAccepted.d.ts +14 -21
- package/lib/chevre/repo/sellerPaymentAccepted.js +65 -38
- package/lib/chevre/repo/task.d.ts +3 -3
- package/lib/chevre/repo/transaction/placeOrder.d.ts +2 -3
- package/lib/chevre/repo/transaction/placeOrder.js +15 -36
- package/lib/chevre/repository.d.ts +30 -15
- package/lib/chevre/repository.js +63 -30
- package/lib/chevre/service/aggregation/event/aggregateOffers.js +1 -2
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +2 -2
- package/lib/chevre/service/aggregation.d.ts +0 -2
- package/lib/chevre/service/aggregation.js +1 -3
- package/lib/chevre/service/assetTransaction/pay/start/preStart/validateAcceptedPaymentMethodIfNeeded.js +1 -2
- package/lib/chevre/service/assetTransaction/pay/start/preStart/validateSeller.js +2 -2
- package/lib/chevre/service/assetTransaction/reserve/start.js +2 -1
- package/lib/chevre/service/delivery/reservation/factory.d.ts +1 -1
- package/lib/chevre/service/event/saveScreeningEventSeries.d.ts +2 -2
- package/lib/chevre/service/event/saveScreeningEventSeries.js +2 -3
- package/lib/chevre/service/event/saveScreeningEvents.d.ts +2 -0
- package/lib/chevre/service/event/saveScreeningEvents.js +4 -4
- package/lib/chevre/service/event.d.ts +2 -0
- package/lib/chevre/service/event.js +0 -1
- package/lib/chevre/service/notification/sendEmailMessage.d.ts +2 -0
- package/lib/chevre/service/notification/sendEmailMessage.js +23 -6
- package/lib/chevre/service/offer/any.d.ts +1 -1
- package/lib/chevre/service/offer/event/authorize/factory.d.ts +3 -3
- package/lib/chevre/service/offer/event/authorize/factory.js +1 -8
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +1 -1
- package/lib/chevre/service/offer/event/issueEventOfferTicket.js +0 -11
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +4 -10
- package/lib/chevre/service/offer/event/searchOfferAppliesToMovieTicket.js +2 -8
- package/lib/chevre/service/offer/event/searchOfferCatalogItems.js +2 -2
- package/lib/chevre/service/offer/event/searchOffersByIds.js +3 -9
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +0 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.js +0 -7
- package/lib/chevre/service/offer/onEventChanged.js +9 -21
- package/lib/chevre/service/offer.js +1 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +4 -6
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.js +23 -4
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/processOrder.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +1 -1
- package/lib/chevre/service/order/placeOrder/factory/orderedItem.d.ts +1 -1
- package/lib/chevre/service/order/placeOrder/factory.d.ts +1 -1
- package/lib/chevre/service/order/sendOrder.js +2 -14
- package/lib/chevre/service/payment/creditCard/getGMOInfoFromSeller.js +1 -1
- package/lib/chevre/service/payment/factory/createPayObjectServiceOutput.d.ts +3 -3
- package/lib/chevre/service/payment/movieTicket/checkMovieTicket.js +1 -1
- package/lib/chevre/service/payment/movieTicket/payMovieTicket/payActionParams2seatInfoSyncIn.js +1 -1
- package/lib/chevre/service/payment/movieTicket/validation.js +1 -1
- package/lib/chevre/service/project.d.ts +3 -3
- package/lib/chevre/service/project.js +1 -1
- package/lib/chevre/service/task/importEventsFromCOA.js +2 -0
- package/lib/chevre/service/task/onResourceDeleted.js +8 -8
- package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.d.ts +7 -3
- package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.js +51 -50
- package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated/syncOfferCatalog.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated.js +10 -47
- package/lib/chevre/service/task/sendEmailMessage.js +3 -1
- package/lib/chevre/service/task/syncResourcesFromCOA.js +5 -3
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.d.ts +6 -3
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.js +2 -15
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.d.ts +6 -4
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.js +3 -7
- package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateInvoiceReferencesOrder.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateMovieTicket.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +2 -2
- package/lib/chevre/service/transaction/placeOrder/confirm.d.ts +0 -2
- package/lib/chevre/service/transaction/placeOrder/confirm.js +6 -11
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.d.ts +6 -3
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +8 -9
- package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.d.ts +6 -3
- package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +2 -7
- package/lib/chevre/service/transaction/returnOrder/potentialActions.d.ts +6 -3
- package/lib/chevre/service/transaction/returnOrder/potentialActions.js +4 -3
- package/lib/chevre/service/transaction/returnOrder/preStart/factory.d.ts +1 -1
- package/lib/chevre/service/transaction/returnOrder/preStart.js +1 -2
- package/lib/chevre/service/transaction/returnOrder.d.ts +0 -2
- package/lib/chevre/service/transaction/returnOrder.js +6 -6
- package/package.json +2 -2
- package/lib/chevre/repo/accountTitle.d.ts +0 -28
- package/lib/chevre/repo/accountTitle.js +0 -30
- package/lib/chevre/service/aggregation/project.d.ts +0 -17
- package/lib/chevre/service/aggregation/project.js +0 -98
- package/lib/chevre/service/delivery/factory.d.ts +0 -16
- package/lib/chevre/service/delivery/factory.js +0 -124
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.1090.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.1090.0",
|
|
14
|
-
"@chevre/factory": "11.
|
|
14
|
+
"@chevre/factory": "11.1.0-alpha.9",
|
|
15
15
|
"@motionpicture/coa-service": "10.0.0",
|
|
16
16
|
"@motionpicture/gmo-service": "6.1.0-alpha.0",
|
|
17
17
|
"@sendgrid/client": "8.1.4",
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
"postversion": "git push origin --tags",
|
|
89
89
|
"prepublishOnly": "npm run clean && npm run build"
|
|
90
90
|
},
|
|
91
|
-
"version": "28.0.0-alpha.
|
|
91
|
+
"version": "28.0.0-alpha.41"
|
|
92
92
|
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { Connection } from 'mongoose';
|
|
2
|
-
import { factory } from '../factory';
|
|
3
|
-
import { IModel } from './mongoose/schemas/accountTitle';
|
|
4
|
-
/**
|
|
5
|
-
* 科目リポジトリ
|
|
6
|
-
*/
|
|
7
|
-
export declare class AccountTitleRepo {
|
|
8
|
-
readonly accountTitleModel: IModel;
|
|
9
|
-
constructor(connection: Connection);
|
|
10
|
-
deleteByProject(params: {
|
|
11
|
-
project: {
|
|
12
|
-
id: string;
|
|
13
|
-
};
|
|
14
|
-
}): Promise<void>;
|
|
15
|
-
getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, factory.accountTitle.IAccountTitle, import("./mongoose/virtuals").IVirtuals, {}> & factory.accountTitle.IAccountTitle & {
|
|
16
|
-
_id: import("mongoose").Types.ObjectId;
|
|
17
|
-
} & {
|
|
18
|
-
__v: number;
|
|
19
|
-
}, import("mongoose").QueryOptions<factory.accountTitle.IAccountTitle>, (import("mongoose").Document<unknown, Record<string, never>, factory.accountTitle.IAccountTitle, import("./mongoose/virtuals").IVirtuals, {}> & factory.accountTitle.IAccountTitle & {
|
|
20
|
-
_id: import("mongoose").Types.ObjectId;
|
|
21
|
-
} & {
|
|
22
|
-
__v: number;
|
|
23
|
-
}) | null>;
|
|
24
|
-
unsetUnnecessaryFields(params: {
|
|
25
|
-
filter: any;
|
|
26
|
-
$unset: any;
|
|
27
|
-
}): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
28
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AccountTitleRepo = void 0;
|
|
4
|
-
const factory_1 = require("../factory");
|
|
5
|
-
const accountTitle_1 = require("./mongoose/schemas/accountTitle");
|
|
6
|
-
/**
|
|
7
|
-
* 科目リポジトリ
|
|
8
|
-
*/
|
|
9
|
-
class AccountTitleRepo {
|
|
10
|
-
accountTitleModel;
|
|
11
|
-
constructor(connection) {
|
|
12
|
-
this.accountTitleModel = connection.model(accountTitle_1.modelName, (0, accountTitle_1.createSchema)());
|
|
13
|
-
}
|
|
14
|
-
async deleteByProject(params) {
|
|
15
|
-
await this.accountTitleModel.deleteMany({
|
|
16
|
-
'project.id': { $exists: true, $eq: params.project.id }
|
|
17
|
-
})
|
|
18
|
-
.exec();
|
|
19
|
-
}
|
|
20
|
-
getCursor(conditions, projection) {
|
|
21
|
-
return this.accountTitleModel.find(conditions, projection)
|
|
22
|
-
.sort({ codeValue: factory_1.factory.sortType.Descending })
|
|
23
|
-
.cursor();
|
|
24
|
-
}
|
|
25
|
-
async unsetUnnecessaryFields(params) {
|
|
26
|
-
return this.accountTitleModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
|
|
27
|
-
.exec();
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.AccountTitleRepo = AccountTitleRepo;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { ProjectRepo } from '../../repo/project';
|
|
2
|
-
import type { ReservationRepo } from '../../repo/reservation';
|
|
3
|
-
import type { TaskRepo } from '../../repo/task';
|
|
4
|
-
export type IAggregateOperation<T> = (repos: {
|
|
5
|
-
project: ProjectRepo;
|
|
6
|
-
reservation: ReservationRepo;
|
|
7
|
-
task: TaskRepo;
|
|
8
|
-
}) => Promise<T>;
|
|
9
|
-
export declare function aggregate(params: {
|
|
10
|
-
project: {
|
|
11
|
-
id: string;
|
|
12
|
-
};
|
|
13
|
-
reservationFor: {
|
|
14
|
-
startFrom: Date;
|
|
15
|
-
startThrough: Date;
|
|
16
|
-
};
|
|
17
|
-
}): IAggregateOperation<void>;
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.aggregate = aggregate;
|
|
7
|
-
/**
|
|
8
|
-
* プロジェクト集計サービス
|
|
9
|
-
*/
|
|
10
|
-
const debug_1 = __importDefault(require("debug"));
|
|
11
|
-
const moment_1 = __importDefault(require("moment"));
|
|
12
|
-
const factory_1 = require("../../factory");
|
|
13
|
-
const debug = (0, debug_1.default)('chevre-domain:service');
|
|
14
|
-
function aggregate(params) {
|
|
15
|
-
return async (repos) => {
|
|
16
|
-
const now = new Date();
|
|
17
|
-
// 集計対象プロジェクト検索
|
|
18
|
-
const project = await repos.project.findById({
|
|
19
|
-
id: params.project.id,
|
|
20
|
-
inclusion: ['typeOf']
|
|
21
|
-
});
|
|
22
|
-
// 予約集計
|
|
23
|
-
const { aggregateReservation } = await aggregateReservationOnProject({
|
|
24
|
-
aggregateDate: now,
|
|
25
|
-
project: { id: project.id, typeOf: project.typeOf },
|
|
26
|
-
reservationFor: {
|
|
27
|
-
startFrom: (0, moment_1.default)(params.reservationFor.startFrom)
|
|
28
|
-
.toDate(),
|
|
29
|
-
startThrough: (0, moment_1.default)(params.reservationFor.startThrough)
|
|
30
|
-
.toDate()
|
|
31
|
-
}
|
|
32
|
-
})(repos);
|
|
33
|
-
debug('aggregated. aggregateReservation:', aggregateReservation);
|
|
34
|
-
// 保管
|
|
35
|
-
await repos.project.updateAggregateReservation({
|
|
36
|
-
id: project.id,
|
|
37
|
-
aggregateReservation
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
function aggregateReservationOnProject(params) {
|
|
42
|
-
return async (repos) => {
|
|
43
|
-
let attendeeCount = 0;
|
|
44
|
-
let checkInCount = 0;
|
|
45
|
-
let reservationCount = 0;
|
|
46
|
-
const reservationForConditions = {
|
|
47
|
-
startFrom: (0, moment_1.default)(params.reservationFor.startFrom)
|
|
48
|
-
.add(-1, 'day')
|
|
49
|
-
.toDate()
|
|
50
|
-
};
|
|
51
|
-
while (reservationForConditions.startThrough === undefined
|
|
52
|
-
|| (0, moment_1.default)(params.reservationFor.startThrough)
|
|
53
|
-
.isAfter((0, moment_1.default)(reservationForConditions.startThrough))) {
|
|
54
|
-
reservationForConditions.startFrom = (0, moment_1.default)(reservationForConditions.startFrom)
|
|
55
|
-
.add(1, 'day')
|
|
56
|
-
.toDate();
|
|
57
|
-
reservationForConditions.startThrough = (0, moment_1.default)(reservationForConditions.startFrom)
|
|
58
|
-
.add(1, 'day')
|
|
59
|
-
.add(-1, 'millisecond')
|
|
60
|
-
.toDate();
|
|
61
|
-
debug('counting...', reservationForConditions);
|
|
62
|
-
reservationCount += await repos.reservation.count({
|
|
63
|
-
project: { id: { $eq: params.project.id } },
|
|
64
|
-
typeOf: factory_1.factory.reservationType.EventReservation,
|
|
65
|
-
reservationFor: reservationForConditions,
|
|
66
|
-
reservationStatuses: [factory_1.factory.reservationStatusType.ReservationConfirmed]
|
|
67
|
-
});
|
|
68
|
-
attendeeCount += await repos.reservation.count({
|
|
69
|
-
project: { id: { $eq: params.project.id } },
|
|
70
|
-
typeOf: factory_1.factory.reservationType.EventReservation,
|
|
71
|
-
reservationFor: reservationForConditions,
|
|
72
|
-
// reservationStatuses: [factory.reservationStatusType.ReservationConfirmed],
|
|
73
|
-
attended: true
|
|
74
|
-
});
|
|
75
|
-
checkInCount += await repos.reservation.count({
|
|
76
|
-
project: { id: { $eq: params.project.id } },
|
|
77
|
-
typeOf: factory_1.factory.reservationType.EventReservation,
|
|
78
|
-
reservationFor: reservationForConditions,
|
|
79
|
-
// reservationStatuses: [factory.reservationStatusType.ReservationConfirmed],
|
|
80
|
-
checkedIn: true
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
return {
|
|
84
|
-
aggregateReservation: {
|
|
85
|
-
typeOf: 'AggregateReservation',
|
|
86
|
-
aggregateDate: params.aggregateDate,
|
|
87
|
-
reservationFor: {
|
|
88
|
-
startDate: `${(0, moment_1.default)(params.reservationFor.startFrom)
|
|
89
|
-
.toISOString()}/${(0, moment_1.default)(params.reservationFor.startThrough)
|
|
90
|
-
.toISOString()}`
|
|
91
|
-
},
|
|
92
|
-
attendeeCount,
|
|
93
|
-
checkInCount,
|
|
94
|
-
reservationCount
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { factory } from '../../factory';
|
|
2
|
-
export type IOwnershipInfo = factory.ownershipInfo.IOwnershipInfo<factory.ownershipInfo.IGood>;
|
|
3
|
-
/**
|
|
4
|
-
* 注文から所有権を作成する
|
|
5
|
-
*/
|
|
6
|
-
export declare function createOwnershipInfosFromOrder(params: {
|
|
7
|
-
order: Pick<factory.order.IOrder, 'orderDate' | 'project' | 'customer' | 'orderNumber' | 'seller'> & {
|
|
8
|
-
acceptedOffers: (Omit<factory.order.IAcceptedOffer, 'priceSpecification' | 'name'> & {
|
|
9
|
-
/**
|
|
10
|
-
* COA以外では注文ドキュメントにpriceSpecificationが存在しないのでIFを補完
|
|
11
|
-
*/
|
|
12
|
-
priceSpecification?: factory.order.ITicketPriceSpecification;
|
|
13
|
-
})[];
|
|
14
|
-
};
|
|
15
|
-
offerIndexBase: number;
|
|
16
|
-
}): IOwnershipInfo[];
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createOwnershipInfosFromOrder = createOwnershipInfosFromOrder;
|
|
7
|
-
const moment_timezone_1 = __importDefault(require("moment-timezone"));
|
|
8
|
-
const util_1 = require("util");
|
|
9
|
-
const factory_1 = require("../../factory");
|
|
10
|
-
// import { createProductOwnershipInfo } from './product/factory';
|
|
11
|
-
const factory_2 = require("./reservation/factory");
|
|
12
|
-
/**
|
|
13
|
-
* 注文から所有権を作成する
|
|
14
|
-
*/
|
|
15
|
-
function createOwnershipInfosFromOrder(params) {
|
|
16
|
-
const ownershipInfos = [];
|
|
17
|
-
if (!Array.isArray(params.order.acceptedOffers)) {
|
|
18
|
-
throw new factory_1.factory.errors.ArgumentNull('order.acceptedOffers');
|
|
19
|
-
}
|
|
20
|
-
params.order.acceptedOffers.forEach((acceptedOffer, offerIndex) => {
|
|
21
|
-
const itemOffered = acceptedOffer.itemOffered;
|
|
22
|
-
let ownershipInfo;
|
|
23
|
-
const ownedFrom = (0, moment_timezone_1.default)(params.order.orderDate)
|
|
24
|
-
.toDate();
|
|
25
|
-
const identifier = createOwnershipInfoIdentifier({
|
|
26
|
-
order: params.order,
|
|
27
|
-
itemOffered,
|
|
28
|
-
offerIndex,
|
|
29
|
-
offerIndexBase: params.offerIndexBase
|
|
30
|
-
});
|
|
31
|
-
const acquiredFrom = createAcquiredFrom(params);
|
|
32
|
-
const ownedBy = createOwnedby(params);
|
|
33
|
-
// 所有者があれば所有権を作成する
|
|
34
|
-
if (ownedBy.length > 0) {
|
|
35
|
-
const itemOfferedType = itemOffered.typeOf;
|
|
36
|
-
switch (itemOfferedType) {
|
|
37
|
-
case factory_1.factory.reservationType.EventReservation: {
|
|
38
|
-
const excludeCOAReservation = acceptedOffer.offeredThrough?.identifier === factory_1.factory.service.webAPI.Identifier.COA;
|
|
39
|
-
if (excludeCOAReservation) {
|
|
40
|
-
// bookingService:COAでは作成しない(2024-12-31~)
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
ownershipInfo = (0, factory_2.createReservationOwnershipInfo)({
|
|
44
|
-
project: params.order.project,
|
|
45
|
-
ownedBy: ownedBy,
|
|
46
|
-
acceptedOffer,
|
|
47
|
-
ownedFrom: ownedFrom,
|
|
48
|
-
identifier: identifier,
|
|
49
|
-
acquiredFrom: acquiredFrom
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
// case factory.permit.PermitType.Permit:
|
|
55
|
-
// ownershipInfo = createProductOwnershipInfo({
|
|
56
|
-
// project: params.order.project,
|
|
57
|
-
// ownedBy: ownedBy,
|
|
58
|
-
// acceptedOffer: { ...acceptedOffer, itemOffered },
|
|
59
|
-
// ownedFrom: ownedFrom,
|
|
60
|
-
// identifier: identifier,
|
|
61
|
-
// acquiredFrom: acquiredFrom
|
|
62
|
-
// });
|
|
63
|
-
// break;
|
|
64
|
-
// case factory.actionType.MoneyTransfer:
|
|
65
|
-
// // no op
|
|
66
|
-
// // 所有権は発生しない
|
|
67
|
-
// break;
|
|
68
|
-
default:
|
|
69
|
-
throw new factory_1.factory.errors.NotImplemented(`Offered item type ${itemOfferedType} not implemented`);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
if (ownershipInfo !== undefined) {
|
|
73
|
-
ownershipInfos.push(ownershipInfo);
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
return ownershipInfos;
|
|
77
|
-
}
|
|
78
|
-
function createOwnershipInfoIdentifier(params) {
|
|
79
|
-
return (0, util_1.format)('%s-%s-%s-%s', params.order.customer.id, params.itemOffered.typeOf, params.order.orderNumber, (params.offerIndexBase + params.offerIndex));
|
|
80
|
-
}
|
|
81
|
-
function createAcquiredFrom(params) {
|
|
82
|
-
// 最低限の情報に絞る
|
|
83
|
-
const seller = params.order.seller;
|
|
84
|
-
return {
|
|
85
|
-
// 最適化(2022-11-15~)
|
|
86
|
-
// project: { typeOf: params.order.project.typeOf, id: params.order.project.id },
|
|
87
|
-
id: seller.id,
|
|
88
|
-
typeOf: seller.typeOf,
|
|
89
|
-
name: (typeof seller.name === 'string')
|
|
90
|
-
? seller.name
|
|
91
|
-
: String(seller.typeOf)
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
function createOwnedby(params) {
|
|
95
|
-
const customer = params.order.customer;
|
|
96
|
-
let owner;
|
|
97
|
-
// 顧客組織の場合
|
|
98
|
-
if (customer.typeOf === factory_1.factory.organizationType.Organization) {
|
|
99
|
-
// discontinue(2026-03-15~)
|
|
100
|
-
// const ownerAsOrganization: factory.ownershipInfo.IOwnerAsOrganization = {
|
|
101
|
-
// // 個人情報排除するように
|
|
102
|
-
// typeOf: customer.typeOf,
|
|
103
|
-
// id: customer.id
|
|
104
|
-
// };
|
|
105
|
-
// owner = ownerAsOrganization;
|
|
106
|
-
}
|
|
107
|
-
else if (customer.typeOf === factory_1.factory.personType.Person) {
|
|
108
|
-
const ownerAsPerson = {
|
|
109
|
-
// 個人情報排除するように
|
|
110
|
-
typeOf: customer.typeOf,
|
|
111
|
-
id: customer.id
|
|
112
|
-
};
|
|
113
|
-
owner = ownerAsPerson;
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
// discontinue(2026-03-15~)
|
|
117
|
-
// owner = {
|
|
118
|
-
// // 個人情報排除するように
|
|
119
|
-
// typeOf: customer.typeOf,
|
|
120
|
-
// id: customer.id
|
|
121
|
-
// };
|
|
122
|
-
}
|
|
123
|
-
return (owner !== undefined) ? [owner] : [];
|
|
124
|
-
}
|