/**
  * Fill out the request payload with payment data and update the API request
  * body with the complete request.
  * @param Api\IBidirectionalApi $api
  * @param Varien_Object         $payment Most likely a Mage_Sales_Model_Order_Payment
  * @return self
  */
 protected function _prepareApiRequest(Api\IBidirectionalApi $api, Varien_Object $payment)
 {
     $request = $api->getRequestBody();
     $order = $payment->getOrder();
     $billingAddress = $order->getBillingAddress();
     $shippingAddress = $order->getShippingAddress() ?: $billingAddress;
     $request->setIsEncrypted($this->_isUsingClientSideEncryption)->setRequestId($this->_coreHelper->generateRequestId('CCA-'))->setOrderId($order->getIncrementId())->setPanIsToken(false)->setCardNumber($payment->getCcNumber())->setExpirationDate($this->_coreHelper->getNewDateTime(sprintf('%s-%s', $payment->getCcExpYear(), $payment->getCcExpMonth())))->setCardSecurityCode($payment->getCcCid())->setAmount($payment->getBaseAmountAuthorized())->setCurrencyCode(Mage::app()->getStore()->getBaseCurrencyCode())->setEmail($order->getCustomerEmail())->setIp($this->_httpHelper->getRemoteAddr())->setBillingFirstName($billingAddress->getFirstname())->setBillingLastName($billingAddress->getLastname())->setBillingPhone($billingAddress->getTelephone())->setBillingLines($billingAddress->getStreet(-1))->setBillingCity($billingAddress->getCity())->setBillingMainDivision($billingAddress->getRegionCode())->setBillingCountryCode($billingAddress->getCountry())->setBillingPostalCode($billingAddress->getPostcode())->setShipToFirstName($shippingAddress->getFirstname())->setShipToLastName($shippingAddress->getLastname())->setShipToPhone($shippingAddress->getTelephone())->setShipToLines($shippingAddress->getStreet(-1))->setShipToCity($shippingAddress->getCity())->setShipToMainDivision($shippingAddress->getRegionCode())->setShipToCountryCode($shippingAddress->getCountry())->setShipToPostalCode($shippingAddress->getPostcode())->setIsRequestToCorrectCVVOrAVSError($this->_getIsCorrectionNeededForPayment($payment));
     return $this;
 }
Example #2
0
 public function testGetRemoteAddr()
 {
     $this->assertEquals(false, $this->_helper->getRemoteAddr());
 }
Example #3
0
 /**
  * Initialize visitor information from server data
  *
  * @return Mage_Log_Model_Visitor
  */
 public function initServerData()
 {
     $this->addData(array('server_addr' => $this->_httpHelper->getServerAddr(true), 'remote_addr' => $this->_httpHelper->getRemoteAddr(true), 'http_secure' => Mage::app()->getStore()->isCurrentlySecure(), 'http_host' => $this->_httpHelper->getHttpHost(true), 'http_user_agent' => $this->_httpHelper->getHttpUserAgent(true), 'http_accept_language' => $this->_httpHelper->getHttpAcceptLanguage(true), 'http_accept_charset' => $this->_httpHelper->getHttpAcceptCharset(true), 'request_uri' => $this->_httpHelper->getRequestUri(true), 'session_id' => $this->_session->getSessionId(), 'http_referer' => $this->_httpHelper->getHttpReferer(true)));
     return $this;
 }