@chevre/domain 24.0.0-alpha.82 → 24.0.0-alpha.84

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.
Files changed (53) hide show
  1. package/lib/chevre/repo/product.js +0 -3
  2. package/lib/chevre/repo/transaction.d.ts +4 -4
  3. package/lib/chevre/repository.d.ts +0 -30
  4. package/lib/chevre/repository.js +2 -68
  5. package/lib/chevre/service/assetTransaction/reserve/start/createSubReservations.js +1 -19
  6. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.js +1 -31
  7. package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.js +1 -5
  8. package/lib/chevre/service/task/deletePerson.js +0 -2
  9. package/lib/chevre/service/task/onResourceDeleted.js +0 -3
  10. package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +4 -4
  11. package/lib/chevre/service.d.ts +0 -12
  12. package/lib/chevre/service.js +1 -35
  13. package/package.json +2 -2
  14. package/lib/chevre/factory/availableProductTypes.d.ts +0 -1
  15. package/lib/chevre/factory/availableProductTypes.js +0 -8
  16. package/lib/chevre/repo/account.d.ts +0 -129
  17. package/lib/chevre/repo/account.js +0 -391
  18. package/lib/chevre/repo/accountTransaction.d.ts +0 -65
  19. package/lib/chevre/repo/accountTransaction.js +0 -277
  20. package/lib/chevre/repo/comment.d.ts +0 -42
  21. package/lib/chevre/repo/comment.js +0 -121
  22. package/lib/chevre/repo/mongoose/schemas/account.d.ts +0 -11
  23. package/lib/chevre/repo/mongoose/schemas/account.js +0 -118
  24. package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +0 -11
  25. package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +0 -149
  26. package/lib/chevre/repo/mongoose/schemas/comments.d.ts +0 -11
  27. package/lib/chevre/repo/mongoose/schemas/comments.js +0 -103
  28. package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +0 -11
  29. package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +0 -144
  30. package/lib/chevre/repo/permit.d.ts +0 -42
  31. package/lib/chevre/repo/permit.js +0 -77
  32. package/lib/chevre/repo/serviceOutput.d.ts +0 -36
  33. package/lib/chevre/repo/serviceOutput.js +0 -167
  34. package/lib/chevre/repo/serviceOutputIdentifier.d.ts +0 -18
  35. package/lib/chevre/repo/serviceOutputIdentifier.js +0 -74
  36. package/lib/chevre/service/account.d.ts +0 -59
  37. package/lib/chevre/service/account.js +0 -108
  38. package/lib/chevre/service/accountTransaction/deposit.d.ts +0 -14
  39. package/lib/chevre/service/accountTransaction/deposit.js +0 -57
  40. package/lib/chevre/service/accountTransaction/factory.d.ts +0 -10
  41. package/lib/chevre/service/accountTransaction/factory.js +0 -101
  42. package/lib/chevre/service/accountTransaction/transfer.d.ts +0 -14
  43. package/lib/chevre/service/accountTransaction/transfer.js +0 -87
  44. package/lib/chevre/service/accountTransaction/withdraw.d.ts +0 -14
  45. package/lib/chevre/service/accountTransaction/withdraw.js +0 -68
  46. package/lib/chevre/service/accountTransaction.d.ts +0 -20
  47. package/lib/chevre/service/accountTransaction.js +0 -81
  48. package/lib/chevre/service/permit.d.ts +0 -45
  49. package/lib/chevre/service/permit.js +0 -158
  50. package/lib/chevre/service/product.d.ts +0 -9
  51. package/lib/chevre/service/product.js +0 -77
  52. package/lib/chevre/service/task/registerService.d.ts +0 -6
  53. package/lib/chevre/service/task/registerService.js +0 -22
@@ -1,167 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ServiceOutputRepo = void 0;
4
- const serviceOutput_1 = require("./mongoose/schemas/serviceOutput");
5
- const factory_1 = require("../factory");
6
- const settings_1 = require("../settings");
7
- /**
8
- * サービスアウトプットリポジトリ
9
- */
10
- class ServiceOutputRepo {
11
- serviceOutputModel;
12
- constructor(connection) {
13
- this.serviceOutputModel = connection.model(serviceOutput_1.modelName, (0, serviceOutput_1.createSchema)());
14
- }
15
- static CREATE_MONGO_CONDITIONS(params) {
16
- // MongoDB検索条件
17
- const andConditions = [];
18
- const projectIdEq = params.project?.id?.$eq;
19
- if (typeof projectIdEq === 'string') {
20
- andConditions.push({
21
- 'project.id': {
22
- $eq: projectIdEq
23
- }
24
- });
25
- }
26
- const typeOfEq = params.typeOf?.$eq;
27
- if (typeof typeOfEq === 'string') {
28
- andConditions.push({
29
- typeOf: { $eq: typeOfEq }
30
- });
31
- }
32
- const idEq = params.id?.$eq;
33
- if (typeof idEq === 'string') {
34
- andConditions.push({
35
- _id: {
36
- $eq: idEq
37
- }
38
- });
39
- }
40
- const identifierEq = params.identifier?.$eq;
41
- if (typeof identifierEq === 'string') {
42
- andConditions.push({
43
- identifier: {
44
- $exists: true,
45
- $eq: identifierEq
46
- }
47
- });
48
- }
49
- const identifierIn = params.identifier?.$in;
50
- if (Array.isArray(identifierIn)) {
51
- andConditions.push({
52
- identifier: {
53
- $exists: true,
54
- $in: identifierIn
55
- }
56
- });
57
- }
58
- const accessCodeEq = params.accessCode?.$eq;
59
- if (typeof accessCodeEq === 'string') {
60
- andConditions.push({
61
- accessCode: {
62
- $exists: true,
63
- $eq: accessCodeEq
64
- }
65
- });
66
- }
67
- const issuedByIdEq = params.issuedBy?.id?.$eq;
68
- if (typeof issuedByIdEq === 'string') {
69
- andConditions.push({
70
- 'issuedBy.id': {
71
- $exists: true,
72
- $eq: issuedByIdEq
73
- }
74
- });
75
- }
76
- const issuedThroughIdEq = params.issuedThrough?.id?.$eq;
77
- if (typeof issuedThroughIdEq === 'string') {
78
- andConditions.push({
79
- 'issuedThrough.id': {
80
- $exists: true,
81
- $eq: issuedThroughIdEq
82
- }
83
- });
84
- }
85
- const issuedThroughTypeOfEq = params.issuedThrough?.typeOf?.$eq;
86
- if (typeof issuedThroughTypeOfEq === 'string') {
87
- andConditions.push({
88
- 'issuedThrough.typeOf': {
89
- $exists: true,
90
- $eq: issuedThroughTypeOfEq
91
- }
92
- });
93
- }
94
- const issuedThroughServiceTypeCodeValueEq = params.issuedThrough?.serviceType?.codeValue?.$eq;
95
- if (typeof issuedThroughServiceTypeCodeValueEq === 'string') {
96
- andConditions.push({
97
- 'issuedThrough.serviceType.codeValue': {
98
- $exists: true,
99
- $eq: issuedThroughServiceTypeCodeValueEq
100
- }
101
- });
102
- }
103
- return andConditions;
104
- }
105
- /**
106
- * 許可証検索
107
- */
108
- async search(params, projection) {
109
- const conditions = ServiceOutputRepo.CREATE_MONGO_CONDITIONS(params);
110
- const query = this.serviceOutputModel.find((conditions.length > 0) ? { $and: conditions } : {}, {
111
- __v: 0,
112
- createdAt: 0,
113
- updatedAt: 0,
114
- ...projection
115
- });
116
- if (typeof params.limit === 'number' && params.limit > 0) {
117
- const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
118
- query.limit(params.limit)
119
- .skip(params.limit * (page - 1));
120
- }
121
- /* istanbul ignore else */
122
- // if (params.sort !== undefined) {
123
- // query.sort(params.sort);
124
- // }
125
- return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
126
- .exec()
127
- .then((docs) => docs.map((doc) => doc.toObject()));
128
- }
129
- /**
130
- * 許可証発行
131
- */
132
- async issue(params) {
133
- await this.serviceOutputModel.create(params);
134
- }
135
- /**
136
- * 許可証有効化
137
- */
138
- async activate(params) {
139
- const doc = await this.serviceOutputModel.findOneAndUpdate({
140
- typeOf: params.typeOf,
141
- identifier: params.identifier
142
- }, {
143
- validFrom: params.validFrom,
144
- ...(params.validUntil instanceof Date)
145
- ? {
146
- validUntil: params.validUntil
147
- }
148
- : undefined
149
- })
150
- .exec();
151
- if (doc === null) {
152
- throw new factory_1.factory.errors.NotFound(this.serviceOutputModel.modelName);
153
- }
154
- return doc.toObject();
155
- }
156
- async deleteByProject(params) {
157
- await this.serviceOutputModel.deleteMany({
158
- 'project.id': { $eq: params.project.id }
159
- })
160
- .exec();
161
- }
162
- async unsetUnnecessaryFields(params) {
163
- return this.serviceOutputModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
164
- .exec();
165
- }
166
- }
167
- exports.ServiceOutputRepo = ServiceOutputRepo;
@@ -1,18 +0,0 @@
1
- import type { Connection } from 'mongoose';
2
- /**
3
- * サービスアウトプット識別子リポジトリ
4
- */
5
- export declare class ServiceOutputIdentifierRepo {
6
- private readonly counterRepo;
7
- private readonly settingModel;
8
- constructor(params: {
9
- connection: Connection;
10
- });
11
- /**
12
- * タイムスタンプから発行する
13
- */
14
- issueServiceOutputIdentifier(params: {
15
- startDate: Date;
16
- }): Promise<string>;
17
- private findSetting;
18
- }
@@ -1,74 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ServiceOutputIdentifierRepo = void 0;
7
- // import * as cdigit from 'cdigit';
8
- const moment_timezone_1 = __importDefault(require("moment-timezone"));
9
- // const fpe = require('node-fpe-v1');
10
- const factory_1 = require("../factory");
11
- const transactionNumber_1 = require("../factory/transactionNumber");
12
- const setting_1 = require("./mongoose/schemas/setting");
13
- const transactionNumber_2 = require("./mongoose/schemas/transactionNumber");
14
- const transactionNumberCounter_1 = require("./transactionNumberCounter");
15
- /**
16
- * サービスアウトプット識別子リポジトリ
17
- */
18
- class ServiceOutputIdentifierRepo {
19
- counterRepo;
20
- settingModel;
21
- constructor(params) {
22
- this.counterRepo = new transactionNumberCounter_1.TransactionNumberCounterRepo(params);
23
- this.settingModel = params.connection.model(setting_1.modelName, (0, setting_1.createSchema)());
24
- }
25
- /**
26
- * タイムスタンプから発行する
27
- */
28
- async issueServiceOutputIdentifier(params) {
29
- const { fpeSecret, version } = await this.findSetting();
30
- const timestamp = (0, moment_timezone_1.default)(params.startDate)
31
- .valueOf()
32
- .toString();
33
- const dataFeedIdentifier = timestamp;
34
- const dataFeedExpires = (0, moment_timezone_1.default)(params.startDate)
35
- .add(1, 'minute') // ミリ秒でカウントしていくので、予約日時後1分で十分
36
- .toDate();
37
- const incrReply = await this.counterRepo.incrementByMongo({
38
- identifier: dataFeedIdentifier,
39
- includedInDataCatalog: { identifier: transactionNumber_2.DataCatalogIdentifier.serviceOutputIdentifier },
40
- expires: dataFeedExpires
41
- });
42
- const transactionFactory = new transactionNumber_1.TransactionNumberFactory({ fpeSecret, version });
43
- return transactionFactory.generate(timestamp, incrReply);
44
- // let identifier: string = `${timestamp}${incrReply}`;
45
- // // checkdigit
46
- // const cd = cdigit.luhn.compute(identifier);
47
- // identifier = fpe({ password: cd })
48
- // .encrypt(identifier);
49
- // identifier = `${cd}${identifier}`;
50
- // return identifier;
51
- }
52
- async findSetting() {
53
- const filterQuery = { 'project.id': { $eq: '*' } };
54
- const projection = {
55
- _id: 0,
56
- serviceOutputIdentifier: 1
57
- };
58
- const setting = await this.settingModel.findOne(filterQuery, projection)
59
- .lean()
60
- .exec();
61
- if (setting === null || setting.serviceOutputIdentifier === undefined) {
62
- throw new factory_1.factory.errors.NotFound('setting.serviceOutputIdentifier');
63
- }
64
- const { fpeSecret, version } = setting.serviceOutputIdentifier;
65
- if (typeof fpeSecret !== 'string' || fpeSecret === '') {
66
- throw new factory_1.factory.errors.NotFound('setting.serviceOutputIdentifier.secret');
67
- }
68
- if (typeof version !== 'string' || version === '') {
69
- throw new factory_1.factory.errors.NotFound('setting.serviceOutputIdentifier.version');
70
- }
71
- return { fpeSecret, version };
72
- }
73
- }
74
- exports.ServiceOutputIdentifierRepo = ServiceOutputIdentifierRepo;
@@ -1,59 +0,0 @@
1
- /**
2
- * 口座サービス
3
- * 開設、閉鎖等、口座アクション実行など
4
- */
5
- import { factory } from '../factory';
6
- import type { AccountRepo } from '../repo/account';
7
- import type { AccountTransactionRepo } from '../repo/accountTransaction';
8
- export type IOpenOperation<T> = (repos: {
9
- account: AccountRepo;
10
- }) => Promise<T>;
11
- /**
12
- * 口座を開設する
13
- */
14
- export declare function open(params: {
15
- project: {
16
- id: string;
17
- };
18
- typeOf: string;
19
- /**
20
- * 口座タイプ
21
- */
22
- accountType: string;
23
- /**
24
- * 口座番号
25
- * ユニークになるように、Pecorinoサービス利用側で番号を生成すること
26
- */
27
- accountNumber: string;
28
- /**
29
- * 口座名義
30
- */
31
- name: string;
32
- /**
33
- * 初期金額
34
- */
35
- initialBalance: number;
36
- }[]): IOpenOperation<factory.account.IAccount[]>;
37
- /**
38
- * 口座を解約する
39
- */
40
- /**
41
- * 転送する
42
- * 確定取引結果から、実際の転送アクションを実行します。
43
- */
44
- export declare function transferMoney(actionAttributes: factory.account.action.moneyTransfer.IAttributes): (repos: {
45
- account: AccountRepo;
46
- }) => Promise<void>;
47
- /**
48
- * 転送取消
49
- * 期限切れ、あるいは、中止された取引から、転送をアクションを取り消します。
50
- */
51
- export declare function cancelMoneyTransfer(params: {
52
- transaction: {
53
- typeOf: factory.account.transactionType;
54
- id: string;
55
- };
56
- }): (repos: {
57
- account: AccountRepo;
58
- accountTransaction: AccountTransactionRepo;
59
- }) => Promise<void>;
@@ -1,108 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.open = open;
4
- exports.transferMoney = transferMoney;
5
- exports.cancelMoneyTransfer = cancelMoneyTransfer;
6
- /**
7
- * 口座サービス
8
- * 開設、閉鎖等、口座アクション実行など
9
- */
10
- const factory_1 = require("../factory");
11
- /**
12
- * 口座を開設する
13
- */
14
- function open(params) {
15
- return async (repos) => {
16
- const openDate = new Date();
17
- return repos.account.open(params.map((p) => {
18
- return {
19
- project: { typeOf: factory_1.factory.organizationType.Project, id: p.project.id },
20
- typeOf: p.typeOf,
21
- name: p.name,
22
- accountType: p.accountType,
23
- accountNumber: p.accountNumber,
24
- initialBalance: p.initialBalance,
25
- openDate: openDate
26
- };
27
- }));
28
- };
29
- }
30
- /**
31
- * 口座を解約する
32
- */
33
- // export function close(params: {
34
- // /**
35
- // * 口座番号
36
- // */
37
- // accountNumber: string;
38
- // }) {
39
- // return async (repos: {
40
- // account: AccountRepo;
41
- // }) => {
42
- // await repos.account.close({
43
- // accountNumber: params.accountNumber,
44
- // closeDate: new Date()
45
- // });
46
- // };
47
- // }
48
- /**
49
- * 転送する
50
- * 確定取引結果から、実際の転送アクションを実行します。
51
- */
52
- function transferMoney(actionAttributes) {
53
- return async (repos) => {
54
- const action = actionAttributes;
55
- const fromAccountNumber = (typeof action.fromLocation.accountNumber === 'string')
56
- ? action.fromLocation.accountNumber
57
- /* istanbul ignore next */
58
- : undefined;
59
- const toAccountNumber = (typeof action.toLocation.accountNumber === 'string')
60
- ? action.toLocation.accountNumber
61
- /* istanbul ignore next */
62
- : undefined;
63
- await repos.account.settleTransaction({
64
- fromAccountNumber: fromAccountNumber,
65
- toAccountNumber: toAccountNumber,
66
- amount: (typeof action.amount === 'number') ? action.amount : Number(action.amount.value),
67
- transactionId: action.purpose.id
68
- });
69
- };
70
- }
71
- /**
72
- * 転送取消
73
- * 期限切れ、あるいは、中止された取引から、転送をアクションを取り消します。
74
- */
75
- function cancelMoneyTransfer(params) {
76
- return async (repos) => {
77
- let fromAccountNumber;
78
- let toAccountNumber;
79
- // 取引存在確認
80
- const transaction = await repos.accountTransaction.findById({ typeOf: params.transaction.typeOf, id: params.transaction.id });
81
- switch (params.transaction.typeOf) {
82
- case factory_1.factory.account.transactionType.Deposit:
83
- toAccountNumber =
84
- transaction.object.toLocation.accountNumber;
85
- break;
86
- case factory_1.factory.account.transactionType.Withdraw:
87
- fromAccountNumber =
88
- transaction.object.fromLocation.accountNumber;
89
- break;
90
- case factory_1.factory.account.transactionType.Transfer:
91
- fromAccountNumber =
92
- transaction.object.fromLocation.accountNumber;
93
- toAccountNumber =
94
- transaction.object.toLocation.accountNumber;
95
- break;
96
- default:
97
- throw new factory_1.factory.errors.Argument('typeOf', `transaction type ${params.transaction.typeOf} unknown`);
98
- }
99
- await repos.account.voidTransaction({
100
- fromAccountNumber: fromAccountNumber,
101
- toAccountNumber: toAccountNumber,
102
- amount: (typeof transaction.object.amount === 'number')
103
- ? transaction.object.amount
104
- : transaction.object.amount.value,
105
- transactionId: transaction.id
106
- });
107
- };
108
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * 入金取引サービス
3
- */
4
- import { factory } from '../../factory';
5
- import type { AccountRepo } from '../../repo/account';
6
- import type { AccountTransactionRepo } from '../../repo/accountTransaction';
7
- export type IStartOperation<T> = (repos: {
8
- account: AccountRepo;
9
- accountTransaction: AccountTransactionRepo;
10
- }) => Promise<T>;
11
- /**
12
- * 取引開始
13
- */
14
- export declare function start(params: factory.account.transaction.deposit.IStartParamsWithoutDetail): IStartOperation<factory.account.transaction.deposit.ITransaction>;
@@ -1,57 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.start = start;
4
- /**
5
- * 入金取引サービス
6
- */
7
- const factory_1 = require("../../factory");
8
- /**
9
- * 取引開始
10
- */
11
- function start(params) {
12
- return async (repos) => {
13
- // 口座存在確認
14
- const account = await repos.account.findByAccountNumber({
15
- accountNumber: params.object.toLocation.accountNumber
16
- });
17
- // 取引ファクトリーで新しい進行中取引オブジェクトを作成
18
- const startParams = {
19
- project: { typeOf: params.project.typeOf, id: params.project.id },
20
- typeOf: factory_1.factory.account.transactionType.Deposit,
21
- agent: params.agent,
22
- recipient: params.recipient,
23
- object: {
24
- amount: params.object.amount,
25
- toLocation: {
26
- typeOf: account.typeOf,
27
- // 廃止(2023-02-16~)
28
- // accountType: account.accountType,
29
- accountNumber: account.accountNumber,
30
- name: account.name
31
- },
32
- description: params.object.description
33
- },
34
- expires: params.expires,
35
- // 必須化(2022-09-26~)
36
- transactionNumber: params.transactionNumber,
37
- ...(typeof params.identifier === 'string' && params.identifier.length > 0) ? { identifier: params.identifier } : undefined
38
- };
39
- // 取引作成
40
- // 取引識別子が指定されていれば、進行中取引のユニークネスを保証する
41
- const transaction = await repos.accountTransaction.startByIdentifier(startParams);
42
- const pendingTransaction = {
43
- typeOf: transaction.typeOf,
44
- id: transaction.id,
45
- amount: (typeof params.object.amount === 'number')
46
- ? params.object.amount
47
- : params.object.amount.value
48
- };
49
- // 入金先口座に進行中取引を追加
50
- await repos.account.startTransaction({
51
- accountNumber: params.object.toLocation.accountNumber,
52
- transaction: pendingTransaction
53
- });
54
- // 結果返却
55
- return transaction;
56
- };
57
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * 取引ファクトリー
3
- */
4
- import { factory } from '../../factory';
5
- /**
6
- * 転送アクション属性作成
7
- */
8
- export declare function createMoneyTransferActionAttributes(params: {
9
- transaction: factory.account.transaction.ITransaction<factory.account.transactionType>;
10
- }): factory.account.action.moneyTransfer.IAttributes;
@@ -1,101 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createMoneyTransferActionAttributes = createMoneyTransferActionAttributes;
4
- /**
5
- * 取引ファクトリー
6
- */
7
- const factory_1 = require("../../factory");
8
- /**
9
- * 転送アクション属性作成
10
- */
11
- function createMoneyTransferActionAttributes(params) {
12
- const transaction = params.transaction;
13
- let fromLocation = {
14
- typeOf: transaction.agent.typeOf,
15
- name: transaction.agent.name
16
- };
17
- let toLocation = {
18
- typeOf: transaction.recipient.typeOf,
19
- name: transaction.recipient.name
20
- };
21
- switch (transaction.typeOf) {
22
- case factory_1.factory.account.transactionType.Deposit:
23
- toLocation = {
24
- typeOf: transaction.object.toLocation.typeOf,
25
- // 廃止(2023-02-16~)
26
- // accountType: transaction.object.toLocation.accountType,
27
- accountNumber: transaction.object.toLocation.accountNumber,
28
- name: transaction.recipient.name
29
- };
30
- break;
31
- case factory_1.factory.account.transactionType.Transfer:
32
- fromLocation = {
33
- typeOf: transaction.object.fromLocation.typeOf,
34
- // 廃止(2023-02-16~)
35
- // accountType: transaction.object.fromLocation.accountType,
36
- accountNumber: transaction.object.fromLocation.accountNumber,
37
- name: transaction.agent.name
38
- };
39
- toLocation = {
40
- typeOf: transaction.object.toLocation.typeOf,
41
- // 廃止(2023-02-16~)
42
- // accountType: transaction.object.toLocation.accountType,
43
- accountNumber: transaction.object.toLocation.accountNumber,
44
- name: transaction.recipient.name
45
- };
46
- break;
47
- case factory_1.factory.account.transactionType.Withdraw:
48
- fromLocation = {
49
- typeOf: transaction.object.fromLocation.typeOf,
50
- // 廃止(2023-02-16~)
51
- // accountType: transaction.object.fromLocation.accountType,
52
- accountNumber: transaction.object.fromLocation.accountNumber,
53
- name: transaction.agent.name
54
- };
55
- break;
56
- default:
57
- }
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
- return {
82
- project: transaction.project,
83
- typeOf: factory_1.factory.actionType.MoneyTransfer,
84
- // identifier: `${factory.actionType.MoneyTransfer}-${transaction.typeOf}-${transaction.id}`,
85
- description: transaction.object.description,
86
- // object: {},
87
- agent: transaction.agent,
88
- recipient: transaction.recipient,
89
- amount: {
90
- typeOf: 'MonetaryAmount',
91
- // 廃止(2023-02-16~)
92
- // currency: accountType,
93
- value: (typeof transaction.object.amount === 'number')
94
- ? transaction.object.amount
95
- : transaction.object.amount.value
96
- },
97
- fromLocation: fromLocation,
98
- toLocation: toLocation,
99
- purpose
100
- };
101
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * 転送取引サービス
3
- */
4
- import { factory } from '../../factory';
5
- import type { AccountRepo } from '../../repo/account';
6
- import type { AccountTransactionRepo } from '../../repo/accountTransaction';
7
- export type IStartOperation<T> = (repos: {
8
- account: AccountRepo;
9
- accountTransaction: AccountTransactionRepo;
10
- }) => Promise<T>;
11
- /**
12
- * 取引開始
13
- */
14
- export declare function start(params: factory.account.transaction.transfer.IStartParamsWithoutDetail): IStartOperation<factory.account.transaction.transfer.ITransaction>;