@chevre/domain 24.0.0-alpha.83 → 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 (49) 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 -25
  4. package/lib/chevre/repository.js +2 -57
  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/mongoose/schemas/account.d.ts +0 -11
  21. package/lib/chevre/repo/mongoose/schemas/account.js +0 -118
  22. package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +0 -11
  23. package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +0 -149
  24. package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +0 -11
  25. package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +0 -144
  26. package/lib/chevre/repo/permit.d.ts +0 -42
  27. package/lib/chevre/repo/permit.js +0 -77
  28. package/lib/chevre/repo/serviceOutput.d.ts +0 -36
  29. package/lib/chevre/repo/serviceOutput.js +0 -167
  30. package/lib/chevre/repo/serviceOutputIdentifier.d.ts +0 -18
  31. package/lib/chevre/repo/serviceOutputIdentifier.js +0 -74
  32. package/lib/chevre/service/account.d.ts +0 -59
  33. package/lib/chevre/service/account.js +0 -108
  34. package/lib/chevre/service/accountTransaction/deposit.d.ts +0 -14
  35. package/lib/chevre/service/accountTransaction/deposit.js +0 -57
  36. package/lib/chevre/service/accountTransaction/factory.d.ts +0 -10
  37. package/lib/chevre/service/accountTransaction/factory.js +0 -101
  38. package/lib/chevre/service/accountTransaction/transfer.d.ts +0 -14
  39. package/lib/chevre/service/accountTransaction/transfer.js +0 -87
  40. package/lib/chevre/service/accountTransaction/withdraw.d.ts +0 -14
  41. package/lib/chevre/service/accountTransaction/withdraw.js +0 -68
  42. package/lib/chevre/service/accountTransaction.d.ts +0 -20
  43. package/lib/chevre/service/accountTransaction.js +0 -81
  44. package/lib/chevre/service/permit.d.ts +0 -45
  45. package/lib/chevre/service/permit.js +0 -158
  46. package/lib/chevre/service/product.d.ts +0 -9
  47. package/lib/chevre/service/product.js +0 -77
  48. package/lib/chevre/service/task/registerService.d.ts +0 -6
  49. package/lib/chevre/service/task/registerService.js +0 -22
@@ -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>;
@@ -1,87 +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 fromAccount = await repos.account.findByAccountNumber({
15
- accountNumber: params.object.fromLocation.accountNumber
16
- });
17
- const toAccount = await repos.account.findByAccountNumber({
18
- accountNumber: params.object.toLocation.accountNumber
19
- });
20
- /* istanbul ignore if */
21
- if (fromAccount.accountType !== toAccount.accountType) {
22
- throw new factory_1.factory.errors.Argument('accountType', 'FromLocation accountType must be the same as ToLocation');
23
- }
24
- /* istanbul ignore if */
25
- if (fromAccount.accountNumber === toAccount.accountNumber) {
26
- throw new factory_1.factory.errors.Argument('accountNumber', 'FromLocation accountNumber must be different from ToLocation');
27
- }
28
- // 残高検証(2022-10-28~)
29
- if (fromAccount.availableBalance < params.object.amount.value) {
30
- throw new factory_1.factory.errors.Argument('fromLocation', 'Insufficient balance');
31
- }
32
- // 取引ファクトリーで新しい進行中取引オブジェクトを作成
33
- const startParams = {
34
- project: { typeOf: params.project.typeOf, id: params.project.id },
35
- typeOf: factory_1.factory.account.transactionType.Transfer,
36
- agent: params.agent,
37
- recipient: params.recipient,
38
- object: {
39
- amount: params.object.amount,
40
- fromLocation: {
41
- typeOf: fromAccount.typeOf,
42
- // 廃止(2023-02-16~)
43
- // accountType: fromAccount.accountType,
44
- accountNumber: fromAccount.accountNumber,
45
- name: fromAccount.name
46
- },
47
- toLocation: {
48
- typeOf: toAccount.typeOf,
49
- // 廃止(2023-02-16~)
50
- // accountType: toAccount.accountType,
51
- accountNumber: toAccount.accountNumber,
52
- name: toAccount.name
53
- },
54
- description: params.object.description
55
- },
56
- expires: params.expires,
57
- // 必須化(2022-09-26~)
58
- transactionNumber: params.transactionNumber,
59
- ...(typeof params.identifier === 'string' && params.identifier.length > 0) ? { identifier: params.identifier } : undefined
60
- };
61
- // 取引作成
62
- // 取引識別子が指定されていれば、進行中取引のユニークネスを保証する
63
- const transaction = await repos.accountTransaction.startByIdentifier(startParams);
64
- const pendingTransaction = {
65
- typeOf: transaction.typeOf,
66
- id: transaction.id,
67
- amount: (typeof params.object.amount === 'number')
68
- ? params.object.amount
69
- : params.object.amount.value
70
- };
71
- // 残高確認
72
- await repos.account.authorizeAmount({
73
- accountNumber: params.object.fromLocation.accountNumber,
74
- amount: (typeof params.object.amount === 'number')
75
- ? params.object.amount
76
- : params.object.amount.value,
77
- transaction: pendingTransaction
78
- });
79
- // 転送先口座に進行中取引を追加
80
- await repos.account.startTransaction({
81
- accountNumber: params.object.toLocation.accountNumber,
82
- transaction: pendingTransaction
83
- });
84
- // 結果返却
85
- return transaction;
86
- };
87
- }
@@ -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.withdraw.IStartParamsWithoutDetail): IStartOperation<factory.account.transaction.withdraw.ITransaction>;
@@ -1,68 +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 fromAccount = await repos.account.findByAccountNumber({
15
- accountNumber: params.object.fromLocation.accountNumber
16
- });
17
- const forcibly = (params.object.force === true);
18
- if (!forcibly) {
19
- // 残高検証(2022-10-28~)
20
- if (fromAccount.availableBalance < params.object.amount.value) {
21
- throw new factory_1.factory.errors.Argument('fromLocation', 'Insufficient balance');
22
- }
23
- }
24
- // 取引ファクトリーで新しい進行中取引オブジェクトを作成
25
- const startParams = {
26
- project: { typeOf: params.project.typeOf, id: params.project.id },
27
- typeOf: factory_1.factory.account.transactionType.Withdraw,
28
- agent: params.agent,
29
- recipient: params.recipient,
30
- object: {
31
- amount: params.object.amount,
32
- fromLocation: {
33
- typeOf: fromAccount.typeOf,
34
- // 廃止(2023-02-16~)
35
- // accountType: fromAccount.accountType,
36
- accountNumber: fromAccount.accountNumber,
37
- name: fromAccount.name
38
- },
39
- description: params.object.description
40
- },
41
- expires: params.expires,
42
- // 必須化(2022-09-26~)
43
- transactionNumber: params.transactionNumber,
44
- ...(typeof params.identifier === 'string' && params.identifier.length > 0) ? { identifier: params.identifier } : undefined
45
- };
46
- // 取引作成
47
- // 取引識別子が指定されていれば、進行中取引のユニークネスを保証する
48
- const transaction = await repos.accountTransaction.startByIdentifier(startParams);
49
- const pendingTransaction = {
50
- typeOf: transaction.typeOf,
51
- id: transaction.id,
52
- amount: (typeof params.object.amount === 'number')
53
- ? params.object.amount
54
- : params.object.amount.value
55
- };
56
- // 残高確保
57
- await repos.account.authorizeAmount({
58
- accountNumber: params.object.fromLocation.accountNumber,
59
- amount: (typeof params.object.amount === 'number')
60
- ? params.object.amount
61
- : params.object.amount.value,
62
- transaction: pendingTransaction,
63
- force: forcibly
64
- });
65
- // 結果返却
66
- return transaction;
67
- };
68
- }
@@ -1,20 +0,0 @@
1
- /**
2
- * 口座取引サービス
3
- */
4
- import type { AccountTransactionRepo } from '../repo/accountTransaction';
5
- import { factory } from '../factory';
6
- import * as DepositTransactionService from './accountTransaction/deposit';
7
- import * as TransferTransactionService from './accountTransaction/transfer';
8
- import * as WithdrawTransactionService from './accountTransaction/withdraw';
9
- type IConfirmOperation<T> = (repos: {
10
- accountTransaction: AccountTransactionRepo;
11
- }) => Promise<T>;
12
- /**
13
- * 取引確定
14
- */
15
- declare function confirm(params: {
16
- id?: string;
17
- transactionNumber?: string;
18
- typeOf?: factory.account.transactionType;
19
- }): IConfirmOperation<factory.account.transaction.ITransaction<factory.account.transactionType>>;
20
- export { DepositTransactionService as deposit, TransferTransactionService as transfer, WithdrawTransactionService as withdraw, confirm };
@@ -1,81 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.withdraw = exports.transfer = exports.deposit = void 0;
37
- exports.confirm = confirm;
38
- const factory_1 = require("../factory");
39
- const DepositTransactionService = __importStar(require("./accountTransaction/deposit"));
40
- exports.deposit = DepositTransactionService;
41
- const TransferTransactionService = __importStar(require("./accountTransaction/transfer"));
42
- exports.transfer = TransferTransactionService;
43
- const WithdrawTransactionService = __importStar(require("./accountTransaction/withdraw"));
44
- exports.withdraw = WithdrawTransactionService;
45
- const factory_2 = require("./accountTransaction/factory");
46
- /**
47
- * 取引確定
48
- */
49
- function confirm(params) {
50
- return async (repos) => {
51
- let transaction;
52
- // 取引存在確認
53
- /* istanbul ignore else */
54
- if (typeof params.id === 'string') {
55
- transaction = await repos.accountTransaction.findById({ typeOf: params.typeOf, id: params.id });
56
- }
57
- else if (typeof params.transactionNumber === 'string') {
58
- /* istanbul ignore next */
59
- transaction = await repos.accountTransaction.findByTransactionNumber({
60
- typeOf: params.typeOf,
61
- transactionNumber: params.transactionNumber
62
- });
63
- }
64
- else {
65
- /* istanbul ignore next */
66
- throw new factory_1.factory.errors.ArgumentNull('Transaction ID or Transaction Number');
67
- }
68
- // 現金転送アクション属性作成
69
- const moneyTransferActionAttributes = (0, factory_2.createMoneyTransferActionAttributes)({ transaction });
70
- const potentialActions = {
71
- moneyTransfer: moneyTransferActionAttributes
72
- };
73
- // 取引確定
74
- return repos.accountTransaction.confirm({
75
- typeOf: transaction.typeOf,
76
- id: transaction.id,
77
- // result: {},
78
- potentialActions
79
- });
80
- };
81
- }
@@ -1,45 +0,0 @@
1
- /**
2
- * 許可証サービス
3
- */
4
- import { factory } from '../factory';
5
- import type { AccountRepo } from '../repo/account';
6
- import type { ServiceOutputRepo } from '../repo/serviceOutput';
7
- /**
8
- * 許可証発行
9
- */
10
- export declare function issue(params: {
11
- project: {
12
- id: string;
13
- };
14
- issuedThrough: {
15
- typeOf: factory.product.ProductType;
16
- };
17
- serviceOutputs: factory.permit.IPermit[];
18
- }): (repos: {
19
- account: AccountRepo;
20
- serviceOutput: ServiceOutputRepo;
21
- }) => Promise<void>;
22
- /**
23
- * 許可証有効化
24
- */
25
- export declare function activate(params: {
26
- typeOf: string;
27
- identifier: string;
28
- validFrom: Date;
29
- validUntil?: Date;
30
- }): (repos: {
31
- serviceOutput: ServiceOutputRepo;
32
- }) => Promise<factory.permit.IPermit>;
33
- type IPermitWithAccountDetail = Omit<factory.permit.IPermit, 'paymentAccount'> & {
34
- paymentAccount?: factory.permit.IPaymentAccountWithDetail;
35
- };
36
- /**
37
- * プロジェクト指定で、許可証を検索する(ペイメントカードプロダクトの場合、口座詳細込み)
38
- */
39
- export declare function search(project: {
40
- id: string;
41
- }, params: factory.product.IServiceOutputSearchConditions, projection?: any): (repos: {
42
- account: AccountRepo;
43
- serviceOutput: ServiceOutputRepo;
44
- }) => Promise<IPermitWithAccountDetail[]>;
45
- export {};