cas-parser-node 1.4.1 → 1.7.1

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 (181) hide show
  1. package/CHANGELOG.md +128 -0
  2. package/LICENSE +1 -1
  3. package/README.md +30 -32
  4. package/client.d.mts +51 -7
  5. package/client.d.mts.map +1 -1
  6. package/client.d.ts +51 -7
  7. package/client.d.ts.map +1 -1
  8. package/client.js +56 -12
  9. package/client.js.map +1 -1
  10. package/client.mjs +56 -12
  11. package/client.mjs.map +1 -1
  12. package/internal/parse.d.mts.map +1 -1
  13. package/internal/parse.d.ts.map +1 -1
  14. package/internal/parse.js +5 -0
  15. package/internal/parse.js.map +1 -1
  16. package/internal/parse.mjs +5 -0
  17. package/internal/parse.mjs.map +1 -1
  18. package/internal/to-file.d.mts +1 -1
  19. package/internal/to-file.d.ts +1 -1
  20. package/internal/to-file.js +1 -1
  21. package/internal/to-file.mjs +1 -1
  22. package/internal/tslib.js +17 -17
  23. package/package.json +9 -10
  24. package/resources/access-token.d.mts +48 -0
  25. package/resources/access-token.d.mts.map +1 -0
  26. package/resources/access-token.d.ts +48 -0
  27. package/resources/access-token.d.ts.map +1 -0
  28. package/resources/access-token.js +30 -0
  29. package/resources/access-token.js.map +1 -0
  30. package/resources/access-token.mjs +26 -0
  31. package/resources/access-token.mjs.map +1 -0
  32. package/resources/{cas-parser.d.mts → cams-kfintech.d.mts} +282 -105
  33. package/resources/cams-kfintech.d.mts.map +1 -0
  34. package/resources/{cas-parser.d.ts → cams-kfintech.d.ts} +282 -105
  35. package/resources/cams-kfintech.d.ts.map +1 -0
  36. package/resources/cams-kfintech.js +18 -0
  37. package/resources/cams-kfintech.js.map +1 -0
  38. package/resources/cams-kfintech.mjs +14 -0
  39. package/resources/cams-kfintech.mjs.map +1 -0
  40. package/resources/cdsl/cdsl.d.mts +39 -0
  41. package/resources/cdsl/cdsl.d.mts.map +1 -0
  42. package/resources/cdsl/cdsl.d.ts +39 -0
  43. package/resources/cdsl/cdsl.d.ts.map +1 -0
  44. package/resources/cdsl/cdsl.js +31 -0
  45. package/resources/cdsl/cdsl.js.map +1 -0
  46. package/resources/cdsl/cdsl.mjs +26 -0
  47. package/resources/cdsl/cdsl.mjs.map +1 -0
  48. package/resources/cdsl/fetch.d.mts +91 -0
  49. package/resources/cdsl/fetch.d.mts.map +1 -0
  50. package/resources/cdsl/fetch.d.ts +91 -0
  51. package/resources/cdsl/fetch.d.ts.map +1 -0
  52. package/resources/cdsl/fetch.js +50 -0
  53. package/resources/cdsl/fetch.js.map +1 -0
  54. package/resources/cdsl/fetch.mjs +46 -0
  55. package/resources/cdsl/fetch.mjs.map +1 -0
  56. package/resources/cdsl/index.d.mts +3 -0
  57. package/resources/cdsl/index.d.mts.map +1 -0
  58. package/resources/cdsl/index.d.ts +3 -0
  59. package/resources/cdsl/index.d.ts.map +1 -0
  60. package/resources/cdsl/index.js +9 -0
  61. package/resources/cdsl/index.js.map +1 -0
  62. package/resources/cdsl/index.mjs +4 -0
  63. package/resources/cdsl/index.mjs.map +1 -0
  64. package/resources/cdsl.d.mts +2 -0
  65. package/resources/cdsl.d.mts.map +1 -0
  66. package/resources/cdsl.d.ts +2 -0
  67. package/resources/cdsl.d.ts.map +1 -0
  68. package/resources/cdsl.js +6 -0
  69. package/resources/cdsl.js.map +1 -0
  70. package/resources/cdsl.mjs +3 -0
  71. package/resources/cdsl.mjs.map +1 -0
  72. package/resources/contract-note.d.mts +323 -0
  73. package/resources/contract-note.d.mts.map +1 -0
  74. package/resources/contract-note.d.ts +323 -0
  75. package/resources/contract-note.d.ts.map +1 -0
  76. package/resources/contract-note.js +49 -0
  77. package/resources/contract-note.js.map +1 -0
  78. package/resources/contract-note.mjs +45 -0
  79. package/resources/contract-note.mjs.map +1 -0
  80. package/resources/credits.d.mts +47 -0
  81. package/resources/credits.d.mts.map +1 -0
  82. package/resources/credits.d.ts +47 -0
  83. package/resources/credits.d.ts.map +1 -0
  84. package/resources/credits.js +23 -0
  85. package/resources/credits.js.map +1 -0
  86. package/resources/credits.mjs +19 -0
  87. package/resources/credits.mjs.map +1 -0
  88. package/resources/inbox.d.mts +206 -0
  89. package/resources/inbox.d.mts.map +1 -0
  90. package/resources/inbox.d.ts +206 -0
  91. package/resources/inbox.d.ts.map +1 -0
  92. package/resources/inbox.js +109 -0
  93. package/resources/inbox.js.map +1 -0
  94. package/resources/inbox.mjs +105 -0
  95. package/resources/inbox.mjs.map +1 -0
  96. package/resources/index.d.mts +11 -2
  97. package/resources/index.d.mts.map +1 -1
  98. package/resources/index.d.ts +11 -2
  99. package/resources/index.d.ts.map +1 -1
  100. package/resources/index.js +23 -5
  101. package/resources/index.js.map +1 -1
  102. package/resources/index.mjs +11 -2
  103. package/resources/index.mjs.map +1 -1
  104. package/resources/kfintech.d.mts +53 -0
  105. package/resources/kfintech.d.mts.map +1 -0
  106. package/resources/kfintech.d.ts +53 -0
  107. package/resources/kfintech.d.ts.map +1 -0
  108. package/resources/kfintech.js +29 -0
  109. package/resources/kfintech.js.map +1 -0
  110. package/resources/kfintech.mjs +25 -0
  111. package/resources/kfintech.mjs.map +1 -0
  112. package/resources/logs.d.mts +129 -0
  113. package/resources/logs.d.mts.map +1 -0
  114. package/resources/logs.d.ts +129 -0
  115. package/resources/logs.d.ts.map +1 -0
  116. package/resources/logs.js +37 -0
  117. package/resources/logs.js.map +1 -0
  118. package/resources/logs.mjs +33 -0
  119. package/resources/logs.mjs.map +1 -0
  120. package/resources/nsdl.d.mts +30 -0
  121. package/resources/nsdl.d.mts.map +1 -0
  122. package/resources/nsdl.d.ts +30 -0
  123. package/resources/nsdl.d.ts.map +1 -0
  124. package/resources/nsdl.js +18 -0
  125. package/resources/nsdl.js.map +1 -0
  126. package/resources/nsdl.mjs +14 -0
  127. package/resources/nsdl.mjs.map +1 -0
  128. package/resources/smart.d.mts +31 -0
  129. package/resources/smart.d.mts.map +1 -0
  130. package/resources/smart.d.ts +31 -0
  131. package/resources/smart.d.ts.map +1 -0
  132. package/resources/smart.js +19 -0
  133. package/resources/smart.js.map +1 -0
  134. package/resources/smart.mjs +15 -0
  135. package/resources/smart.mjs.map +1 -0
  136. package/resources/verify-token.d.mts +28 -0
  137. package/resources/verify-token.d.mts.map +1 -0
  138. package/resources/verify-token.d.ts +28 -0
  139. package/resources/verify-token.d.ts.map +1 -0
  140. package/resources/verify-token.js +16 -0
  141. package/resources/verify-token.js.map +1 -0
  142. package/resources/verify-token.mjs +12 -0
  143. package/resources/verify-token.mjs.map +1 -0
  144. package/src/client.ts +143 -31
  145. package/src/internal/parse.ts +6 -0
  146. package/src/internal/to-file.ts +1 -1
  147. package/src/resources/access-token.ts +63 -0
  148. package/src/resources/{cas-parser.ts → cams-kfintech.ts} +340 -130
  149. package/src/resources/cdsl/cdsl.ts +67 -0
  150. package/src/resources/cdsl/fetch.ts +122 -0
  151. package/src/resources/cdsl/index.ts +10 -0
  152. package/src/resources/cdsl.ts +3 -0
  153. package/src/resources/contract-note.ts +402 -0
  154. package/src/resources/credits.ts +58 -0
  155. package/src/resources/inbox.ts +283 -0
  156. package/src/resources/index.ts +31 -11
  157. package/src/resources/kfintech.ts +71 -0
  158. package/src/resources/logs.ts +170 -0
  159. package/src/resources/nsdl.ts +42 -0
  160. package/src/resources/smart.ts +46 -0
  161. package/src/resources/verify-token.ts +36 -0
  162. package/src/version.ts +1 -1
  163. package/version.d.mts +1 -1
  164. package/version.d.ts +1 -1
  165. package/version.js +1 -1
  166. package/version.mjs +1 -1
  167. package/resources/cas-generator.d.mts +0 -56
  168. package/resources/cas-generator.d.mts.map +0 -1
  169. package/resources/cas-generator.d.ts +0 -56
  170. package/resources/cas-generator.d.ts.map +0 -1
  171. package/resources/cas-generator.js +0 -27
  172. package/resources/cas-generator.js.map +0 -1
  173. package/resources/cas-generator.mjs +0 -23
  174. package/resources/cas-generator.mjs.map +0 -1
  175. package/resources/cas-parser.d.mts.map +0 -1
  176. package/resources/cas-parser.d.ts.map +0 -1
  177. package/resources/cas-parser.js +0 -43
  178. package/resources/cas-parser.js.map +0 -1
  179. package/resources/cas-parser.mjs +0 -39
  180. package/resources/cas-parser.mjs.map +0 -1
  181. package/src/resources/cas-generator.ts +0 -75
@@ -0,0 +1,323 @@
1
+ import { APIResource } from "../core/resource.mjs";
2
+ import { APIPromise } from "../core/api-promise.mjs";
3
+ import { RequestOptions } from "../internal/request-options.mjs";
4
+ export declare class ContractNote extends APIResource {
5
+ /**
6
+ * This endpoint parses Contract Note PDF files from various brokers including
7
+ * Zerodha, Groww, Upstox, ICICI Securities, and others.
8
+ *
9
+ * **What is a Contract Note?** A contract note is a legal document that provides
10
+ * details of all trades executed by an investor. It includes:
11
+ *
12
+ * - Trade details with timestamps, quantities, and prices
13
+ * - Brokerage and charges breakdown
14
+ * - Settlement information
15
+ * - Regulatory compliance details
16
+ *
17
+ * **Supported Brokers:**
18
+ *
19
+ * - Zerodha Broking Limited
20
+ * - Groww Invest Tech Private Limited
21
+ * - Upstox (RKSV Securities)
22
+ * - ICICI Securities Limited
23
+ * - Auto-detection for unknown brokers
24
+ *
25
+ * **Key Features:**
26
+ *
27
+ * - **Auto-detection**: Automatically identifies broker type from PDF content
28
+ * - **Comprehensive parsing**: Extracts equity transactions, derivatives
29
+ * transactions, detailed trades, and charges
30
+ * - **Flexible input**: Accepts both file upload and URL-based PDF input
31
+ * - **Password protection**: Supports password-protected PDFs
32
+ *
33
+ * The API returns structured data including contract note information, client
34
+ * details, transaction summaries, and detailed trade-by-trade breakdowns.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * const response = await client.contractNote.parse();
39
+ * ```
40
+ */
41
+ parse(body: ContractNoteParseParams, options?: RequestOptions): APIPromise<ContractNoteParseResponse>;
42
+ }
43
+ export interface ContractNoteParseResponse {
44
+ data?: ContractNoteParseResponse.Data;
45
+ msg?: string;
46
+ status?: string;
47
+ }
48
+ export declare namespace ContractNoteParseResponse {
49
+ interface Data {
50
+ broker_info?: Data.BrokerInfo;
51
+ /**
52
+ * Breakdown of various charges and fees
53
+ */
54
+ charges_summary?: Data.ChargesSummary;
55
+ client_info?: Data.ClientInfo;
56
+ contract_note_info?: Data.ContractNoteInfo;
57
+ /**
58
+ * Summary of derivatives transactions
59
+ */
60
+ derivatives_transactions?: Array<Data.DerivativesTransaction>;
61
+ /**
62
+ * Detailed breakdown of all individual trades
63
+ */
64
+ detailed_trades?: Array<Data.DetailedTrade>;
65
+ /**
66
+ * Summary of equity transactions grouped by security
67
+ */
68
+ equity_transactions?: Array<Data.EquityTransaction>;
69
+ }
70
+ namespace Data {
71
+ interface BrokerInfo {
72
+ /**
73
+ * Auto-detected or specified broker type
74
+ */
75
+ broker_type?: 'zerodha' | 'groww' | 'upstox' | 'icici' | 'unknown';
76
+ /**
77
+ * Broker company name
78
+ */
79
+ name?: string;
80
+ /**
81
+ * SEBI registration number of the broker
82
+ */
83
+ sebi_registration?: string;
84
+ }
85
+ /**
86
+ * Breakdown of various charges and fees
87
+ */
88
+ interface ChargesSummary {
89
+ /**
90
+ * Central GST amount
91
+ */
92
+ cgst?: number;
93
+ /**
94
+ * Exchange transaction charges
95
+ */
96
+ exchange_transaction_charges?: number;
97
+ /**
98
+ * Integrated GST amount
99
+ */
100
+ igst?: number;
101
+ /**
102
+ * Final net amount receivable or payable
103
+ */
104
+ net_amount_receivable_payable?: number;
105
+ /**
106
+ * Net pay-in/pay-out obligation
107
+ */
108
+ pay_in_pay_out_obligation?: number;
109
+ /**
110
+ * SEBI turnover fees
111
+ */
112
+ sebi_turnover_fees?: number;
113
+ /**
114
+ * Securities Transaction Tax
115
+ */
116
+ securities_transaction_tax?: number;
117
+ /**
118
+ * State GST amount
119
+ */
120
+ sgst?: number;
121
+ /**
122
+ * Stamp duty charges
123
+ */
124
+ stamp_duty?: number;
125
+ /**
126
+ * Taxable brokerage amount
127
+ */
128
+ taxable_value_brokerage?: number;
129
+ }
130
+ interface ClientInfo {
131
+ /**
132
+ * Client address
133
+ */
134
+ address?: string;
135
+ /**
136
+ * GST state code
137
+ */
138
+ gst_state_code?: string;
139
+ /**
140
+ * Client name
141
+ */
142
+ name?: string;
143
+ /**
144
+ * Client PAN number
145
+ */
146
+ pan?: string;
147
+ /**
148
+ * GST place of supply
149
+ */
150
+ place_of_supply?: string;
151
+ /**
152
+ * Unique Client Code
153
+ */
154
+ ucc?: string;
155
+ }
156
+ interface ContractNoteInfo {
157
+ /**
158
+ * Contract note reference number
159
+ */
160
+ contract_note_number?: string;
161
+ /**
162
+ * Settlement date for the trades
163
+ */
164
+ settlement_date?: string;
165
+ /**
166
+ * Settlement reference number
167
+ */
168
+ settlement_number?: string;
169
+ /**
170
+ * Date when trades were executed
171
+ */
172
+ trade_date?: string;
173
+ }
174
+ interface DerivativesTransaction {
175
+ /**
176
+ * Brokerage charged per unit
177
+ */
178
+ brokerage_per_unit?: number;
179
+ /**
180
+ * Transaction type (Buy/Sell/Bring Forward/Carry Forward)
181
+ */
182
+ buy_sell_bf_cf?: string;
183
+ /**
184
+ * Closing rate per unit
185
+ */
186
+ closing_rate_per_unit?: number;
187
+ /**
188
+ * Derivatives contract description
189
+ */
190
+ contract_description?: string;
191
+ /**
192
+ * Net total amount
193
+ */
194
+ net_total?: number;
195
+ /**
196
+ * Quantity traded
197
+ */
198
+ quantity?: number;
199
+ /**
200
+ * Weighted Average Price per unit
201
+ */
202
+ wap_per_unit?: number;
203
+ }
204
+ interface DetailedTrade {
205
+ /**
206
+ * Brokerage charged for this trade
207
+ */
208
+ brokerage?: number;
209
+ /**
210
+ * Transaction type (B for Buy, S for Sell)
211
+ */
212
+ buy_sell?: string;
213
+ /**
214
+ * Closing rate per unit
215
+ */
216
+ closing_rate_per_unit?: number;
217
+ /**
218
+ * Exchange name
219
+ */
220
+ exchange?: string;
221
+ /**
222
+ * Net rate per unit
223
+ */
224
+ net_rate_per_unit?: number;
225
+ /**
226
+ * Net total for this trade
227
+ */
228
+ net_total?: number;
229
+ /**
230
+ * Order reference number
231
+ */
232
+ order_number?: string;
233
+ /**
234
+ * Time when order was placed
235
+ */
236
+ order_time?: string;
237
+ /**
238
+ * Quantity traded
239
+ */
240
+ quantity?: number;
241
+ /**
242
+ * Additional remarks or notes
243
+ */
244
+ remarks?: string;
245
+ /**
246
+ * Security name with exchange and ISIN
247
+ */
248
+ security_description?: string;
249
+ /**
250
+ * Trade reference number
251
+ */
252
+ trade_number?: string;
253
+ /**
254
+ * Time when trade was executed
255
+ */
256
+ trade_time?: string;
257
+ }
258
+ interface EquityTransaction {
259
+ /**
260
+ * Total quantity purchased
261
+ */
262
+ buy_quantity?: number;
263
+ /**
264
+ * Total value of buy transactions
265
+ */
266
+ buy_total_value?: number;
267
+ /**
268
+ * Weighted Average Price for buy transactions
269
+ */
270
+ buy_wap?: number;
271
+ /**
272
+ * ISIN code of the security
273
+ */
274
+ isin?: string;
275
+ /**
276
+ * Net amount payable/receivable for this security
277
+ */
278
+ net_obligation?: number;
279
+ /**
280
+ * Name of the security
281
+ */
282
+ security_name?: string;
283
+ /**
284
+ * Trading symbol
285
+ */
286
+ security_symbol?: string;
287
+ /**
288
+ * Total quantity sold
289
+ */
290
+ sell_quantity?: number;
291
+ /**
292
+ * Total value of sell transactions
293
+ */
294
+ sell_total_value?: number;
295
+ /**
296
+ * Weighted Average Price for sell transactions
297
+ */
298
+ sell_wap?: number;
299
+ }
300
+ }
301
+ }
302
+ export interface ContractNoteParseParams {
303
+ /**
304
+ * Optional broker type override. If not provided, system will auto-detect.
305
+ */
306
+ broker_type?: 'zerodha' | 'groww' | 'upstox' | 'icici';
307
+ /**
308
+ * Password for the PDF file (usually PAN number for Zerodha)
309
+ */
310
+ password?: string;
311
+ /**
312
+ * Base64 encoded contract note PDF file
313
+ */
314
+ pdf_file?: string;
315
+ /**
316
+ * URL to the contract note PDF file
317
+ */
318
+ pdf_url?: string;
319
+ }
320
+ export declare namespace ContractNote {
321
+ export { type ContractNoteParseResponse as ContractNoteParseResponse, type ContractNoteParseParams as ContractNoteParseParams, };
322
+ }
323
+ //# sourceMappingURL=contract-note.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H,aAAa,CAAC,EAAE,MAAM,CAAC;YAEvB;;eAEG;YACH,eAAe,CAAC,EAAE,MAAM,CAAC;YAEzB;;eAEG;YACH,aAAa,CAAC,EAAE,MAAM,CAAC;YAEvB;;eAEG;YACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;YAE1B;;eAEG;YACH,QAAQ,CAAC,EAAE,MAAM,CAAC;SACnB;KACF;CACF;AAED,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,WAAW,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IAEvD;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,CAAC,OAAO,WAAW,YAAY,CAAC;IACpC,OAAO,EACL,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,uBAAuB,IAAI,uBAAuB,GACxD,CAAC;CACH"}
@@ -0,0 +1,323 @@
1
+ import { APIResource } from "../core/resource.js";
2
+ import { APIPromise } from "../core/api-promise.js";
3
+ import { RequestOptions } from "../internal/request-options.js";
4
+ export declare class ContractNote extends APIResource {
5
+ /**
6
+ * This endpoint parses Contract Note PDF files from various brokers including
7
+ * Zerodha, Groww, Upstox, ICICI Securities, and others.
8
+ *
9
+ * **What is a Contract Note?** A contract note is a legal document that provides
10
+ * details of all trades executed by an investor. It includes:
11
+ *
12
+ * - Trade details with timestamps, quantities, and prices
13
+ * - Brokerage and charges breakdown
14
+ * - Settlement information
15
+ * - Regulatory compliance details
16
+ *
17
+ * **Supported Brokers:**
18
+ *
19
+ * - Zerodha Broking Limited
20
+ * - Groww Invest Tech Private Limited
21
+ * - Upstox (RKSV Securities)
22
+ * - ICICI Securities Limited
23
+ * - Auto-detection for unknown brokers
24
+ *
25
+ * **Key Features:**
26
+ *
27
+ * - **Auto-detection**: Automatically identifies broker type from PDF content
28
+ * - **Comprehensive parsing**: Extracts equity transactions, derivatives
29
+ * transactions, detailed trades, and charges
30
+ * - **Flexible input**: Accepts both file upload and URL-based PDF input
31
+ * - **Password protection**: Supports password-protected PDFs
32
+ *
33
+ * The API returns structured data including contract note information, client
34
+ * details, transaction summaries, and detailed trade-by-trade breakdowns.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * const response = await client.contractNote.parse();
39
+ * ```
40
+ */
41
+ parse(body: ContractNoteParseParams, options?: RequestOptions): APIPromise<ContractNoteParseResponse>;
42
+ }
43
+ export interface ContractNoteParseResponse {
44
+ data?: ContractNoteParseResponse.Data;
45
+ msg?: string;
46
+ status?: string;
47
+ }
48
+ export declare namespace ContractNoteParseResponse {
49
+ interface Data {
50
+ broker_info?: Data.BrokerInfo;
51
+ /**
52
+ * Breakdown of various charges and fees
53
+ */
54
+ charges_summary?: Data.ChargesSummary;
55
+ client_info?: Data.ClientInfo;
56
+ contract_note_info?: Data.ContractNoteInfo;
57
+ /**
58
+ * Summary of derivatives transactions
59
+ */
60
+ derivatives_transactions?: Array<Data.DerivativesTransaction>;
61
+ /**
62
+ * Detailed breakdown of all individual trades
63
+ */
64
+ detailed_trades?: Array<Data.DetailedTrade>;
65
+ /**
66
+ * Summary of equity transactions grouped by security
67
+ */
68
+ equity_transactions?: Array<Data.EquityTransaction>;
69
+ }
70
+ namespace Data {
71
+ interface BrokerInfo {
72
+ /**
73
+ * Auto-detected or specified broker type
74
+ */
75
+ broker_type?: 'zerodha' | 'groww' | 'upstox' | 'icici' | 'unknown';
76
+ /**
77
+ * Broker company name
78
+ */
79
+ name?: string;
80
+ /**
81
+ * SEBI registration number of the broker
82
+ */
83
+ sebi_registration?: string;
84
+ }
85
+ /**
86
+ * Breakdown of various charges and fees
87
+ */
88
+ interface ChargesSummary {
89
+ /**
90
+ * Central GST amount
91
+ */
92
+ cgst?: number;
93
+ /**
94
+ * Exchange transaction charges
95
+ */
96
+ exchange_transaction_charges?: number;
97
+ /**
98
+ * Integrated GST amount
99
+ */
100
+ igst?: number;
101
+ /**
102
+ * Final net amount receivable or payable
103
+ */
104
+ net_amount_receivable_payable?: number;
105
+ /**
106
+ * Net pay-in/pay-out obligation
107
+ */
108
+ pay_in_pay_out_obligation?: number;
109
+ /**
110
+ * SEBI turnover fees
111
+ */
112
+ sebi_turnover_fees?: number;
113
+ /**
114
+ * Securities Transaction Tax
115
+ */
116
+ securities_transaction_tax?: number;
117
+ /**
118
+ * State GST amount
119
+ */
120
+ sgst?: number;
121
+ /**
122
+ * Stamp duty charges
123
+ */
124
+ stamp_duty?: number;
125
+ /**
126
+ * Taxable brokerage amount
127
+ */
128
+ taxable_value_brokerage?: number;
129
+ }
130
+ interface ClientInfo {
131
+ /**
132
+ * Client address
133
+ */
134
+ address?: string;
135
+ /**
136
+ * GST state code
137
+ */
138
+ gst_state_code?: string;
139
+ /**
140
+ * Client name
141
+ */
142
+ name?: string;
143
+ /**
144
+ * Client PAN number
145
+ */
146
+ pan?: string;
147
+ /**
148
+ * GST place of supply
149
+ */
150
+ place_of_supply?: string;
151
+ /**
152
+ * Unique Client Code
153
+ */
154
+ ucc?: string;
155
+ }
156
+ interface ContractNoteInfo {
157
+ /**
158
+ * Contract note reference number
159
+ */
160
+ contract_note_number?: string;
161
+ /**
162
+ * Settlement date for the trades
163
+ */
164
+ settlement_date?: string;
165
+ /**
166
+ * Settlement reference number
167
+ */
168
+ settlement_number?: string;
169
+ /**
170
+ * Date when trades were executed
171
+ */
172
+ trade_date?: string;
173
+ }
174
+ interface DerivativesTransaction {
175
+ /**
176
+ * Brokerage charged per unit
177
+ */
178
+ brokerage_per_unit?: number;
179
+ /**
180
+ * Transaction type (Buy/Sell/Bring Forward/Carry Forward)
181
+ */
182
+ buy_sell_bf_cf?: string;
183
+ /**
184
+ * Closing rate per unit
185
+ */
186
+ closing_rate_per_unit?: number;
187
+ /**
188
+ * Derivatives contract description
189
+ */
190
+ contract_description?: string;
191
+ /**
192
+ * Net total amount
193
+ */
194
+ net_total?: number;
195
+ /**
196
+ * Quantity traded
197
+ */
198
+ quantity?: number;
199
+ /**
200
+ * Weighted Average Price per unit
201
+ */
202
+ wap_per_unit?: number;
203
+ }
204
+ interface DetailedTrade {
205
+ /**
206
+ * Brokerage charged for this trade
207
+ */
208
+ brokerage?: number;
209
+ /**
210
+ * Transaction type (B for Buy, S for Sell)
211
+ */
212
+ buy_sell?: string;
213
+ /**
214
+ * Closing rate per unit
215
+ */
216
+ closing_rate_per_unit?: number;
217
+ /**
218
+ * Exchange name
219
+ */
220
+ exchange?: string;
221
+ /**
222
+ * Net rate per unit
223
+ */
224
+ net_rate_per_unit?: number;
225
+ /**
226
+ * Net total for this trade
227
+ */
228
+ net_total?: number;
229
+ /**
230
+ * Order reference number
231
+ */
232
+ order_number?: string;
233
+ /**
234
+ * Time when order was placed
235
+ */
236
+ order_time?: string;
237
+ /**
238
+ * Quantity traded
239
+ */
240
+ quantity?: number;
241
+ /**
242
+ * Additional remarks or notes
243
+ */
244
+ remarks?: string;
245
+ /**
246
+ * Security name with exchange and ISIN
247
+ */
248
+ security_description?: string;
249
+ /**
250
+ * Trade reference number
251
+ */
252
+ trade_number?: string;
253
+ /**
254
+ * Time when trade was executed
255
+ */
256
+ trade_time?: string;
257
+ }
258
+ interface EquityTransaction {
259
+ /**
260
+ * Total quantity purchased
261
+ */
262
+ buy_quantity?: number;
263
+ /**
264
+ * Total value of buy transactions
265
+ */
266
+ buy_total_value?: number;
267
+ /**
268
+ * Weighted Average Price for buy transactions
269
+ */
270
+ buy_wap?: number;
271
+ /**
272
+ * ISIN code of the security
273
+ */
274
+ isin?: string;
275
+ /**
276
+ * Net amount payable/receivable for this security
277
+ */
278
+ net_obligation?: number;
279
+ /**
280
+ * Name of the security
281
+ */
282
+ security_name?: string;
283
+ /**
284
+ * Trading symbol
285
+ */
286
+ security_symbol?: string;
287
+ /**
288
+ * Total quantity sold
289
+ */
290
+ sell_quantity?: number;
291
+ /**
292
+ * Total value of sell transactions
293
+ */
294
+ sell_total_value?: number;
295
+ /**
296
+ * Weighted Average Price for sell transactions
297
+ */
298
+ sell_wap?: number;
299
+ }
300
+ }
301
+ }
302
+ export interface ContractNoteParseParams {
303
+ /**
304
+ * Optional broker type override. If not provided, system will auto-detect.
305
+ */
306
+ broker_type?: 'zerodha' | 'groww' | 'upstox' | 'icici';
307
+ /**
308
+ * Password for the PDF file (usually PAN number for Zerodha)
309
+ */
310
+ password?: string;
311
+ /**
312
+ * Base64 encoded contract note PDF file
313
+ */
314
+ pdf_file?: string;
315
+ /**
316
+ * URL to the contract note PDF file
317
+ */
318
+ pdf_url?: string;
319
+ }
320
+ export declare namespace ContractNote {
321
+ export { type ContractNoteParseResponse as ContractNoteParseResponse, type ContractNoteParseParams as ContractNoteParseParams, };
322
+ }
323
+ //# sourceMappingURL=contract-note.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract-note.d.ts","sourceRoot":"","sources":["../src/resources/contract-note.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAGzB,qBAAa,YAAa,SAAQ,WAAW;IAC3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,KAAK,CAAC,IAAI,EAAE,uBAAuB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,yBAAyB,CAAC;CAMtG;AAED,MAAM,WAAW,yBAAyB;IACxC,IAAI,CAAC,EAAE,yBAAyB,CAAC,IAAI,CAAC;IAEtC,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,yBAAiB,yBAAyB,CAAC;IACzC,UAAiB,IAAI;QACnB,WAAW,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC;QAE9B;;WAEG;QACH,eAAe,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC;QAEtC,WAAW,CAAC,EAAE,IAAI,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