|
17 | 17 | use KiteConnect\Exception\OrderException; |
18 | 18 | use KiteConnect\Exception\PermissionException; |
19 | 19 | use KiteConnect\Exception\TokenException; |
20 | | -use phpDocumentor\Reflection\Types\Mixed_; |
21 | 20 | use stdClass; |
22 | 21 |
|
23 | 22 | /** |
|
49 | 48 | * use one instance to manage many users. |
50 | 49 | * Hence, in your web application, typically: |
51 | 50 | * - You will initialise an instance of the Kite client |
52 | | - * - Redirect the user to the `login_url()` |
| 51 | + * - Redirect the user to the `getLoginURL()` |
53 | 52 | * - At the redirect url endpoint, obtain the |
54 | 53 | * `request_token` from the query parameters |
55 | 54 | * - Initialise a new instance of Kite client, |
@@ -154,6 +153,7 @@ class KiteConnect |
154 | 153 | "order.cancel" => "/orders/{variety}/{order_id}", |
155 | 154 | "order.trades" => "/orders/{order_id}/trades", |
156 | 155 | "order.margins" => "/margins/orders", |
| 156 | + "order.contract_note" => "/charges/orders", |
157 | 157 |
|
158 | 158 | "portfolio.positions" => "/portfolio/positions", |
159 | 159 | "portfolio.holdings" => "/portfolio/holdings", |
@@ -208,6 +208,9 @@ class KiteConnect |
208 | 208 | /** @var Closure */ |
209 | 209 | private $sessionHook; |
210 | 210 |
|
| 211 | + /** @var \GuzzleHttp\Client|null */ |
| 212 | + private ?\GuzzleHttp\Client $guzzleClient; |
| 213 | + |
211 | 214 | /** |
212 | 215 | * Initialise a new Kite Connect client instance. |
213 | 216 | * |
@@ -389,7 +392,7 @@ public function renewAccessToken(string $refreshToken, string $apiSecret): array |
389 | 392 | * @throws PermissionException |
390 | 393 | * @throws TokenException |
391 | 394 | */ |
392 | | - public function invalidateRefreshToken(string $refreshToken): Mixed_ |
| 395 | + public function invalidateRefreshToken(string $refreshToken): mixed |
393 | 396 | { |
394 | 397 | return $this->delete("api.token.invalidate", [ |
395 | 398 | "refresh_token" => $refreshToken, |
@@ -498,7 +501,7 @@ public function placeOrder(string $variety, array $params) |
498 | 501 | * @throws PermissionException |
499 | 502 | * @throws TokenException |
500 | 503 | */ |
501 | | - public function modifyOrder(string $variety, string $orderId, array $params): Mixed_ |
| 504 | + public function modifyOrder(string $variety, string $orderId, array $params): mixed |
502 | 505 | { |
503 | 506 | $params["variety"] = $variety; |
504 | 507 | $params["order_id"] = $orderId; |
@@ -610,6 +613,33 @@ public function orderMargins(array $params): array |
610 | 613 | return $this->post("order.margins", (array)json_encode($params), 'application/json'); |
611 | 614 | } |
612 | 615 |
|
| 616 | + /** |
| 617 | + * Fetch detailed charges order-wise for the order book |
| 618 | + * |
| 619 | + * @param array $params Order params to fetch charges detail |
| 620 | + * $params string "order_id" Unique order ID |
| 621 | + * $params string "exchange" Name of the exchange(eg. NSE, BSE, NFO, CDS, MCX) |
| 622 | + * $params string "tradingsymbol" Trading symbol of the instrument |
| 623 | + * $params string "transaction_type" eg. BUY, SELL |
| 624 | + * $params string "variety" Order variety (regular, amo, bo, co etc.) |
| 625 | + * $params string "product" Margin product to use for the order |
| 626 | + * $params string "order_type" Order type (MARKET, LIMIT etc.) |
| 627 | + * $params int "quantity" Quantity of the order |
| 628 | + * $params float "average_price" Average price at which the order was executed (Note: Should be non-zero). |
| 629 | + * @return array |
| 630 | + * @throws DataException |
| 631 | + * @throws GeneralException |
| 632 | + * @throws InputException |
| 633 | + * @throws NetworkException |
| 634 | + * @throws OrderException |
| 635 | + * @throws PermissionException |
| 636 | + * @throws TokenException |
| 637 | + */ |
| 638 | + public function getVirtualContractNote(array $params): array |
| 639 | + { |
| 640 | + return $this->post("order.contract_note", (array)json_encode($params), 'application/json'); |
| 641 | + } |
| 642 | + |
613 | 643 | /** |
614 | 644 | * Retrieve the list of trades executed. |
615 | 645 | * @return array |
@@ -1509,7 +1539,7 @@ private function request(string $route, string $method, array $params, string $h |
1509 | 1539 | * @param array|null $params Array of key=>value request parameters. |
1510 | 1540 | * @return array Returns an array with response "headers" and "body". |
1511 | 1541 | */ |
1512 | | - private function guzzle(string $url, string $method, ?array $headers, $params = null, $guzzleClient = null): array |
| 1542 | + private function guzzle(string $url, string $method, ?array $headers, $params = null, ?\GuzzleHttp\Client $guzzleClient = null): array |
1513 | 1543 | { |
1514 | 1544 | // set header to Guzzle http client |
1515 | 1545 | // mock patching isn't allowed in PHP |
|
0 commit comments