@vesant-sdk/transaction 0.1.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.
@@ -0,0 +1,84 @@
1
+ import { Timestamp, BaseClient, BaseClientConfig, RequestOptions } from '@vesant-sdk/core';
2
+
3
+ /**
4
+ * TypeScript types for the Transaction Monitoring (TM) Service
5
+ */
6
+
7
+ type TransactionType = "deposit" | "withdrawal" | "transfer" | "payment" | "refund" | "fee" | "adjustment";
8
+ type TransactionMode = "fiat" | "crypto" | "bank_transfer" | "card" | "wallet";
9
+ type TransactionStatus = "pending" | "processing" | "completed" | "failed" | "cancelled" | "reversed";
10
+ interface TransactionCreateDTO {
11
+ tx_id: string;
12
+ reference: string;
13
+ tenant_id: string;
14
+ customer_id: string;
15
+ transaction_type: TransactionType;
16
+ transaction_mode: TransactionMode;
17
+ amount: string;
18
+ currency: string;
19
+ status: TransactionStatus;
20
+ source_account: string;
21
+ destination_account: string;
22
+ country: string;
23
+ ip_address: string;
24
+ metadata: Record<string, any>;
25
+ benificiary_comment: string;
26
+ transaction_date: Timestamp;
27
+ }
28
+ type WithholdingType = "none" | "backup_us" | "backup_non_us" | "treaty";
29
+ type JSONB = Record<string, any>;
30
+ type Transaction = {
31
+ id: string;
32
+ tx_id: string;
33
+ reference: string;
34
+ tenant_id: string;
35
+ customer_id: string;
36
+ transaction_type: TransactionType;
37
+ transaction_mode: TransactionMode;
38
+ amount: string;
39
+ withheld_amount: string;
40
+ released_amount: string;
41
+ withholding_rate: number;
42
+ withholding_reason?: string;
43
+ withholding_type?: WithholdingType;
44
+ tax_year: number;
45
+ currency: string;
46
+ status: TransactionStatus;
47
+ source_account?: string;
48
+ destination_account?: string;
49
+ country?: string;
50
+ ip_address?: string;
51
+ risk_score: number;
52
+ metadata?: JSONB;
53
+ benificiary_comment?: string;
54
+ transaction_date: string;
55
+ created_at: string;
56
+ updated_at: string;
57
+ deleted_at?: string | null;
58
+ };
59
+ interface TransactionClientConfig {
60
+ baseURL: string;
61
+ tenantId: string;
62
+ apiKey?: string;
63
+ headers?: Record<string, string>;
64
+ timeout?: number;
65
+ retries?: number;
66
+ debug?: boolean;
67
+ environment?: 'production' | 'sandbox';
68
+ }
69
+ type TransactionCreateResponse = {
70
+ transaction: Transaction;
71
+ message: string;
72
+ };
73
+
74
+ /**
75
+ * TransactionClient — SDK for the Transaction Monitoring service
76
+ */
77
+
78
+ declare class TransactionClient extends BaseClient {
79
+ constructor(config: BaseClientConfig);
80
+ createTransaction(request: TransactionCreateDTO, requestOptions?: RequestOptions): Promise<TransactionCreateResponse>;
81
+ getTransaction(transactionId: string, requestOptions?: RequestOptions): Promise<void>;
82
+ }
83
+
84
+ export { type JSONB, type Transaction, TransactionClient, type TransactionClientConfig, type TransactionCreateDTO, type TransactionCreateResponse, type TransactionMode, type TransactionStatus, type TransactionType, type WithholdingType };
@@ -0,0 +1,84 @@
1
+ import { Timestamp, BaseClient, BaseClientConfig, RequestOptions } from '@vesant-sdk/core';
2
+
3
+ /**
4
+ * TypeScript types for the Transaction Monitoring (TM) Service
5
+ */
6
+
7
+ type TransactionType = "deposit" | "withdrawal" | "transfer" | "payment" | "refund" | "fee" | "adjustment";
8
+ type TransactionMode = "fiat" | "crypto" | "bank_transfer" | "card" | "wallet";
9
+ type TransactionStatus = "pending" | "processing" | "completed" | "failed" | "cancelled" | "reversed";
10
+ interface TransactionCreateDTO {
11
+ tx_id: string;
12
+ reference: string;
13
+ tenant_id: string;
14
+ customer_id: string;
15
+ transaction_type: TransactionType;
16
+ transaction_mode: TransactionMode;
17
+ amount: string;
18
+ currency: string;
19
+ status: TransactionStatus;
20
+ source_account: string;
21
+ destination_account: string;
22
+ country: string;
23
+ ip_address: string;
24
+ metadata: Record<string, any>;
25
+ benificiary_comment: string;
26
+ transaction_date: Timestamp;
27
+ }
28
+ type WithholdingType = "none" | "backup_us" | "backup_non_us" | "treaty";
29
+ type JSONB = Record<string, any>;
30
+ type Transaction = {
31
+ id: string;
32
+ tx_id: string;
33
+ reference: string;
34
+ tenant_id: string;
35
+ customer_id: string;
36
+ transaction_type: TransactionType;
37
+ transaction_mode: TransactionMode;
38
+ amount: string;
39
+ withheld_amount: string;
40
+ released_amount: string;
41
+ withholding_rate: number;
42
+ withholding_reason?: string;
43
+ withholding_type?: WithholdingType;
44
+ tax_year: number;
45
+ currency: string;
46
+ status: TransactionStatus;
47
+ source_account?: string;
48
+ destination_account?: string;
49
+ country?: string;
50
+ ip_address?: string;
51
+ risk_score: number;
52
+ metadata?: JSONB;
53
+ benificiary_comment?: string;
54
+ transaction_date: string;
55
+ created_at: string;
56
+ updated_at: string;
57
+ deleted_at?: string | null;
58
+ };
59
+ interface TransactionClientConfig {
60
+ baseURL: string;
61
+ tenantId: string;
62
+ apiKey?: string;
63
+ headers?: Record<string, string>;
64
+ timeout?: number;
65
+ retries?: number;
66
+ debug?: boolean;
67
+ environment?: 'production' | 'sandbox';
68
+ }
69
+ type TransactionCreateResponse = {
70
+ transaction: Transaction;
71
+ message: string;
72
+ };
73
+
74
+ /**
75
+ * TransactionClient — SDK for the Transaction Monitoring service
76
+ */
77
+
78
+ declare class TransactionClient extends BaseClient {
79
+ constructor(config: BaseClientConfig);
80
+ createTransaction(request: TransactionCreateDTO, requestOptions?: RequestOptions): Promise<TransactionCreateResponse>;
81
+ getTransaction(transactionId: string, requestOptions?: RequestOptions): Promise<void>;
82
+ }
83
+
84
+ export { type JSONB, type Transaction, TransactionClient, type TransactionClientConfig, type TransactionCreateDTO, type TransactionCreateResponse, type TransactionMode, type TransactionStatus, type TransactionType, type WithholdingType };
package/dist/index.js ADDED
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+
3
+ var core = require('@vesant-sdk/core');
4
+
5
+ // src/client.ts
6
+ var TransactionClient = class extends core.BaseClient {
7
+ constructor(config) {
8
+ super(config);
9
+ }
10
+ async createTransaction(request, requestOptions) {
11
+ const data = await this.requestWithRetry("/api/v1/tm/transactions", {
12
+ method: "POST",
13
+ body: JSON.stringify(request)
14
+ }, void 0, void 0, requestOptions);
15
+ return data;
16
+ }
17
+ async getTransaction(transactionId, requestOptions) {
18
+ await this.requestWithRetry(`/api/v1/tm/transactions/status/${transactionId}`, {
19
+ method: "GET"
20
+ }, void 0, void 0, requestOptions);
21
+ }
22
+ };
23
+
24
+ exports.TransactionClient = TransactionClient;
25
+ //# sourceMappingURL=index.js.map
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/client.ts"],"names":["BaseClient"],"mappings":";;;;;AAQO,IAAM,iBAAA,GAAN,cAAgCA,eAAA,CAAW;AAAA,EAChD,YAAY,MAAA,EAA0B;AACpC,IAAA,KAAA,CAAM,MAAM,CAAA;AAAA,EACd;AAAA,EAEA,MAAM,iBAAA,CACJ,OAAA,EACA,cAAA,EACoC;AACpC,IAAA,MAAM,IAAA,GAAO,MAAM,IAAA,CAAK,gBAAA,CAA4C,yBAAA,EAA2B;AAAA,MAC7F,MAAA,EAAQ,MAAA;AAAA,MACR,IAAA,EAAM,IAAA,CAAK,SAAA,CAAU,OAAO;AAAA,KAC9B,EAAG,MAAA,EAAW,MAAA,EAAW,cAAc,CAAA;AACvC,IAAA,OAAO,IAAA;AAAA,EACT;AAAA,EAEA,MAAM,cAAA,CAAe,aAAA,EAAuB,cAAA,EAAgD;AAC1F,IAAA,MAAM,IAAA,CAAK,gBAAA,CAAuB,CAAA,+BAAA,EAAkC,aAAa,CAAA,CAAA,EAAI;AAAA,MACnF,MAAA,EAAQ;AAAA,KACV,EAAG,MAAA,EAAW,MAAA,EAAW,cAAc,CAAA;AAAA,EACzC;AACF","file":"index.js","sourcesContent":["/**\n * TransactionClient — SDK for the Transaction Monitoring service\n */\n\nimport { BaseClient } from '@vesant-sdk/core';\nimport type { BaseClientConfig, RequestOptions } from '@vesant-sdk/core';\nimport type { TransactionCreateDTO, TransactionCreateResponse } from './types';\n\nexport class TransactionClient extends BaseClient {\n constructor(config: BaseClientConfig) {\n super(config);\n }\n\n async createTransaction(\n request: TransactionCreateDTO,\n requestOptions?: RequestOptions\n ): Promise<TransactionCreateResponse> {\n const data = await this.requestWithRetry<TransactionCreateResponse>('/api/v1/tm/transactions', {\n method: 'POST',\n body: JSON.stringify(request),\n }, undefined, undefined, requestOptions);\n return data;\n }\n\n async getTransaction(transactionId: string, requestOptions?: RequestOptions): Promise<void> {\n await this.requestWithRetry<void>(`/api/v1/tm/transactions/status/${transactionId}`, {\n method: 'GET',\n }, undefined, undefined, requestOptions);\n }\n}\n"]}
package/dist/index.mjs ADDED
@@ -0,0 +1,24 @@
1
+ import { BaseClient } from '@vesant-sdk/core';
2
+
3
+ // src/client.ts
4
+ var TransactionClient = class extends BaseClient {
5
+ constructor(config) {
6
+ super(config);
7
+ }
8
+ async createTransaction(request, requestOptions) {
9
+ const data = await this.requestWithRetry("/api/v1/tm/transactions", {
10
+ method: "POST",
11
+ body: JSON.stringify(request)
12
+ }, void 0, void 0, requestOptions);
13
+ return data;
14
+ }
15
+ async getTransaction(transactionId, requestOptions) {
16
+ await this.requestWithRetry(`/api/v1/tm/transactions/status/${transactionId}`, {
17
+ method: "GET"
18
+ }, void 0, void 0, requestOptions);
19
+ }
20
+ };
21
+
22
+ export { TransactionClient };
23
+ //# sourceMappingURL=index.mjs.map
24
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/client.ts"],"names":[],"mappings":";;;AAQO,IAAM,iBAAA,GAAN,cAAgC,UAAA,CAAW;AAAA,EAChD,YAAY,MAAA,EAA0B;AACpC,IAAA,KAAA,CAAM,MAAM,CAAA;AAAA,EACd;AAAA,EAEA,MAAM,iBAAA,CACJ,OAAA,EACA,cAAA,EACoC;AACpC,IAAA,MAAM,IAAA,GAAO,MAAM,IAAA,CAAK,gBAAA,CAA4C,yBAAA,EAA2B;AAAA,MAC7F,MAAA,EAAQ,MAAA;AAAA,MACR,IAAA,EAAM,IAAA,CAAK,SAAA,CAAU,OAAO;AAAA,KAC9B,EAAG,MAAA,EAAW,MAAA,EAAW,cAAc,CAAA;AACvC,IAAA,OAAO,IAAA;AAAA,EACT;AAAA,EAEA,MAAM,cAAA,CAAe,aAAA,EAAuB,cAAA,EAAgD;AAC1F,IAAA,MAAM,IAAA,CAAK,gBAAA,CAAuB,CAAA,+BAAA,EAAkC,aAAa,CAAA,CAAA,EAAI;AAAA,MACnF,MAAA,EAAQ;AAAA,KACV,EAAG,MAAA,EAAW,MAAA,EAAW,cAAc,CAAA;AAAA,EACzC;AACF","file":"index.mjs","sourcesContent":["/**\n * TransactionClient — SDK for the Transaction Monitoring service\n */\n\nimport { BaseClient } from '@vesant-sdk/core';\nimport type { BaseClientConfig, RequestOptions } from '@vesant-sdk/core';\nimport type { TransactionCreateDTO, TransactionCreateResponse } from './types';\n\nexport class TransactionClient extends BaseClient {\n constructor(config: BaseClientConfig) {\n super(config);\n }\n\n async createTransaction(\n request: TransactionCreateDTO,\n requestOptions?: RequestOptions\n ): Promise<TransactionCreateResponse> {\n const data = await this.requestWithRetry<TransactionCreateResponse>('/api/v1/tm/transactions', {\n method: 'POST',\n body: JSON.stringify(request),\n }, undefined, undefined, requestOptions);\n return data;\n }\n\n async getTransaction(transactionId: string, requestOptions?: RequestOptions): Promise<void> {\n await this.requestWithRetry<void>(`/api/v1/tm/transactions/status/${transactionId}`, {\n method: 'GET',\n }, undefined, undefined, requestOptions);\n }\n}\n"]}
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@vesant-sdk/transaction",
3
+ "version": "0.1.0",
4
+ "description": "Transaction monitoring client for the Vesant Compliance Platform",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.mjs",
12
+ "require": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": ["dist"],
16
+ "scripts": {
17
+ "build": "tsup",
18
+ "dev": "tsup --watch",
19
+ "test": "vitest run",
20
+ "test:watch": "vitest",
21
+ "type-check": "tsc --noEmit",
22
+ "lint": "eslint src --ext .ts"
23
+ },
24
+ "keywords": ["vesant", "compliance", "transaction", "transaction-monitoring"],
25
+ "author": "Vesant Compliance",
26
+ "license": "MIT",
27
+ "dependencies": {
28
+ "@vesant-sdk/core": "0.1.0"
29
+ },
30
+ "devDependencies": {
31
+ "msw": "^2.4.0",
32
+ "tsup": "^8.0.0",
33
+ "typescript": "^5.3.0",
34
+ "vitest": "^2.0.0"
35
+ },
36
+ "sideEffects": false,
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "https://github.com/botcalm-compliance/vesant-sdk.git",
40
+ "directory": "typescript/packages/transaction"
41
+ }
42
+ }