本文整理匯總了PHP中float::getOrder方法的典型用法代碼示例。如果您正苦於以下問題:PHP float::getOrder方法的具體用法?PHP float::getOrder怎麽用?PHP float::getOrder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類float
的用法示例。
在下文中一共展示了float::getOrder方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _processPartialAuthorizationResponse
/**
* Set split_tender_id to quote payment if needed
*
* @param \Magento\Framework\Object $response
* @param float $orderPayment
* @throws \Magento\Payment\Model\Info\Exception
* @return bool
*/
protected function _processPartialAuthorizationResponse($response, $orderPayment)
{
if (!$response->getSplitTenderId()) {
return false;
}
$quotePayment = $orderPayment->getOrder()->getQuote()->getPayment();
$this->setPartialAuthorizationLastActionState(self::PARTIAL_AUTH_LAST_DECLINED);
$exceptionMessage = null;
try {
switch ($response->getResponseCode()) {
case self::RESPONSE_CODE_APPROVED:
$this->_registerCard($response, $orderPayment);
$this->_clearAssignedData($quotePayment);
$this->setPartialAuthorizationLastActionState(self::PARTIAL_AUTH_LAST_SUCCESS);
return true;
case self::RESPONSE_CODE_HELD:
if ($response->getResponseReasonCode() != self::RESPONSE_REASON_CODE_PARTIAL_APPROVE) {
return false;
}
if ($this->getCardsStorage($orderPayment)->getCardsCount() + 1 >= self::PARTIAL_AUTH_CARDS_LIMIT) {
$this->cancelPartialAuthorization($orderPayment);
$this->_clearAssignedData($quotePayment);
$this->setPartialAuthorizationLastActionState(self::PARTIAL_AUTH_CARDS_LIMIT_EXCEEDED);
$quotePayment->setAdditionalInformation($orderPayment->getAdditionalInformation());
$exceptionMessage = __('You have reached the maximum number of credit cards ' . 'allowed to be used for the payment.');
break;
}
$orderPayment->setAdditionalInformation($this->_splitTenderIdKey, $response->getSplitTenderId());
$this->_registerCard($response, $orderPayment);
$this->_clearAssignedData($quotePayment);
$this->setPartialAuthorizationLastActionState(self::PARTIAL_AUTH_LAST_SUCCESS);
$quotePayment->setAdditionalInformation($orderPayment->getAdditionalInformation());
$exceptionMessage = null;
break;
case self::RESPONSE_CODE_DECLINED:
case self::RESPONSE_CODE_ERROR:
$this->setPartialAuthorizationLastActionState(self::PARTIAL_AUTH_LAST_DECLINED);
$quotePayment->setAdditionalInformation($orderPayment->getAdditionalInformation());
$exceptionMessage = $this->_wrapGatewayError($response->getResponseReasonText());
break;
default:
$this->setPartialAuthorizationLastActionState(self::PARTIAL_AUTH_LAST_DECLINED);
$quotePayment->setAdditionalInformation($orderPayment->getAdditionalInformation());
$exceptionMessage = $this->_wrapGatewayError(__('Something went wrong while authorizing the partial payment.'));
}
} catch (\Exception $e) {
$exceptionMessage = $e->getMessage();
}
throw new \Magento\Payment\Model\Info\Exception($exceptionMessage);
}