当前位置: 首页>>代码示例>>PHP>>正文


PHP Object::getAmount方法代码示例

本文整理汇总了PHP中Magento\Framework\Object::getAmount方法的典型用法代码示例。如果您正苦于以下问题:PHP Object::getAmount方法的具体用法?PHP Object::getAmount怎么用?PHP Object::getAmount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\Object的用法示例。


在下文中一共展示了Object::getAmount方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _registerCard

 /**
  * It sets card`s data into additional information of payment model
  *
  * @param \Magento\Framework\Object $response
  * @param \Magento\Sales\Model\Order\Payment $payment
  * @return string
  */
 protected function _registerCard(\Magento\Framework\Object $response, \Magento\Sales\Model\Order\Payment $payment)
 {
     $cardsStorage = $this->getCardsStorage($payment);
     $card = $cardsStorage->registerCard();
     $card->setRequestedAmount($response->getRequestedAmount())->setBalanceOnCard($response->getBalanceOnCard())->setLastTransId($response->getTransactionId())->setProcessedAmount($response->getAmount())->setCcType($payment->getCcType())->setCcOwner($payment->getCcOwner())->setCcLast4($payment->getCcLast4())->setCcExpMonth($payment->getCcExpMonth())->setCcExpYear($payment->getCcExpYear())->setCcSsIssue($payment->getCcSsIssue())->setCcSsStartMonth($payment->getCcSsStartMonth())->setCcSsStartYear($payment->getCcSsStartYear());
     $cardsStorage->updateCard($card);
     $this->_clearAssignedData($payment);
     return $card;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:16,代码来源:Authorizenet.php

示例2: cmpShippingOptions

 /**
  * Compare two shipping options based on their amounts
  *
  * This function is used as a callback comparison function in shipping options sorting process
  * @see self::_prepareShippingOptions()
  *
  * @param \Magento\Framework\Object $option1
  * @param \Magento\Framework\Object $option2
  * @return int
  */
 protected static function cmpShippingOptions(\Magento\Framework\Object $option1, \Magento\Framework\Object $option2)
 {
     if ($option1->getAmount() == $option2->getAmount()) {
         return 0;
     }
     return $option1->getAmount() < $option2->getAmount() ? -1 : 1;
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:17,代码来源:Checkout.php

示例3: getItemDetailsRowAmount

 /**
  * Getter for details row amount
  *
  * @param \Magento\Framework\Object $row
  * @return string
  */
 public function getItemDetailsRowAmount(\Magento\Framework\Object $row)
 {
     return $row->getAmount();
 }
开发者ID:aiesh,项目名称:magento2,代码行数:10,代码来源:Nominal.php

示例4: validate

 /**
  * Validate payment data
  *
  * This check is performed on payment information submission, as well as on placing order.
  * Workflow state is stored validation state model
  *
  * @param \Magento\Framework\Object $data
  * @return void
  * @throws \Magento\Framework\Model\Exception
  */
 public function validate($data)
 {
     $newChecksum = $this->_generateChecksum($data->getPaymentMethodCode(), $data->getCardType(), $data->getCardNumber(), $data->getCardExpMonth(), $data->getCardExpYear(), $data->getAmount(), $data->getCurrencyCode());
     $validationState = $this->_getValidationState($data->getCardType());
     if (!$validationState) {
         $this->_resetValidationState();
         return;
     }
     // check whether is authenticated before placing order
     if ($this->getIsPlaceOrder()) {
         if ($validationState->getChecksum() != $newChecksum) {
             throw new \Magento\Framework\Model\Exception(__('Payment information error. Please start over.'));
         }
         if ($validationState->isAuthenticateSuccessful()) {
             return;
         }
         throw new \Magento\Framework\Model\Exception(__('Please verify the card with the issuer bank before placing the order.'));
     } else {
         if ($validationState->getChecksum() != $newChecksum || !$validationState->isLookupSuccessful()) {
             $this->lookup($data);
             $validationState = $this->_getValidationState();
         }
         if ($validationState->isLookupSuccessful()) {
             return;
         }
         throw new \Magento\Framework\Model\Exception(__('This card has failed validation and cannot be used.'));
     }
 }
开发者ID:aiesh,项目名称:magento2,代码行数:38,代码来源:Service.php

示例5: buildRequest

 /**
  * Prepare request to gateway
  *
  * @param \Magento\Framework\Object|\Magento\Payment\Model\InfoInterface $payment
  * @return \Magento\Authorizenet\Model\Request
  * @link http://www.authorize.net/support/AIM_guide.pdf
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 protected function buildRequest(\Magento\Framework\Object $payment)
 {
     /** @var \Magento\Sales\Model\Order $order */
     $order = $payment->getOrder();
     $this->setStore($order->getStoreId());
     $request = $this->getRequest()->setXType($payment->getAnetTransType())->setXMethod(self::REQUEST_METHOD_CC);
     if ($order && $order->getIncrementId()) {
         $request->setXInvoiceNum($order->getIncrementId());
     }
     if ($payment->getAmount()) {
         $request->setXAmount($payment->getAmount(), 2);
         $request->setXCurrencyCode($order->getBaseCurrencyCode());
     }
     switch ($payment->getAnetTransType()) {
         case self::REQUEST_TYPE_AUTH_CAPTURE:
             $request->setXAllowPartialAuth($this->getConfigData('allow_partial_authorization') ? 'True' : 'False');
             break;
         case self::REQUEST_TYPE_AUTH_ONLY:
             $request->setXAllowPartialAuth($this->getConfigData('allow_partial_authorization') ? 'True' : 'False');
             break;
         case self::REQUEST_TYPE_CREDIT:
             /**
              * Send last 4 digits of credit card number to authorize.net
              * otherwise it will give an error
              */
             $request->setXCardNum($payment->getCcLast4());
             $request->setXTransId($payment->getXTransId());
             break;
         case self::REQUEST_TYPE_VOID:
             $request->setXTransId($payment->getXTransId());
             break;
         case self::REQUEST_TYPE_PRIOR_AUTH_CAPTURE:
             $request->setXTransId($payment->getXTransId());
             break;
         case self::REQUEST_TYPE_CAPTURE_ONLY:
             $request->setXAuthCode($payment->getCcAuthCode());
             break;
     }
     if (!empty($order)) {
         $billing = $order->getBillingAddress();
         if (!empty($billing)) {
             $request->setXFirstName($billing->getFirstname())->setXLastName($billing->getLastname())->setXCompany($billing->getCompany())->setXAddress($billing->getStreetLine(1))->setXCity($billing->getCity())->setXState($billing->getRegion())->setXZip($billing->getPostcode())->setXCountry($billing->getCountry())->setXPhone($billing->getTelephone())->setXFax($billing->getFax())->setXCustId($order->getCustomerId())->setXCustomerIp($order->getRemoteIp())->setXCustomerTaxId($billing->getTaxId())->setXEmail($order->getCustomerEmail())->setXEmailCustomer($this->getConfigData('email_customer'))->setXMerchantEmail($this->getConfigData('merchant_email'));
         }
         $shipping = $order->getShippingAddress();
         if (!empty($shipping)) {
             $request->setXShipToFirstName($shipping->getFirstname())->setXShipToLastName($shipping->getLastname())->setXShipToCompany($shipping->getCompany())->setXShipToAddress($shipping->getStreetLine(1))->setXShipToCity($shipping->getCity())->setXShipToState($shipping->getRegion())->setXShipToZip($shipping->getPostcode())->setXShipToCountry($shipping->getCountry());
         }
         $request->setXPoNum($payment->getPoNumber())->setXTax($order->getBaseTaxAmount())->setXFreight($order->getBaseShippingAmount());
     }
     if ($payment->getCcNumber()) {
         $request->setXCardNum($payment->getCcNumber())->setXExpDate(sprintf('%02d-%04d', $payment->getCcExpMonth(), $payment->getCcExpYear()))->setXCardCode($payment->getCcCid());
     }
     return $request;
 }
开发者ID:nja78,项目名称:magento2,代码行数:64,代码来源:Authorizenet.php


注:本文中的Magento\Framework\Object::getAmount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。