charge returning transaction.

@param $body

@return \Exception|mixed
973691
public function chargeAuthorization($body)
    {
        $request = $this->paystackHttpClient->post(
            Resource::CHARGE_AUTHORIZATION,
            [
                'body'  => is_array($body) ? $this->toJson($body) : $body,
            ]
        );

        return $this->processResourceRequestResponse($request);
    }
668144
public function callbackAction(Request $request): Response
    {
        /** @var LoggerInterface $logger */
        $logger = $this->get('logger');
        /** @var EventDispatcherInterface $dispatcher */
        $dispatcher = $this->get('event_dispatcher');

        // get the body from the request
        $content = $request->getContent();

        // decode the request object to see what kind of object this is
        $json = json_decode($content, true) ?? [];
        if (!\array_key_exists(self::NOTIFICATION_URL, $json)) {
            throw new HttpException(400, self::BAD_REQUEST);
        }

        // serialize into json and feed it to the api components
        $notificationStr = json_encode($json[self::NOTIFICATION_URL]);
        $notification = NotificationUrl::createFromJsonString($notificationStr);

        // if this is not a mutation, don't accept it
        if (self::MUTATION !== $notification->getCategory()) {
            throw new HttpException(405, self::WRONG_REQUEST_TYPE);
        }

        // if the mutation doesn't hold a payment, don't accept it
        $payment = $notification->getObject()->getPayment();
        if (null === $payment) {
            throw new HttpException(400, self::PAYMENT_MISSING_FROM_REQUEST);
        }

        // logging for historical reasons
        $logger->info(
            sprintf(
                self::RECEIVED_PAYMENT_OBJECT_FROM_BUNQ_FOR_ACCOUNT_ID,
                $payment->getMonetaryAccountId()
            ),
            [
                'monetaryAccountId' => $payment->getMonetaryAccountId(),
                'amount' => $payment->getAmount()->getValue(),
                'currency' => $payment->getAmount()->getCurrency(),
                'description' => $payment->getDescription(),
                'counter_party_iban' => $payment->getCounterpartyAlias()->getIban(),
                'counter_party_name' => $payment->getCounterpartyAlias()->getDisplayName(),
            ]
        );

        // create the event and dispatch it into the kernel
        $event = new MutationEvent($payment);
        $dispatcher->dispatch(MutationEvent::NAME, $event);

        // tell bunq we're cool
        return new Response(self::CALLBACK_OK, 200);
    }
612410
function StartTransaction()
	{
		if ($this->IsTransactionInProgress())
			throw new Exception('Transaction is already in progress.  Commit or rollback must be called before beginning a new transaction');
		
		if ($this->ConnectionSetting->IsReadOnlySlave)
			throw new Exception('Transactions are not allowed on a read-only slave');
		
		$this->RequireConnection(true);
		$this->Observe("DataAdapter ($this->_label) (DataAdapter.StartTransaction)", OBSERVE_QUERY);
		$this->_transactionInProgress = true;
		return $this->_driver->StartTransaction($this->_dbconn);
	}
893045
private function parse($body)
    {
        try {
            $xml = new \SimpleXMLElement($body);
        } catch (\Exception $e) {
            return array(
                'EXact_Message' => $body
            );
        }

        $root = $xml->xpath('/TransactionResult');

        $response = $this->parseElements($root[0]);

        return $response;
    }
289147
public function getTransactionResult($token)
    {
        $transactionResult = new TransactionResult();
        $transactionResult->tokenInput = $token;

        return $this->callSoapMethod('getTransactionResult', $transactionResult);
    }
61400
protected function getUnenvelopedBody($body)
    {
        if(isset($body->{$this->envelope_key})) {
            return $body->{$this->envelope_key};
        }

        return $body->data;
    }
833495
public function body($body = null)
    {
        if (!is_null($body)) {
            $this->write($body, true);
        }

        return $this->body;
    }
968485
public function beginTransaction()
    {
        $return = $this->repository->beginTransaction();

        if ($this->signalDispatcher instanceof TransactionHandler) {
            $this->signalDispatcher->beginTransaction();
        }

        return $return;
    }
209110
public function transaction($callback)
    {
        $this->startTrans();

        try {
            $result = null;
            if (is_callable($callback)) {
                $result = call_user_func_array($callback, [$this]);
            }

            $this->commit();
            return $result;
        } catch (\Exception $e) {
            $this->rollback();
            throw $e;
        } catch (\Throwable $e) {
            $this->rollback();
            throw $e;
        }
    }
988268
public function fee($fee = null)
    {
        $amount = $fee ?: $this->getAttribute("fee");
        if (!$amount)
            $amount = (int) Fee::calculateForTransaction($this);

        return new Fee(["amount" => $amount]);
    }
1318072
public function body($body)
    {
        if ($body instanceof ReadableStreamInterface) {
            return new ReadableBodyStream($body);
        }

        return \RingCentral\Psr7\stream_for($body);
    }
664988
public function getQueue( $transaction = self::TRANSACTIONS_ALL, $throwExceptionIfNotFound = true, $outputAsArray = false )
    {

        if( $transaction === self::TRANSACTIONS_ALL ) {

            return $this->queue;

        // passed a array of transactions
        } elseif( is_array( $transaction ) ) {
            if( $throwExceptionIfNotFound and $missing = array_diff( $transaction, array_keys( $this->queue ) ) ) {
                $missing = implode( ', ', $missing );
                throw new TransactionDoesNotExistException(
                    "The following requested named transactions do not exist `{$missing}`"
                );
            }
            // this is a array_intersect *with ordering*
            $output = [];
            foreach( $transaction as $name ) {
                $output[$name] = $this->queue[$name];

            }
            return $output;
        }

        $transaction = $this->getTransaction( $transaction, $throwExceptionIfNotFound );
        if( $transaction !== null ) {
            return $outputAsArray
                ? array( $transaction => $this->queue[$transaction] )
                : $this->queue[$transaction];
        }

        return $outputAsArray ? array() : null;

    }
1156777
public function commitTransaction() {
        // check that a transaction is really active - do not check/renew the connection - renewing a connection breaks the transaction
        if (!$this->getConnection(false)->inTransaction())
            throw new \Exception("Not inside a DB transaction. Cannot commit.");

        try {
            $this->getConnection(false)->commit();
        } catch (Exception $_e) {
            throw new \Exception("Error while committing DB transaction: ".$pe->getMessage());
        }
    }
457814
public function refund($amount, $originalTransactionReference, $clientReference = NULL, $comment = NULL, $description = NULL, $cardHolderName = NULL, $taxAmount = NULL)
	{
		$request = Request::createFromClient($this);

		$request->setTransactionType(Request::TRANSACTION_TYPE_REFUND)
		        ->setTotalAmount($amount)
		        ->setOriginalTransactionReference($originalTransactionReference)
		        ->setClientReference($clientReference)
		        ->setComment($comment)
		        ->setMerchantDescription($description)
		        ->setMerchantCardHolderName($cardHolderName)
		        ->setTaxAmount($taxAmount);

		return $request;
	}
1361504
public function checkWebPayment($token, $transactionId)
    {
        $requestPayment = new Structure\RequestPaymentDetails($token, $transactionId);

        $this->response = parent::checkWebPayment($this->entity, $requestPayment);

        /**
         * Checks the state of the platform integration.
         */
        if (Exception\IntegrationState::check($this->response->requestState)) {
            throw new Exception\IntegrationState($this->response->requestState);
        }

        if ($this->response->requestState->state == 0) {
            throw new Exception\IntegrationResponse(
                $this->response->requestState->message,
                $this->response->requestState->code
            );
        }

        return $this->response;
    }
563877
public function getBodyByType($type)
    {
        if (!isset($this->bodyList[$type])) {
            throw new \Exception('No body of type "' . $type . '"');
        }

        return $this->bodyList[$type];
    }
839615
public function getTransaction() {
        if(!$this->isInTransaction()) {
            throw new \Exception('This transaction has already been rolled back, or committed, or has not began yet');
        }
        $transactions = $this->getTransactions();
        return $transactions[$this->getDbService()];
    }