@param      $transactionId
@param null $amount
@param null $gratuity
@param null $clientTransactionId
@param null $directMarketData

@return array|null
@throws \HpsArgumentException
@throws \HpsGatewayException
545533
public function capture($transactionId, $amount = null, $gratuity = null, $clientTransactionId = null, $directMarketData = null)
    {
        $xml = new DOMDocument();
        $hpsTransaction = $xml->createElement('hps:Transaction');
        $hpsCreditAddToBatch = $xml->createElement('hps:CreditAddToBatch');

        $hpsCreditAddToBatch->appendChild($xml->createElement('hps:GatewayTxnId', $transactionId));
        if ($amount != null) {
            $amount = sprintf("%0.2f", round($amount, 3));
            $hpsCreditAddToBatch->appendChild($xml->createElement('hps:Amt', $amount));
        }
        if ($gratuity != null) {
            $hpsCreditAddToBatch->appendChild($xml->createElement('hps:GratuityAmtInfo', $gratuity));
        }

        if ($directMarketData != null && $directMarketData->invoiceNumber != null) {
            $hpsCreditAddToBatch->appendChild($this->_hydrateDirectMarketData($directMarketData, $xml));
        }

        $hpsTransaction->appendChild($hpsCreditAddToBatch);
        $options = array();
        if ($clientTransactionId != null) {
            $options['clientTransactionId'] = $clientTransactionId;
        }
        $response = $this->doRequest($hpsTransaction, $options);
        $this->_processChargeGatewayResponse($response, 'CreditAddToBatch');

        return $this->get($transactionId);
    }
510982
function GetTransactionDetails($txnID) {
    if ($this->_mode == 'payflow') {
      $values['ORIGID'] = $txnID;
      $values['TENDER'] = 'C';
      $values['TRXTYPE'] = 'I';
      $values['VERBOSITY'] = 'MEDIUM';
    } elseif ($this->_mode == 'nvp') {
      $values['TRANSACTIONID'] = $txnID;
    }
    return $this->_request($values, 'GetTransactionDetails');
  }
569007
public function loadByTransactionId($transactionId)
    {
        $db = $this->getDb();
        $data = $db->getRow('SELECT * FROM `oepaypal_orderpayments` WHERE `oepaypal_transactionid` = ' . $db->quote($transactionId));

        return $data;
    }
965001
public function initialize()
    {
        return !is_null($this->transactionRef) ?
           $this->getTransactionResource()->initialize($this->_requestPayload()) :
            new PaystackInvalidTransactionException(
                json_decode(
                    json_encode(
                        [
                            'message' => 'Transaction Reference Not Generated.',
                        ]
                    ),
                    false
                )
            );
    }
298736
public function processPaypalSale(Transaction $transaction, $delivery=null, $credtCard=null)
    {
        
        $totals = $this->calculateTotals($transaction, $delivery);
  
        $this->paypalToken();
        
        if(is_null($credtCard)){
            $paymentMehod = array("payment_method" => "paypal");
        }else{
            $paymentMehod = array(
            "payment_method" => "credit_card",
            "funding_instruments" => array(
                array(
                  "credit_card" => $credtCard
                )
              )
            );
        }
        
        $returnValues = array();
        foreach ($transaction->getItems() as $productPurchase) {
            $sub = array();
            $sub['quantity'] = $productPurchase->getQuantity();
            if($productPurchase->getProduct() instanceof Product){
                $sub['name'] = $productPurchase->getProduct()->getName();
                $sub['price'] = number_format($productPurchase->getProduct()->getPrice(), 2);
            }elseif($productPurchase->getAdvert() instanceof Advert){
                $sub['name'] = $productPurchase->getAdvert()->getTitle();
                $sub['price'] = number_format($this->advertUnitPrice, 2);
            }
            
            $sub['sku'] = $productPurchase->getId();
            $sub['currency'] = "EUR";
            $returnValues[] = $sub;
        }
        
        $host = $this->paypalFactory->getHost();
        $url = $host.'/v1/payments/payment';
        $payment = array(
                        'intent' => 'sale',
                        'payer' => $paymentMehod,
                        'transactions' => array (array(
                                        'amount' => array(
                                                'total' => number_format($totals['amount'], 2),
                                                'currency' => 'EUR',
                                                'details' =>  array(
                                                    "subtotal" => number_format($totals['amount_clean'], 2),
                                                    "tax" => number_format($totals['vat'], 2),
                                                    "shipping" => $totals['delivery_expenses']
                                                  )
                                                ),
                                        'description' => 'payment using a PayPal account',
                                        "item_list" => array (
                                                "items" => $returnValues
                                                ),
                                        )),
                        'redirect_urls' => array (
                                'return_url' => $this->paypalFactory->getReturnUrl(),
                                'cancel_url' => $this->paypalFactory->getCancelUrl()
                        )
                    );

        $json = json_encode($payment);
        $json_resp = $this->paypalCall('POST', $url, $json);
               
        if(!is_null($credtCard)){
            if($json_resp['state'] == 'approved'){
                 //UPDATE TRANSACTION
                $pm = $this->manager->getRepository('EcommerceBundle:PaymentMethod')->findOneBySlug('paypal-direct-payment');
                $transaction->setStatus(Transaction::STATUS_PAID);
                $transaction->setPaymentMethod($pm);
                $transaction->setPaymentDetails(json_encode($json_resp));
                $this->manager->persist($transaction);
                $this->manager->flush();
                
                //confirmation payment
                $answer = new \stdClass();
                $answer->redirectUrl = $this->router->generate('ecommerce_checkout_confirmationpayment');

                return $answer;
            }else{
                //cancel payment
                $answer = new \stdClass();
                $answer->redirectUrl = $this->paypalFactory->getCancelUrl();

                return $answer;
            }
        }else{
            //UPDATE TRANSACTION
            $pm = $this->manager->getRepository('EcommerceBundle:PaymentMethod')->findOneBySlug('paypal');
            $transaction->setStatus(Transaction::STATUS_PENDING);
            $transaction->setPaymentMethod($pm);
            $transaction->setPaymentDetails(json_encode($json_resp));
            $this->manager->persist($transaction);
            $this->manager->flush();


            foreach ($json_resp['links'] as $link) {
                    if($link['rel'] == 'execute'){
                            $payment_execute_url = $link['href'];
                            $payment_execute_method = $link['method'];
                    }elseif($link['rel'] == 'approval_url'){
                            $payment_approval_url = $link['href'];
                            $payment_approval_method = $link['method'];
                    }
            }

            $answer = new \stdClass();
            $answer->redirectUrl = $payment_approval_url;

            return $answer;
        }
        
    }
1115980
public static function initTransaction($transactionTemplate = null) {
        $fields = ['description', 'date', 'value'];
        
        $transaction = new Transaction();
        
        if ($transactionTemplate !== null) {
            foreach ($fields as $f) {
                $transaction->$f = $transactionTemplate->$f;
            }
        }
        
        return $transaction;
    }
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()
                    );
                }
            );
    }
453557
public function postContactsTransactionalDataImport(
        $transactionalData,
        $collectionName = 'Orders'
    ) {
        $orders = [];
        foreach ($transactionalData as $one) {
            if (isset($one['email'])) {
                $orders[] = [
                    'Key' => $one['id'],
                    'ContactIdentifier' => $one['email'],
                    'Json' => json_encode($one),
                ];
            }
        }
        $url = $this->getApiEndpoint() . self::REST_TRANSACTIONAL_DATA_IMPORT
            . $collectionName;
        $this->setUrl($url)
            ->setVerb('POST')
            ->buildPostBody($orders);

        $response = $this->execute();

        if (isset($response->message)) {
            $message = ' SEND MULTI TRANSACTIONAL DATA ' . $response->message;
            $this->helper->debug('postContactsTransactionalDataImport', [$message]);
        }

        return $response;
    }
133169
protected function verifyTransactionType($transactionType, $parameters = [])
    {
        if (!Types::isValidWPFTransactionType($transactionType)) {
            throw new \Genesis\Exceptions\ErrorParameter(
                sprintf(
                    'Transaction type (%s) is not valid. Valid WPF transactions are: %s.',
                    $transactionType,
                    implode(', ', Types::getWPFTransactionTypes())
                )
            );
        }

        $txnCustomRequiredParams = Types::getCustomRequiredParameters(
            $transactionType
        );

        if (!CommonUtils::isValidArray($txnCustomRequiredParams)) {
            return;
        }

        $txnCustomRequiredParams = static::validateNativeCustomParameters($transactionType, $txnCustomRequiredParams);

        if (CommonUtils::isValidArray($txnCustomRequiredParams) && !CommonUtils::isValidArray($parameters)) {
            throw new \Genesis\Exceptions\ErrorParameter(
                sprintf(
                    'Custom transaction parameters (%s) are required and none are set.',
                    implode(', ', array_keys($txnCustomRequiredParams))
                )
            );
        }

        foreach ($txnCustomRequiredParams as $customRequiredParam => $customRequiredParamValues) {
            $this->validateRequiredParameter(
                $transactionType,
                $customRequiredParam,
                $customRequiredParamValues,
                $parameters
            );
        }
    }
1333859
private TxQueueItem txnOfferReserveInternal(long itemId, String transactionId) {
        TxQueueItem item = new TxQueueItem(this, itemId, null)
                .setTransactionId(transactionId)
                .setPollOperation(false);
        return txMap.put(itemId, item);
    }
1215398
public function registerTransaction(array $transactionData): RegisterInterface
    {
        $uri = $this->getUri('register', $this->getParameters($transactionData));
        /** @var RegisterInterface $response */
        $response = $this->performRequest((string) $uri);

        Assert::isInstanceOf($response, RegisterInterface::class, 'Invalid response');

        return $response;
    }
1069614
public function verify($cardOrToken, $cardHolder = null, $requestMultiUseToken = false, $clientTransactionId = null)
    {
        $xml = new DOMDocument();
        $hpsTransaction = $xml->createElement('hps:Transaction');
        $hpsCreditAccountVerify = $xml->createElement('hps:CreditAccountVerify');
        $hpsBlock1 = $xml->createElement('hps:Block1');

        if ($cardHolder != null) {
            $hpsBlock1->appendChild($this->_hydrateCardHolderData($cardHolder, $xml));
        }

        $cardData = $xml->createElement('hps:CardData');
        if ($cardOrToken instanceof HpsCreditCard) {
            $cardData->appendChild($this->_hydrateManualEntry($cardOrToken, $xml));
        } else {
            $cardData->appendChild($this->_hydrateTokenData($cardOrToken, $xml));
        }
        $cardData->appendChild($xml->createElement('hps:TokenRequest', ($requestMultiUseToken) ? 'Y' : 'N'));

        $hpsBlock1->appendChild($cardData);
        $hpsCreditAccountVerify->appendChild($hpsBlock1);
        $hpsTransaction->appendChild($hpsCreditAccountVerify);

        return $this->_submitTransaction($hpsTransaction, 'CreditAccountVerify', $clientTransactionId);
    }
803940
public void refundTransaction(final String transactionId, @Nullable final BigDecimal amount) {
        String url = Transactions.TRANSACTIONS_RESOURCE + "/" + transactionId;
        if (amount != null) {
            url = url + "?amount_in_cents=" + (amount.intValue() * 100);
        }
        doDELETE(url);
    }
27710
public function reverseAction(
    $transactionId, $originalAction = AffiliateBuiltInAction::ACQUISITION,
    $reason = ReversalReason::CANCEL, $reversalId = null, $reversalAmount = 0,
    array $data = null
  )
  {
    $endpoint = AffiliateActionEndpoint::bound($this->_getApi());
    $payload = new ReversalPayload();
    $payload->userAgent = $this->_fortifi->getUserAgent();
    $payload->language = $this->_fortifi->getUserLanguage();
    $payload->clientIp = $this->_fortifi->getClientIp();
    $payload->encoding = $this->_fortifi->getUserEncoding();
    $payload->reason = $reason;
    $payload->reversalAmount = $reversalAmount;
    $payload->reversalId = $reversalId;
    $payload->sourceActionKey = $originalAction;
    $payload->sourceTransactionId = $transactionId;
    $payload->data = $data;
    $payload->visitorId = $this->_visitorId;

    $req = $endpoint->reverse($payload);
    return $this->_processRequest($req);
  }
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');
    }
390636
public function execute(TransactionData $transactionData, $argument = null)
    {
        $this->storage->clearRequests();

        $transactionData->setResponse(
            $transactionData->getResponse()->withStatus(200)
        );
    }
79389
public static void putTransactionId(final String transactionId) {
		if ((transactionId != null) && (0 < transactionId.length())) {
			MDC.put(TRANSACTION_ID, transactionId);
		}
	}