@chevre/domain 26.0.0-alpha.25 → 26.0.0-alpha.26
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/repo/adminAssetTransaction.d.ts +132 -0
- package/lib/chevre/repo/adminAssetTransaction.js +504 -0
- package/lib/chevre/repo/aggregateAssetTransaction.d.ts +43 -0
- package/lib/chevre/repo/aggregateAssetTransaction.js +166 -0
- package/lib/chevre/repo/assetTransaction.d.ts +10 -235
- package/lib/chevre/repo/assetTransaction.js +48 -636
- package/lib/chevre/repository.d.ts +10 -0
- package/lib/chevre/repository.js +24 -2
- package/lib/chevre/service/aggregation/system.d.ts +5 -5
- package/lib/chevre/service/aggregation/system.js +2 -2
- package/lib/chevre/service/assetTransaction/cancelReservation/start.js +10 -17
- package/lib/chevre/service/assetTransaction/refund.js +2 -2
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.js +1 -3
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/isDeliverable.js +1 -49
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.js +2 -2
- package/lib/chevre/service/payment/any/processVoidPayTransaction.js +1 -1
- package/lib/chevre/service/reserve/cancelReservation.js +3 -3
- package/lib/chevre/service/reserve/checkInReservation.js +2 -2
- package/lib/chevre/service/reserve/confirmReservation.js +1 -1
- package/lib/chevre/service/reserve/useReservation.js +1 -1
- package/lib/chevre/service/task/returnPayTransaction.js +2 -2
- package/lib/chevre/service/transaction/deleteTransaction/deletePayTransactionsByPlaceOrder.js +2 -2
- package/lib/chevre/service/transaction/deleteTransaction/deleteReservationsByPlaceOrder.js +2 -2
- package/lib/chevre/service/transaction/placeOrder/confirm.js +1 -1
- package/lib/chevre/service/validation/validateOrder.js +2 -2
- package/package.json +2 -2
|
@@ -17,10 +17,12 @@ import type { PayActionRepo } from './repo/action/pay';
|
|
|
17
17
|
import type { RefundActionRepo } from './repo/action/refund';
|
|
18
18
|
import type { AsyncActionRepo } from './repo/asyncAction';
|
|
19
19
|
import type { AdditionalPropertyRepo } from './repo/additionalProperty';
|
|
20
|
+
import type { AdminAssetTransactionRepo } from './repo/adminAssetTransaction';
|
|
20
21
|
import type { AdminAsyncActionRepo } from './repo/adminAsyncAction';
|
|
21
22
|
import type { AdminScheduledTaskRepo } from './repo/adminScheduledTask';
|
|
22
23
|
import type { AdminTaskRepo } from './repo/adminTask';
|
|
23
24
|
import type { AggregateActionRepo } from './repo/aggregateAction';
|
|
25
|
+
import type { AggregateAssetTransactionRepo } from './repo/aggregateAssetTransaction';
|
|
24
26
|
import type { AggregateOfferRepo } from './repo/aggregateOffer';
|
|
25
27
|
import type { AggregateOrderRepo } from './repo/aggregateOrder';
|
|
26
28
|
import type { AggregateReservationRepo } from './repo/aggregateReservation';
|
|
@@ -166,6 +168,10 @@ export type AdditionalProperty = AdditionalPropertyRepo;
|
|
|
166
168
|
export declare namespace AdditionalProperty {
|
|
167
169
|
function createInstance(...params: ConstructorParameters<typeof AdditionalPropertyRepo>): Promise<AdditionalPropertyRepo>;
|
|
168
170
|
}
|
|
171
|
+
export type AdminAssetTransaction = AdminAssetTransactionRepo;
|
|
172
|
+
export declare namespace AdminAssetTransaction {
|
|
173
|
+
function createInstance(...params: ConstructorParameters<typeof AdminAssetTransactionRepo>): Promise<AdminAssetTransactionRepo>;
|
|
174
|
+
}
|
|
169
175
|
export type AdminAsyncAction = AdminAsyncActionRepo;
|
|
170
176
|
export declare namespace AdminAsyncAction {
|
|
171
177
|
function createInstance(...params: ConstructorParameters<typeof AdminAsyncActionRepo>): Promise<AdminAsyncActionRepo>;
|
|
@@ -190,6 +196,10 @@ export type AggregateTask = AggregateTaskRepo;
|
|
|
190
196
|
export declare namespace AggregateTask {
|
|
191
197
|
function createInstance(...params: ConstructorParameters<typeof AggregateTaskRepo>): Promise<AggregateTaskRepo>;
|
|
192
198
|
}
|
|
199
|
+
export type AggregateAssetTransaction = AggregateAssetTransactionRepo;
|
|
200
|
+
export declare namespace AggregateAssetTransaction {
|
|
201
|
+
function createInstance(...params: ConstructorParameters<typeof AggregateAssetTransactionRepo>): Promise<AggregateAssetTransactionRepo>;
|
|
202
|
+
}
|
|
193
203
|
export type AggregateOffer = AggregateOfferRepo;
|
|
194
204
|
export declare namespace AggregateOffer {
|
|
195
205
|
function createInstance(...params: ConstructorParameters<typeof AggregateOfferRepo>): Promise<AggregateOfferRepo>;
|
package/lib/chevre/repository.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.WebSite = exports.rateLimit = exports.TransactionProcess = exports.TransactionNumber = exports.transaction = exports.Transaction = exports.Ticket = exports.AsyncAction = exports.TaskDelayed = exports.Task = exports.ScheduledTask = exports.StockHolder = exports.setting = exports.Setting = exports.ServiceAvailableHour = exports.SellerReturnPolicy = exports.SellerPaymentAccepted = exports.SellerMakesOffer = exports.Seller = exports.Schedule = exports.Role = exports.ReserveInterface = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductHasOfferCatalog = exports.Product = exports.PriceSpecification = exports.PotentialAction = exports.place = exports.Person = exports.PendingReservation = exports.PaymentServiceProvider = exports.PaymentServiceChannel = void 0;
|
|
3
|
+
exports.OwnershipInfo = exports.OrderNumber = exports.OrderInTransaction = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalogItem = exports.OfferCatalog = exports.NoteAboutOrder = exports.Note = exports.MovieTicketType = exports.Message = exports.MerchantReturnPolicy = exports.MemberProgram = exports.Member = exports.Issuer = exports.IdentityProvider = exports.Identity = exports.EventSeries = exports.EventSellerMakesOffer = exports.EventOffer = exports.Event = exports.EmailMessage = exports.CustomerType = exports.Customer = exports.Credentials = exports.CreativeWork = exports.ConfirmationNumber = exports.Authorization = exports.CategoryCode = exports.assetTransaction = exports.AssetTransaction = exports.Aggregation = exports.AggregateReservation = exports.AggregateOrder = exports.AggregateOffer = exports.AggregateAssetTransaction = exports.AggregateTask = exports.AggregateScheduledTask = exports.AggregateAction = exports.AdminTask = exports.AdminScheduledTask = exports.AdminAsyncAction = exports.AdminAssetTransaction = exports.AdditionalProperty = exports.action = exports.Action = exports.AccountTitle = exports.AccountingReport = exports.AcceptedOffer = void 0;
|
|
4
|
+
exports.WebSite = exports.rateLimit = exports.TransactionProcess = exports.TransactionNumber = exports.transaction = exports.Transaction = exports.Ticket = exports.AsyncAction = exports.TaskDelayed = exports.Task = exports.ScheduledTask = exports.StockHolder = exports.setting = exports.Setting = exports.ServiceAvailableHour = exports.SellerReturnPolicy = exports.SellerPaymentAccepted = exports.SellerMakesOffer = exports.Seller = exports.Schedule = exports.Role = exports.ReserveInterface = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductHasOfferCatalog = exports.Product = exports.PriceSpecification = exports.PotentialAction = exports.place = exports.Person = exports.PendingReservation = exports.PaymentServiceProvider = exports.PaymentServiceChannel = exports.PaymentService = exports.Passport = void 0;
|
|
5
5
|
var AcceptedOffer;
|
|
6
6
|
(function (AcceptedOffer) {
|
|
7
7
|
let repo;
|
|
@@ -170,6 +170,17 @@ var AdditionalProperty;
|
|
|
170
170
|
}
|
|
171
171
|
AdditionalProperty.createInstance = createInstance;
|
|
172
172
|
})(AdditionalProperty || (exports.AdditionalProperty = AdditionalProperty = {}));
|
|
173
|
+
var AdminAssetTransaction;
|
|
174
|
+
(function (AdminAssetTransaction) {
|
|
175
|
+
let repo;
|
|
176
|
+
async function createInstance(...params) {
|
|
177
|
+
if (repo === undefined) {
|
|
178
|
+
repo = (await import('./repo/adminAssetTransaction.js')).AdminAssetTransactionRepo;
|
|
179
|
+
}
|
|
180
|
+
return new repo(...params);
|
|
181
|
+
}
|
|
182
|
+
AdminAssetTransaction.createInstance = createInstance;
|
|
183
|
+
})(AdminAssetTransaction || (exports.AdminAssetTransaction = AdminAssetTransaction = {}));
|
|
173
184
|
var AdminAsyncAction;
|
|
174
185
|
(function (AdminAsyncAction) {
|
|
175
186
|
let repo;
|
|
@@ -236,6 +247,17 @@ var AggregateTask;
|
|
|
236
247
|
}
|
|
237
248
|
AggregateTask.createInstance = createInstance;
|
|
238
249
|
})(AggregateTask || (exports.AggregateTask = AggregateTask = {}));
|
|
250
|
+
var AggregateAssetTransaction;
|
|
251
|
+
(function (AggregateAssetTransaction) {
|
|
252
|
+
let repo;
|
|
253
|
+
async function createInstance(...params) {
|
|
254
|
+
if (repo === undefined) {
|
|
255
|
+
repo = (await import('./repo/aggregateAssetTransaction.js')).AggregateAssetTransactionRepo;
|
|
256
|
+
}
|
|
257
|
+
return new repo(...params);
|
|
258
|
+
}
|
|
259
|
+
AggregateAssetTransaction.createInstance = createInstance;
|
|
260
|
+
})(AggregateAssetTransaction || (exports.AggregateAssetTransaction = AggregateAssetTransaction = {}));
|
|
239
261
|
var AggregateOffer;
|
|
240
262
|
(function (AggregateOffer) {
|
|
241
263
|
let repo;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { AggregateActionRepo } from '../../repo/aggregateAction';
|
|
2
|
+
import type { AggregateAssetTransactionRepo } from '../../repo/aggregateAssetTransaction';
|
|
2
3
|
import type { AggregateScheduledTaskRepo } from '../../repo/aggregateScheduledTask';
|
|
3
4
|
import type { AggregateTaskRepo } from '../../repo/aggregateTask';
|
|
4
|
-
import { AggregationRepo } from '../../repo/aggregation';
|
|
5
|
-
import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
5
|
+
import type { AggregationRepo } from '../../repo/aggregation';
|
|
6
6
|
import type { EventRepo } from '../../repo/event';
|
|
7
|
-
import { OrderRepo } from '../../repo/order';
|
|
7
|
+
import type { OrderRepo } from '../../repo/order';
|
|
8
8
|
import type { TransactionRepo } from '../../repo/transaction';
|
|
9
9
|
type AggregateDurationUnit = 'days' | 'hours';
|
|
10
10
|
interface IAggregateParams {
|
|
@@ -125,7 +125,7 @@ declare function aggregatePayMovieTicketAction(params: IAggregateParams): (repos
|
|
|
125
125
|
}>;
|
|
126
126
|
declare function aggregatePayTransaction(params: IAggregateParams): (repos: {
|
|
127
127
|
agregation: AggregationRepo;
|
|
128
|
-
|
|
128
|
+
aggregateAssetTransaction: AggregateAssetTransactionRepo;
|
|
129
129
|
}) => Promise<{
|
|
130
130
|
aggregationCount: number;
|
|
131
131
|
aggregateDuration: string;
|
|
@@ -135,7 +135,7 @@ declare function aggregatePayTransaction(params: IAggregateParams): (repos: {
|
|
|
135
135
|
*/
|
|
136
136
|
declare function aggregateReserveTransaction(params: IAggregateParams): (repos: {
|
|
137
137
|
agregation: AggregationRepo;
|
|
138
|
-
|
|
138
|
+
aggregateAssetTransaction: AggregateAssetTransactionRepo;
|
|
139
139
|
}) => Promise<{
|
|
140
140
|
aggregationCount: number;
|
|
141
141
|
aggregateDuration: string;
|
|
@@ -587,7 +587,7 @@ function aggregatePayTransaction(params) {
|
|
|
587
587
|
.add(-i, params.aggregateDurationUnit)
|
|
588
588
|
.endOf(params.aggregateDurationUnit)
|
|
589
589
|
.toDate();
|
|
590
|
-
const aggregateResult = await repos.
|
|
590
|
+
const aggregateResult = await repos.aggregateAssetTransaction.aggregateAssetTransaction({
|
|
591
591
|
project: { id: { $ne: params.excludedProjectId } },
|
|
592
592
|
startFrom,
|
|
593
593
|
startThrough,
|
|
@@ -632,7 +632,7 @@ function aggregateReserveTransaction(params) {
|
|
|
632
632
|
.add(-i, params.aggregateDurationUnit)
|
|
633
633
|
.endOf(params.aggregateDurationUnit)
|
|
634
634
|
.toDate();
|
|
635
|
-
const aggregateResult = await repos.
|
|
635
|
+
const aggregateResult = await repos.aggregateAssetTransaction.aggregateAssetTransaction({
|
|
636
636
|
project: { id: { $ne: params.excludedProjectId } },
|
|
637
637
|
startFrom,
|
|
638
638
|
startThrough,
|
|
@@ -11,30 +11,15 @@ function validateStartParams(params) {
|
|
|
11
11
|
const sellerId = params.seller?.id;
|
|
12
12
|
// 予約番号で取引存在確認
|
|
13
13
|
if (typeof params.object.reservation?.reservationNumber === 'string') {
|
|
14
|
-
const transactions = await repos.assetTransaction.
|
|
14
|
+
const transactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
15
15
|
limit: 1,
|
|
16
16
|
page: 1,
|
|
17
17
|
typeOf: factory_1.factory.assetTransactionType.Reserve,
|
|
18
18
|
object: {
|
|
19
|
-
reservationNumber: { $eq: params.object.reservation.reservationNumber }
|
|
20
|
-
// 販売者検証(2023-08-01~)
|
|
21
|
-
...(typeof sellerId === 'string') ? { provider: { id: { $eq: sellerId } } } : undefined
|
|
19
|
+
reservationNumber: { $eq: params.object.reservation.reservationNumber }
|
|
22
20
|
}
|
|
23
21
|
});
|
|
24
22
|
reserveTransaction = transactions.shift();
|
|
25
|
-
// ここでReservationConfirmedでない予約をスルーしても、
|
|
26
|
-
// ReservationRepo.cancel()で冪等性を保証しているのでvalidation不要か(2022-05-12~)
|
|
27
|
-
// 予約ステータス確認
|
|
28
|
-
// const unconfirmedReservations = await repos.reservation.search({
|
|
29
|
-
// limit: 1,
|
|
30
|
-
// page: 1,
|
|
31
|
-
// typeOf: factory.reservationType.EventReservation,
|
|
32
|
-
// reservationNumber: { $eq: params.object.reservation.reservationNumber },
|
|
33
|
-
// reservationStatus: { $ne: factory.reservationStatusType.ReservationConfirmed }
|
|
34
|
-
// });
|
|
35
|
-
// if (unconfirmedReservations.length > 0) {
|
|
36
|
-
// throw new factory.errors.Argument('object.reservation.reservationNumber', `Reservation ${unconfirmedReservations[0].id} not confirmed`);
|
|
37
|
-
// }
|
|
38
23
|
}
|
|
39
24
|
// 取引指定が確認できなければ、予約指定を確認
|
|
40
25
|
if (reserveTransaction === undefined) {
|
|
@@ -59,6 +44,14 @@ function validateStartParams(params) {
|
|
|
59
44
|
reservations = [reservation];
|
|
60
45
|
}
|
|
61
46
|
}
|
|
47
|
+
else {
|
|
48
|
+
// 販売者検証(2023-08-01~)
|
|
49
|
+
if (typeof sellerId === 'string') {
|
|
50
|
+
if (reserveTransaction.object.provider?.id !== sellerId) {
|
|
51
|
+
throw new factory_1.factory.errors.NotFound(factory_1.factory.reservationType.EventReservation);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
62
55
|
if (reserveTransaction === undefined && reservations === undefined) {
|
|
63
56
|
throw new factory_1.factory.errors.Argument('object', 'Transaction or reservation must be specified');
|
|
64
57
|
}
|
|
@@ -135,12 +135,12 @@ function confirm(params) {
|
|
|
135
135
|
else {
|
|
136
136
|
throw new factory_1.factory.errors.ArgumentNull('Transaction ID or Transaction Number');
|
|
137
137
|
}
|
|
138
|
-
const payTransaction = (await repos.assetTransaction.
|
|
138
|
+
const payTransaction = (await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
139
139
|
limit: 1,
|
|
140
140
|
page: 1,
|
|
141
141
|
typeOf: factory_1.factory.assetTransactionType.Pay,
|
|
142
142
|
transactionNumber: { $eq: transaction.object.paymentMethodId }
|
|
143
|
-
}, ['recipient']
|
|
143
|
+
}, ['recipient'])).shift();
|
|
144
144
|
if (payTransaction === undefined) {
|
|
145
145
|
throw new factory_1.factory.errors.NotFound(factory_1.factory.assetTransactionType.Pay);
|
|
146
146
|
}
|
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.processVoidTransaction4chevre = processVoidTransaction4chevre;
|
|
4
4
|
const factory_1 = require("../../../../factory");
|
|
5
|
-
// import type { TransactionRepo } from '../../../../repo/transaction';
|
|
6
5
|
const reserve_1 = require("../../../assetTransaction/reserve");
|
|
7
6
|
function processVoidTransaction4chevre(params) {
|
|
8
7
|
return async (repos, settings) => {
|
|
9
|
-
// const transactionNumber = params.action.object.pendingTransaction?.transactionNumber;
|
|
10
8
|
const transactionNumber = params.action.instrument.transactionNumber;
|
|
11
9
|
if (typeof transactionNumber === 'string') {
|
|
12
10
|
// 取引が存在すれば中止
|
|
13
|
-
const assetTransactions = await repos.assetTransaction.
|
|
11
|
+
const assetTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
14
12
|
limit: 1,
|
|
15
13
|
page: 1,
|
|
16
14
|
project: { id: { $eq: params.action.project.id } },
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// import createDebug from 'debug';
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.isDeliverable = isDeliverable;
|
|
5
4
|
const factory_1 = require("../../../factory");
|
|
6
|
-
// const debug = createDebug('chevre-domain:service:order');
|
|
7
5
|
function isDeliverable(params) {
|
|
8
6
|
return async (repos) => {
|
|
9
7
|
let allReserveTransactionConfirmed = false;
|
|
@@ -15,7 +13,7 @@ function isDeliverable(params) {
|
|
|
15
13
|
// 注文のreservationNumberを取得
|
|
16
14
|
const reservationNumbers = await repos.acceptedOffer.distinctValues({ orderNumber: { $in: [params.orderNumber] } }, 'acceptedOffers.itemOffered.reservationNumber');
|
|
17
15
|
if (reservationNumbers.length > 0) {
|
|
18
|
-
const referencedReserveTransactions = await repos.assetTransaction.
|
|
16
|
+
const referencedReserveTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
19
17
|
project: { id: { $eq: params.project.id } },
|
|
20
18
|
typeOf: factory_1.factory.assetTransactionType.Reserve,
|
|
21
19
|
transactionNumber: { $in: reservationNumbers }
|
|
@@ -27,52 +25,6 @@ function isDeliverable(params) {
|
|
|
27
25
|
else {
|
|
28
26
|
allReserveTransactionConfirmed = true;
|
|
29
27
|
}
|
|
30
|
-
// } else if (params.assetTransactionType === factory.assetTransactionType.MoneyTransfer) {
|
|
31
|
-
// allReserveTransactionConfirmed = true;
|
|
32
|
-
// allRegisterServiceTransactionConfirmed = true;
|
|
33
|
-
// // 注文のMoneyTransferTransaction.transactionNumberを取得
|
|
34
|
-
// const moneyTransferTransactionNumbers = await repos.acceptedOffer.distinctValues(
|
|
35
|
-
// { orderNumber: { $in: [params.orderNumber] } },
|
|
36
|
-
// 'acceptedOffers.serialNumber'
|
|
37
|
-
// );
|
|
38
|
-
// if (moneyTransferTransactionNumbers.length > 0) {
|
|
39
|
-
// debug('is deliverable?...', params.orderNumber, 'moneyTransferTransactionNumbers:', moneyTransferTransactionNumbers);
|
|
40
|
-
// const referencedMoneyTransferTransactions = await repos.assetTransaction.search(
|
|
41
|
-
// {
|
|
42
|
-
// project: { id: { $eq: params.project.id } },
|
|
43
|
-
// typeOf: factory.assetTransactionType.MoneyTransfer,
|
|
44
|
-
// transactionNumber: { $in: moneyTransferTransactionNumbers }
|
|
45
|
-
// },
|
|
46
|
-
// ['status']
|
|
47
|
-
// ) as Pick<factory.assetTransaction.moneyTransfer.ITransaction, 'status'>[];
|
|
48
|
-
// allMoneyTransferTransactionConfirmed =
|
|
49
|
-
// referencedMoneyTransferTransactions.length === moneyTransferTransactionNumbers.length
|
|
50
|
-
// && referencedMoneyTransferTransactions.every(({ status }) => status === factory.transactionStatusType.Confirmed);
|
|
51
|
-
// } else {
|
|
52
|
-
// allMoneyTransferTransactionConfirmed = true;
|
|
53
|
-
// }
|
|
54
|
-
// } else if (params.assetTransactionType === factory.assetTransactionType.RegisterService) {
|
|
55
|
-
// allReserveTransactionConfirmed = true;
|
|
56
|
-
// allMoneyTransferTransactionConfirmed = true;
|
|
57
|
-
// const registerServiceTransactionNumbers = await repos.acceptedOffer.distinctValues(
|
|
58
|
-
// { orderNumber: { $in: [params.orderNumber] } },
|
|
59
|
-
// 'acceptedOffers.serialNumber'
|
|
60
|
-
// );
|
|
61
|
-
// if (registerServiceTransactionNumbers.length > 0) {
|
|
62
|
-
// const referencedRegisterServiceTransactions = await repos.assetTransaction.search(
|
|
63
|
-
// {
|
|
64
|
-
// project: { id: { $eq: params.project.id } },
|
|
65
|
-
// typeOf: factory.assetTransactionType.RegisterService,
|
|
66
|
-
// transactionNumber: { $in: registerServiceTransactionNumbers }
|
|
67
|
-
// },
|
|
68
|
-
// ['status']
|
|
69
|
-
// ) as Pick<factory.assetTransaction.registerService.ITransaction, 'status'>[];
|
|
70
|
-
// allRegisterServiceTransactionConfirmed =
|
|
71
|
-
// referencedRegisterServiceTransactions.length === registerServiceTransactionNumbers.length
|
|
72
|
-
// && referencedRegisterServiceTransactions.every(({ status }) => status === factory.transactionStatusType.Confirmed);
|
|
73
|
-
// } else {
|
|
74
|
-
// allRegisterServiceTransactionConfirmed = true;
|
|
75
|
-
// }
|
|
76
28
|
}
|
|
77
29
|
return allReserveTransactionConfirmed && allMoneyTransferTransactionConfirmed && allRegisterServiceTransactionConfirmed;
|
|
78
30
|
};
|
package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.js
CHANGED
|
@@ -36,7 +36,7 @@ function onPayTransactionConfirmed(params) {
|
|
|
36
36
|
}
|
|
37
37
|
function fixPaymentMethodIdentifierIfPossible(params) {
|
|
38
38
|
return async (repos) => {
|
|
39
|
-
const referencedPayTransactions = await repos.assetTransaction.
|
|
39
|
+
const referencedPayTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
40
40
|
project: { id: { $eq: params.project.id } },
|
|
41
41
|
typeOf: factory_1.factory.assetTransactionType.Pay,
|
|
42
42
|
statuses: [factory_1.factory.transactionStatusType.Confirmed],
|
|
@@ -73,7 +73,7 @@ function isProcessable(params) {
|
|
|
73
73
|
const paymentMethodIds = order.paymentMethods.filter((invoice) => typeof invoice.paymentMethodId === 'string' && invoice.paymentMethodId.length > 0)
|
|
74
74
|
.map((invoice) => invoice.paymentMethodId);
|
|
75
75
|
if (paymentMethodIds.length > 0) {
|
|
76
|
-
const referencedPayTransactions = await repos.assetTransaction.
|
|
76
|
+
const referencedPayTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
77
77
|
project: { id: { $eq: params.project.id } },
|
|
78
78
|
typeOf: factory_1.factory.assetTransactionType.Pay,
|
|
79
79
|
transactionNumber: { $in: paymentMethodIds }
|
|
@@ -109,7 +109,7 @@ function processVoidPayTransaction(params) {
|
|
|
109
109
|
// 取引が存在すれば中止
|
|
110
110
|
const transactionNumber = action.object.paymentMethodId;
|
|
111
111
|
if (typeof transactionNumber === 'string' && transactionNumber.length > 0) {
|
|
112
|
-
const payTransaction = (await repos.assetTransaction.
|
|
112
|
+
const payTransaction = (await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
113
113
|
limit: 1,
|
|
114
114
|
page: 1,
|
|
115
115
|
project: { id: { $eq: action.project.id } },
|
|
@@ -39,7 +39,7 @@ function cancelPengindIfNotYet(params) {
|
|
|
39
39
|
return async (repos) => {
|
|
40
40
|
const reserveTransactionId = params.purpose.id;
|
|
41
41
|
// 予約取引を検索
|
|
42
|
-
const reserveTransactions = await repos.assetTransaction.
|
|
42
|
+
const reserveTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
43
43
|
limit: 1,
|
|
44
44
|
page: 1,
|
|
45
45
|
typeOf: factory_1.factory.assetTransactionType.Reserve,
|
|
@@ -169,7 +169,7 @@ function cancelReservation(actionAttributesList) {
|
|
|
169
169
|
try {
|
|
170
170
|
if (actionAttributes.object.typeOf === factory_1.factory.reservationType.ReservationPackage) {
|
|
171
171
|
// 予約取引を検索
|
|
172
|
-
const reserveTransactions = await repos.assetTransaction.
|
|
172
|
+
const reserveTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
173
173
|
limit: 1,
|
|
174
174
|
page: 1,
|
|
175
175
|
typeOf: factory_1.factory.assetTransactionType.Reserve,
|
|
@@ -226,7 +226,7 @@ function cancelReservation(actionAttributesList) {
|
|
|
226
226
|
inclusion: ['reservationNumber', 'reservationStatus', 'project', 'reservedTicket', 'subReservation', 'reservationFor']
|
|
227
227
|
});
|
|
228
228
|
// 予約取引を検索
|
|
229
|
-
const reserveTransactions = await repos.assetTransaction.
|
|
229
|
+
const reserveTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
230
230
|
limit: 1,
|
|
231
231
|
page: 1,
|
|
232
232
|
typeOf: factory_1.factory.assetTransactionType.Reserve,
|
|
@@ -90,7 +90,7 @@ function reserveIfNotYet(params) {
|
|
|
90
90
|
) => {
|
|
91
91
|
let reserveTransactions = [];
|
|
92
92
|
if (Array.isArray(params.object.ids) && params.object.ids.length > 0) {
|
|
93
|
-
reserveTransactions = await repos.assetTransaction.
|
|
93
|
+
reserveTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
94
94
|
typeOf: factory_1.factory.assetTransactionType.Reserve,
|
|
95
95
|
object: {
|
|
96
96
|
reservations: { id: { $in: params.object.ids } }
|
|
@@ -100,7 +100,7 @@ function reserveIfNotYet(params) {
|
|
|
100
100
|
debug(reserveTransactions.length, 'reserveTransactions found in reserveIfNotYet. ids:', params.object.ids, 'reserveTransactions:', JSON.stringify(reserveTransactions));
|
|
101
101
|
}
|
|
102
102
|
if (Array.isArray(params.object.reservationNumbers) && params.object.reservationNumbers.length > 0) {
|
|
103
|
-
reserveTransactions = await repos.assetTransaction.
|
|
103
|
+
reserveTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
104
104
|
typeOf: factory_1.factory.assetTransactionType.Reserve,
|
|
105
105
|
object: {
|
|
106
106
|
reservationNumber: { $in: params.object.reservationNumbers }
|
|
@@ -140,7 +140,7 @@ function reserveIfNotYet(
|
|
|
140
140
|
params, options) {
|
|
141
141
|
return async (repos) => {
|
|
142
142
|
const reservationPackage = params.object;
|
|
143
|
-
const reserveTransaction = (await repos.assetTransaction.
|
|
143
|
+
const reserveTransaction = (await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
144
144
|
limit: 1,
|
|
145
145
|
page: 1,
|
|
146
146
|
typeOf: factory_1.factory.assetTransactionType.Reserve,
|
|
@@ -112,7 +112,7 @@ function reserveIfNotYet(params) {
|
|
|
112
112
|
) => {
|
|
113
113
|
let reserveTransactions = [];
|
|
114
114
|
if (typeof params.object.id === 'string' && params.object.id.length > 0) {
|
|
115
|
-
reserveTransactions = await repos.assetTransaction.
|
|
115
|
+
reserveTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
116
116
|
typeOf: factory_1.factory.assetTransactionType.Reserve,
|
|
117
117
|
object: {
|
|
118
118
|
reservations: { id: { $in: [params.object.id] } }
|
|
@@ -213,14 +213,14 @@ function createRefundPurpose(params, order) {
|
|
|
213
213
|
}
|
|
214
214
|
function refundTransactionAlreadyExists(params) {
|
|
215
215
|
return async (repos) => {
|
|
216
|
-
const refundTransactions = await repos.assetTransaction.
|
|
216
|
+
const refundTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
217
217
|
limit: 1,
|
|
218
218
|
page: 1,
|
|
219
219
|
project: { id: { $eq: params.project.id } },
|
|
220
220
|
typeOf: factory_1.factory.assetTransactionType.Refund,
|
|
221
221
|
statuses: [factory_1.factory.transactionStatusType.Confirmed],
|
|
222
222
|
object: { paymentMethodId: { $eq: params.object.paymentMethodId } }
|
|
223
|
-
}, ['_id']
|
|
223
|
+
}, ['_id']);
|
|
224
224
|
return refundTransactions.length > 0;
|
|
225
225
|
};
|
|
226
226
|
}
|
package/lib/chevre/service/transaction/deleteTransaction/deletePayTransactionsByPlaceOrder.js
CHANGED
|
@@ -29,10 +29,10 @@ function deletePayTransactionsByPlaceOrder(params) {
|
|
|
29
29
|
deletedCount: deleteAssetTransactionsResult?.deletedCount
|
|
30
30
|
};
|
|
31
31
|
// 返金取引も削除(2023-05-19~)
|
|
32
|
-
const refundTransactions = await repos.assetTransaction.
|
|
32
|
+
const refundTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
33
33
|
typeOf: factory_1.factory.assetTransactionType.Refund,
|
|
34
34
|
object: { paymentMethodId: { $in: payTransactionNumbers } }
|
|
35
|
-
}, ['transactionNumber']
|
|
35
|
+
}, ['transactionNumber']);
|
|
36
36
|
if (refundTransactions.length > 0) {
|
|
37
37
|
const deleteRefundAssetTransactionsResult = await repos.assetTransaction.deleteByTransactionNumber({
|
|
38
38
|
project: { id: params.transaction.project.id },
|
|
@@ -40,11 +40,11 @@ function deleteReservationsByPlaceOrder(params) {
|
|
|
40
40
|
deletedCount: deleteAssetTransactionsResult?.deletedCount
|
|
41
41
|
};
|
|
42
42
|
// 予約番号で予約取消取引を検索
|
|
43
|
-
const deletingCancelReservationTransactions = await repos.assetTransaction.
|
|
43
|
+
const deletingCancelReservationTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
44
44
|
project: { id: { $eq: params.transaction.project.id } },
|
|
45
45
|
object: { reservationNumber: { $in: reserveTransactionNumbers } },
|
|
46
46
|
typeOf: factory_1.factory.assetTransactionType.CancelReservation
|
|
47
|
-
}, ['transactionNumber']
|
|
47
|
+
}, ['transactionNumber']);
|
|
48
48
|
if (deletingCancelReservationTransactions.length > 0) {
|
|
49
49
|
// 予約取消取引も削除(2024-04-18~)
|
|
50
50
|
const deleteCancelReservationResult = await repos.assetTransaction.deleteByTransactionNumber({
|
|
@@ -128,7 +128,7 @@ function confirm(params, options) {
|
|
|
128
128
|
const payTransactionNumbers = authorizePaymentActions.map((authorizeAction) => authorizeAction.object.paymentMethodId);
|
|
129
129
|
// const payTransactionNumbers = authorizePaymentActions.map(({ instrument }) => instrument.transactionNumber);
|
|
130
130
|
if (payTransactionNumbers.length > 0) {
|
|
131
|
-
payTransactions = await repos.assetTransaction.
|
|
131
|
+
payTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
132
132
|
typeOf: factory_1.factory.assetTransactionType.Pay,
|
|
133
133
|
transactionNumber: { $in: payTransactionNumbers }
|
|
134
134
|
}, ['object']);
|
|
@@ -25,11 +25,11 @@ function validateOrder(params) {
|
|
|
25
25
|
});
|
|
26
26
|
let payTransactions = [];
|
|
27
27
|
if (order.paymentMethods.length > 0) {
|
|
28
|
-
payTransactions = await repos.assetTransaction.
|
|
28
|
+
payTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
29
29
|
project: { id: { $eq: order.project.id } },
|
|
30
30
|
typeOf: factory_1.factory.assetTransactionType.Pay,
|
|
31
31
|
transactionNumber: { $in: order.paymentMethods.map(({ paymentMethodId }) => paymentMethodId) }
|
|
32
|
-
}, []
|
|
32
|
+
}, []);
|
|
33
33
|
}
|
|
34
34
|
// 型検証
|
|
35
35
|
if (typeof order.confirmationNumber !== 'string' || order.confirmationNumber.length === 0) {
|
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": "10.3.0-alpha.
|
|
14
|
+
"@chevre/factory": "10.3.0-alpha.3",
|
|
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": "26.0.0-alpha.
|
|
91
|
+
"version": "26.0.0-alpha.26"
|
|
92
92
|
}
|