Get customerId as string and validate it.
@ignore
@param Payment|string|array $payment String, Payment object or array as returned from paymentInit call
@return string
@throws Exception
978525
protected function getCustomerId($payment) {
		if (!is_string($payment) and $payment instanceof Payment) {
			$payment = $payment->customerId;
		}
		if (is_array($payment) and isset($payment["customerId"])) {
			$payment = $payment["customerId"];
		}
		if (!is_string($payment)) {
			throw new Exception("Given Customer ID is not valid.");
		}
		return $payment;
	}
766680
public function clientGetByUid($uid)
  {
    foreach($this->clientList() as $client)
    {
      if($client["client_unique_identifier"] == $uid) return $client;
    }

    throw new Exception("invalid clientID", 0x200);
  }
1352987
public Result processPayment(Payment payment) throws PaytrailException {
		try {
			String data = marshaller.objectToString(payment);
			String url = serviceUrl + "/api-payment/create";
			
			IOHandlerResult requestResult = postJsonRequest(url, data);
			
			if (requestResult.getCode() != 201) {
				JsonError jsonError = marshaller.stringToObject(JsonError.class, requestResult.getResponse());
				throw new PaytrailException(jsonError.getErrorMessage());
	  	}
			
			return marshaller.stringToObject(Result.class, requestResult.getResponse());
		} catch (IOException e) {
			throw new PaytrailException(e);
		}
	}
747436
private function checkPaymentMethod($payment)
    {
        $paymentMethod = $payment->getMethod();

        if ($paymentMethod != Payment::METHOD_CODE) {
            throw new LocalizedException(__(
                'Payment method assigned to order is: %1',
                $paymentMethod
            ));
        }
    }
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]
            )
        );
    }
1370488
public function find($token)
    {
        $this->_validateId($token);
        try {
            $path = $this->_config->merchantPath() . '/payment_methods/any/' . $token;
            $response = $this->_http->get($path);
            return PaymentMethodParser::parsePaymentMethod($response);
        } catch (Exception\NotFound $e) {
            throw new Exception\NotFound(
                'payment method with token ' . $token . ' not found'
            );
        }
    }
475066
public function payment($parameters)
    {
        $array = $this->getParameters($parameters);
        $array['Shop_IDP'] = $this->getShopId();
        $array['Signature'] = $this->signaturePayment
            ->setShopIdp(array_get($array, 'Shop_IDP'))
            ->setOrderIdp(array_get($array, 'Order_IDP'))
            ->setSubtotalP(array_get($array, 'Subtotal_P'))
            ->setMeanType(array_get($array, 'MeanType'))
            ->setEMoneyType(array_get($array, 'EMoneyType'))
            ->setLifeTime(array_get($array, 'Lifetime'))
            ->setCustomerIdp(array_get($array, 'Customer_IDP'))
            ->setCardIdp(array_get($array, 'Card_IDP'))
            ->setIData(array_get($array, 'IData'))
            ->setPtCode(array_get($array, 'PT_Code'))
            ->setPassword($this->getPassword())
            ->create();

        return $this->getPayment()->execute($array, $this->getOptions());
    }
914762
public function payment(Payment $payment, &$paymentParams)
    {
        if (!$this->checkCurrency($payment->currency)) {
            Yii::$app->session->setFlash(Yii::t('payment', 'The gateway does not support the current currency!'));
        } else {
            $params = [
                'MerNo' => $this->merNo,
                'BillNo' => $payment->id,
                'Amount' => round($payment->money, 2),
                'ReturnURL' => $this->getReturnUrl(),
                'AdviceURL' => $this->getNoticeUrl(),
                'products' => !empty($payment->model_id) ? $payment->model_id : '充值',
                'Remark' => 'Remark',
                'defaultBankNumber' => $this->defaultBankNumber,
                'orderTime' => date('YmdHis')
            ];
            $md5src = $this->merNo . '&' . $payment->id . '&' . $params['Amount'] . '&' . $params['ReturnURL'] . '&' . $this->md5Key;        //校验源字符串
            $params['SignInfo'] = strtoupper(md5($md5src));//MD5检验结果
            $this->getRedirectResponse($params);
        }
    }
629157
public function getTransactionString()
    {
        return sprintf(
                "Paymentmethod: %s \n| OrderID: %s \n| Status: %s \n| StatusCode: %s \n| PaymentID: %s \n| TransactionID: %s \n| Amount: %s", isset($this->data->paymentMethod) ? $this->data->paymentMethod : "", isset($this->data->orderID) ? $this->data->orderID : "", isset($this->data->status) ? $this->data->status : "", isset($this->data->statusCode) ? $this->data->statusCode : "", isset($this->data->paymentID) ? $this->data->paymentID : "", isset($this->data->transactionID) ? $this->data->transactionID : "", isset($this->data->amount) ? $this->data->amount : ""
        );
    }
936185
protected function extractCardReference(ResponseInterface $response): string
    {
        if (!$response->isSuccessful()) {
            throw new PaymentException($response->getMessage());
        }

        return (string) $response->getTransactionReference();
    }
865582
public OvhPayment refund_refundId_payment_GET(String refundId) throws IOException {
		String qPath = "/me/refund/{refundId}/payment";
		StringBuilder sb = path(qPath, refundId);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, OvhPayment.class);
	}
851679
public function validatePaymentReference(Structure\RequestReferenceDetails $paymentData)
    {
        $this->response = parent::validatePaymentReference($this->entity, $paymentData);

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

        /**
         * In case an error code is returned not related to the integration state.
         * (eg.: maximum daily amount exceeded, maximum reference amount, etc.)
         */
        if (!empty($this->response->err_code)) {
            throw new Exception\IntegrationResponse(
                $this->response->err_msg,
                $this->response->err_code
            );
        }

        return $this->response;
    }
1171643
public function auth($payment, $url)
	{

		// decrypt payment identify
		$paymentId = Crypt::decrypt($payment);

		// check request
		$this->payAuthValidateRequest($paymentId, $url);

		// check payment status
		$processor = Processor::makePayment($paymentId);
		if (!$processor->isAuthStatus()) {
			App::abort(406, 'Unrecognized Payment Status');
		}

		// check input hint value and go back with result
		$redirect = $this->payAuthProcessHint($paymentId, $url);
		if ($redirect) {
			return $redirect;
		}

		$this->layout = View::make('ff-bank-em::layouts.authorization');
		$this->make('authorization');

		return null;

	}
255719
public function setPayment(Payment $payment)
    {
        $this->payment = $payment;

        if (!$payment->hasPaymentTransaction($this))
        {
            $payment->addPaymentTransaction($this);
        }

        return $this;
    }
400312
public function paymentMethod()
    {
        $customer = $this->asBraintreeCustomer();

        foreach ($customer->paymentMethods as $paymentMethod) {
            if ($paymentMethod->isDefault()) {
                return $paymentMethod;
            }
        }
    }
397429
private function sendValidateShipmentRequest($data) {
		switch($this->getMayor()) {
			case 1:
				throw new Exception(__FUNCTION__ . ': Method doesn\'t exists for Version 1!');
			case 2:
			default:
				return $this->getSoapClient()->validateShipment($data);
		}
	}
1137676
public function getCheckedPaymentId()
    {
        if ($this->_sCheckedPaymentId === null) {
            if (!($sPaymentID = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('paymentid'))) {
                $sPaymentID = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('paymentid');
            }
            if ($sPaymentID) {
                $sCheckedId = $sPaymentID;
            } elseif (($sSelectedPaymentID = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('_selected_paymentid'))) {
                $sCheckedId = $sSelectedPaymentID;
            } else {
                // #1010A.
                if ($oUser = $this->getUser()) {
                    $oOrder = oxNew(\OxidEsales\Eshop\Application\Model\Order::class);
                    if (($sLastPaymentId = $oOrder->getLastUserPaymentType($oUser->getId()))) {
                        $sCheckedId = $sLastPaymentId;
                    }
                }
            }

            // #M253 set to selected payment in db
            if (!$sCheckedId && $this->_sCheckedId) {
                $sCheckedId = $this->_sCheckedId;
            }

            // #646
            $oPaymentList = $this->getPaymentList();
            if (isset($oPaymentList) && $oPaymentList && !isset($oPaymentList[$sCheckedId])) {
                end($oPaymentList);
                $sCheckedId = key($oPaymentList);
            }
            $this->_sCheckedPaymentId = $sCheckedId;
        }

        return $this->_sCheckedPaymentId;
    }