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


PHP Varien_Object::getAmount方法代码示例

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


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

示例1: _prepareGiftVoucher

 protected function _prepareGiftVoucher(Varien_Object $buyRequest, $product)
 {
     $store = Mage::app()->getStore();
     if ($store->isAdmin()) {
         $amount = $product->getPrice();
     } else {
         if ($buyRequest->getAmount()) {
             $amount = $buyRequest->getAmount();
             $includeTax = Mage::getStoreConfig('tax/display/type') != 1;
             $amount = $amount * 100 / Mage::helper('tax')->getPrice($product, 100, $includeTax);
         } else {
             $amount = $product->getPrice();
         }
         if (!$amount) {
             return Mage::helper('giftvoucher')->__('Please enter gift voucher information');
         }
     }
     if (!$buyRequest->getAmount()) {
         $buyRequest->setAmount($amount);
     }
     $product->addCustomOption('amount', $amount);
     $fields = array();
     foreach (Mage::helper('giftvoucher')->getFullGiftVoucherOptions() as $key => $label) {
         if ($value = $buyRequest->getData($key)) {
             $product->addCustomOption($key, $value);
         }
     }
     return array($product);
 }
开发者ID:CherylMuniz,项目名称:fashion,代码行数:29,代码来源:Type.php

示例2: assignData

 public function assignData($data)
 {
     if (!$data instanceof Varien_Object) {
         $data = new Varien_Object($data);
     }
     $info = $this->getInfoInstance();
     $info->setCcavenuepayType($this->getCcavenuepayAccountId1())->setMerchant_Id($data->getMerchant_Id())->setOrder_Id($data->getOrder_Id())->setAmount($data->getAmount())->setCurrency_code($data->getCurrency_code())->setShipping($data->getShipping())->setChecksum($data->getChecksum())->setTax($data->getTax())->setBilling_cust_name($data->getBilling_cust_name())->setBilling_cust_address($data->getBilling_cust_address())->setBilling_cust_city($data->getBilling_cust_city())->setBilling_cust_state($data->getBilling_cust_state())->setBilling_zip_code($data->getBilling_zip_code())->setBilling_cust_country($data->getBilling_cust_country())->setBilling_cust_tel($data->getBilling_cust_tel())->setbilling_cust_email($data->getbilling_cust_email())->setDelivery_cust_name($data->getDelivery_cust_name())->setDelivery_cust_address($data->getDelivery_cust_address())->setDelivery_cust_city($data->getDelivery_cust_city())->setDelivery_cust_state($data->getDelivery_cust_state())->setDelivery_zip_code($data->getDelivery_zip_code())->setDelivery_cust_country($data->getDelivery_cust_country())->setDelivery_cust_tel($data->getDelivery_cust_tel())->setBilling_cust_notes($data->getBilling_cust_notes())->setRedirect_Url($data->getRedirect_Url());
     return $this;
 }
开发者ID:sagmahajan,项目名称:aswan_release,代码行数:9,代码来源:Ccavenuepay_27_Aug_2013_07_14_PM.php

示例3: assignData

 /**
  * Assign data to info model instance
  *
  * @param   mixed $data
  * @return  Mage_ccavenuepay_Model_Info
  */
 public function assignData($data)
 {
     if (!$data instanceof Varien_Object) {
         $data = new Varien_Object($data);
     }
     $info = $this->getInfoInstance();
     $info->setCcavenuepayType($this->getCcavenuepayAccountId1())->setMerchant_Id($data->getMerchant_Id())->setOrder_Id($data->getOrder_Id())->setAmount($data->getAmount())->setCurrency($data->getCurrency())->setLanguage($data->getLanguage())->setCancel_Url($data->getCancel_Url())->setMerchant_Param($data->getMerchantParam())->setBilling_name($data->getBilling_name())->setBilling_address($data->getBilling_address())->setBilling_city($data->getBilling_city())->setBilling_state($data->getBilling_state())->setBilling_zip($data->getBilling_zip())->setBilling_country($data->getBilling_country())->setBilling_tel($data->getBilling_tel())->setbilling_email($data->getbilling_email())->setDelivery_name($data->getDelivery_name())->setDelivery_address($data->getDelivery_address())->setDelivery_city($data->getDelivery_city())->setDelivery_state($data->getDelivery_state())->setDelivery_zip($data->getDelivery_zip())->setDelivery_country($data->getDelivery_country())->setDelivery_tel($data->getDelivery_tel())->setBilling_notes($data->getBilling_notes())->setDelivery_notes($data->getDelivery_notes())->setPayType($data->getPayType())->setRedirect_Url($data->getRedirect_Url());
     return $this;
 }
开发者ID:vinayshuklasourcefuse,项目名称:sareez,代码行数:15,代码来源:Ccavenuepay.php

示例4: _registerCard

 /**
  * It sets card`s data into additional information of payment model
  * AuthorizeNet has added additional_information field in sale_flat_order_payment table
  * where they savve credit card info, and disallow to save the card in other fields,
  * This method is temprory and we need to fetch the card info from additional_information
  * field.
  * @param Mage_Paygate_Model_Authorizenet_Result $response
  * @param Mage_Sales_Model_Order_Payment $payment
  * @return Varien_Object
  */
 protected function _registerCard(Varien_Object $response, Mage_Sales_Model_Order_Payment $payment)
 {
     //$isAuth = Mage::getStoreConfig('editorder/general/reauth');
     //if(isset($isAuth) && $isAuth == 1) {
     $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);
     //below is the only reason to override this method,
     //$this->_clearAssignedData($payment);
     return $card;
     //}
 }
开发者ID:CE-Webmaster,项目名称:CE-Hub,代码行数:23,代码来源:Authorizenet.php

示例5: _prepareCustomerCredit

 protected function _prepareCustomerCredit(Varien_Object $buyRequest, $product)
 {
     $store = Mage::app()->getStore();
     if ($store->isAdmin()) {
         $amount = $product->getPrice();
     } else {
         if ($buyRequest->getAmount()) {
             $amount = $buyRequest->getAmount();
             $includeTax = Mage::getStoreConfig('tax/display/type') != 1;
             $amount = $amount * 100 / Mage::helper('tax')->getPrice($product, 100, $includeTax);
         } else {
             $amount = $product->getPrice();
         }
         if (!$amount) {
             return Mage::helper('customercredit')->__('Please enter customercredit information');
         }
     }
     if (!$buyRequest->getAmount()) {
         $buyRequest->setAmount($amount);
     }
     $product->addCustomOption('amount', $amount);
     return array($product);
 }
开发者ID:protechhelp,项目名称:gamamba,代码行数:23,代码来源:Type.php

示例6: 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 Varien_Object $option1
  * @param Varien_Object $option2
  * @return integer
  */
 protected static function cmpShippingOptions(Varien_Object $option1, Varien_Object $option2)
 {
     if ($option1->getAmount() == $option2->getAmount()) {
         return 0;
     }
     return $option1->getAmount() < $option2->getAmount() ? -1 : 1;
 }
开发者ID:ksaltik,项目名称:tooldexlive,代码行数:17,代码来源:Checkout.php

示例7: _buildRequest

 /**
  * Prepare request to gateway
  * 
  * HERE WE NEED TO CHIME IN AND USE AN EXISTING CUSTOMER ACCOUNT IF A TOKEN
  * IS PRESENT
  *
  * @link http://www.authorize.net/support/AIM_guide.pdf
  * @param Mage_Payment_Model_Info $payment
  * @return Mage_Paygate_Model_Authorizenet_Request
  */
 protected function _buildRequest(Varien_Object $payment)
 {
     $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');
             if ($payment->getAdditionalInformation($this->_splitTenderIdKey)) {
                 $request->setXSplitTenderId($payment->getAdditionalInformation($this->_splitTenderIdKey));
             }
             break;
         case self::REQUEST_TYPE_AUTH_ONLY:
             $request->setXAllowPartialAuth($this->getConfigData('allow_partial_authorization') ? 'True' : 'False');
             if ($payment->getAdditionalInformation($this->_splitTenderIdKey)) {
                 $request->setXSplitTenderId($payment->getAdditionalInformation($this->_splitTenderIdKey));
             }
             break;
         case self::REQUEST_TYPE_CREDIT:
             /**
              * Send last 4 digits of credit card number to authorize.net
              * otherwise it will give an error
              * 
              * x_trans_id is the transaction ID we provide every 
              * transaction. It would be used to reference transactions in 
              * our system when doing export requests, etc.
              * 
              */
             $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:
             /**
              * x_auth_code is the authorization code you would pass if you 
              * were doing a forced sale type where you already had an 
              * approval and needed to force it into PayTrace.
              */
             $request->setXAuthCode($payment->getCcAuthCode());
             break;
     }
     if ($this->getIsCentinelValidationEnabled()) {
         $params = $this->getCentinelValidator()->exportCmpiData(array());
         $request = Varien_Object_Mapper::accumulateByMap($params, $request, $this->_centinelFieldMap);
     }
     /**
      * x_description is a description you can pass along with the 
      * transaction which will show in PayTrace reporting for reporting 
      * purposes.
      */
     $request->setXDescription('Magento Store Online Order');
     if (!empty($order)) {
         $billing = $order->getBillingAddress();
         if (!empty($billing)) {
             $request->setXDelimChar(self::RESPONSE_DELIM_CHAR)->setXEncapChar('')->setXFirstName($billing->getFirstname())->setXLastName($billing->getLastname())->setXCompany($billing->getCompany())->setXAddress($billing->getStreet(1))->setXCity($billing->getCity())->setXState($billing->getRegion())->setXZip($billing->getPostcode())->setXPhone($billing->getTelephone())->setXFax($billing->getFax())->setXEmail($order->getCustomerEmail())->setXMerchantEmail($this->getConfigData('merchant_email'));
         }
         $shipping = $order->getShippingAddress();
         if (!empty($shipping)) {
             $request->setXShipToFirstName($shipping->getFirstname())->setXShipToLastName($shipping->getLastname())->setXShipToCompany($shipping->getCompany())->setXShipToAddress($shipping->getStreet(1))->setXShipToCity($shipping->getCity())->setXShipToState($shipping->getRegion())->setXShipToZip($shipping->getPostcode())->setXShipToCountry($shipping->getCountry());
         }
         /*
          * x_po_num - * For Authorize.net this field is for Purchase 
          * Order numbers, for PayTrace this is only used for 
          * transactions that are identified as corporate or purchasing 
          * credit cards. This is an identifier that your customer may 
          * ask you to provide in order to reference the transaction to 
          * their credit card statement.
          */
         //e            $po_number = $order->getPoNumber()
         //                        ?$order->getPoNumber()
         //                        : ($order->getQuote()
         //                               ? $order->getQuote()->getPoNumber()
         //                                : '');
         //
         //            $request->setXPoNum($po_number);
         //
         //            $request->setXTax($order->getBaseTaxAmount())
         //f               ->setXFreight($order->getBaseShippingAmount());
//.........这里部分代码省略.........
开发者ID:Jonathonbyrd,项目名称:Optimized-Magento-1.9.x,代码行数:101,代码来源:Revolution.php

示例8: _buildRequest

 protected function _buildRequest(Varien_Object $payment)
 {
     if (!$payment->getTrxtype()) {
         $payment->setTrxtype(self::TRXTYPE_AUTH_ONLY);
     }
     if (!$payment->getTender()) {
         $payment->setTender(self::TENDER_CC);
     }
     $request = Mage::getModel('paygate/payflow_pro_request')->setUser($this->getConfigData('user'))->setVendor($this->getConfigData('vendor'))->setPartner($this->getConfigData('partner'))->setPwd($this->getConfigData('pwd'))->setTender($payment->getTender())->setTrxtype($payment->getTrxtype())->setVerbosity($this->getConfigData('verbosity'))->setRequestId($this->_generateRequestId());
     if ($payment->getAmount()) {
         $request->setAmt(round($payment->getAmount(), 2));
         $request->setCurrency($payment->getOrder()->getBaseCurrencyCode());
     }
     switch ($request->getTender()) {
         case self::TENDER_CC:
             if ($payment->getCcNumber()) {
                 $request->setAcct($payment->getCcNumber())->setExpdate(sprintf('%02d', $payment->getCcExpMonth()) . substr($payment->getCcExpYear(), -2, 2))->setCvv2($payment->getCcCid());
             }
             break;
     }
     $order = $payment->getOrder();
     if (!empty($order)) {
         $billing = $order->getBillingAddress();
         if (!empty($billing)) {
             $request->setFirstname($billing->getFirstname())->setLastname($billing->getLastname())->setStreet($billing->getStreet(1))->setCity($billing->getCity())->setState($billing->getRegion())->setZip($billing->getPostcode())->setCountry($billing->getCountry())->setEmail($payment->getOrder()->getCustomerEmail());
         }
         $shipping = $order->getShippingAddress();
         if (!empty($shipping)) {
             $request->setShiptofirstname($shipping->getFirstname())->setShiptolastname($shipping->getLastname())->setShiptostreet($shipping->getStreet(1))->setShiptocity($shipping->getCity())->setShiptostate($shipping->getRegion())->setShiptozip($shipping->getPostcode())->setShiptocountry($shipping->getCountry());
         }
     }
     return $request;
 }
开发者ID:HelioFreitas,项目名称:magento-pt_br,代码行数:33,代码来源:Pro.php

示例9: _registerCard

 /**
  * It sets card`s data into additional information of payment model
  *
  * @param Mage_Paygate_Model_Authorizenet_Result $response
  * @param Mage_Sales_Model_Order_Payment $payment
  * @return Varien_Object
  */
 protected function _registerCard(Varien_Object $response, Mage_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:par-orillonsoft,项目名称:magento_work,代码行数:16,代码来源:Authorizenet.php

示例10: _buildRequest

 /**
  * Prepare request to gateway
  *
  * @link http://www.authorize.net/support/AIM_guide.pdf
  * @param Mage_Sales_Model_Document $order
  * @return unknown
  */
 protected function _buildRequest(Varien_Object $payment)
 {
     $order = $payment->getOrder();
     $this->setStore($order->getStoreId());
     if (!$payment->getAnetTransMethod()) {
         $payment->setAnetTransMethod(self::REQUEST_METHOD_CC);
     }
     $request = Mage::getModel('paygate/authorizenet_request')->setXVersion(3.1)->setXDelimData('True')->setXDelimChar(self::RESPONSE_DELIM_CHAR)->setXRelayResponse('False');
     if ($order && $order->getIncrementId()) {
         $request->setXInvoiceNum($order->getIncrementId());
     }
     $request->setXTestRequest($this->getConfigData('test') ? 'TRUE' : 'FALSE');
     $request->setXLogin($this->getConfigData('login'))->setXTranKey($this->getConfigData('trans_key'))->setXType($payment->getAnetTransType())->setXMethod($payment->getAnetTransMethod());
     if ($payment->getAmount()) {
         $request->setXAmount($payment->getAmount(), 2);
         $request->setXCurrencyCode($order->getBaseCurrencyCode());
     }
     switch ($payment->getAnetTransType()) {
         case self::REQUEST_TYPE_CREDIT:
         case self::REQUEST_TYPE_VOID:
         case self::REQUEST_TYPE_PRIOR_AUTH_CAPTURE:
             $request->setXTransId($payment->getCcTransId());
             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->getStreet(1))->setXCity($billing->getCity())->setXState($billing->getRegion())->setXZip($billing->getPostcode())->setXCountry($billing->getCountry())->setXPhone($billing->getTelephone())->setXFax($billing->getFax())->setXCustId($billing->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->getStreet(1))->setXShipToCity($shipping->getCity())->setXShipToState($shipping->getRegion())->setXShipToZip($shipping->getPostcode())->setXShipToCountry($shipping->getCountry());
         }
         $request->setXPoNum($payment->getPoNumber())->setXTax($order->getTaxAmount())->setXFreight($order->getShippingAmount());
     }
     switch ($payment->getAnetTransMethod()) {
         case self::REQUEST_METHOD_CC:
             if ($payment->getCcNumber()) {
                 $request->setXCardNum($payment->getCcNumber())->setXExpDate(sprintf('%02d-%04d', $payment->getCcExpMonth(), $payment->getCcExpYear()))->setXCardCode($payment->getCcCid());
             }
             break;
         case self::REQUEST_METHOD_ECHECK:
             $request->setXBankAbaCode($payment->getEcheckRoutingNumber())->setXBankName($payment->getEcheckBankName())->setXBankAcctNum($payment->getEcheckAccountNumber())->setXBankAcctType($payment->getEcheckAccountType())->setXBankAcctName($payment->getEcheckAccountName())->setXEcheckType($payment->getEcheckType());
             break;
     }
     return $request;
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:57,代码来源:Authorizenet.php

示例11: _build

 /**
  * Build a moneris transaction object the data of moneris
  * Make sure the transaction object is the appropriate type for the current
  * step.
  *
  * @var Varien_Object $payment
  * @var string $type
  */
 public function _build(Varien_Object $payment, $type)
 {
     $order = $payment->getOrder();
     $billing = $order->getBillingAddress();
     $shipping = $order->getShippingAddress();
     # Should be only used in the developement environment
     # without it we get duplicate order id.
     $token = $this->getConfigData('order_token');
     $token = empty($token) ? "" : "-" . $token;
     $transaction = array('type' => $type, 'order_id' => $order->getIncrementId() . $token, 'crypt_type' => self::CRYPT_TYPE);
     switch ($type) {
         case self::TRANSACTION_PREAUTH:
             $transaction = $transaction + array('cust_id' => $billing->getCustomerId(), 'amount' => sprintf("%01.2f", $payment->getAmount()), 'pan' => $this->_cleanCC($payment->getCcNumber()), 'expdate' => $this->_formatExpirationDate($payment->getCcExpYear(), $payment->getCcExpMonth()), 'cvd_value' => $payment->getCcCid(), 'cvd_indicator' => 1);
             break;
         case self::TRANSACTION_COMPLETION:
             $transaction = $transaction + array('comp_amount' => sprintf("%01.2f", $payment->getAmount()), 'txn_number' => $payment->getCcTransId());
             break;
         case self::TRANSACTION_VOID:
             $transaction = $transaction + array('comp_amount' => sprintf("%01.2f", $payment->getAmount()), 'txn_number' => $payment->getCcTransId());
             break;
     }
     return new mpgTransaction($transaction);
 }
开发者ID:ph,项目名称:magento-moneris,代码行数:31,代码来源:PaymentMethod.php

示例12: authorize

 /**
  * Send authorize request to gateway
  *
  * @param   Varien_Object $payment
  * @param   decimal $amount
  * @return  Mage_Paygate_Model_Authorizenet
  */
 public function authorize(Varien_Object $payment, $amount)
 {
     $payment->setAmount($this->getQuote()->getGrandTotal());
     $error = false;
     $security = $this->getSecurityKey();
     $payment->setSuSecurity($security);
     if ($payment->getAmount()) {
         $amount = number_format($this->getQuote()->getGrandTotal(), 2, '.', '');
         $billing = $this->getQuote()->getBillingAddress();
         $locale = explode('_', Mage::app()->getLocale()->getLocaleCode());
         if (is_array($locale) && !empty($locale) && in_array($locale[0], $this->_supportedLocales)) {
             $locale = strtoupper($locale[0]);
         } else {
             $locale = strtoupper($this->getDefaultLocale());
         }
         $params = array('user_id' => $this->getConfigData('customer'), 'project_id' => $this->getConfigData('project'), 'amount' => $amount, 'reason_1' => Mage::helper('pnsofortueberweisung')->__('Order: ') . $this->getQuote()->getReservedOrderId(), 'reason_2' => '', 'sender_holder' => $payment->getSuHolder(), 'sender_account_number' => $payment->getSuAccountNumber(), 'sender_bank_code' => $payment->getSuBankCode(), 'sender_bank_bic' => $payment->getSuBic(), 'sender_iban' => $payment->getSuIban(), 'sender_country_id' => $billing->getCountry(), 'user_variable_0' => $this->getQuote()->getReservedOrderId(), 'user_variable_1' => $payment->getSuSecurity(), 'user_variable_2' => '', 'user_variable_3' => '', 'user_variable_4' => '', 'user_variable_5' => '', 'expires' => $this->getConfigData('expires'), 'language_id' => $locale);
         if ($this->getConfigData('check_input_yesno') == 1) {
             $params['hash'] = md5(implode('|', $params) . '|' . $this->getConfigData('project_pswd'));
         }
         $result = $this->_postRequest($params);
         if (strstr($result, 'Errors') === false) {
             $payment->setSuPaycode($result);
             $payment->setStatus(self::STATUS_APPROVED);
         } else {
             $error = Mage::helper('pnsofortueberweisung')->__('Please check your account data.');
         }
     } else {
         $error = Mage::helper('pnsofortueberweisung')->__('Invalid amount for authorization.');
     }
     if ($error !== false) {
         Mage::throwException($error);
     }
     return $this;
 }
开发者ID:jronatay,项目名称:ultimo-magento-jron,代码行数:41,代码来源:Paycode.php

示例13: _prepareCustomerCredit

 protected function _prepareCustomerCredit(Varien_Object $buyRequest, $product)
 {
     if (Mage::app()->getStore()->isAdmin()) {
         $store = Mage::getSingleton('adminhtml/session_quote')->getStore();
     } else {
         $store = Mage::app()->getStore();
     }
     $amount = $buyRequest->getAmount();
     if ($amount) {
         $creditAmount = Mage::helper('customercredit/creditproduct')->getCreditValue($product);
         switch ($creditAmount['type']) {
             case 'range':
                 if ($amount < $this->convertPrice($product, $creditAmount['from'])) {
                     $amount = $this->convertPrice($product, $creditAmount['from']) * $creditAmount['storecredit_rate'];
                 } elseif ($amount > $this->convertPrice($product, $creditAmount['to'])) {
                     $amount = $this->convertPrice($product, $creditAmount['to']) * $creditAmount['storecredit_rate'];
                 } else {
                     if ($amount > 0) {
                         $amount = $amount * $creditAmount['storecredit_rate'];
                     } else {
                         $amount = 0;
                     }
                 }
                 $fnPrice = $amount;
                 break;
             case 'dropdown':
                 if (!empty($creditAmount['options'])) {
                     $check = false;
                     $giftDropdown = array();
                     for ($i = 0; $i < count($creditAmount['options']); $i++) {
                         $giftDropdown[$i] = $this->convertPrice($product, $creditAmount['options'][$i]);
                         if ($amount == $giftDropdown[$i]) {
                             $check = true;
                         }
                     }
                     if (!$check) {
                         $amount = $creditAmount['options'][0];
                     }
                     $fnPrices = array_combine($giftDropdown, $creditAmount['prices']);
                     $fnPrice = $fnPrices[$amount];
                 }
                 break;
             case 'static':
                 if ($amount != $this->convertPrice($product, $creditAmount['value'])) {
                     $amount = $creditAmount['value'];
                 }
                 $fnPrice = $creditAmount['credit_price'];
                 break;
             default:
                 return Mage::helper('customercredit')->__('Please enter Store Credit information.');
         }
     } else {
         return Mage::helper('customercredit')->__('Please enter Store Credit information.');
     }
     $buyRequest->setAmount($amount);
     $product->addCustomOption('credit_price_amount', $fnPrice);
     foreach (Mage::helper('customercredit')->getFullCreditProductOptions() as $key => $label) {
         if ($value = $buyRequest->getData($key)) {
             $product->addCustomOption($key, $value);
         }
     }
     return array($product);
 }
开发者ID:javik223,项目名称:Evron-Magento,代码行数:63,代码来源:Type.php

示例14: capture

 /**
  * Send capture request to gateway
  *
  * @param Varien_Object $payment
  * @param decimal $amount
  * @return Mage_Paygate_Model_Authorizenet
  * @throws Mage_Core_Exception
  */
 public function capture(Varien_Object $payment, $amount)
 {
     if ($amount <= 0) {
         Mage::throwException(Mage::helper('linkpoint')->__('Invalid amount for transaction.'));
     }
     $payment->setAmount($amount);
     $data = $this->_prepareData();
     $data['ordertype'] = "SALE";
     $creditcard = array('cardnumber' => $payment->getCcNumber(), 'cardexpmonth' => $payment->getCcExpMonth(), 'cardexpyear' => substr($payment->getCcExpYear(), -2));
     if ($this->getConfigData('useccv') == 1) {
         $creditcard["cvmindicator"] = "provided";
         $creditcard["cvmvalue"] = $payment->getCcCid();
     }
     $shipping = array();
     $billing = array();
     $order = $payment->getOrder();
     if (!empty($order)) {
         $BillingAddress = $order->getBillingAddress();
         $billing['name'] = $BillingAddress->getFirstname() . " " . $BillingAddress->getLastname();
         $billing['company'] = $BillingAddress->getCompany();
         $billing['address'] = $BillingAddress->getStreet(1);
         $billing['city'] = $BillingAddress->getCity();
         $billing['state'] = $BillingAddress->getRegion();
         $billing['zip'] = $BillingAddress->getPostcode();
         $billing['country'] = $BillingAddress->getCountry();
         $billing['email'] = $order->getCustomerEmail();
         $billing['phone'] = $BillingAddress->getTelephone();
         $billing['fax'] = $BillingAddress->getFax();
         $ShippingAddress = $order->getShippingAddress();
         if (!empty($shipping)) {
             $shipping['sname'] = $ShippingAddress->getFirstname() . " " . $ShippingAddress->getLastname();
             $shipping['saddress1'] = $ShippingAddress->getStreet(1);
             $shipping['scity'] = $ShippingAddress->getCity();
             $shipping['sstate'] = $ShippingAddress->getRegion();
             $shipping['szip'] = $ShippingAddress->getPostcode();
             $shipping['scountry'] = $ShippingAddress->getCountry();
         }
     }
     $transactiondetails = array();
     $merchantinfo = array();
     $merchantinfo['configfile'] = $data['storenumber'];
     $merchantinfo['keyfile'] = $data['key'];
     $paymentdetails = array();
     $paymentdetails['chargetotal'] = $payment->getAmount();
     $data = array_merge($data, $creditcard, $billing, $shipping, $transactiondetails, $merchantinfo, $paymentdetails);
     $result = $this->_postRequest($data);
     if (is_array($result) && count($result) > 0) {
         if (array_key_exists("r_approved", $result)) {
             if ($result["r_approved"] != "APPROVED") {
                 $payment->setStatus(self::STATUS_ERROR);
                 Mage::throwException("Gateway error : {" . (string) $result["r_error"] . "}");
             } else {
                 $payment->setStatus(self::STATUS_APPROVED);
                 $payment->setLastTransId((string) $result["r_ordernum"]);
                 if (!$payment->getParentTransactionId() || (string) $result["r_ordernum"] != $payment->getParentTransactionId()) {
                     $payment->setTransactionId((string) $result["r_ordernum"]);
                 }
                 return $this;
             }
         } else {
             Mage::throwException("No approval found");
         }
     } else {
         Mage::throwException("No response found");
     }
 }
开发者ID:tannpv,项目名称:magento1702,代码行数:74,代码来源:Linkpoint.php

示例15: _buildRequest

 /**
  *  Building request array
  *
  *  @param    Varien_Object
  *  @return	  array
  */
 protected function _buildRequest(Varien_Object $payment)
 {
     $order = $payment->getOrder();
     $billing = $order->getBillingAddress();
     $streets = $billing->getStreet();
     $street = isset($streets[0]) && $streets[0] != '' ? $streets[0] : (isset($streets[1]) && $streets[1] != '' ? $streets[1] : '');
     $request = Mage::getModel('chronopay/gateway_request')->setOpcode($payment->getOpcode())->setProductId($this->getConfigData('product_id'));
     switch ($request->getOpcode()) {
         case self::OPCODE_CUSTOMER_FUND_TRANSFER:
             $request->setCustomer($order->getCustomerId())->setAmount(sprintf('%.2f', $payment->getAmount()))->setCurrency($order->getBaseCurrencyCode());
             break;
         case self::OPCODE_CHARGING:
         case self::OPCODE_REFUND:
         case self::OPCODE_AUTHORIZE:
         case self::OPCODE_VOID_AUTHORIZE:
             $request->setFname($billing->getFirstname())->setLname($billing->getLastname())->setCardholder($payment->getCcOwner())->setZip($billing->getPostcode())->setStreet($street)->setCity($billing->getCity())->setState($billing->getRegionModel()->getCode())->setCountry($billing->getCountryModel()->getIso3Code())->setEmail($order->getCustomerEmail())->setPhone($billing->getTelephone())->setIp($this->_getIp())->setCardNo($payment->getCcNumber())->setCvv($payment->getCcCid())->setExpirey($payment->getCcExpYear())->setExpirem(sprintf('%02d', $payment->getCcExpMonth()))->setAmount(sprintf('%.2f', $payment->getAmount()))->setCurrency($order->getBaseCurrencyCode());
             break;
         default:
             Mage::throwException(Mage::helper('chronopay')->__('Invalid operation code.'));
             break;
     }
     $request->setShowTransactionId(1);
     if ($this->getTransactionId()) {
         $request->setTransaction($this->getTransactionId());
     }
     $hash = $this->_getHash($request);
     $request->setHash($hash);
     return $request;
 }
开发者ID:jweiss,项目名称:Magento-Example,代码行数:35,代码来源:Gateway.php


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