@cranberry-money/shared-services 1.5.0 → 1.6.0

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 (28) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +1 -0
  4. package/dist/services/cash_accounts/constants.d.ts +7 -0
  5. package/dist/services/cash_accounts/constants.d.ts.map +1 -0
  6. package/dist/services/cash_accounts/constants.js +7 -0
  7. package/dist/services/cash_accounts/index.d.ts +5 -0
  8. package/dist/services/cash_accounts/index.d.ts.map +1 -0
  9. package/dist/services/cash_accounts/index.js +6 -0
  10. package/dist/services/cash_accounts/service.d.ts +8 -0
  11. package/dist/services/cash_accounts/service.d.ts.map +1 -0
  12. package/dist/services/cash_accounts/service.js +32 -0
  13. package/dist/services/cash_accounts/transactions/constants.d.ts +18 -0
  14. package/dist/services/cash_accounts/transactions/constants.d.ts.map +1 -0
  15. package/dist/services/cash_accounts/transactions/constants.js +25 -0
  16. package/dist/services/cash_accounts/transactions/index.d.ts +4 -0
  17. package/dist/services/cash_accounts/transactions/index.d.ts.map +1 -0
  18. package/dist/services/cash_accounts/transactions/index.js +4 -0
  19. package/dist/services/cash_accounts/transactions/service.d.ts +12 -0
  20. package/dist/services/cash_accounts/transactions/service.d.ts.map +1 -0
  21. package/dist/services/cash_accounts/transactions/service.js +66 -0
  22. package/dist/services/cash_accounts/transactions/types.d.ts +38 -0
  23. package/dist/services/cash_accounts/transactions/types.d.ts.map +1 -0
  24. package/dist/services/cash_accounts/transactions/types.js +11 -0
  25. package/dist/services/cash_accounts/types.d.ts +24 -0
  26. package/dist/services/cash_accounts/types.d.ts.map +1 -0
  27. package/dist/services/cash_accounts/types.js +4 -0
  28. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -14,6 +14,7 @@ export * from './services/AuthService';
14
14
  export * from './services/PortfolioService';
15
15
  export * as AccountsService from './services/accounts';
16
16
  export * as AuthService from './services/auth';
17
+ export * as CashAccountsService from './services/cash_accounts';
17
18
  export * as PortfoliosService from './services/portfolios';
18
19
  export * as UsersService from './services/users';
19
20
  export * as TradesService from './services/trades';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AAGrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAG3C,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,qBAAqB,EACrB,YAAY,EACb,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EACV,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAGrB,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAG5C,OAAO,KAAK,eAAe,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,WAAW,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,iBAAiB,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,YAAY,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,aAAa,MAAM,mBAAmB,CAAC;AAGnD,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AAGtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AAGrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAG3C,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,qBAAqB,EACrB,YAAY,EACb,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EACV,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAGrB,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAG5C,OAAO,KAAK,eAAe,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,WAAW,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,mBAAmB,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,iBAAiB,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,YAAY,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,aAAa,MAAM,mBAAmB,CAAC;AAGnD,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AAGtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC"}
package/dist/index.js CHANGED
@@ -18,6 +18,7 @@ export * from './services/PortfolioService';
18
18
  // New functional domain services
19
19
  export * as AccountsService from './services/accounts';
20
20
  export * as AuthService from './services/auth';
21
+ export * as CashAccountsService from './services/cash_accounts';
21
22
  export * as PortfoliosService from './services/portfolios';
22
23
  export * as UsersService from './services/users';
23
24
  export * as TradesService from './services/trades';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Cash account constants.
3
+ */
4
+ export declare const API_ENDPOINTS: {
5
+ readonly CASH_ACCOUNTS: "/api/cash-accounts/";
6
+ };
7
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/services/cash_accounts/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,aAAa;;CAEhB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Cash account constants.
3
+ */
4
+ // API Endpoints
5
+ export const API_ENDPOINTS = {
6
+ CASH_ACCOUNTS: '/api/cash-accounts/',
7
+ };
@@ -0,0 +1,5 @@
1
+ export type { CashAccount, CashAccountQueryParams, CurrencyCode, PaginatedCashAccounts, } from './types';
2
+ export { getCashAccounts, getCashAccountByUuid, getAccountCashAccounts, } from './service';
3
+ export { API_ENDPOINTS } from './constants';
4
+ export * as Transactions from './transactions';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/cash_accounts/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,WAAW,EACX,sBAAsB,EACtB,YAAY,EACZ,qBAAqB,GACtB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,6 @@
1
+ // Export service functions
2
+ export { getCashAccounts, getCashAccountByUuid, getAccountCashAccounts, } from './service';
3
+ // Export constants
4
+ export { API_ENDPOINTS } from './constants';
5
+ // Export transactions sub-service as namespace
6
+ export * as Transactions from './transactions';
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Cash account API service functions.
3
+ */
4
+ import type { CashAccount, CashAccountQueryParams, PaginatedCashAccounts } from './types';
5
+ export declare const getCashAccounts: (params?: CashAccountQueryParams) => Promise<import("axios").AxiosResponse<PaginatedCashAccounts, any>>;
6
+ export declare const getCashAccountByUuid: (uuid: string) => Promise<import("axios").AxiosResponse<CashAccount, any>>;
7
+ export declare const getAccountCashAccounts: (accountUuid: string) => Promise<import("axios").AxiosResponse<PaginatedCashAccounts, any>>;
8
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/services/cash_accounts/service.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAE1F,eAAO,MAAM,eAAe,GAAI,SAAS,sBAAsB,uEAsB9D,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,MAAM,MAAM,6DAEhD,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,aAAa,MAAM,uEAEzD,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Cash account API service functions.
3
+ */
4
+ import { webApiClient } from '../../api/apiClient';
5
+ import { API_ENDPOINTS } from './constants';
6
+ export const getCashAccounts = (params) => {
7
+ const queryParams = {};
8
+ if (params?.account) {
9
+ queryParams.account = params.account;
10
+ }
11
+ if (params?.currency) {
12
+ queryParams.currency = params.currency;
13
+ }
14
+ if (params?.minBalance !== undefined) {
15
+ queryParams.min_balance = params.minBalance.toString();
16
+ }
17
+ if (params?.maxBalance !== undefined) {
18
+ queryParams.max_balance = params.maxBalance.toString();
19
+ }
20
+ if (params?.ordering) {
21
+ queryParams.ordering = params.ordering;
22
+ }
23
+ return webApiClient.get(API_ENDPOINTS.CASH_ACCOUNTS, {
24
+ params: queryParams,
25
+ });
26
+ };
27
+ export const getCashAccountByUuid = (uuid) => {
28
+ return webApiClient.get(`${API_ENDPOINTS.CASH_ACCOUNTS}${uuid}/`);
29
+ };
30
+ export const getAccountCashAccounts = (accountUuid) => {
31
+ return getCashAccounts({ account: accountUuid });
32
+ };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Cash account transaction constants.
3
+ */
4
+ export declare const TRANSACTION_TYPE_LABEL_DEPOSIT = "Deposit";
5
+ export declare const TRANSACTION_TYPE_LABEL_WITHDRAWAL = "Withdrawal";
6
+ export declare const TRANSACTION_TYPE_LABEL_TRADE_SETTLEMENT = "Trade Settlement";
7
+ export declare const TRANSACTION_TYPE_LABEL_DISTRIBUTION = "Distribution";
8
+ export declare const TRANSACTION_TYPE_LABEL_FEE = "Fee";
9
+ export declare const TRANSACTION_TYPE_LABEL_INTEREST = "Interest";
10
+ export declare const TRANSACTION_TYPE_LABEL_OTHER = "Adjustment";
11
+ export declare const TRANSACTION_TYPE_OPTIONS: {
12
+ value: string;
13
+ label: string;
14
+ }[];
15
+ export declare const API_ENDPOINTS: {
16
+ readonly CASH_ACCOUNT_TRANSACTIONS: "/api/cash-account-transactions/";
17
+ };
18
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/services/cash_accounts/transactions/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,8BAA8B,YAAY,CAAC;AACxD,eAAO,MAAM,iCAAiC,eAAe,CAAC;AAC9D,eAAO,MAAM,uCAAuC,qBAAqB,CAAC;AAC1E,eAAO,MAAM,mCAAmC,iBAAiB,CAAC;AAClE,eAAO,MAAM,0BAA0B,QAAQ,CAAC;AAChD,eAAO,MAAM,+BAA+B,aAAa,CAAC;AAC1D,eAAO,MAAM,4BAA4B,eAAe,CAAC;AAGzD,eAAO,MAAM,wBAAwB;;;GAQpC,CAAC;AAGF,eAAO,MAAM,aAAa;;CAEhB,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Cash account transaction constants.
3
+ */
4
+ // Transaction Type label constants
5
+ export const TRANSACTION_TYPE_LABEL_DEPOSIT = 'Deposit';
6
+ export const TRANSACTION_TYPE_LABEL_WITHDRAWAL = 'Withdrawal';
7
+ export const TRANSACTION_TYPE_LABEL_TRADE_SETTLEMENT = 'Trade Settlement';
8
+ export const TRANSACTION_TYPE_LABEL_DISTRIBUTION = 'Distribution';
9
+ export const TRANSACTION_TYPE_LABEL_FEE = 'Fee';
10
+ export const TRANSACTION_TYPE_LABEL_INTEREST = 'Interest';
11
+ export const TRANSACTION_TYPE_LABEL_OTHER = 'Adjustment';
12
+ // Transaction Type options
13
+ export const TRANSACTION_TYPE_OPTIONS = [
14
+ { value: 'DEPOSIT', label: TRANSACTION_TYPE_LABEL_DEPOSIT },
15
+ { value: 'WITHDRAWAL', label: TRANSACTION_TYPE_LABEL_WITHDRAWAL },
16
+ { value: 'TRADE_SETTLEMENT', label: TRANSACTION_TYPE_LABEL_TRADE_SETTLEMENT },
17
+ { value: 'DISTRIBUTION', label: TRANSACTION_TYPE_LABEL_DISTRIBUTION },
18
+ { value: 'FEE', label: TRANSACTION_TYPE_LABEL_FEE },
19
+ { value: 'INTEREST', label: TRANSACTION_TYPE_LABEL_INTEREST },
20
+ { value: 'OTHER', label: TRANSACTION_TYPE_LABEL_OTHER },
21
+ ];
22
+ // API Endpoints
23
+ export const API_ENDPOINTS = {
24
+ CASH_ACCOUNT_TRANSACTIONS: '/api/cash-account-transactions/',
25
+ };
@@ -0,0 +1,4 @@
1
+ export type { CashAccountTransaction, CashAccountTransactionQueryParams, TransactionSummary, TransactionType, PaginatedCashAccountTransactions, TRANSACTION_TYPE_DEPOSIT, TRANSACTION_TYPE_WITHDRAWAL, TRANSACTION_TYPE_TRADE_SETTLEMENT, TRANSACTION_TYPE_DISTRIBUTION, TRANSACTION_TYPE_FEE, TRANSACTION_TYPE_INTEREST, TRANSACTION_TYPE_OTHER, } from './types';
2
+ export { getCashAccountTransactions, getCashAccountTransactionByUuid, getCashAccountTransactionsByAccount, getTransactionsByDateRange, getRecentTransactions, getTransactionTypeLabel, } from './service';
3
+ export { TRANSACTION_TYPE_LABEL_DEPOSIT, TRANSACTION_TYPE_LABEL_WITHDRAWAL, TRANSACTION_TYPE_LABEL_TRADE_SETTLEMENT, TRANSACTION_TYPE_LABEL_DISTRIBUTION, TRANSACTION_TYPE_LABEL_FEE, TRANSACTION_TYPE_LABEL_INTEREST, TRANSACTION_TYPE_LABEL_OTHER, TRANSACTION_TYPE_OPTIONS, } from './constants';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/cash_accounts/transactions/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,sBAAsB,EACtB,iCAAiC,EACjC,kBAAkB,EAClB,eAAe,EACf,gCAAgC,EAChC,wBAAwB,EACxB,2BAA2B,EAC3B,iCAAiC,EACjC,6BAA6B,EAC7B,oBAAoB,EACpB,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,0BAA0B,EAC1B,+BAA+B,EAC/B,mCAAmC,EACnC,0BAA0B,EAC1B,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,8BAA8B,EAC9B,iCAAiC,EACjC,uCAAuC,EACvC,mCAAmC,EACnC,0BAA0B,EAC1B,+BAA+B,EAC/B,4BAA4B,EAC5B,wBAAwB,GACzB,MAAM,aAAa,CAAC"}
@@ -0,0 +1,4 @@
1
+ // Export service functions
2
+ export { getCashAccountTransactions, getCashAccountTransactionByUuid, getCashAccountTransactionsByAccount, getTransactionsByDateRange, getRecentTransactions, getTransactionTypeLabel, } from './service';
3
+ // Export constants
4
+ export { TRANSACTION_TYPE_LABEL_DEPOSIT, TRANSACTION_TYPE_LABEL_WITHDRAWAL, TRANSACTION_TYPE_LABEL_TRADE_SETTLEMENT, TRANSACTION_TYPE_LABEL_DISTRIBUTION, TRANSACTION_TYPE_LABEL_FEE, TRANSACTION_TYPE_LABEL_INTEREST, TRANSACTION_TYPE_LABEL_OTHER, TRANSACTION_TYPE_OPTIONS, } from './constants';
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Cash account transaction API service functions.
3
+ */
4
+ import type { CashAccountTransaction, CashAccountTransactionQueryParams, PaginatedCashAccountTransactions, TransactionType } from './types';
5
+ export declare const getCashAccountTransactions: (params?: CashAccountTransactionQueryParams) => Promise<import("axios").AxiosResponse<PaginatedCashAccountTransactions, any>>;
6
+ export declare const getCashAccountTransactionByUuid: (uuid: string) => Promise<import("axios").AxiosResponse<CashAccountTransaction, any>>;
7
+ export declare const getCashAccountTransactionsByAccount: (cashAccountUuid: string, params?: Omit<CashAccountTransactionQueryParams, "cashAccount">) => Promise<import("axios").AxiosResponse<PaginatedCashAccountTransactions, any>>;
8
+ export declare const getTransactionsByDateRange: (startDate: string, endDate: string, params?: Omit<CashAccountTransactionQueryParams, "startDate" | "endDate">) => Promise<import("axios").AxiosResponse<PaginatedCashAccountTransactions, any>>;
9
+ export declare const getRecentTransactions: (days?: number, // Default to 30 days for recent transactions
10
+ params?: CashAccountTransactionQueryParams) => Promise<import("axios").AxiosResponse<PaginatedCashAccountTransactions, any>>;
11
+ export declare const getTransactionTypeLabel: (transactionType: TransactionType) => string;
12
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/services/cash_accounts/transactions/service.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EACV,sBAAsB,EACtB,iCAAiC,EACjC,gCAAgC,EAChC,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,0BAA0B,GAAI,SAAS,iCAAiC,kFA4BpF,CAAC;AAEF,eAAO,MAAM,+BAA+B,GAAI,MAAM,MAAM,wEAE3D,CAAC;AAEF,eAAO,MAAM,mCAAmC,GAC9C,iBAAiB,MAAM,EACvB,SAAS,IAAI,CAAC,iCAAiC,EAAE,aAAa,CAAC,kFAMhE,CAAC;AAEF,eAAO,MAAM,0BAA0B,GACrC,WAAW,MAAM,EACjB,SAAS,MAAM,EACf,SAAS,IAAI,CAAC,iCAAiC,EAAE,WAAW,GAAG,SAAS,CAAC,kFAO1E,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,OAAM,MAAW,EAAE,6CAA6C;AAChE,SAAS,iCAAiC,kFAM3C,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,iBAAiB,eAAe,KAAG,MAY1E,CAAC"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Cash account transaction API service functions.
3
+ */
4
+ import { webApiClient } from '../../../api/apiClient';
5
+ import { API_ENDPOINTS } from './constants';
6
+ export const getCashAccountTransactions = (params) => {
7
+ const queryParams = {};
8
+ if (params?.cashAccount) {
9
+ queryParams.cash_account = params.cashAccount;
10
+ }
11
+ if (params?.transactionType) {
12
+ queryParams.transaction_type = params.transactionType;
13
+ }
14
+ if (params?.startDate) {
15
+ queryParams.start_date = params.startDate;
16
+ }
17
+ if (params?.endDate) {
18
+ queryParams.end_date = params.endDate;
19
+ }
20
+ if (params?.minAmount !== undefined) {
21
+ queryParams.min_amount = params.minAmount.toString();
22
+ }
23
+ if (params?.maxAmount !== undefined) {
24
+ queryParams.max_amount = params.maxAmount.toString();
25
+ }
26
+ if (params?.orderBy) {
27
+ queryParams.order_by = params.orderBy;
28
+ }
29
+ return webApiClient.get(API_ENDPOINTS.CASH_ACCOUNT_TRANSACTIONS, {
30
+ params: queryParams,
31
+ });
32
+ };
33
+ export const getCashAccountTransactionByUuid = (uuid) => {
34
+ return webApiClient.get(`${API_ENDPOINTS.CASH_ACCOUNT_TRANSACTIONS}${uuid}/`);
35
+ };
36
+ export const getCashAccountTransactionsByAccount = (cashAccountUuid, params) => {
37
+ return getCashAccountTransactions({
38
+ ...params,
39
+ cashAccount: cashAccountUuid,
40
+ });
41
+ };
42
+ export const getTransactionsByDateRange = (startDate, endDate, params) => {
43
+ return getCashAccountTransactions({
44
+ ...params,
45
+ startDate,
46
+ endDate,
47
+ });
48
+ };
49
+ export const getRecentTransactions = (days = 30, // Default to 30 days for recent transactions
50
+ params) => {
51
+ const endDate = new Date().toISOString().split('T')[0];
52
+ const startDate = new Date(Date.now() - days * 24 * 60 * 60 * 1000).toISOString().split('T')[0];
53
+ return getTransactionsByDateRange(startDate, endDate, params);
54
+ };
55
+ export const getTransactionTypeLabel = (transactionType) => {
56
+ const labels = {
57
+ DEPOSIT: 'Deposit',
58
+ WITHDRAWAL: 'Withdrawal',
59
+ TRADE_SETTLEMENT: 'Trade Settlement',
60
+ DISTRIBUTION: 'Distribution',
61
+ FEE: 'Fee',
62
+ INTEREST: 'Interest',
63
+ OTHER: 'Adjustment',
64
+ };
65
+ return labels[transactionType];
66
+ };
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Cash account transaction types and interfaces.
3
+ */
4
+ import type { PaginatedResponse } from '../../../api/types';
5
+ export type { PaginatedResponse } from '../../../api/types';
6
+ export declare const TRANSACTION_TYPE_DEPOSIT = "DEPOSIT";
7
+ export declare const TRANSACTION_TYPE_WITHDRAWAL = "WITHDRAWAL";
8
+ export declare const TRANSACTION_TYPE_TRADE_SETTLEMENT = "TRADE_SETTLEMENT";
9
+ export declare const TRANSACTION_TYPE_DISTRIBUTION = "DISTRIBUTION";
10
+ export declare const TRANSACTION_TYPE_FEE = "FEE";
11
+ export declare const TRANSACTION_TYPE_INTEREST = "INTEREST";
12
+ export declare const TRANSACTION_TYPE_OTHER = "OTHER";
13
+ export type TransactionType = typeof TRANSACTION_TYPE_DEPOSIT | typeof TRANSACTION_TYPE_WITHDRAWAL | typeof TRANSACTION_TYPE_TRADE_SETTLEMENT | typeof TRANSACTION_TYPE_DISTRIBUTION | typeof TRANSACTION_TYPE_FEE | typeof TRANSACTION_TYPE_INTEREST | typeof TRANSACTION_TYPE_OTHER;
14
+ export interface CashAccountTransaction {
15
+ uuid: string;
16
+ cashAccount: string;
17
+ amount: string;
18
+ date: string;
19
+ transactionType: TransactionType;
20
+ reference: string;
21
+ }
22
+ export interface CashAccountTransactionQueryParams {
23
+ cashAccount?: string;
24
+ transactionType?: TransactionType;
25
+ startDate?: string;
26
+ endDate?: string;
27
+ minAmount?: number;
28
+ maxAmount?: number;
29
+ orderBy?: string;
30
+ }
31
+ export interface TransactionSummary {
32
+ totalDeposits: number;
33
+ totalWithdrawals: number;
34
+ netAmount: number;
35
+ transactionCount: number;
36
+ }
37
+ export type PaginatedCashAccountTransactions = PaginatedResponse<CashAccountTransaction>;
38
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/services/cash_accounts/transactions/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAG5D,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAG5D,eAAO,MAAM,wBAAwB,YAAY,CAAC;AAClD,eAAO,MAAM,2BAA2B,eAAe,CAAC;AACxD,eAAO,MAAM,iCAAiC,qBAAqB,CAAC;AACpE,eAAO,MAAM,6BAA6B,iBAAiB,CAAC;AAC5D,eAAO,MAAM,oBAAoB,QAAQ,CAAC;AAC1C,eAAO,MAAM,yBAAyB,aAAa,CAAC;AACpD,eAAO,MAAM,sBAAsB,UAAU,CAAC;AAE9C,MAAM,MAAM,eAAe,GACvB,OAAO,wBAAwB,GAC/B,OAAO,2BAA2B,GAClC,OAAO,iCAAiC,GACxC,OAAO,6BAA6B,GACpC,OAAO,oBAAoB,GAC3B,OAAO,yBAAyB,GAChC,OAAO,sBAAsB,CAAC;AAElC,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,eAAe,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,iCAAiC;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAGD,MAAM,MAAM,gCAAgC,GAAG,iBAAiB,CAAC,sBAAsB,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Cash account transaction types and interfaces.
3
+ */
4
+ // Transaction type constants
5
+ export const TRANSACTION_TYPE_DEPOSIT = 'DEPOSIT';
6
+ export const TRANSACTION_TYPE_WITHDRAWAL = 'WITHDRAWAL';
7
+ export const TRANSACTION_TYPE_TRADE_SETTLEMENT = 'TRADE_SETTLEMENT';
8
+ export const TRANSACTION_TYPE_DISTRIBUTION = 'DISTRIBUTION';
9
+ export const TRANSACTION_TYPE_FEE = 'FEE';
10
+ export const TRANSACTION_TYPE_INTEREST = 'INTEREST';
11
+ export const TRANSACTION_TYPE_OTHER = 'OTHER';
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Cash account types and interfaces.
3
+ */
4
+ import type { PaginatedResponse } from '../../api/types';
5
+ export type { PaginatedResponse } from '../../api/types';
6
+ export type CurrencyCode = 'AUD' | 'USD' | 'EUR' | 'GBP' | 'CAD' | 'NZD' | 'SGD' | 'HKD' | 'JPY';
7
+ export interface CashAccount {
8
+ uuid: string;
9
+ account: string;
10
+ accountNumber: string;
11
+ bsb?: string;
12
+ payid?: string;
13
+ currency: CurrencyCode;
14
+ balance: string;
15
+ }
16
+ export interface CashAccountQueryParams {
17
+ account?: string;
18
+ currency?: CurrencyCode;
19
+ minBalance?: number;
20
+ maxBalance?: number;
21
+ ordering?: string;
22
+ }
23
+ export type PaginatedCashAccounts = PaginatedResponse<CashAccount>;
24
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/cash_accounts/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGzD,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGzD,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAEjG,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAGD,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Cash account types and interfaces.
3
+ */
4
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cranberry-money/shared-services",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "Shared API services and client for MyPortfolio platform",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",