Update an order transaction
https://developers.taxjar.com/api/?php#update-an-refund-transaction

@param array $parameters

@return object Order object.
514025
public function updateRefund($parameters = [])
    {
        $response = $this->client->put('transactions/refunds/' . $parameters['transaction_id'], [
            'json' => $parameters,
        ]);
        return json_decode($response->getBody())->refund;
    }
998615
public function updateOrderPayment($order, $transaction = null, $reference = null, $hookType = null)
    {
        // Fetch transaction info if transaction is not passed as a parameter
        if ($reference && !$transaction) {
            $transaction = $this->fetchTransactionInfo($reference);
        } else {
            $reference = $transaction->reference;
        }

        /** @var OrderPaymentInterface $payment */
        $payment = $order->getPayment();

        $this->checkPaymentMethod($payment);

        // Check for total amount mismatch between magento and bolt order.
        $this->holdOnTotalsMismatch($order, $transaction);

        // Get the last stored transaction parameters
        $prevTransactionState = $payment->getAdditionalInformation('transaction_state');
        $prevTransactionReference = $payment->getAdditionalInformation('transaction_reference');

        // Get the transaction state
        $transactionState = $this->getTransactionState($transaction, $payment, $hookType);

        $newCapture = in_array($transactionState, [self::TS_CAPTURED, self::TS_COMPLETED])
            ? $this->getUnprocessedCapture($payment, $transaction)
            : null;

        // Skip if there is no state change (i.e. fetch transaction call from admin panel / Payment model)
        // Reference check and $newCapture were added to support multiple refunds and captures,
        // valid same state transitions
        if (
            $transactionState == $prevTransactionState &&
            $reference == $prevTransactionReference &&
            !$newCapture
        ) {
            if ($this->isAnAllowedUpdateFromAdminPanel($order, $transactionState)){
                $payment->setIsTransactionApproved(true);
            }
            return;
        }

        if (!$this->validateTransition($prevTransactionState, $transactionState)) {
            throw new LocalizedException(__(
                'Invalid transaction state transition: %1 -> %2',
                $prevTransactionState,
                $transactionState
            ));
        }

        // preset default payment / transaction values
        // before more specific changes below
        if ($newCapture) {
            $amount = $newCapture->amount->amount;
        } else {
            $amount = $transaction->amount->amount;
        }
        $transactionId = $transaction->id;

        $realTransactionId = $parentTransactionId = $payment->getAdditionalInformation('real_transaction_id');
        $realTransactionId = $realTransactionId ?: $transaction->id;
        $paymentAuthorized = (bool)$payment->getAdditionalInformation('authorized');

        $processedCaptures = $this->getProcessedCaptures($payment);
        $processedRefunds = $this->getProcessedRefunds($payment);

        switch ($transactionState) {

            case self::TS_ZERO_AMOUNT:
                $orderState = OrderModel::STATE_PROCESSING;
                $transactionType = Transaction::TYPE_ORDER;
                break;

            case self::TS_PENDING:
                $orderState = OrderModel::STATE_PAYMENT_REVIEW;
                $transactionType = Transaction::TYPE_ORDER;
                break;

            case self::TS_AUTHORIZED:
                $orderState = OrderModel::STATE_PROCESSING;
                $transactionType = Transaction::TYPE_AUTH;
                $transactionId = $transaction->id.'-auth';
                break;

            case self::TS_CAPTURED:
                if (!$newCapture) return;
                $orderState = OrderModel::STATE_PROCESSING;
                $transactionType = Transaction::TYPE_CAPTURE;
                $transactionId = $transaction->id.'-capture-'.$newCapture->id;
                $parentTransactionId = $transaction->id.'-auth';
                break;

            case self::TS_PARTIAL_VOIDED:
                $authorizationTransaction = $payment->getAuthorizationTransaction();
                $authorizationTransaction->closeAuthorization();
                $order->addCommentToStatusHistory($this->getVoidMessage($payment));
                $order->save();
                return;

            case self::TS_COMPLETED:
                if (!$newCapture) return;
                $orderState = OrderModel::STATE_PROCESSING;
                $transactionType = Transaction::TYPE_CAPTURE;
                if ($paymentAuthorized) {
                    $transactionId = $transaction->id.'-capture-'.$newCapture->id;
                    $parentTransactionId = $transaction->id.'-auth';
                } else {
                    $transactionId = $transaction->id.'-payment';
                }
                break;

            case self::TS_CANCELED:
                $orderState = OrderModel::STATE_CANCELED;
                $transactionType = Transaction::TYPE_VOID;
                $transactionId = $transaction->id.'-void';
                $parentTransactionId = $paymentAuthorized ? $transaction->id.'-auth' : $transaction->id;
                break;

            case self::TS_REJECTED_REVERSIBLE:
                $orderState = OrderModel::STATE_HOLDED;
                $transactionType = Transaction::TYPE_ORDER;
                $transactionId = $transaction->id.'-rejected_reversible';
                break;

            case self::TS_REJECTED_IRREVERSIBLE:
                $orderState = OrderModel::STATE_CANCELED;
                $transactionType = Transaction::TYPE_ORDER;
                $transactionId = $transaction->id.'-rejected_irreversible';
                break;

            case self::TS_CREDIT_COMPLETED:
                if (in_array($transaction->id, $processedRefunds)) return;
                $transactionType = Transaction::TYPE_REFUND;
                $transactionId = $transaction->id.'-refund';
                if (Hook::$fromBolt) {
                    // Refunds need to be initiated from the store admin (Invoice -> Credit Memo)
                    // If called from Bolt merchant dashboard there is no enough info to sync the totals
                    $orderState = OrderModel::STATE_HOLDED;
                } else {
                    $orderState = OrderModel::STATE_PROCESSING;
                }
                break;

            default:
                throw new LocalizedException(__(
                    'Unhandled transaction state : %1',
                    $transactionState
                ));
                break;
        }

        // set order state and status
        $this->setOrderState($order, $orderState);

        // format the last transaction data for storing within the order payment record instance

        if ($newCapture) {
            array_push($processedCaptures, $newCapture->id);
        }

        if ($transactionState == self::TS_CREDIT_COMPLETED) {
            array_push($processedRefunds, $transaction->id);
        }

        $paymentData = [
            'real_transaction_id' => $realTransactionId,
            'transaction_reference' => $transaction->reference,
            'transaction_state' => $transactionState,
            'authorized' => $paymentAuthorized || in_array($transactionState, [self::TS_AUTHORIZED, self::TS_CAPTURED]),
            'captures' => implode(',', $processedCaptures),
            'refunds' => implode(',', $processedRefunds)
        ];

        // format the price with currency symbol
        $formattedPrice = $order->getBaseCurrency()->formatTxt($amount / 100);

        $message = __(
            'BOLTPAY INFO :: PAYMENT Status: %1 Amount: %2<br>Bolt transaction: %3',
            $this->getBoltTransactionStatus($transactionState),
            $formattedPrice,
            $this->formatReferenceUrl($transaction->reference)
        );

        $transactionData = $this->formatTransactionData($order, $transaction, $amount);

        // update order payment instance
        $payment->setParentTransactionId($parentTransactionId);
        $payment->setTransactionId($transactionId);
        $payment->setLastTransId($transactionId);
        $payment->setAdditionalInformation($paymentData);
        $payment->setIsTransactionClosed($transactionType != Transaction::TYPE_AUTH);

        // We will create an invoice if we have zero amount or new capture.
        if ($this->isCaptureHookRequest($newCapture) || $this->isZeroAmountHook($transactionState)) {
            $this->validateCaptureAmount($order, $amount / 100);
            $invoice = $this->createOrderInvoice($order, $realTransactionId, $amount / 100);
        }

        if (!$order->getTotalDue()) {
            $payment->setShouldCloseParentTransaction(true);
        }

        if ($newCapture && @$invoice) {
            $this->_eventManager->dispatch(
                'sales_order_payment_capture',
                ['payment' => $payment, 'invoice' => $invoice]
            );
        }

        // build a new transaction record and assign it to the order and payment
        /** @var Transaction $payment_transaction */
        $payment_transaction = $this->transactionBuilder->setPayment($payment)
            ->setOrder($order)
            ->setTransactionId($transactionId)
            ->setAdditionalInformation([
                Transaction::RAW_DETAILS => $transactionData
            ])
            ->setFailSafe(true)
            ->build($transactionType);

        $payment->addTransactionCommentsToOrder(
            $payment_transaction,
            $message
        );

        $payment_transaction->save();

        // save payment and order
        $payment->save();
        $order->save();
    }
1330792
public function update($order)
    {
        $orderId = "";

        if (is_array($order)) {
            $orderId = $order["id"];
        }
        elseif (is_object($order)) {
            $orderId = $order->id;
        }

        return $this->client->put("/orders/" . rawurlencode($orderId), $order, null);
    }
599819
public function refund($params, $opts = null)
    {
        $url = self::classUrl() . '/' . $this->instanceId() . "/refund";
        list($resp, $usedOpts) = self::request(self::METHOD_POST, $url, $params, $opts);
        $this->install($resp, $usedOpts);
        return $this;
    }
1226629
public function createRefund($parameters = [])
    {
        $response = $this->client->post('transactions/refunds', [
            'json' => $parameters,
        ]);
        return json_decode($response->getBody())->refund;
    }
931384
public function transform(array $parameters)
    {
        $transformed = array();

        foreach ($parameters as $name => $value) {
            $transformed[$name] = $this->transformerResolver->resolve($value)->transform($value);
        }

        return $transformed;
    }
1039749
public function refundPayment(PayoneRefundTransfer $refundTransfer)
    {
        $payonePaymentTransfer = $refundTransfer->getPayment();

        $paymentEntity = $this->getPaymentEntity($payonePaymentTransfer->getFkSalesOrder());
        $paymentMethodMapper = $this->getPaymentMethodMapper($paymentEntity);
        $requestContainer = $paymentMethodMapper->mapPaymentToRefund($paymentEntity);
        $requestContainer->setAmount(0 - $paymentEntity->getSpyPaymentPayoneDetail()->getAmount());
        $requestContainer = $this->prepareOrderItems($refundTransfer->getOrder(), $requestContainer);
        $requestContainer = $this->prepareOrderShipment($refundTransfer->getOrder(), $requestContainer);
        $requestContainer = $this->prepareOrderDiscount($refundTransfer->getOrder(), $requestContainer);

        $this->setStandardParameter($requestContainer);

        $apiLogEntity = $this->initializeApiLog($paymentEntity, $requestContainer);

        $rawResponse = $this->executionAdapter->sendRequest($requestContainer);
        $responseContainer = new RefundResponseContainer($rawResponse);

        $this->updateApiLogAfterRefund($apiLogEntity, $responseContainer);

        $responseMapper = new RefundResponseMapper();
        $responseTransfer = $responseMapper->getRefundResponseTransfer($responseContainer);

        return $responseTransfer;
    }
551801
public function update(array $params = [])
    {
        $params = array_intersect_key(
            $params,
            array_flip([
                'statusId',
                'orderId',
                'paymentStatusId',
                'additionalInfo',
                'paymentStatusDescription'
            ])
        );

        //Update current order with params
        $order = $this->client
            ->orders($this->client->getVersion())
            ->update($this->getId(), $params);

        //Get order by current orderId with items
        $orderWithItems = $this->client->orders($this->client->getVersion())->byId($this->getId());
        $order->items = $orderWithItems->items;

        //Set data to current order
        $this->setOrderData($order);
    }
801064
public function queryRefund(array $options)
    {
        $pay = new Refund($this->config->get());
        return $pay->query($options);
    }
668263
public static function listAllOrderLineItemsAsync(array $parameters = [])
    {
        return self::listAllOrderLineItemsAsyncWithHttpInfo($page, $size, $sort)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }
313274
public function parameters(array $parameters): HttpRequest
    {
        foreach ($parameters as $name => $value) {
            $this->parameter($name, $value);
        }

        return $this;
    }
1002724
public function update(Transaction $transaction, UpdateTransactionRequest $request)
    {
        $this->transaction->update($transaction, $request->all());

        return redirect()->route('admin.order.order.show', $transaction->order_id)
            ->withSuccess(trans('core::core.messages.resource updated', ['name' => trans('order::transactions.title.transactions')]));
    }
547830
public function create($parameters)
    {
        return $this->update($this->repository->newEntity(), $parameters, Tokens::PERMISSION_CREATE);
    }
257037
protected static function deleteRefundTransactionByIdAsyncWithHttpInfo($refund_transaction_id) 
    {
        $returnType = '';  
        $request = self::deleteRefundTransactionByIdRequest($refund_transaction_id); 

        return self::getHttpClient()
            ->sendAsync($request, self::createHttpClientOption())
            ->then(
                function ($response) use ($returnType) {
                    return [null, $response->getStatusCode(), $response->getHeaders()];
                },
                function ($exception) {
                    $response = $exception->getResponse();
                    $statusCode = $response->getStatusCode();
                    throw new ApiException(
                        sprintf(
                            '[%d] Error connecting to the API (%s)',
                            $statusCode,
                            $exception->getRequest()->getUri()
                        ),
                        $statusCode,
                        $response->getHeaders(),
                        $response->getBody()
                    );
                }
            );
    }
457403
public static function listAllTaxClassesAsync(array $parameters = [])
    {
        return self::listAllTaxClassesAsyncWithHttpInfo($page, $size, $sort)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }
695933
public function refund($data = [])
    {
        $resource = "payments/" . urlencode($this->id) . "/refunds";

        $body = null;
        if (count($data) > 0) {
            $body = json_encode($data);
        }

        $result = $this->client->performHttpCall(
            MollieApiClient::HTTP_POST,
            $resource,
            $body
        );

        return ResourceFactory::createFromApiResult(
            $result,
            new Refund($this->client)
        );
    }
602007
public function update($sql, $parameters = array()) {
        DB::addQueryLog($sql, $parameters);
        return $this->getEngine()->update($sql, $parameters);
    }