@chevre/domain 21.6.0-alpha.0 → 21.6.0-alpha.10
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/createManyEventsIfNotExist.ts +0 -2
- package/example/src/chevre/migrateEventOrganizer.ts +33 -12
- package/example/src/chevre/migrateMovieAvailabilityStarts.ts +11 -0
- package/example/src/chevre/searchSellers.ts +28 -0
- package/example/src/chevre/unsetUnnecessaryFields.ts +18 -6
- package/lib/chevre/repo/event.d.ts +15 -0
- package/lib/chevre/repo/event.js +12 -0
- package/lib/chevre/repo/mongoose/schemas/seller.js +12 -0
- package/lib/chevre/repo/offer.d.ts +15 -0
- package/lib/chevre/repo/offer.js +21 -0
- package/lib/chevre/repo/offerCatalog.d.ts +14 -0
- package/lib/chevre/repo/offerCatalog.js +21 -0
- package/lib/chevre/repo/product.d.ts +8 -0
- package/lib/chevre/repo/product.js +9 -0
- package/lib/chevre/repo/seller.js +14 -2
- package/lib/chevre/service/assetTransaction/pay/factory.js +33 -29
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +21 -26
- package/lib/chevre/service/assetTransaction/pay.js +0 -3
- package/lib/chevre/service/event.js +3 -7
- package/lib/chevre/service/order/onOrderStatusChanged.js +5 -3
- package/lib/chevre/service/order/placeOrder.js +10 -5
- package/lib/chevre/service/order/returnOrder.js +5 -1
- package/lib/chevre/service/order/sendOrder.js +5 -1
- package/lib/chevre/service/payment/any/factory.js +10 -9
- package/lib/chevre/service/payment/movieTicket.js +2 -2
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +4 -0
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +158 -1
- package/lib/chevre/service/task/onResourceUpdated.js +4 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/factory.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +3 -6
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/givePointAward.js +15 -15
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +15 -42
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +15 -15
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/sendEmailMessage.js +5 -3
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.js +5 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/result.js +14 -7
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +10 -2
- package/lib/chevre/service/transaction/placeOrderInProgress.js +1 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.js +5 -3
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +25 -21
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.js +5 -3
- package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +5 -4
- package/lib/chevre/service/transaction/returnOrder/potentialActions.js +17 -13
- package/lib/chevre/service/transaction/returnOrder.js +124 -95
- package/package.json +3 -3
|
@@ -105,7 +105,6 @@ async function main() {
|
|
|
105
105
|
},
|
|
106
106
|
offers: {
|
|
107
107
|
typeOf: chevre.factory.offerType.Offer,
|
|
108
|
-
priceCurrency: chevre.factory.priceCurrency.JPY,
|
|
109
108
|
availabilityEnds: moment('2023-06-26T14:20:00.000Z')
|
|
110
109
|
.toDate(),
|
|
111
110
|
availabilityStarts: moment('2023-06-23T15:00:00.000Z')
|
|
@@ -275,7 +274,6 @@ async function main() {
|
|
|
275
274
|
},
|
|
276
275
|
offers: {
|
|
277
276
|
typeOf: chevre.factory.offerType.Offer,
|
|
278
|
-
priceCurrency: chevre.factory.priceCurrency.JPY,
|
|
279
277
|
availabilityEnds: moment('2023-06-26T14:20:00.000Z')
|
|
280
278
|
.toDate(),
|
|
281
279
|
availabilityStarts: moment('2023-06-23T15:00:00.000Z')
|
|
@@ -5,7 +5,7 @@ import * as mongoose from 'mongoose';
|
|
|
5
5
|
import { chevre } from '../../../lib/index';
|
|
6
6
|
|
|
7
7
|
// const project = { id: String(process.env.PROJECT_ID) };
|
|
8
|
-
|
|
8
|
+
const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
|
|
9
9
|
|
|
10
10
|
// tslint:disable-next-line:max-func-body-length
|
|
11
11
|
async function main() {
|
|
@@ -17,7 +17,7 @@ async function main() {
|
|
|
17
17
|
const cursor = eventRepo.getCursor(
|
|
18
18
|
{
|
|
19
19
|
// 'project.id': { $eq: project.id },
|
|
20
|
-
|
|
20
|
+
'project.id': { $ne: EXCLUDED_PROJECT_ID },
|
|
21
21
|
typeOf: {
|
|
22
22
|
$in: [
|
|
23
23
|
// chevre.factory.eventType.ScreeningEvent,
|
|
@@ -96,16 +96,16 @@ async function main() {
|
|
|
96
96
|
|
|
97
97
|
if (alreadyMigrated) {
|
|
98
98
|
console.log('already exist...', event.project.id, event.id, event.startDate, organizerId, i);
|
|
99
|
-
if (organizerId
|
|
99
|
+
if (organizerId === sellerId) {
|
|
100
|
+
console.log('organizerId is valid', event.project.id, event.id, event.startDate, organizerId, i);
|
|
101
|
+
} else {
|
|
100
102
|
invalidOrganizerCount += 1;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if (typeof sellerId === 'string') {
|
|
108
|
-
const newOrganizer: chevre.factory.event.screeningEventSeries.IOrganizer = {
|
|
103
|
+
|
|
104
|
+
// organizerを修正する
|
|
105
|
+
if (typeof sellerId !== 'string') {
|
|
106
|
+
throw new Error('movieTheater not found');
|
|
107
|
+
}
|
|
108
|
+
const fixedOrganizer: chevre.factory.event.screeningEventSeries.IOrganizer = {
|
|
109
109
|
id: sellerId
|
|
110
110
|
};
|
|
111
111
|
console.log('updating event...', event.project.id, event.id, event.startDate, i);
|
|
@@ -114,12 +114,33 @@ async function main() {
|
|
|
114
114
|
id: event.id,
|
|
115
115
|
attributes: <any>{
|
|
116
116
|
typeOf: event.typeOf,
|
|
117
|
-
organizer:
|
|
117
|
+
organizer: fixedOrganizer
|
|
118
118
|
}
|
|
119
119
|
});
|
|
120
120
|
updateCount += 1;
|
|
121
121
|
console.log('updated.', event.project.id, event.id, event.startDate, i);
|
|
122
122
|
}
|
|
123
|
+
} else {
|
|
124
|
+
throw new Error('organizer not found');
|
|
125
|
+
// if (typeof sellerId !== 'string') {
|
|
126
|
+
// throw new Error('movieTheater not found');
|
|
127
|
+
// }
|
|
128
|
+
// if (typeof sellerId === 'string') {
|
|
129
|
+
// const newOrganizer: chevre.factory.event.screeningEventSeries.IOrganizer = {
|
|
130
|
+
// id: sellerId
|
|
131
|
+
// };
|
|
132
|
+
// console.log('updating event...', event.project.id, event.id, event.startDate, i);
|
|
133
|
+
// await eventRepo.updatePartiallyById({
|
|
134
|
+
// project: { id: event.project.id },
|
|
135
|
+
// id: event.id,
|
|
136
|
+
// attributes: <any>{
|
|
137
|
+
// typeOf: event.typeOf,
|
|
138
|
+
// organizer: newOrganizer
|
|
139
|
+
// }
|
|
140
|
+
// });
|
|
141
|
+
// updateCount += 1;
|
|
142
|
+
// console.log('updated.', event.project.id, event.id, event.startDate, i);
|
|
143
|
+
// }
|
|
123
144
|
}
|
|
124
145
|
});
|
|
125
146
|
|
|
@@ -24,6 +24,7 @@ async function main() {
|
|
|
24
24
|
let i = 0;
|
|
25
25
|
let updateCount = 0;
|
|
26
26
|
let datePublishedUndefinedCount = 0;
|
|
27
|
+
let datePublishedIsAfterNowCount = 0;
|
|
27
28
|
await cursor.eachAsync(async (doc) => {
|
|
28
29
|
i += 1;
|
|
29
30
|
const movie: chevre.factory.creativeWork.movie.ICreativeWork = doc.toObject();
|
|
@@ -38,6 +39,14 @@ async function main() {
|
|
|
38
39
|
|
|
39
40
|
if (alreadyMigrated) {
|
|
40
41
|
console.log('already exist...', movie.project.id, movie.id, movie.identifier, availabilityStarts, availabilityEnds, i);
|
|
42
|
+
|
|
43
|
+
if (moment(movie.datePublished)
|
|
44
|
+
.isAfter(moment())) {
|
|
45
|
+
datePublishedIsAfterNowCount += 1;
|
|
46
|
+
// tslint:disable-next-line:max-line-length
|
|
47
|
+
// throw new Error(`movie.datePublished isAfter now ${movie.project.id} ${movie.id} ${movie.identifier} ${movie.datePublished}`);
|
|
48
|
+
|
|
49
|
+
}
|
|
41
50
|
} else {
|
|
42
51
|
if (movie.datePublished === undefined) {
|
|
43
52
|
console.error('movie.datePublished undefined', movie.project.id, movie.id, movie.identifier, i);
|
|
@@ -63,6 +72,8 @@ async function main() {
|
|
|
63
72
|
console.log(i, 'creativeWorks checked');
|
|
64
73
|
console.log(updateCount, 'creativeWorks updated');
|
|
65
74
|
console.log(datePublishedUndefinedCount, 'datePublishedUndefinedCount');
|
|
75
|
+
console.log(datePublishedIsAfterNowCount, 'datePublishedIsAfterNowCount');
|
|
76
|
+
|
|
66
77
|
}
|
|
67
78
|
|
|
68
79
|
main()
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../lib/index';
|
|
5
|
+
|
|
6
|
+
const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
+
|
|
8
|
+
async function main() {
|
|
9
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
|
+
|
|
11
|
+
const sellerRepo = new chevre.repository.Seller(mongoose.connection);
|
|
12
|
+
|
|
13
|
+
const sellers = await sellerRepo.search(
|
|
14
|
+
{
|
|
15
|
+
project: { id: { $eq: project.id } },
|
|
16
|
+
paymentAccepted: { paymentMethodType: { $eq: 'Cash' } },
|
|
17
|
+
hasMerchantReturnPolicy: { applicablePaymentMethod: {} }
|
|
18
|
+
},
|
|
19
|
+
['name'],
|
|
20
|
+
[]
|
|
21
|
+
);
|
|
22
|
+
console.log('sellers found', sellers);
|
|
23
|
+
console.log(sellers.length, 'sellers found');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
main()
|
|
27
|
+
.then()
|
|
28
|
+
.catch(console.error);
|
|
@@ -4,16 +4,28 @@ import * as mongoose from 'mongoose';
|
|
|
4
4
|
import { chevre } from '../../../lib/index';
|
|
5
5
|
|
|
6
6
|
async function main() {
|
|
7
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
7
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const eventRepo = new chevre.repository.Event(mongoose.connection);
|
|
10
10
|
|
|
11
11
|
let updateResult: any;
|
|
12
|
-
updateResult = await
|
|
13
|
-
filter: { '
|
|
14
|
-
$unset: { '
|
|
12
|
+
updateResult = await eventRepo.unsetUnnecessaryFields({
|
|
13
|
+
filter: { 'offers.acceptedPaymentMethod': { $exists: true } },
|
|
14
|
+
$unset: { 'offers.acceptedPaymentMethod': 1 }
|
|
15
15
|
});
|
|
16
|
-
console.log('
|
|
16
|
+
console.log('events unset', updateResult);
|
|
17
|
+
|
|
18
|
+
updateResult = await eventRepo.unsetUnnecessaryFields({
|
|
19
|
+
filter: { 'offers.project': { $exists: true } },
|
|
20
|
+
$unset: { 'offers.project': 1 }
|
|
21
|
+
});
|
|
22
|
+
console.log('events unset', updateResult);
|
|
23
|
+
|
|
24
|
+
updateResult = await eventRepo.unsetUnnecessaryFields({
|
|
25
|
+
filter: { 'offers.priceCurrency': { $exists: true } },
|
|
26
|
+
$unset: { 'offers.priceCurrency': 1 }
|
|
27
|
+
});
|
|
28
|
+
console.log('events unset', updateResult);
|
|
17
29
|
}
|
|
18
30
|
|
|
19
31
|
main()
|
|
@@ -237,6 +237,21 @@ export declare class MongoRepository {
|
|
|
237
237
|
};
|
|
238
238
|
};
|
|
239
239
|
}): Promise<import("mongodb").DeleteResult>;
|
|
240
|
+
/**
|
|
241
|
+
* 興行(プロダクト)から削除する
|
|
242
|
+
*/
|
|
243
|
+
deleteManyByItemOfferedId(params: {
|
|
244
|
+
project: {
|
|
245
|
+
id: string;
|
|
246
|
+
};
|
|
247
|
+
offers: {
|
|
248
|
+
itemOffered: {
|
|
249
|
+
id: {
|
|
250
|
+
$in: string[];
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
}): Promise<import("mongodb").DeleteResult>;
|
|
240
255
|
deleteByProject(params: {
|
|
241
256
|
project: {
|
|
242
257
|
id: string;
|
package/lib/chevre/repo/event.js
CHANGED
|
@@ -954,6 +954,18 @@ class MongoRepository {
|
|
|
954
954
|
.exec();
|
|
955
955
|
});
|
|
956
956
|
}
|
|
957
|
+
/**
|
|
958
|
+
* 興行(プロダクト)から削除する
|
|
959
|
+
*/
|
|
960
|
+
deleteManyByItemOfferedId(params) {
|
|
961
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
962
|
+
return this.eventModel.deleteMany({
|
|
963
|
+
'project.id': { $eq: params.project.id },
|
|
964
|
+
'offers.itemOffered.id': { $exists: true, $in: params.offers.itemOffered.id.$in }
|
|
965
|
+
})
|
|
966
|
+
.exec();
|
|
967
|
+
});
|
|
968
|
+
}
|
|
957
969
|
deleteByProject(params) {
|
|
958
970
|
return __awaiter(this, void 0, void 0, function* () {
|
|
959
971
|
yield this.eventModel.deleteMany({
|
|
@@ -75,6 +75,18 @@ schema.index({ additionalProperty: 1, branchCode: 1 }, {
|
|
|
75
75
|
additionalProperty: { $exists: true }
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
|
+
schema.index({ 'paymentAccepted.paymentMethodType': 1, branchCode: 1 }, {
|
|
79
|
+
name: 'searchByPaymentAccepted',
|
|
80
|
+
partialFilterExpression: {
|
|
81
|
+
'paymentAccepted.paymentMethodType': { $exists: true }
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
schema.index({ 'hasMerchantReturnPolicy.applicablePaymentMethod': 1, branchCode: 1 }, {
|
|
85
|
+
name: 'searchByHasMerchantReturnPolicyApplicablePaymentMethod',
|
|
86
|
+
partialFilterExpression: {
|
|
87
|
+
'hasMerchantReturnPolicy.applicablePaymentMethod': { $exists: true }
|
|
88
|
+
}
|
|
89
|
+
});
|
|
78
90
|
schema.index({ 'hasMerchantReturnPolicy.itemCondition.id': 1, branchCode: 1 }, {
|
|
79
91
|
name: 'searchByHasMerchantReturnPolicyItemConditionId',
|
|
80
92
|
partialFilterExpression: {
|
|
@@ -71,6 +71,21 @@ export declare class MongoRepository {
|
|
|
71
71
|
attributes: factory.unitPriceOffer.IUnitPriceOffer;
|
|
72
72
|
upsert?: boolean;
|
|
73
73
|
}[]): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* プロダクトIDからアドオンを除外する
|
|
76
|
+
*/
|
|
77
|
+
pullAddOns(params: {
|
|
78
|
+
project: {
|
|
79
|
+
id: string;
|
|
80
|
+
};
|
|
81
|
+
addOn: {
|
|
82
|
+
itemOffered: {
|
|
83
|
+
id: {
|
|
84
|
+
$in: string[];
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
}): Promise<import("mongodb").UpdateResult | undefined>;
|
|
74
89
|
deleteById(params: {
|
|
75
90
|
id: string;
|
|
76
91
|
}): Promise<void>;
|
package/lib/chevre/repo/offer.js
CHANGED
|
@@ -494,6 +494,27 @@ class MongoRepository {
|
|
|
494
494
|
}
|
|
495
495
|
});
|
|
496
496
|
}
|
|
497
|
+
/**
|
|
498
|
+
* プロダクトIDからアドオンを除外する
|
|
499
|
+
*/
|
|
500
|
+
pullAddOns(params) {
|
|
501
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
502
|
+
if (params.addOn.itemOffered.id.$in.length === 0) {
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
return this.offerModel.updateMany({
|
|
506
|
+
'project.id': { $eq: params.project.id },
|
|
507
|
+
'addOn.itemOffered.id': { $exists: true, $in: params.addOn.itemOffered.id.$in }
|
|
508
|
+
}, {
|
|
509
|
+
$pull: {
|
|
510
|
+
addOn: {
|
|
511
|
+
'itemOffered.id': { $in: params.addOn.itemOffered.id.$in }
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
})
|
|
515
|
+
.exec();
|
|
516
|
+
});
|
|
517
|
+
}
|
|
497
518
|
deleteById(params) {
|
|
498
519
|
return __awaiter(this, void 0, void 0, function* () {
|
|
499
520
|
yield this.offerModel.findOneAndRemove({ _id: params.id })
|
|
@@ -52,6 +52,20 @@ export declare class MongoRepository {
|
|
|
52
52
|
};
|
|
53
53
|
};
|
|
54
54
|
}): Promise<void>;
|
|
55
|
+
pullItemListElement(params: {
|
|
56
|
+
project: {
|
|
57
|
+
id: string;
|
|
58
|
+
};
|
|
59
|
+
$pull: {
|
|
60
|
+
itemListElement: {
|
|
61
|
+
$elemMatch: {
|
|
62
|
+
id: {
|
|
63
|
+
$in: string[];
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
}): Promise<import("mongodb").UpdateResult | undefined>;
|
|
55
69
|
search(params: factory.offerCatalog.ISearchConditions): Promise<(Omit<factory.offerCatalog.IOfferCatalog, 'itemListElement'> & {
|
|
56
70
|
numberOfItems?: number;
|
|
57
71
|
})[]>;
|
|
@@ -178,6 +178,27 @@ class MongoRepository {
|
|
|
178
178
|
.exec();
|
|
179
179
|
});
|
|
180
180
|
}
|
|
181
|
+
pullItemListElement(params) {
|
|
182
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
183
|
+
if (params.$pull.itemListElement.$elemMatch.id.$in.length === 0) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
return this.offerCatalogModel.updateMany({
|
|
187
|
+
'project.id': { $eq: params.project.id },
|
|
188
|
+
'itemListElement.id': {
|
|
189
|
+
$exists: true,
|
|
190
|
+
$in: params.$pull.itemListElement.$elemMatch.id.$in
|
|
191
|
+
}
|
|
192
|
+
}, {
|
|
193
|
+
$pull: {
|
|
194
|
+
itemListElement: {
|
|
195
|
+
id: { $in: params.$pull.itemListElement.$elemMatch.id.$in }
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
})
|
|
199
|
+
.exec();
|
|
200
|
+
});
|
|
201
|
+
}
|
|
181
202
|
search(params) {
|
|
182
203
|
var _a;
|
|
183
204
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -68,6 +68,14 @@ export declare class MongoRepository {
|
|
|
68
68
|
*/
|
|
69
69
|
createIfNotExist?: boolean;
|
|
70
70
|
}): Promise<factory.product.IProduct>;
|
|
71
|
+
deleteByHasOfferCatalog(params: {
|
|
72
|
+
project: {
|
|
73
|
+
id: string;
|
|
74
|
+
};
|
|
75
|
+
hasOfferCatalog: {
|
|
76
|
+
id: string;
|
|
77
|
+
};
|
|
78
|
+
}): Promise<import("mongodb").DeleteResult>;
|
|
71
79
|
/**
|
|
72
80
|
* プロジェクト指定で削除する
|
|
73
81
|
*/
|
|
@@ -371,6 +371,15 @@ class MongoRepository {
|
|
|
371
371
|
return doc.toObject();
|
|
372
372
|
});
|
|
373
373
|
}
|
|
374
|
+
deleteByHasOfferCatalog(params) {
|
|
375
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
376
|
+
return this.productModel.deleteMany({
|
|
377
|
+
'project.id': { $eq: params.project.id },
|
|
378
|
+
'hasOfferCatalog.id': { $exists: true, $eq: params.hasOfferCatalog.id }
|
|
379
|
+
})
|
|
380
|
+
.exec();
|
|
381
|
+
});
|
|
382
|
+
}
|
|
374
383
|
/**
|
|
375
384
|
* プロジェクト指定で削除する
|
|
376
385
|
*/
|
|
@@ -34,7 +34,7 @@ class MongoRepository {
|
|
|
34
34
|
}
|
|
35
35
|
// tslint:disable-next-line:max-func-body-length
|
|
36
36
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
37
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
37
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
38
38
|
// MongoDB検索条件
|
|
39
39
|
const andConditions = [];
|
|
40
40
|
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
@@ -120,7 +120,19 @@ class MongoRepository {
|
|
|
120
120
|
}
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
|
-
const
|
|
123
|
+
const paymentAcceptedEq = (_p = (_o = params.paymentAccepted) === null || _o === void 0 ? void 0 : _o.paymentMethodType) === null || _p === void 0 ? void 0 : _p.$eq;
|
|
124
|
+
if (typeof paymentAcceptedEq === 'string') {
|
|
125
|
+
andConditions.push({
|
|
126
|
+
'paymentAccepted.paymentMethodType': { $exists: true, $eq: paymentAcceptedEq }
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
const hasMerchantReturnApplicablePaymentMethodEq = (_r = (_q = params.hasMerchantReturnPolicy) === null || _q === void 0 ? void 0 : _q.applicablePaymentMethod) === null || _r === void 0 ? void 0 : _r.$eq;
|
|
130
|
+
if (typeof hasMerchantReturnApplicablePaymentMethodEq === 'string') {
|
|
131
|
+
andConditions.push({
|
|
132
|
+
'hasMerchantReturnPolicy.applicablePaymentMethod': { $exists: true, $eq: hasMerchantReturnApplicablePaymentMethodEq }
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
const hasMerchantReturnPolicyItemConditionIdEq = (_u = (_t = (_s = params.hasMerchantReturnPolicy) === null || _s === void 0 ? void 0 : _s.itemCondition) === null || _t === void 0 ? void 0 : _t.id) === null || _u === void 0 ? void 0 : _u.$eq;
|
|
124
136
|
if (typeof hasMerchantReturnPolicyItemConditionIdEq === 'string') {
|
|
125
137
|
andConditions.push({
|
|
126
138
|
'hasMerchantReturnPolicy.itemCondition.id': {
|
|
@@ -7,7 +7,7 @@ exports.createStartParams = void 0;
|
|
|
7
7
|
const factory = require("../../../factory");
|
|
8
8
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
9
9
|
function createStartParams(params) {
|
|
10
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
10
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
11
11
|
const paymentServiceId = (params.paymentService !== undefined)
|
|
12
12
|
? String(params.paymentService.id)
|
|
13
13
|
: '';
|
|
@@ -36,15 +36,14 @@ function createStartParams(params) {
|
|
|
36
36
|
};
|
|
37
37
|
break;
|
|
38
38
|
case factory.service.paymentService.PaymentServiceType.MovieTicket:
|
|
39
|
+
const specifiedMovieTickets = (_c = params.object.paymentMethod) === null || _c === void 0 ? void 0 : _c.movieTickets;
|
|
39
40
|
totalPaymentDue = {
|
|
40
41
|
typeOf: 'MonetaryAmount',
|
|
41
42
|
currency: factory.unitCode.C62,
|
|
42
|
-
value: (Array.isArray(
|
|
43
|
-
? (_d = params.object.paymentMethod) === null || _d === void 0 ? void 0 : _d.movieTickets.length
|
|
44
|
-
: 0
|
|
43
|
+
value: (Array.isArray(specifiedMovieTickets)) ? specifiedMovieTickets.length : 0
|
|
45
44
|
};
|
|
46
45
|
// MovieTicketIFの決済取引において最大同時着券数を設定可能にする(2023-03-27~)
|
|
47
|
-
const totalPaymentDueMaxValue = (
|
|
46
|
+
const totalPaymentDueMaxValue = (_f = (_e = (_d = params.paymentService) === null || _d === void 0 ? void 0 : _d.availableChannel) === null || _e === void 0 ? void 0 : _e.totalPaymentDue) === null || _f === void 0 ? void 0 : _f.maxValue;
|
|
48
47
|
const totalPaymentDueValue = totalPaymentDue.value;
|
|
49
48
|
if (typeof totalPaymentDueValue === 'number' && typeof totalPaymentDueMaxValue === 'number') {
|
|
50
49
|
if (totalPaymentDueValue > totalPaymentDueMaxValue) {
|
|
@@ -56,30 +55,35 @@ function createStartParams(params) {
|
|
|
56
55
|
// no op
|
|
57
56
|
}
|
|
58
57
|
const informPaymentParams = createInformPaymentParams({ paymentService: params.paymentService });
|
|
59
|
-
const accountId = (
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
58
|
+
const accountId = (_g = params.object.paymentMethod) === null || _g === void 0 ? void 0 : _g.accountId;
|
|
59
|
+
const creditCardAsPaymentServiceOutputCurrency = (_k = (_j = (_h = params.paymentService) === null || _h === void 0 ? void 0 : _h.serviceOutput) === null || _j === void 0 ? void 0 : _j.amount) === null || _k === void 0 ? void 0 : _k.currency;
|
|
60
|
+
const paymentMethod = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ additionalProperty: (Array.isArray((_l = params.object.paymentMethod) === null || _l === void 0 ? void 0 : _l.additionalProperty))
|
|
61
|
+
? (_m = params.object.paymentMethod) === null || _m === void 0 ? void 0 : _m.additionalProperty
|
|
62
|
+
: [], name: (typeof ((_o = params.object.paymentMethod) === null || _o === void 0 ? void 0 : _o.name) === 'string')
|
|
63
|
+
? params.object.paymentMethod.name
|
|
64
|
+
: paymentMethodType, amount: params.amount, paymentMethodId: params.transactionNumber, typeOf: paymentMethodType }, (typeof ((_p = params.object.paymentMethod) === null || _p === void 0 ? void 0 : _p.description) === 'string')
|
|
65
|
+
? { description: (_q = params.object.paymentMethod) === null || _q === void 0 ? void 0 : _q.description }
|
|
66
|
+
: undefined), (totalPaymentDue !== undefined)
|
|
67
|
+
? { totalPaymentDue: totalPaymentDue }
|
|
68
|
+
: undefined), (typeof accountId === 'string') ? { accountId: accountId } : undefined), (typeof ((_r = params.object.paymentMethod) === null || _r === void 0 ? void 0 : _r.method) === 'string')
|
|
69
|
+
? { method: (_s = params.object.paymentMethod) === null || _s === void 0 ? void 0 : _s.method }
|
|
70
|
+
: undefined), (((_t = params.object.paymentMethod) === null || _t === void 0 ? void 0 : _t.creditCard) !== undefined)
|
|
71
|
+
? { creditCard: (_u = params.object.paymentMethod) === null || _u === void 0 ? void 0 : _u.creditCard }
|
|
72
|
+
: undefined), (Array.isArray((_v = params.object.paymentMethod) === null || _v === void 0 ? void 0 : _v.movieTickets))
|
|
73
|
+
? { movieTickets: (_w = params.object.paymentMethod) === null || _w === void 0 ? void 0 : _w.movieTickets }
|
|
74
|
+
: undefined);
|
|
75
|
+
const serviceOutput = (typeof creditCardAsPaymentServiceOutputCurrency === 'string')
|
|
76
|
+
? {
|
|
77
|
+
amount: {
|
|
78
|
+
currency: creditCardAsPaymentServiceOutputCurrency,
|
|
79
|
+
value: paymentMethod.amount // 通貨区分としての金額
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
: undefined;
|
|
83
|
+
const object = Object.assign({
|
|
84
|
+
// パラメータから必要なもののみ取り込む
|
|
85
|
+
accountId: (typeof accountId === 'string') ? accountId : '', paymentMethodId: params.transactionNumber, typeOf: params.paymentServiceType, id: paymentServiceId, onPaymentStatusChanged: { informPayment: informPaymentParams }, paymentMethod }, (typeof serviceOutput !== undefined) ? { serviceOutput } : undefined);
|
|
86
|
+
return Object.assign({ project: { typeOf: factory.organizationType.Project, id: params.project.id }, transactionNumber: params.transactionNumber, typeOf: factory.assetTransactionType.Pay, agent: params.agent, recipient: params.recipient, object, expires: params.expires }, (typeof ((_x = params.location) === null || _x === void 0 ? void 0 : _x.typeOf) === 'string')
|
|
83
87
|
? { location: params.location }
|
|
84
88
|
: undefined);
|
|
85
89
|
}
|
|
@@ -9,17 +9,6 @@ function createPayActions(params) {
|
|
|
9
9
|
const payObject = createPayObject(params);
|
|
10
10
|
const informPaymentActions = createInformPaymentActions(params);
|
|
11
11
|
if (payObject !== undefined) {
|
|
12
|
-
// const maskedCustomer = createMaskedCustomer(params.order);
|
|
13
|
-
// const simpleOrder: factory.order.ISimpleOrder = {
|
|
14
|
-
// typeOf: params.order.typeOf,
|
|
15
|
-
// seller: params.order.seller,
|
|
16
|
-
// // mask
|
|
17
|
-
// customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id, name: maskedCustomer.name },
|
|
18
|
-
// orderNumber: params.order.orderNumber,
|
|
19
|
-
// price: params.order.price,
|
|
20
|
-
// priceCurrency: params.order.priceCurrency,
|
|
21
|
-
// orderDate: params.order.orderDate
|
|
22
|
-
// };
|
|
23
12
|
const payPurpose = {
|
|
24
13
|
typeOf: params.order.typeOf,
|
|
25
14
|
confirmationNumber: params.order.confirmationNumber,
|
|
@@ -28,10 +17,7 @@ function createPayActions(params) {
|
|
|
28
17
|
const payAction = Object.assign({ project: params.transaction.project, typeOf: factory.actionType.PayAction, object: [payObject], agent: params.transaction.project, potentialActions: {
|
|
29
18
|
add2report: true,
|
|
30
19
|
informPayment: informPaymentActions
|
|
31
|
-
},
|
|
32
|
-
// optimize(2023-03-20~)
|
|
33
|
-
// purpose: simpleOrder,
|
|
34
|
-
purpose: payPurpose, recipient: {
|
|
20
|
+
}, purpose: payPurpose, recipient: {
|
|
35
21
|
id: params.transaction.recipient.id,
|
|
36
22
|
name: params.transaction.recipient.name,
|
|
37
23
|
typeOf: params.transaction.recipient.typeOf
|
|
@@ -42,8 +28,9 @@ function createPayActions(params) {
|
|
|
42
28
|
}
|
|
43
29
|
return payActions;
|
|
44
30
|
}
|
|
31
|
+
// tslint:disable-next-line:cyclomatic-complexity
|
|
45
32
|
function createPayObject(params) {
|
|
46
|
-
var _a
|
|
33
|
+
var _a;
|
|
47
34
|
const transaction = params.transaction;
|
|
48
35
|
const paymentMethod = transaction.object.paymentMethod;
|
|
49
36
|
const paymentMethodType = String(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.typeOf);
|
|
@@ -81,15 +68,11 @@ function createPayObject(params) {
|
|
|
81
68
|
};
|
|
82
69
|
break;
|
|
83
70
|
case factory.service.paymentService.PaymentServiceType.CreditCard:
|
|
84
|
-
payObject = {
|
|
85
|
-
typeOf: transaction.object.typeOf,
|
|
86
|
-
id: (typeof transaction.object.id === 'string') ? transaction.object.id : '',
|
|
87
|
-
paymentMethod: Object.assign({ additionalProperty: (Array.isArray(additionalProperty)) ? additionalProperty : [], name: paymentMethodName, paymentMethodId: paymentMethodId, totalPaymentDue: {
|
|
71
|
+
payObject = Object.assign({ typeOf: transaction.object.typeOf, id: (typeof transaction.object.id === 'string') ? transaction.object.id : '', paymentMethod: Object.assign({ additionalProperty: (Array.isArray(additionalProperty)) ? additionalProperty : [], name: paymentMethodName, paymentMethodId: paymentMethodId, totalPaymentDue: {
|
|
88
72
|
typeOf: 'MonetaryAmount',
|
|
89
73
|
currency: factory.priceCurrency.JPY,
|
|
90
74
|
value: Number(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.amount)
|
|
91
|
-
}, typeOf: paymentMethodType }, (typeof (paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.accountId) === 'string') ? { accountId: paymentMethod.accountId } : undefined)
|
|
92
|
-
};
|
|
75
|
+
}, typeOf: paymentMethodType }, (typeof (paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.accountId) === 'string') ? { accountId: paymentMethod.accountId } : undefined) }, (paymentServiceOutput !== undefined) ? { serviceOutput: paymentServiceOutput } : undefined);
|
|
93
76
|
break;
|
|
94
77
|
case factory.service.paymentService.PaymentServiceType.MovieTicket:
|
|
95
78
|
payObject = Object.assign({ typeOf: transaction.object.typeOf, id: (typeof transaction.object.id === 'string') ? transaction.object.id : '', paymentMethod: {
|
|
@@ -100,7 +83,7 @@ function createPayObject(params) {
|
|
|
100
83
|
totalPaymentDue: {
|
|
101
84
|
typeOf: 'MonetaryAmount',
|
|
102
85
|
currency: factory.unitCode.C62,
|
|
103
|
-
value: (
|
|
86
|
+
value: (Array.isArray(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.movieTickets)) ? paymentMethod.movieTickets.length : 0
|
|
104
87
|
},
|
|
105
88
|
typeOf: paymentMethodType
|
|
106
89
|
}, movieTickets: paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.movieTickets }, (Array.isArray(paymentServiceOutput)) ? { serviceOutput: paymentServiceOutput } : undefined);
|
|
@@ -111,6 +94,7 @@ function createPayObject(params) {
|
|
|
111
94
|
return payObject;
|
|
112
95
|
}
|
|
113
96
|
function createPayObjectServiceOutput(params) {
|
|
97
|
+
var _a, _b;
|
|
114
98
|
const transaction = params.transaction;
|
|
115
99
|
const paymentMethod = transaction.object.paymentMethod;
|
|
116
100
|
const order = params.order;
|
|
@@ -118,7 +102,20 @@ function createPayObjectServiceOutput(params) {
|
|
|
118
102
|
switch (transaction.object.typeOf) {
|
|
119
103
|
case factory.service.paymentService.PaymentServiceType.FaceToFace:
|
|
120
104
|
case factory.service.paymentService.PaymentServiceType.PaymentCard:
|
|
105
|
+
break;
|
|
121
106
|
case factory.service.paymentService.PaymentServiceType.CreditCard:
|
|
107
|
+
// CreditCardIFのカード通貨区分を追加(2023-08-07~)
|
|
108
|
+
const creditCardAsPaymentServiceOutput = (typeof ((_b = (_a = transaction.object.serviceOutput) === null || _a === void 0 ? void 0 : _a.amount) === null || _b === void 0 ? void 0 : _b.currency) === 'string')
|
|
109
|
+
? {
|
|
110
|
+
amount: {
|
|
111
|
+
currency: transaction.object.serviceOutput.amount.currency,
|
|
112
|
+
value: transaction.object.paymentMethod.amount
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
: undefined;
|
|
116
|
+
if (creditCardAsPaymentServiceOutput !== undefined) {
|
|
117
|
+
paymentServiceOutput = creditCardAsPaymentServiceOutput;
|
|
118
|
+
}
|
|
122
119
|
break;
|
|
123
120
|
case factory.service.paymentService.PaymentServiceType.MovieTicket:
|
|
124
121
|
const paymentMethodType = paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.typeOf;
|
|
@@ -129,9 +126,7 @@ function createPayObjectServiceOutput(params) {
|
|
|
129
126
|
const amount = movieTicket2amount(transaction, movieTicket);
|
|
130
127
|
const reservation4invoice = movieTicket2reservation4invoice(movieTicket, order, String(paymentMethodType));
|
|
131
128
|
return Object.assign(Object.assign({ identifier: movieTicket.identifier }, (typeof (amount === null || amount === void 0 ? void 0 : amount.value) === 'number') ? { amount } : undefined), (typeof ((_a = reservation4invoice.priceSpecification) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
|
|
132
|
-
? {
|
|
133
|
-
serviceOutput: reservation4invoice
|
|
134
|
-
}
|
|
129
|
+
? { serviceOutput: reservation4invoice }
|
|
135
130
|
: undefined);
|
|
136
131
|
});
|
|
137
132
|
}
|
|
@@ -243,9 +243,6 @@ function processAuthorizeAccount(params, transaction, paymentServiceId) {
|
|
|
243
243
|
typeOf: 'MonetaryAmount',
|
|
244
244
|
currency,
|
|
245
245
|
value: amount
|
|
246
|
-
// value: (typeof pendingTransaction.object.amount === 'number')
|
|
247
|
-
// ? pendingTransaction.object.amount
|
|
248
|
-
// : pendingTransaction.object.amount.value
|
|
249
246
|
};
|
|
250
247
|
const savingPendingTransaction = {
|
|
251
248
|
typeOf: pendingTransaction.typeOf,
|