@chevre/domain 20.4.0-alpha.1 → 20.4.0-alpha.11
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 +10 -10
- package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +96 -0
- package/example/src/chevre/searchEventTicketOffers.ts +1 -2
- package/example/src/chevre/unsetUnnecessaryFields.ts +32 -0
- package/lib/chevre/repo/account.d.ts +4 -10
- package/lib/chevre/repo/account.js +72 -60
- package/lib/chevre/repo/accountTransaction.d.ts +0 -1
- package/lib/chevre/repo/accountTransaction.js +1 -1
- package/lib/chevre/repo/assetTransaction.d.ts +1 -0
- package/lib/chevre/repo/assetTransaction.js +5 -0
- package/lib/chevre/repo/event.js +7 -1
- package/lib/chevre/repo/mongoose/model/comments.d.ts +1 -1
- package/lib/chevre/repo/mongoose/model/comments.js +1 -1
- package/lib/chevre/repo/offer.d.ts +1 -0
- package/lib/chevre/repo/offer.js +34 -35
- package/lib/chevre/repo/serviceOutput.d.ts +4 -0
- package/lib/chevre/repo/serviceOutput.js +6 -0
- package/lib/chevre/repository.d.ts +6 -3
- package/lib/chevre/repository.js +8 -5
- package/lib/chevre/service/account.d.ts +0 -8
- package/lib/chevre/service/account.js +16 -37
- package/lib/chevre/service/accountTransaction/deposit.js +2 -5
- package/lib/chevre/service/accountTransaction/factory.js +36 -40
- package/lib/chevre/service/accountTransaction/transfer.js +4 -6
- package/lib/chevre/service/accountTransaction/withdraw.js +2 -5
- package/lib/chevre/service/accountTransaction.js +1 -1
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +19 -11
- package/lib/chevre/service/assetTransaction/pay.js +17 -11
- package/lib/chevre/service/assetTransaction/registerService/factory.js +9 -4
- package/lib/chevre/service/delivery.js +12 -3
- package/lib/chevre/service/event.js +3 -23
- package/lib/chevre/service/moneyTransfer.d.ts +1 -1
- package/lib/chevre/service/moneyTransfer.js +8 -9
- package/lib/chevre/service/offer/event/authorize.js +0 -1
- package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +2 -4
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +35 -39
- package/lib/chevre/service/offer/moneyTransfer/authorize.js +0 -1
- package/lib/chevre/service/offer/moneyTransfer/returnMoneyTransfer.js +0 -1
- package/lib/chevre/service/payment/paymentCard.d.ts +6 -2
- package/lib/chevre/service/payment/paymentCard.js +16 -8
- package/lib/chevre/service/permit.d.ts +5 -1
- package/lib/chevre/service/permit.js +18 -11
- package/lib/chevre/service/transaction/moneyTransfer.js +0 -1
- package/lib/chevre/settings.d.ts +1 -0
- package/lib/chevre/settings.js +2 -2
- package/package.json +3 -3
- package/example/src/chevre/migrateAccountTitleAdditionalProperties.ts +0 -157
- package/example/src/chevre/migrateProjectSubscription.ts +0 -51
- package/example/src/chevre/migrateSection.ts +0 -105
- package/lib/chevre/repo/accountAction.d.ts +0 -42
- package/lib/chevre/repo/accountAction.js +0 -474
- package/lib/chevre/repo/mongoose/model/accountAction.d.ts +0 -7
- package/lib/chevre/repo/mongoose/model/accountAction.js +0 -177
package/lib/chevre/repo/offer.js
CHANGED
|
@@ -35,7 +35,7 @@ class MongoRepository {
|
|
|
35
35
|
}
|
|
36
36
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
37
37
|
static CREATE_OFFER_MONGO_CONDITIONS(params) {
|
|
38
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24;
|
|
38
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28;
|
|
39
39
|
// MongoDB検索条件
|
|
40
40
|
const andConditions = [];
|
|
41
41
|
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
@@ -184,8 +184,16 @@ class MongoRepository {
|
|
|
184
184
|
}
|
|
185
185
|
});
|
|
186
186
|
}
|
|
187
|
+
const appliesToMovieTicketServiceOutputTypeOfNin = (_4 = (_3 = (_2 = (_1 = params.priceSpecification) === null || _1 === void 0 ? void 0 : _1.appliesToMovieTicket) === null || _2 === void 0 ? void 0 : _2.serviceOutput) === null || _3 === void 0 ? void 0 : _3.typeOf) === null || _4 === void 0 ? void 0 : _4.$nin;
|
|
188
|
+
if (Array.isArray(appliesToMovieTicketServiceOutputTypeOfNin)) {
|
|
189
|
+
andConditions.push({
|
|
190
|
+
'priceSpecification.appliesToMovieTicket.serviceOutput.typeOf': {
|
|
191
|
+
$nin: appliesToMovieTicketServiceOutputTypeOfNin
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
}
|
|
187
195
|
if (params.priceSpecification !== undefined && params.priceSpecification !== null) {
|
|
188
|
-
const priceSpecificationPriceGte = (
|
|
196
|
+
const priceSpecificationPriceGte = (_5 = params.priceSpecification.price) === null || _5 === void 0 ? void 0 : _5.$gte;
|
|
189
197
|
if (typeof priceSpecificationPriceGte === 'number') {
|
|
190
198
|
andConditions.push({
|
|
191
199
|
'priceSpecification.price': {
|
|
@@ -194,7 +202,7 @@ class MongoRepository {
|
|
|
194
202
|
}
|
|
195
203
|
});
|
|
196
204
|
}
|
|
197
|
-
const priceSpecificationPriceLte = (
|
|
205
|
+
const priceSpecificationPriceLte = (_6 = params.priceSpecification.price) === null || _6 === void 0 ? void 0 : _6.$lte;
|
|
198
206
|
if (typeof priceSpecificationPriceLte === 'number') {
|
|
199
207
|
andConditions.push({
|
|
200
208
|
'priceSpecification.price': {
|
|
@@ -203,7 +211,7 @@ class MongoRepository {
|
|
|
203
211
|
}
|
|
204
212
|
});
|
|
205
213
|
}
|
|
206
|
-
const accountsReceivableGte = (
|
|
214
|
+
const accountsReceivableGte = (_8 = (_7 = params.priceSpecification.accounting) === null || _7 === void 0 ? void 0 : _7.accountsReceivable) === null || _8 === void 0 ? void 0 : _8.$gte;
|
|
207
215
|
if (typeof accountsReceivableGte === 'number') {
|
|
208
216
|
andConditions.push({
|
|
209
217
|
'priceSpecification.accounting.accountsReceivable': {
|
|
@@ -212,7 +220,7 @@ class MongoRepository {
|
|
|
212
220
|
}
|
|
213
221
|
});
|
|
214
222
|
}
|
|
215
|
-
const accountsReceivableLte = (
|
|
223
|
+
const accountsReceivableLte = (_10 = (_9 = params.priceSpecification.accounting) === null || _9 === void 0 ? void 0 : _9.accountsReceivable) === null || _10 === void 0 ? void 0 : _10.$lte;
|
|
216
224
|
if (typeof accountsReceivableLte === 'number') {
|
|
217
225
|
andConditions.push({
|
|
218
226
|
'priceSpecification.accounting.accountsReceivable': {
|
|
@@ -221,7 +229,7 @@ class MongoRepository {
|
|
|
221
229
|
}
|
|
222
230
|
});
|
|
223
231
|
}
|
|
224
|
-
const accountingCodeValueEq = (
|
|
232
|
+
const accountingCodeValueEq = (_13 = (_12 = (_11 = params.priceSpecification.accounting) === null || _11 === void 0 ? void 0 : _11.operatingRevenue) === null || _12 === void 0 ? void 0 : _12.codeValue) === null || _13 === void 0 ? void 0 : _13.$eq;
|
|
225
233
|
if (typeof accountingCodeValueEq === 'string') {
|
|
226
234
|
andConditions.push({
|
|
227
235
|
'priceSpecification.accounting.operatingRevenue.codeValue': {
|
|
@@ -230,7 +238,7 @@ class MongoRepository {
|
|
|
230
238
|
}
|
|
231
239
|
});
|
|
232
240
|
}
|
|
233
|
-
const accountingCodeValueIn = (
|
|
241
|
+
const accountingCodeValueIn = (_16 = (_15 = (_14 = params.priceSpecification.accounting) === null || _14 === void 0 ? void 0 : _14.operatingRevenue) === null || _15 === void 0 ? void 0 : _15.codeValue) === null || _16 === void 0 ? void 0 : _16.$in;
|
|
234
242
|
if (Array.isArray(accountingCodeValueIn)) {
|
|
235
243
|
andConditions.push({
|
|
236
244
|
'priceSpecification.accounting.operatingRevenue.codeValue': {
|
|
@@ -239,7 +247,7 @@ class MongoRepository {
|
|
|
239
247
|
}
|
|
240
248
|
});
|
|
241
249
|
}
|
|
242
|
-
const referenceQuantityValueEq = (
|
|
250
|
+
const referenceQuantityValueEq = (_18 = (_17 = params.priceSpecification.referenceQuantity) === null || _17 === void 0 ? void 0 : _17.value) === null || _18 === void 0 ? void 0 : _18.$eq;
|
|
243
251
|
if (typeof referenceQuantityValueEq === 'number') {
|
|
244
252
|
andConditions.push({
|
|
245
253
|
'priceSpecification.referenceQuantity.value': {
|
|
@@ -249,7 +257,7 @@ class MongoRepository {
|
|
|
249
257
|
});
|
|
250
258
|
}
|
|
251
259
|
}
|
|
252
|
-
const availableAtOrFromIdEq = (
|
|
260
|
+
const availableAtOrFromIdEq = (_20 = (_19 = params.availableAtOrFrom) === null || _19 === void 0 ? void 0 : _19.id) === null || _20 === void 0 ? void 0 : _20.$eq;
|
|
253
261
|
if (typeof availableAtOrFromIdEq === 'string') {
|
|
254
262
|
andConditions.push({
|
|
255
263
|
'availableAtOrFrom.id': {
|
|
@@ -258,7 +266,7 @@ class MongoRepository {
|
|
|
258
266
|
}
|
|
259
267
|
});
|
|
260
268
|
}
|
|
261
|
-
const availableAtOrFromIdIn = (
|
|
269
|
+
const availableAtOrFromIdIn = (_22 = (_21 = params.availableAtOrFrom) === null || _21 === void 0 ? void 0 : _21.id) === null || _22 === void 0 ? void 0 : _22.$in;
|
|
262
270
|
if (Array.isArray(availableAtOrFromIdIn)) {
|
|
263
271
|
andConditions.push({
|
|
264
272
|
'availableAtOrFrom.id': {
|
|
@@ -267,7 +275,7 @@ class MongoRepository {
|
|
|
267
275
|
}
|
|
268
276
|
});
|
|
269
277
|
}
|
|
270
|
-
const addOnItemOfferedIdEq = (
|
|
278
|
+
const addOnItemOfferedIdEq = (_25 = (_24 = (_23 = params.addOn) === null || _23 === void 0 ? void 0 : _23.itemOffered) === null || _24 === void 0 ? void 0 : _24.id) === null || _25 === void 0 ? void 0 : _25.$eq;
|
|
271
279
|
if (typeof addOnItemOfferedIdEq === 'string') {
|
|
272
280
|
andConditions.push({
|
|
273
281
|
'addOn.itemOffered.id': {
|
|
@@ -276,7 +284,7 @@ class MongoRepository {
|
|
|
276
284
|
}
|
|
277
285
|
});
|
|
278
286
|
}
|
|
279
|
-
const hasMerchantReturnPolicyIdEq = (
|
|
287
|
+
const hasMerchantReturnPolicyIdEq = (_27 = (_26 = params.hasMerchantReturnPolicy) === null || _26 === void 0 ? void 0 : _26.id) === null || _27 === void 0 ? void 0 : _27.$eq;
|
|
280
288
|
if (typeof hasMerchantReturnPolicyIdEq === 'string') {
|
|
281
289
|
andConditions.push({
|
|
282
290
|
'hasMerchantReturnPolicy.id': {
|
|
@@ -285,7 +293,7 @@ class MongoRepository {
|
|
|
285
293
|
}
|
|
286
294
|
});
|
|
287
295
|
}
|
|
288
|
-
const additionalPropertyElemMatch = (
|
|
296
|
+
const additionalPropertyElemMatch = (_28 = params.additionalProperty) === null || _28 === void 0 ? void 0 : _28.$elemMatch;
|
|
289
297
|
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
290
298
|
andConditions.push({
|
|
291
299
|
additionalProperty: {
|
|
@@ -324,31 +332,22 @@ class MongoRepository {
|
|
|
324
332
|
const sortedOfferIds = (Array.isArray(itemListElements))
|
|
325
333
|
? itemListElements.map((element) => element.id)
|
|
326
334
|
: [];
|
|
327
|
-
// const offerCatalog = await this.offerCatalogModel.findById(
|
|
328
|
-
// params.offerCatalog.id,
|
|
329
|
-
// {
|
|
330
|
-
// itemListElement: 1
|
|
331
|
-
// }
|
|
332
|
-
// )
|
|
333
|
-
// .exec()
|
|
334
|
-
// .then((doc) => {
|
|
335
|
-
// if (doc === null) {
|
|
336
|
-
// throw new factory.errors.NotFound(this.offerCatalogModel.modelName);
|
|
337
|
-
// }
|
|
338
|
-
// return <Pick<factory.offerCatalog.IOfferCatalog, 'itemListElement'>>doc.toObject();
|
|
339
|
-
// });
|
|
340
|
-
// let sortedOfferIds: string[] = (Array.isArray(offerCatalog.itemListElement))
|
|
341
|
-
// ? offerCatalog.itemListElement.map((element) => element.id)
|
|
342
|
-
// : [];
|
|
343
|
-
// const filteredIds = params.ids;
|
|
344
|
-
// if (Array.isArray(filteredIds)) {
|
|
345
|
-
// sortedOfferIds = sortedOfferIds.filter((id) => filteredIds.includes(id));
|
|
346
|
-
// }
|
|
347
335
|
let offers = [];
|
|
348
336
|
if (sortedOfferIds.length > 0) {
|
|
349
|
-
|
|
337
|
+
const searchOffersConditions = Object.assign(Object.assign({ id: { $in: sortedOfferIds } }, (typeof ((_a = params.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
350
338
|
? { availableAtOrFrom: { id: { $eq: params.availableAtOrFrom.id } } }
|
|
351
|
-
: undefined))
|
|
339
|
+
: undefined), (Array.isArray(params.unacceptedPaymentMethod) && params.unacceptedPaymentMethod.length > 0)
|
|
340
|
+
? {
|
|
341
|
+
priceSpecification: {
|
|
342
|
+
appliesToMovieTicket: {
|
|
343
|
+
serviceOutput: {
|
|
344
|
+
typeOf: { $nin: params.unacceptedPaymentMethod }
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
: undefined);
|
|
350
|
+
offers = yield this.search(searchOffersConditions);
|
|
352
351
|
if (params.sort) {
|
|
353
352
|
// sorting
|
|
354
353
|
offers = offers.sort((a, b) => sortedOfferIds.indexOf(String(a.id)) - sortedOfferIds.indexOf(String(b.id)));
|
|
@@ -169,5 +169,11 @@ class MongoRepository {
|
|
|
169
169
|
.exec();
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
|
+
unsetUnnecessaryFields(params) {
|
|
173
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
174
|
+
return this.serviceOutputModel.updateMany(params.filter, { $unset: params.$unset })
|
|
175
|
+
.exec();
|
|
176
|
+
});
|
|
177
|
+
}
|
|
172
178
|
}
|
|
173
179
|
exports.MongoRepository = MongoRepository;
|
|
@@ -11,6 +11,7 @@ import { MongoRepository as AggregationRepo } from './repo/aggregation';
|
|
|
11
11
|
import { MongoRepository as AssetTransactionRepo } from './repo/assetTransaction';
|
|
12
12
|
import { MongoRepository as CategoryCodeRepo } from './repo/categoryCode';
|
|
13
13
|
import { MongoRepository as CodeRepo } from './repo/code';
|
|
14
|
+
import { MongoRepository as CommentRepo } from './repo/comment';
|
|
14
15
|
import { MongoRepository as CreativeWorkRepo } from './repo/creativeWork';
|
|
15
16
|
import { MongoRepository as CustomerRepo } from './repo/customer';
|
|
16
17
|
import { MongoRepository as EmailMessageRepo } from './repo/emailMessage';
|
|
@@ -48,9 +49,6 @@ import { CognitoRepository as PersonRepo } from './repo/person';
|
|
|
48
49
|
*/
|
|
49
50
|
export declare class Account extends AccountRepo {
|
|
50
51
|
}
|
|
51
|
-
/**
|
|
52
|
-
* 口座アクションリポジトリ
|
|
53
|
-
*/
|
|
54
52
|
/**
|
|
55
53
|
* 経理レポートリポジトリ
|
|
56
54
|
*/
|
|
@@ -85,6 +83,11 @@ export declare class CategoryCode extends CategoryCodeRepo {
|
|
|
85
83
|
*/
|
|
86
84
|
export declare class Code extends CodeRepo {
|
|
87
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* コメントリポジトリ
|
|
88
|
+
*/
|
|
89
|
+
export declare class Comment extends CommentRepo {
|
|
90
|
+
}
|
|
88
91
|
/**
|
|
89
92
|
* 確認番号リポジトリ
|
|
90
93
|
*/
|
package/lib/chevre/repository.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.rateLimit = exports.itemAvailability = exports.Trip = exports.TransactionNumber = exports.Transaction = exports.Telemetry = exports.Task = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.Seller = exports.Role = exports.Reservation = exports.Project = exports.Product = exports.PriceSpecification = exports.Place = exports.Permit = exports.Person = exports.paymentMethod = exports.OwnershipInfo = exports.OrderNumber = exports.Order = exports.OfferCatalog = exports.Offer = exports.MerchantReturnPolicy = exports.Member = exports.Event = exports.EmailMessage = exports.Customer = exports.CreativeWork = exports.ConfirmationNumber = exports.Code = exports.CategoryCode = exports.AssetTransaction = exports.action = exports.Aggregation = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = void 0;
|
|
3
|
+
exports.rateLimit = exports.itemAvailability = exports.Trip = exports.TransactionNumber = exports.Transaction = exports.Telemetry = exports.Task = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.Seller = exports.Role = exports.Reservation = exports.Project = exports.Product = exports.PriceSpecification = exports.Place = exports.Permit = exports.Person = exports.paymentMethod = exports.OwnershipInfo = exports.OrderNumber = exports.Order = exports.OfferCatalog = exports.Offer = exports.MerchantReturnPolicy = exports.Member = exports.Event = exports.EmailMessage = exports.Customer = exports.CreativeWork = exports.ConfirmationNumber = exports.Comment = exports.Code = exports.CategoryCode = exports.AssetTransaction = exports.action = exports.Aggregation = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = void 0;
|
|
4
4
|
// tslint:disable:max-classes-per-file completed-docs
|
|
5
5
|
/**
|
|
6
6
|
* リポジトリ
|
|
@@ -15,6 +15,7 @@ const aggregation_1 = require("./repo/aggregation");
|
|
|
15
15
|
const assetTransaction_1 = require("./repo/assetTransaction");
|
|
16
16
|
const categoryCode_1 = require("./repo/categoryCode");
|
|
17
17
|
const code_1 = require("./repo/code");
|
|
18
|
+
const comment_1 = require("./repo/comment");
|
|
18
19
|
const creativeWork_1 = require("./repo/creativeWork");
|
|
19
20
|
const customer_1 = require("./repo/customer");
|
|
20
21
|
const emailMessage_1 = require("./repo/emailMessage");
|
|
@@ -53,10 +54,6 @@ const person_1 = require("./repo/person");
|
|
|
53
54
|
class Account extends account_1.MongoRepository {
|
|
54
55
|
}
|
|
55
56
|
exports.Account = Account;
|
|
56
|
-
/**
|
|
57
|
-
* 口座アクションリポジトリ
|
|
58
|
-
*/
|
|
59
|
-
// export class AccountAction extends AccountActionRepo { }
|
|
60
57
|
/**
|
|
61
58
|
* 経理レポートリポジトリ
|
|
62
59
|
*/
|
|
@@ -102,6 +99,12 @@ exports.CategoryCode = CategoryCode;
|
|
|
102
99
|
class Code extends code_1.MongoRepository {
|
|
103
100
|
}
|
|
104
101
|
exports.Code = Code;
|
|
102
|
+
/**
|
|
103
|
+
* コメントリポジトリ
|
|
104
|
+
*/
|
|
105
|
+
class Comment extends comment_1.MongoRepository {
|
|
106
|
+
}
|
|
107
|
+
exports.Comment = Comment;
|
|
105
108
|
/**
|
|
106
109
|
* 確認番号リポジトリ
|
|
107
110
|
*/
|
|
@@ -37,14 +37,6 @@ export declare function open(params: {
|
|
|
37
37
|
/**
|
|
38
38
|
* 口座を解約する
|
|
39
39
|
*/
|
|
40
|
-
export declare function close(params: {
|
|
41
|
-
/**
|
|
42
|
-
* 口座番号
|
|
43
|
-
*/
|
|
44
|
-
accountNumber: string;
|
|
45
|
-
}): (repos: {
|
|
46
|
-
account: AccountRepo;
|
|
47
|
-
}) => Promise<void>;
|
|
48
40
|
/**
|
|
49
41
|
* 転送する
|
|
50
42
|
* 確定取引結果から、実際の転送アクションを実行します。
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.cancelMoneyTransfer = exports.transferMoney = exports.
|
|
12
|
+
exports.cancelMoneyTransfer = exports.transferMoney = exports.open = void 0;
|
|
13
13
|
/**
|
|
14
14
|
* 口座サービス
|
|
15
15
|
* 開設、閉鎖等、口座アクション実行など
|
|
@@ -38,27 +38,27 @@ exports.open = open;
|
|
|
38
38
|
/**
|
|
39
39
|
* 口座を解約する
|
|
40
40
|
*/
|
|
41
|
-
function close(params
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
// export function close(params: {
|
|
42
|
+
// /**
|
|
43
|
+
// * 口座番号
|
|
44
|
+
// */
|
|
45
|
+
// accountNumber: string;
|
|
46
|
+
// }) {
|
|
47
|
+
// return async (repos: {
|
|
48
|
+
// account: AccountRepo;
|
|
49
|
+
// }) => {
|
|
50
|
+
// await repos.account.close({
|
|
51
|
+
// accountNumber: params.accountNumber,
|
|
52
|
+
// closeDate: new Date()
|
|
53
|
+
// });
|
|
54
|
+
// };
|
|
55
|
+
// }
|
|
50
56
|
/**
|
|
51
57
|
* 転送する
|
|
52
58
|
* 確定取引結果から、実際の転送アクションを実行します。
|
|
53
59
|
*/
|
|
54
60
|
function transferMoney(actionAttributes) {
|
|
55
61
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
// 口座取引におけるAccountAction管理を廃止(2022-11-28~)
|
|
57
|
-
// let action = await repos.accountAction.startByIdentifier<factory.actionType.MoneyTransfer>(actionAttributes);
|
|
58
|
-
// すでに完了していれば何もしない
|
|
59
|
-
// if (action.actionStatus === factory.actionStatusType.CompletedActionStatus) {
|
|
60
|
-
// return;
|
|
61
|
-
// }
|
|
62
62
|
const action = actionAttributes;
|
|
63
63
|
let fromAccountNumber;
|
|
64
64
|
let toAccountNumber;
|
|
@@ -81,18 +81,8 @@ function transferMoney(actionAttributes) {
|
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
83
|
catch (error) {
|
|
84
|
-
// actionにエラー結果を追加
|
|
85
|
-
// try {
|
|
86
|
-
// const actionError = { ...error, message: error.message, name: error.name };
|
|
87
|
-
// await repos.accountAction.giveUp(action.typeOf, action.id, actionError);
|
|
88
|
-
// } catch (__) {
|
|
89
|
-
// // 失敗したら仕方ない
|
|
90
|
-
// }
|
|
91
84
|
throw error;
|
|
92
85
|
}
|
|
93
|
-
// アクション完了
|
|
94
|
-
// const actionResult: factory.account.action.moneyTransfer.IResult = {};
|
|
95
|
-
// action = await repos.accountAction.complete(action.typeOf, action.id, actionResult);
|
|
96
86
|
});
|
|
97
87
|
}
|
|
98
88
|
exports.transferMoney = transferMoney;
|
|
@@ -133,17 +123,6 @@ function cancelMoneyTransfer(params) {
|
|
|
133
123
|
: transaction.object.amount.value,
|
|
134
124
|
transactionId: transaction.id
|
|
135
125
|
});
|
|
136
|
-
// 口座取引におけるAccountAction管理を廃止(2022-11-28~)
|
|
137
|
-
// アクション取得
|
|
138
|
-
// const actions = await repos.accountAction.searchTransferActions({
|
|
139
|
-
// purpose: {
|
|
140
|
-
// typeOf: { $eq: transaction.typeOf },
|
|
141
|
-
// id: { $eq: transaction.id }
|
|
142
|
-
// }
|
|
143
|
-
// });
|
|
144
|
-
// await Promise.all(actions.map(async (action) => {
|
|
145
|
-
// await repos.accountAction.cancel(action.typeOf, action.id);
|
|
146
|
-
// }));
|
|
147
126
|
});
|
|
148
127
|
}
|
|
149
128
|
exports.cancelMoneyTransfer = cancelMoneyTransfer;
|
|
@@ -29,7 +29,8 @@ function start(params) {
|
|
|
29
29
|
amount: params.object.amount,
|
|
30
30
|
toLocation: {
|
|
31
31
|
typeOf: account.typeOf,
|
|
32
|
-
|
|
32
|
+
// 廃止(2023-02-16~)
|
|
33
|
+
// accountType: account.accountType,
|
|
33
34
|
accountNumber: account.accountNumber,
|
|
34
35
|
name: account.name
|
|
35
36
|
},
|
|
@@ -63,10 +64,6 @@ function start(params) {
|
|
|
63
64
|
accountNumber: params.object.toLocation.accountNumber,
|
|
64
65
|
transaction: pendingTransaction
|
|
65
66
|
});
|
|
66
|
-
// 口座取引におけるAccountAction管理を廃止(2022-11-28~)
|
|
67
|
-
// アクション開始
|
|
68
|
-
// const moneyTransferActionAttributes = createMoneyTransferActionAttributes({ transaction });
|
|
69
|
-
// await repos.accountAction.startByIdentifier(moneyTransferActionAttributes);
|
|
70
67
|
// 結果返却
|
|
71
68
|
return transaction;
|
|
72
69
|
});
|
|
@@ -8,9 +8,7 @@ const factory = require("../../factory");
|
|
|
8
8
|
/**
|
|
9
9
|
* 転送アクション属性作成
|
|
10
10
|
*/
|
|
11
|
-
// tslint:disable-next-line:max-func-body-length
|
|
12
11
|
function createMoneyTransferActionAttributes(params) {
|
|
13
|
-
var _a, _b;
|
|
14
12
|
const transaction = params.transaction;
|
|
15
13
|
let fromLocation = {
|
|
16
14
|
typeOf: transaction.agent.typeOf,
|
|
@@ -22,14 +20,10 @@ function createMoneyTransferActionAttributes(params) {
|
|
|
22
20
|
};
|
|
23
21
|
switch (transaction.typeOf) {
|
|
24
22
|
case factory.account.transactionType.Deposit:
|
|
25
|
-
if (typeof ((_a = transaction.object.fromLocation) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') {
|
|
26
|
-
fromLocation = Object.assign({ typeOf: transaction.object.fromLocation.typeOf, name: transaction.agent.name }, (typeof transaction.object.fromLocation.id === 'string')
|
|
27
|
-
? { id: transaction.object.fromLocation.id }
|
|
28
|
-
: undefined);
|
|
29
|
-
}
|
|
30
23
|
toLocation = {
|
|
31
24
|
typeOf: transaction.object.toLocation.typeOf,
|
|
32
|
-
|
|
25
|
+
// 廃止(2023-02-16~)
|
|
26
|
+
// accountType: transaction.object.toLocation.accountType,
|
|
33
27
|
accountNumber: transaction.object.toLocation.accountNumber,
|
|
34
28
|
name: transaction.recipient.name
|
|
35
29
|
};
|
|
@@ -37,13 +31,15 @@ function createMoneyTransferActionAttributes(params) {
|
|
|
37
31
|
case factory.account.transactionType.Transfer:
|
|
38
32
|
fromLocation = {
|
|
39
33
|
typeOf: transaction.object.fromLocation.typeOf,
|
|
40
|
-
|
|
34
|
+
// 廃止(2023-02-16~)
|
|
35
|
+
// accountType: transaction.object.fromLocation.accountType,
|
|
41
36
|
accountNumber: transaction.object.fromLocation.accountNumber,
|
|
42
37
|
name: transaction.agent.name
|
|
43
38
|
};
|
|
44
39
|
toLocation = {
|
|
45
40
|
typeOf: transaction.object.toLocation.typeOf,
|
|
46
|
-
|
|
41
|
+
// 廃止(2023-02-16~)
|
|
42
|
+
// accountType: transaction.object.toLocation.accountType,
|
|
47
43
|
accountNumber: transaction.object.toLocation.accountNumber,
|
|
48
44
|
name: transaction.recipient.name
|
|
49
45
|
};
|
|
@@ -51,56 +47,56 @@ function createMoneyTransferActionAttributes(params) {
|
|
|
51
47
|
case factory.account.transactionType.Withdraw:
|
|
52
48
|
fromLocation = {
|
|
53
49
|
typeOf: transaction.object.fromLocation.typeOf,
|
|
54
|
-
|
|
50
|
+
// 廃止(2023-02-16~)
|
|
51
|
+
// accountType: transaction.object.fromLocation.accountType,
|
|
55
52
|
accountNumber: transaction.object.fromLocation.accountNumber,
|
|
56
53
|
name: transaction.agent.name
|
|
57
54
|
};
|
|
58
|
-
if (typeof ((_b = transaction.object.toLocation) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string') {
|
|
59
|
-
toLocation = Object.assign({ typeOf: transaction.object.toLocation.typeOf, name: transaction.recipient.name }, (typeof transaction.object.toLocation.id === 'string')
|
|
60
|
-
? { id: transaction.object.toLocation.id }
|
|
61
|
-
: undefined);
|
|
62
|
-
}
|
|
63
55
|
break;
|
|
64
56
|
default:
|
|
65
57
|
}
|
|
66
|
-
let accountType;
|
|
67
|
-
const transactionType = params.transaction.typeOf;
|
|
68
|
-
switch (transactionType) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
58
|
+
// let accountType: string;
|
|
59
|
+
// const transactionType = params.transaction.typeOf;
|
|
60
|
+
// switch (transactionType) {
|
|
61
|
+
// case factory.account.transactionType.Deposit:
|
|
62
|
+
// accountType = params.transaction.object.toLocation.accountType;
|
|
63
|
+
// break;
|
|
64
|
+
// case factory.account.transactionType.Transfer:
|
|
65
|
+
// accountType = params.transaction.object.fromLocation.accountType;
|
|
66
|
+
// break;
|
|
67
|
+
// case factory.account.transactionType.Withdraw:
|
|
68
|
+
// accountType = params.transaction.object.fromLocation.accountType;
|
|
69
|
+
// break;
|
|
70
|
+
// default:
|
|
71
|
+
// throw new factory.errors.NotImplemented(`transaction type ${transactionType} not implemented`);
|
|
72
|
+
// }
|
|
73
|
+
const purpose = {
|
|
74
|
+
typeOf: transaction.typeOf,
|
|
75
|
+
id: transaction.id,
|
|
76
|
+
transactionNumber: transaction.transactionNumber
|
|
77
|
+
// ...(typeof transaction.identifier === 'string')
|
|
78
|
+
// ? { identifier: transaction.identifier }
|
|
79
|
+
// : /* istanbul ignore next */ undefined
|
|
80
|
+
};
|
|
81
81
|
return {
|
|
82
82
|
project: transaction.project,
|
|
83
83
|
typeOf: factory.actionType.MoneyTransfer,
|
|
84
|
-
identifier: `${factory.actionType.MoneyTransfer}-${transaction.typeOf}-${transaction.id}`,
|
|
84
|
+
// identifier: `${factory.actionType.MoneyTransfer}-${transaction.typeOf}-${transaction.id}`,
|
|
85
85
|
description: transaction.object.description,
|
|
86
|
-
//
|
|
87
|
-
// amount: transaction.object.amount
|
|
88
|
-
// },
|
|
89
|
-
object: {},
|
|
86
|
+
// object: {},
|
|
90
87
|
agent: transaction.agent,
|
|
91
88
|
recipient: transaction.recipient,
|
|
92
89
|
amount: {
|
|
93
90
|
typeOf: 'MonetaryAmount',
|
|
94
|
-
|
|
91
|
+
// 廃止(2023-02-16~)
|
|
92
|
+
// currency: accountType,
|
|
95
93
|
value: (typeof transaction.object.amount === 'number')
|
|
96
94
|
? transaction.object.amount
|
|
97
95
|
: transaction.object.amount.value
|
|
98
96
|
},
|
|
99
97
|
fromLocation: fromLocation,
|
|
100
98
|
toLocation: toLocation,
|
|
101
|
-
purpose
|
|
102
|
-
? { identifier: transaction.identifier }
|
|
103
|
-
: /* istanbul ignore next */ undefined)
|
|
99
|
+
purpose
|
|
104
100
|
};
|
|
105
101
|
}
|
|
106
102
|
exports.createMoneyTransferActionAttributes = createMoneyTransferActionAttributes;
|
|
@@ -47,13 +47,15 @@ function start(params) {
|
|
|
47
47
|
amount: params.object.amount,
|
|
48
48
|
fromLocation: {
|
|
49
49
|
typeOf: fromAccount.typeOf,
|
|
50
|
-
|
|
50
|
+
// 廃止(2023-02-16~)
|
|
51
|
+
// accountType: fromAccount.accountType,
|
|
51
52
|
accountNumber: fromAccount.accountNumber,
|
|
52
53
|
name: fromAccount.name
|
|
53
54
|
},
|
|
54
55
|
toLocation: {
|
|
55
56
|
typeOf: toAccount.typeOf,
|
|
56
|
-
|
|
57
|
+
// 廃止(2023-02-16~)
|
|
58
|
+
// accountType: toAccount.accountType,
|
|
57
59
|
accountNumber: toAccount.accountNumber,
|
|
58
60
|
name: toAccount.name
|
|
59
61
|
},
|
|
@@ -95,10 +97,6 @@ function start(params) {
|
|
|
95
97
|
accountNumber: params.object.toLocation.accountNumber,
|
|
96
98
|
transaction: pendingTransaction
|
|
97
99
|
});
|
|
98
|
-
// 口座取引におけるAccountAction管理を廃止(2022-11-28~)
|
|
99
|
-
// アクション開始
|
|
100
|
-
// const moneyTransferActionAttributes = createMoneyTransferActionAttributes({ transaction });
|
|
101
|
-
// await repos.accountAction.startByIdentifier(moneyTransferActionAttributes);
|
|
102
100
|
// 結果返却
|
|
103
101
|
return transaction;
|
|
104
102
|
});
|
|
@@ -36,7 +36,8 @@ function start(params) {
|
|
|
36
36
|
amount: params.object.amount,
|
|
37
37
|
fromLocation: {
|
|
38
38
|
typeOf: fromAccount.typeOf,
|
|
39
|
-
|
|
39
|
+
// 廃止(2023-02-16~)
|
|
40
|
+
// accountType: fromAccount.accountType,
|
|
40
41
|
accountNumber: fromAccount.accountNumber,
|
|
41
42
|
name: fromAccount.name
|
|
42
43
|
},
|
|
@@ -74,10 +75,6 @@ function start(params) {
|
|
|
74
75
|
transaction: pendingTransaction,
|
|
75
76
|
force: forcibly
|
|
76
77
|
});
|
|
77
|
-
// 口座取引におけるAccountAction管理を廃止(2022-11-28~)
|
|
78
|
-
// アクション開始
|
|
79
|
-
// const moneyTransferActionAttributes = createMoneyTransferActionAttributes({ transaction });
|
|
80
|
-
// await repos.accountAction.startByIdentifier(moneyTransferActionAttributes);
|
|
81
78
|
// 結果返却
|
|
82
79
|
return transaction;
|
|
83
80
|
});
|
|
@@ -62,20 +62,29 @@ function start(params) {
|
|
|
62
62
|
recipient: params.recipient,
|
|
63
63
|
object: Object.assign(Object.assign({ amount,
|
|
64
64
|
fromLocation,
|
|
65
|
-
toLocation, pendingTransaction: Object.assign({ typeOf: transactionType,
|
|
65
|
+
toLocation, pendingTransaction: Object.assign({ typeOf: transactionType, transactionNumber: transactionNumber }, (typeof params.identifier === 'string') ? { identifier: params.identifier } : undefined) }, (typeof params.object.description === 'string') ? { description: params.object.description } : {}), { force: params.object.force === true }),
|
|
66
66
|
expires: params.expires
|
|
67
67
|
};
|
|
68
68
|
// 取引開始
|
|
69
69
|
let transaction;
|
|
70
70
|
try {
|
|
71
71
|
transaction = yield repos.assetTransaction.start(startParams);
|
|
72
|
-
const pendingTransaction =
|
|
73
|
-
yield
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
// const pendingTransaction = await authorizeAccount({ transaction })(repos);
|
|
73
|
+
yield authorizeAccount({ transaction })(repos);
|
|
74
|
+
// 更新不要(2023-02-20~)
|
|
75
|
+
// await repos.assetTransaction.findByIdAndUpdate<factory.assetTransactionType.MoneyTransfer>({
|
|
76
|
+
// id: transaction.id,
|
|
77
|
+
// update: {
|
|
78
|
+
// 'object.pendingTransaction': {
|
|
79
|
+
// typeOf: pendingTransaction.typeOf,
|
|
80
|
+
// id: pendingTransaction.id,
|
|
81
|
+
// transactionNumber: pendingTransaction.transactionNumber,
|
|
82
|
+
// ...(typeof pendingTransaction.identifier === 'string')
|
|
83
|
+
// ? { identifier: pendingTransaction.identifier }
|
|
84
|
+
// : undefined
|
|
85
|
+
// }
|
|
86
|
+
// }
|
|
87
|
+
// });
|
|
79
88
|
}
|
|
80
89
|
catch (error) {
|
|
81
90
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
@@ -113,13 +122,12 @@ function authorizeAccount(params) {
|
|
|
113
122
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
114
123
|
var _a, _b, _c;
|
|
115
124
|
const transaction = params.transaction;
|
|
116
|
-
let pendingTransaction;
|
|
117
125
|
const fromLocation = transaction.object.fromLocation;
|
|
118
126
|
const toLocation = transaction.object.toLocation;
|
|
119
127
|
if (typeof ((_a = transaction.object.pendingTransaction) === null || _a === void 0 ? void 0 : _a.typeOf) !== 'string') {
|
|
120
128
|
throw new factory.errors.NotFound('transaction.object.pendingTransaction.typeOf');
|
|
121
129
|
}
|
|
122
|
-
|
|
130
|
+
yield MoneyTransferService.authorize({
|
|
123
131
|
typeOf: transaction.object.pendingTransaction.typeOf,
|
|
124
132
|
identifier: transaction.object.pendingTransaction.identifier,
|
|
125
133
|
transactionNumber: transaction.object.pendingTransaction.transactionNumber,
|
|
@@ -143,7 +151,7 @@ function authorizeAccount(params) {
|
|
|
143
151
|
recipient: transaction.recipient,
|
|
144
152
|
purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
145
153
|
})(repos);
|
|
146
|
-
return pendingTransaction;
|
|
154
|
+
// return pendingTransaction;
|
|
147
155
|
});
|
|
148
156
|
}
|
|
149
157
|
function fixMonetaryAmount(params, product) {
|