Cancel a transaction

@param int $mpayTid The mPAY24 transaction ID for the transaction you want to cancel

@return ManualReverseResponse
191244
public function manualReverse($mpayTid)
    {
        $request = new ManualReverse($this->config->getMerchantId());

        $request->setMpayTid($mpayTid);

        $this->request = $request->getXml();

        $this->send();

        $result = new ManualReverseResponse($this->response);

        return $result;
    }
1060618
public function cancel($reference = null, $subscriptionId = null)
    {
        if ($reference) {
          $this->setParameter('REFERENCE', $reference);
        }

        if ($subscriptionId) {
          $this->setParameter('ABONNEMENT', $subscriptionId);
        }

        $this->transport->setEndpoint($this->getUrl());

        return $this->transport->call($this);
    }
783076
def cancel(self, order_id):
        """"""

        response = self.request(E.cancelSslCertRequest(
            E.id(order_id)
        ))

        return int(response.data.id)
360311
public function cancelTransaction($params)
    {
        $this->sdk->ServiceURL = $this->getApiEndpoint('DoAction');
        $this->sdk->Action = array_replace(
            $this->sdk->Action,
            array_intersect_key($params, $this->sdk->Action)
        );

        return $this->sdk->DoAction();
    }
702714
public function cancel()
    {
        $data = $this->twisto->requestJson('POST', 'invoice/' . urlencode($this->invoice_id) . '/cancel/');
        $this->deserialize($data);
    }
334750
public static function cancel_data_request($requestid) {
        global $USER;

        $warnings = [];
        $params = external_api::validate_parameters(self::cancel_data_request_parameters(), [
            'requestid' => $requestid
        ]);
        $requestid = $params['requestid'];

        // Validate context and access to manage the registry.
        $context = context_user::instance($USER->id);
        self::validate_context($context);

        // Ensure the request exists.
        $select = 'id = :id AND (userid = :userid OR requestedby = :requestedby)';
        $params = ['id' => $requestid, 'userid' => $USER->id, 'requestedby' => $USER->id];
        $requests = data_request::get_records_select($select, $params);
        $requestexists = count($requests) === 1;

        $result = false;
        if ($requestexists) {
            $request = reset($requests);
            $datasubject = $request->get('userid');

            if ($datasubject !== $USER->id) {
                // The user is not the subject. Check that they can cancel this request.
                if (!api::can_create_data_request_for_user($datasubject)) {
                    $forusercontext = \context_user::instance($datasubject);
                    throw new required_capability_exception($forusercontext,
                            'tool/dataprivacy:makedatarequestsforchildren', 'nopermissions', '');
                }
            }

            // TODO: Do we want a request to be non-cancellable past a certain point? E.g. When it's already approved/processing.
            $result = api::update_request_status($requestid, api::DATAREQUEST_STATUS_CANCELLED);
        } else {
            $warnings[] = [
                'item' => $requestid,
                'warningcode' => 'errorrequestnotfound',
                'message' => get_string('errorrequestnotfound', 'tool_dataprivacy')
            ];
        }

        return [
            'result' => $result,
            'warnings' => $warnings
        ];
    }
1252021
protected function cancelRequest($pid, $ex)
    {
        $callback = $this->reqs[$pid]->onCancel();
        unset($this->reqs[$pid]);
        $callback($ex);
    }
892014
public function cancel()
    {
        $subscription = $this->asBraintreeSubscription();

        if ($this->onTrial()) {
            BraintreeSubscription::cancel($subscription->id);

            $this->markAsCancelled();
        } else {
            BraintreeSubscription::update($subscription->id, [
                'numberOfBillingCycles' => $subscription->currentBillingCycle,
            ]);

            $this->ends_at = $subscription->billingPeriodEndDate;

            $this->save();
        }

        return $this;
    }
89201
protected function cancelSubscription($subscriptionId)
    {
        $subscription = $this->getSubscriptionById($subscriptionId);

        if ($subscription && (! $subscription->cancelled() || $subscription->onGracePeriod())) {
            $subscription->markAsCancelled();
        }

        return new Response('Webhook Handled', 200);
    }
889506
public static function cancel()
  {
    if (is_null(self::$_transaction)) {
      $result = false;
    } else {
      $result = true;

      $aTran = self::$_transaction;
      $aCurr = $aTran->_stored;

      if (!is_null($aCurr)) {
        $names = array_keys($aTran->_data);
        foreach ($names as $name) {
          Config::clearInstance($name);
        }
      }
      
      self::_stop();
      self::$_transaction = null;
    }
    
    return $result;
  }
135726
public function cancelRecurringPayment($orderId)
    {
        $service = $this->getService();

        $recurringPaymentAction = new Request\Action\RecurringPayment\Cancel($service, $orderId);

        return $recurringPaymentAction->cancel();
    }
993542
protected static function deleteTransactionByIdAsyncWithHttpInfo($transaction_id) 
    {
        $returnType = '';  
        $request = self::deleteTransactionByIdRequest($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()
                    );
                }
            );
    }
1350413
public function cancelRefund($refundID, $paymentID)
    {
        $obj = new stdClass();

        // Must be in specific order for checksum --
        $obj->Secret = $this->getSecretCode();
        $obj->MerchantID = $this->getMerchantID();
        $obj->Timestamp = $this->getTimeStamp();
        $obj->RefundID = $refundID;
        $obj->PaymentID = $paymentID;
        // -----------------------------------------  
        // Generate Checksum
        $obj->Checksum = $this->generateChecksum($obj);

        // Ask for cancelRefunt and get response
        $result = $this->client->CancelRefund($obj);
        $result = $result->CancelRefundResult;

        $obj->Timestamp = $result->Timestamp;
        $obj->Success = $result->Success;

        // Unset properties for new Checksum
        unset($obj->RefundID, $obj->PaymentID, $obj->Checksum);

        // Verify response data by making a new Checksum
        $Checksum = $this->generateChecksum($obj);

        // Compare Checksums
        if ($result->Checksum != $Checksum)
            throw new Exception('Data could not be verified');

        return (array) $result;
    }
618372
public function refund($transactionId, $isPartial = false, $partialAmount = null)
    {
        $xml = new DOMDocument();
        $transaction = $xml->createElement('hps:Transaction');
        $return = $xml->createElement('hps:AltPaymentReturn');

        $return->appendChild($xml->createElement('hps:TransactionType', $this->_transactionType));
        $return->appendChild($xml->createElement('hps:GatewayTxnId', $transactionId));

        if ($isPartial) {
            $return->appendChild($xml->createElement('hps:Amt', $partialAmount));
        }

        $payment = $xml->createElement('hps:Return');
        $nvp = $xml->createElement('hps:NameValuePair');
        $nvp->appendChild($xml->createElement('hps:Name', 'ReturnType'));
        $nvp->appendChild($xml->createElement('hps:Value', $isPartial ? 'partial' : 'full'));
        $payment->appendChild($nvp);

        $return->appendChild($payment);
        $transaction->appendChild($return);
        return $this->_submitTransaction($transaction, 'AltPaymentReturn');
    }
628129
def cancelOrder(self, orderId):
        
        self.ibConn.cancelOrder(orderId)

        # update order id for next time
        self.requestOrderIds()
        return orderId
390853
public function cancelByBuyer()
    {
        $this->setStatusCode(self::STATUS_CANCELED_BY_BUYER);

        // Replace stock
        foreach ($this->getLineItems() as $lineItem)
        {
            $quantity = $lineItem->getQuantity();

            // Increment stock from Product
            $product = $lineItem->getProduct();
            $product->setQuantityOnHold($product->getQuantityOnHold()-$quantity);
            $product->setQuantityAvailable($product->getQuantityAvailable()+$quantity);

            // Create stock transaction for each line item
            $stockTransaction = new OrderStockTransaction();
            $stockTransaction->setQuantity($quantity);
            $stockTransaction->setProduct($product);
            $stockTransaction->setStatusCode(OrderStockTransaction::STATUS_PENDING);

            $lineItem->setStockTransaction($stockTransaction);
        }
    }
267399
public static function delete(
        int $cashRegisterId,
        string $tabUuid,
        int $tabItemShopId,
        int $monetaryAccountId = null,
        array $customHeaders = []
    ): BunqResponseNull {
        $apiClient = new ApiClient(static::getApiContext());
        $responseRaw = $apiClient->delete(
            vsprintf(
                self::ENDPOINT_URL_DELETE,
                [
                    static::determineUserId(),
                    static::determineMonetaryAccountId($monetaryAccountId),
                    $cashRegisterId,
                    $tabUuid,
                    $tabItemShopId,
                ]
            ),
            $customHeaders
        );

        return BunqResponseNull::castFromBunqResponse(
            new BunqResponse(null, $responseRaw->getHeaders())
        );
    }