@param int   $paymentOrderId
@param array $addElements

@return array
771020
public function PaymentOrderDetail($paymentOrderId, array $addElements = array())
    {
        $request = new Request();
        $request->setMethod('GET');

        if (null == $paymentOrderId) {
            throw new InvalidArgumentException('paymentOrderId');
        }

        $qs = array('Id' => $paymentOrderId);

        if ($addElements) {
            $qs['AddElements'] = implode(',', $addElements);
        }

        return $this->doRequest('PaymentOrder/Detail', $request, $qs)->getContentJson();
    }
137019
public function addPayment(\OxidEsales\PayPalModule\Model\OrderPayment $payment)
    {
        $paymentList = $this->getPaymentList();
        $paymentList->addPayment($payment);
        $this->setPaymentList(null);
    }
797706
public function ordersPaymentEdit(array $payment, $by = 'id', $site = null)
    {
        if (!count($payment)) {
            throw new \InvalidArgumentException(
                'Parameter `payment` must contains a data'
            );
        }

        $this->checkIdParameter($by);

        if (!array_key_exists($by, $payment)) {
            throw new \InvalidArgumentException(
                sprintf('Order array must contain the "%s" parameter.', $by)
            );
        }

        /* @noinspection PhpUndefinedMethodInspection */
        return $this->client->makeRequest(
            sprintf('/orders/payments/%s/edit', $payment[$by]),
            "POST",
            $this->fillSite(
                $site,
                ['payment' => json_encode($payment), 'by' => $by]
            )
        );
    }
631374
protected function addBillingData(\SimpleXMLElement $data)
    {
        /** @var mixed $req */
        $req = $data->transactionRequest;

        // The order must come before the customer ID.
        $req->order->invoiceNumber = $this->getInvoiceNumber();
        $req->order->description = $this->getDescription();

        // Merchant assigned customer ID
        $customer = $this->getCustomerId();
        if (!empty($customer)) {
            $req->customer->id = $customer;
        }

        //$req->order->description = $this->getDescription();

        /** @var CreditCard $card */
        if ($card = $this->getCard()) {
            // A card is present, so include billing and shipping details
            $req->customer->email = $card->getEmail();

            $req->billTo->firstName = $card->getBillingFirstName();
            $req->billTo->lastName = $card->getBillingLastName();
            $req->billTo->company = $card->getBillingCompany();
            $req->billTo->address = trim($card->getBillingAddress1() . " \n" . $card->getBillingAddress2());
            $req->billTo->city = $card->getBillingCity();
            $req->billTo->state = $card->getBillingState();
            $req->billTo->zip = $card->getBillingPostcode();
            $req->billTo->country = $card->getBillingCountry();
            $req->billTo->phoneNumber = $card->getBillingPhone();

            $req->shipTo->firstName = $card->getShippingFirstName();
            $req->shipTo->lastName = $card->getShippingLastName();
            $req->shipTo->company = $card->getShippingCompany();
            $req->shipTo->address = trim($card->getShippingAddress1() . " \n" . $card->getShippingAddress2());
            $req->shipTo->city = $card->getShippingCity();
            $req->shipTo->state = $card->getShippingState();
            $req->shipTo->zip = $card->getShippingPostcode();
            $req->shipTo->country = $card->getShippingCountry();
        }

        return $data;
    }
1097214
public function run(array $orderItems, SpySalesOrder $orderEntity, ReadOnlyArrayObject $data)
    {
        $payoneRefundTransfer = new PayoneRefundTransfer();

        $orderTransfer = new OrderTransfer();
        $orderTransfer->fromArray($orderEntity->toArray(), true);

        $refundTransfer = $this->getFactory()
            ->getRefundFacade()
            ->calculateRefund($orderItems, $orderEntity);

        $payoneRefundTransfer->setAmount($refundTransfer->getAmount() * -1);

        $paymentPayoneEntity = $orderEntity->getSpyPaymentPayones()->getFirst();

        $payonePaymentTransfer = new PayonePaymentTransfer();
        $payonePaymentTransfer->fromArray($paymentPayoneEntity->toArray(), true);

        $payoneRefundTransfer->setPayment($payonePaymentTransfer);
        $payoneRefundTransfer->setUseCustomerdata(PayoneApiConstants::USE_CUSTOMER_DATA_YES);
        $payoneRefundTransfer->setOrder($this->getOrderTransfer($orderEntity));

        $narrativeText = $this->getFactory()->getConfig()->getNarrativeText($orderItems, $orderEntity, $data);
        $payoneRefundTransfer->setNarrativeText($narrativeText);

        $this->getFacade()->refundPayment($payoneRefundTransfer);

        return [];
    }
1193380
public function getPaymentMethods()
    {
        $paymentMethods = array();

        foreach ($this->data['data'] as $method) {
            $paymentMethods[] = new PaymentMethod(
                $method['id'],
                $method['description']
            );
        }

        return $paymentMethods;
    }
112495
public function getHppPaymentMethodFee($paymentMethod)
    {
        $paymentMethod = str_replace('adyen_hpp_', '', $paymentMethod);

        $paymentFees = $this->getHppPaymentMethodFees();

        if ($paymentFees && is_array($paymentFees) && !empty($paymentFees)) {
            foreach ($paymentFees as $paymentFee) {
                if (isset($paymentFee['code']) && $paymentFee['code'] == $paymentMethod) {
                    if (isset($paymentFee['amount'])) {
                        return $paymentFee['amount'];
                    }
                }
            }
        }

        return null;
    }
727218
public function addPaymentMethod($paymentId, IPaymentMethod $paymentMethod)
    {
        $nameOnAccount = sprintf('%s %s', $this->firstName, $this->lastName);
        if (empty(str_replace(' ', '', $nameOnAccount))) {
            $nameOnAccount = $this->company;
        }

        $payment = new RecurringPaymentMethod($paymentMethod);
        $payment->address = $this->address;
        $payment->customerKey = $this->key;
        $payment->id = $paymentId;
        $payment->nameOnAccount = $nameOnAccount;
        return $payment;
    }
71796
public function void($paymentId, $amount){
        $uri = Braspag::$apiBase . "sales/{$paymentId}/void"; 
        
        if($amount != null){
            $uri = $uri . "?amount={$amount}";
        }
        
        $response = Request::put($uri)
            ->sendsJson()
            ->addHeaders($this->headers)
            ->send();
        
        if($response->code == HttpStatus::Ok){    
            
            $voidResponse = new VoidResponse();
            $voidResponse->status = $response->body->Status;
            $voidResponse->reasonCode = $response->body->ReasonCode;
            $voidResponse->reasonMessage = $response->body->ReasonMessage;
            
            $voidResponse->links = $this->parseLinks($response->body->Links);
            
            return $voidResponse;
            
        }elseif($response->code == HttpStatus::BadRequest){            
            Utils::handleApiError($response);            
        }   
        
        return $response->code;
    }
1262993
private function validatePaymentSettings(array $paymentSettings)
    {
        $rules = [
          'paymentMethod'                          => 'required',
          'bankName'                               => 'required_if:paymentMethod,eft',
          'creditCardToken'                        => 'required_if:paymentMethod,creditCard',
          'installmentQuantity'                    => 'required_if:paymentMethod,creditCard|integer|between:1,18',
          'installmentValue'                       => 'required_if:paymentMethod,creditCard|numeric|between:0.00,9999999.00',
          'noInterestInstallmentQuantity'          => 'integer|between:1,18',
        ];

        $this->validate($paymentSettings, $rules);

        $this->validateSenderInfo($this->senderInfo);
        $this->validateShippingAddress($this->shippingAddress);
        $this->validateItems($this->items);

        if ($paymentSettings['paymentMethod'] === 'creditCard') {
            $this->validateCreditCardHolder($this->creditCardHolder);
            $this->validateBillingAddress($this->billingAddress);
        }

        if (!empty($this->shippingInfo)) {
            $this->validateShippingInfo($this->shippingInfo);
        }
    }
473442
public function processPayment(PaylandsMethod $paymentMethod)
    {
        /*
         * At this point, order must be created given a cart, and placed in PaymentBridge.
         *
         * So, $this->paymentBridge->getOrder() must return an object
         */
        $this
            ->paymentEventDispatcher
            ->notifyPaymentOrderLoad(
                $this->paymentBridge,
                $paymentMethod
            );

        /*
         * Order Not found Exception must be thrown just here.
         */
        if (!$this->paymentBridge->getOrder()) {
            throw new PaymentOrderNotFoundException();
        }

        /*
         * Order exists right here.
         */
        $this
            ->paymentEventDispatcher
            ->notifyPaymentOrderCreated(
                $this->paymentBridge,
                $paymentMethod
            );

        /*
         * Try to make the payment transaction
         */
        try {
            $this->paylandsApiAdapter->validateCard($paymentMethod);

            $this->paylandsEventDispatcher->notifyCardValid($paymentMethod);

            if (!$paymentMethod->isOnlyTokenizeCard()) {
                $this->paylandsApiAdapter->createTransaction($paymentMethod);
            }

            /*
             * Payment paid done.
             *
             * Paid process has ended ( No matters result )
             */
            $this
                ->paymentEventDispatcher
                ->notifyPaymentOrderDone(
                    $this->paymentBridge,
                    $paymentMethod
                );

            if (PaylandsMethod::STATUS_OK !== $paymentMethod->getPaymentStatus()) {
                throw new PaymentException(sprintf('Order %s could not be paid',
                    $paymentMethod->getPaymentResult()['order']['uuid']
                ));
            }

            /*
             * Payment paid successfully.
             *
             * Paid process has ended successfully
             */
            $this
                ->paymentEventDispatcher
                ->notifyPaymentOrderSuccess(
                    $this->paymentBridge,
                    $paymentMethod
                );
        } catch (PaymentException $e) {
            /*
             * Payment paid failed.
             *
             * Paid process has ended failed
             */
            $this
                ->paymentEventDispatcher
                ->notifyPaymentOrderFail(
                    $this->paymentBridge,
                    $paymentMethod
                );

            throw $e;
        }

        return $this;
    }
748553
private function _setPayments($paymentEntries)
    {
        $payments = Array();
        foreach ($paymentEntries as $paymentEntry) {
            switch ($paymentEntry['paymentType']) {
                case self::$PAYMENTTYPE_PAYPAL:
                    $payments[] = new WirecardCEE_QPay_Response_Toolkit_Order_Payment_Paypal($paymentEntry);
                    break;
                case self::$PAYMENTTYPE_SOFORTUEBERWEISUNG:
                    $payments[] = new WirecardCEE_QPay_Response_Toolkit_Order_Payment_Sofortueberweisung($paymentEntry);
                    break;
                case self::$PAYMENTTYPE_IDEAL:
                    $payments[] = new WirecardCEE_QPay_Response_Toolkit_Order_Payment_Ideal($paymentEntry);
                    break;
                default:
                    $payments[] = new WirecardCEE_QPay_Response_Toolkit_Order_Payment($paymentEntry);
                    break;
            }
        }
        $this->_payments = new WirecardCEE_QPay_Response_Toolkit_Order_PaymentIterator($payments);
    }
155283
private function formatOutput($installments)
    {
        $response = $this->getOptions();
        foreach($installments as $installment) {
            $response['installments'][] = $this->formatInstallments($installment);
        }
        return $response;
    }
637748
@Indexable(type = IndexableType.REINDEX)
	@Override
	public CommerceOrderPayment addCommerceOrderPayment(
		CommerceOrderPayment commerceOrderPayment) {
		commerceOrderPayment.setNew(true);

		return commerceOrderPaymentPersistence.update(commerceOrderPayment);
	}
1328486
public function getPaymentLogs($orders)
    {
        $apiLogs = $this->queryContainer->createApiLogsByOrderIds($orders)->find()->getData();

        $transactionStatusLogs = $this->queryContainer->createTransactionStatusLogsByOrderIds($orders)->find()->getData();

        $logs = [];
        /** @var \Orm\Zed\Payone\Persistence\SpyPaymentPayoneApiLog $apiLog */
        foreach ($apiLogs as $apiLog) {
            $key = $apiLog->getCreatedAt()->format('Y-m-d\TH:i:s\Z') . 'a' . $apiLog->getIdPaymentPayoneApiLog();
            $payonePaymentLogTransfer = new PayonePaymentLogTransfer();
            $payonePaymentLogTransfer->fromArray($apiLog->toArray(), true);
            $payonePaymentLogTransfer->setLogType(self::LOG_TYPE_API_LOG);
            $logs[$key] = $payonePaymentLogTransfer;
        }
        /** @var \Orm\Zed\Payone\Persistence\SpyPaymentPayoneTransactionStatusLog $transactionStatusLog */
        foreach ($transactionStatusLogs as $transactionStatusLog) {
            $key = $transactionStatusLog->getCreatedAt()->format('Y-m-d\TH:i:s\Z') . 't' . $transactionStatusLog->getIdPaymentPayoneTransactionStatusLog();
            $payonePaymentLogTransfer = new PayonePaymentLogTransfer();
            $payonePaymentLogTransfer->fromArray($transactionStatusLog->toArray(), true);
            $payonePaymentLogTransfer->setLogType(self::LOG_TYPE_TRANSACTION_STATUS_LOG);
            $logs[$key] = $payonePaymentLogTransfer;
        }

        ksort($logs);

        $payonePaymentLogCollectionTransfer = new PayonePaymentLogCollectionTransfer();

        foreach ($logs as $log) {
            $payonePaymentLogCollectionTransfer->addPaymentLogs($log);
        }

        return $payonePaymentLogCollectionTransfer;
    }
599747
public function addPayment(\OxidEsales\PayPalModule\Model\OrderPayment $payment)
    {
        //order payment info
        if ($this->getOrderId()) {
            $payment->setOrderId($this->getOrderId());
            $payment->save();
        }

        $this->load($this->getOrderId());

        return $payment;
    }
626072
private function addPaymentMethods(Order $order, ElementInterface $radioGroup)
    {
        $paymentMethods = $this->getPaymentMethodProvider()->getPaymentMethodsForOrder($order);
        
        $paymentMethods->map(function (PaymentMethod $paymentMethod) use ($radioGroup) {
            $radioGroup->addOptionToSelect($paymentMethod->getId(), $paymentMethod->translate()->getName());
        });
    }