public function setOrderCapturedStatus(Order $order) 
    {  
        try {
            $transactionId = $order->transactions()->current()->id()->toString();
            $response = $this->getHttpClient()
                ->method(Http::POST)
                ->uri($this->baseUrl . 'orders/' . $order->id() . '/transactions/'. $transactionId . '/captures/')
                ->timeout(30)
                ->sends(Mime::JSON)
                ->send();

            if ($response->hasErrors()) {
                throw new \Exception($response->raw_body, $response->code);
            }

            return Transaction::fromArray($response->body);
        } catch (\Exception $exception) {
            if ($exception->getCode() == 404) {
                throw new OrderNotFoundException('No order with that ID was found.', 404, $exception);
            }
            throw new ClientException(
                'An error occurred while updating the order: '.$exception->getMessage(),
                $exception->getCode(),
                $exception
            );
        }
    }
public function setOrderCapturedStatus(Order $order) 
    {  
        try {
            $transactionId = $order->transactions()->current()->id()->toString();
            $response = $this->getHttpClient()
                ->method(Http::POST)
                ->uri($this->baseUrl . 'orders/' . $order->id() . '/transactions/'. $transactionId . '/captures/')
                ->timeout(30)
                ->sends(Mime::JSON)
                ->send();

            if ($response->hasErrors()) {
                throw new \Exception($response->raw_body, $response->code);
            }

            return Transaction::fromArray($response->body);
        } catch (\Exception $exception) {
            if ($exception->getCode() == 404) {
                throw new OrderNotFoundException('No order with that ID was found.', 404, $exception);
            }
            throw new ClientException(
                'An error occurred while updating the order: '.$exception->getMessage(),
                $exception->getCode(),
                $exception
            );
        }
    }
public function setOrderCapturedStatus ( Order $ order ) { try { $ transactionId = $ order -> transactions ( ) -> current ( ) -> id ( ) -> toString ( ) ; $ response = $ this -> getHttpClient ( ) -> method ( Http :: POST ) -> uri ( $ this -> baseUrl . 'orders/' . $ order -> id ( ) . '/transactions/' . $ transactionId . '/captures/' ) -> timeout ( 30 ) -> sends ( Mime :: JSON ) -> send ( ) ; if ( $ response -> hasErrors ( ) ) { throw new \ Exception ( $ response -> raw_body , $ response -> code ) ; } return Transaction :: fromArray ( $ response -> body ) ; } catch ( \ Exception $ exception ) { if ( $ exception -> getCode ( ) == 404 ) { throw new OrderNotFoundException ( 'No order with that ID was found.' , 404 , $ exception ) ; } throw new ClientException ( 'An error occurred while updating the order: ' . $ exception -> getMessage ( ) , $ exception -> getCode ( ) , $ exception ) ; } }
update the order status to captured

@param  Order $order
@throws OrderNotFoundException
@throws ClientException
@return Transaction
update the order status to captured