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


PHP Varien_Object::setAdditionalInformation方法代码示例

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


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

示例1: testGetAliasWithAdditionalInformation

 public function testGetAliasWithAdditionalInformation()
 {
     $quote = new Varien_Object();
     $payment = new Varien_Object();
     $payment->setAdditionalInformation(array('alias' => 'testAlias'));
     $quote->setPayment($payment);
     $aliasHelperMock = $this->getHelperMock('ops/alias', array('isAdminSession'));
     $aliasHelperMock->expects($this->any())->method('isAdminSession')->will($this->returnValue(false));
     $this->assertEquals('testAlias', $aliasHelperMock->getAlias($quote));
 }
开发者ID:roshu1980,项目名称:add-computers,代码行数:10,代码来源:AliasTest.php

示例2: order

 /**
  * Send payment request after order (backend / frontend).
  *
  * @param Varien_Object $payment
  * @param float $amount
  * @return $this|Mage_Payment_Model_Abstract
  * @throws Mage_Core_Exception
  */
 public function order(Varien_Object $payment, $amount)
 {
     $order = $payment->getOrder();
     $orderAddress = $order->getBillingAddress();
     $bzPayment = Mage::getModel('barzahlen/api_request_payment', array('customerEmail' => $order->getCustomerEmail(), 'customerStreetNr' => $orderAddress->getData("street"), 'customerZipcode' => $orderAddress->getData("postcode"), 'customerCity' => $orderAddress->getData("city"), 'customerCountry' => $orderAddress->getData("country_id"), 'orderId' => $order->getRealOrderId(), 'amount' => $amount, 'currency' => $order->getOrderCurrencyCode()));
     try {
         $this->getBarzahlenApi()->handleRequest($bzPayment);
         $payment->setAdditionalInformation('transaction_id', $bzPayment->getTransactionId())->setTransactionId($bzPayment->getTransactionId())->setIsTransactionClosed(0);
         $session = Mage::getSingleton('checkout/session');
         $session->setData('barzahlen_infotext', $bzPayment->getInfotext1());
     } catch (Exception $e) {
         Mage::helper('barzahlen')->bzLog($e);
         Mage::throwException(Mage::helper('barzahlen')->__('bz_frnt_error'));
     }
     return $this;
 }
开发者ID:TriplesenseReply,项目名称:Barzahlen-Magento,代码行数:24,代码来源:Barzahlen.php

示例3: testGetParameterForCaptureWillReturnArray

 public function testGetParameterForCaptureWillReturnArray()
 {
     $fakePayment = new Varien_Object();
     $fakePayment->setOrder(new Varien_Object());
     $fakePayment->setAdditionalInformation(array('paymentId' => '4711'));
     $arrInfo = array('operation' => 'capture');
     $amount = 10;
     $opsPaymentMethod = Mage::getModel('ops/payment_abstract');
     $requestParams = Mage::getModel('ops/backend_operation_parameter')->getParameterFor(Netresearch_OPS_Model_Payment_Abstract::OPS_CAPTURE_TRANSACTION_TYPE, $opsPaymentMethod, $fakePayment, $amount, $arrInfo);
     $this->assertArrayHasKey('AMOUNT', $requestParams);
     $this->assertArrayHasKey('PAYID', $requestParams);
     $this->assertArrayHasKey('OPERATION', $requestParams);
     $this->assertArrayHasKey('CURRENCY', $requestParams);
     $this->assertEquals(1000, $requestParams['AMOUNT']);
     $this->assertEquals(4711, $requestParams['PAYID']);
     $this->assertEquals('capture', $requestParams['OPERATION']);
     $this->assertEquals(Mage::app()->getStore($fakePayment->getOrder()->getStoreId())->getBaseCurrencyCode(), $requestParams['CURRENCY']);
 }
开发者ID:roshu1980,项目名称:add-computers,代码行数:18,代码来源:ParameterTest.php

示例4: testGetRequestParams

 public function testGetRequestParams()
 {
     $fakePayment = new Varien_Object();
     $fakePayment->setOrder(new Varien_Object());
     $fakePayment->setAdditionalInformation(array('paymentId' => '4711'));
     $arrInfo = array('operation' => 'refund', 'invoice_id' => 2);
     $amount = 10;
     $opsPaymentMethod = Mage::getModel('ops/payment_abstract');
     $captureParameterModel = Mage::getModel('ops/backend_operation_refund_parameter');
     $requestParams = $captureParameterModel->getRequestParams($opsPaymentMethod, $fakePayment, $amount, $arrInfo);
     $this->assertArrayHasKey('AMOUNT', $requestParams);
     $this->assertArrayHasKey('PAYID', $requestParams);
     $this->assertArrayHasKey('OPERATION', $requestParams);
     $this->assertArrayHasKey('CURRENCY', $requestParams);
     $this->assertEquals(1000, $requestParams['AMOUNT']);
     $this->assertEquals(4711, $requestParams['PAYID']);
     $this->assertEquals('refund', $requestParams['OPERATION']);
     $this->assertEquals(Mage::app()->getStore($fakePayment->getOrder()->getStoreId())->getBaseCurrencyCode(), $requestParams['CURRENCY']);
 }
开发者ID:roshu1980,项目名称:add-computers,代码行数:19,代码来源:ParameterTest.php

示例5: _beforeProcessResponse

 protected function _beforeProcessResponse($request, $result, Varien_Object $payment)
 {
     try {
         $action = explode('.', $request['PAYMENT.CODE']);
         if (!isset($action[1])) {
             Mage::throwException(Mage::helper('moneybookerspsp')->__('MoneybookersPSP: Wrong response data, method is missing'));
         }
         $method = strtoupper($action[0]);
         $action = strtoupper($action[1]);
         if ((string) $result->Transaction->attributes()->{'response'} == 'ASYNC' && (string) $result->Transaction->Processing->Result == self::PROCESSING_RESULT_OK && (string) $result->Transaction->Processing->Status->attributes()->{'code'} == self::PROCESSING_STATUS_CODE_WAITING && !empty($result->Transaction->Processing->Redirect)) {
             $this->setOrderPlaceRedirectUrl(Mage::getUrl('moneybookerspsp/processing/threeds'));
             $params = array();
             foreach ($result->Transaction->Processing->Redirect->Parameter as $parameter) {
                 $params[(string) $parameter->attributes()->{'name'}] = (string) $parameter;
             }
             $params['redirect_url'] = (string) $result->Transaction->Processing->Redirect->attributes()->{'url'};
             $payment->setAdditionalInformation($params);
         } else {
             return parent::_beforeProcessResponse($request, $result, $payment);
         }
     } catch (Exception $e) {
         Mage::logException($e);
     }
 }
开发者ID:protechhelp,项目名称:gamamba,代码行数:24,代码来源:Cc.php

示例6: authorize

 /**
  * Authorize the transaction by calling PAYMENT_INIT, PAYMENT_REQUEST and PAYMENT_CONFIRM.
  *
  * @param   Varien_Object $orderPayment
  * @param   float $amount
  * @return  RatePAY_Ratepaypayment_Model_Method_Rechnung
  */
 public function authorize(Varien_Object $payment, $amount)
 {
     $client = Mage::getSingleton('ratepaypayment/request');
     $order = $this->getQuoteOrOrder();
     $helper = Mage::helper('ratepaypayment/mapping');
     if (Mage::getSingleton('ratepaypayment/session')->getQueryActive() && Mage::getSingleton('ratepaypayment/session')->getTransactionId()) {
         $resultInit['transactionId'] = Mage::getSingleton('ratepaypayment/session')->getTransactionId();
         $resultInit['transactionShortId'] = Mage::getSingleton('ratepaypayment/session')->getTransactionShortId();
     } else {
         $resultInit = $client->callPaymentInit($helper->getRequestHead($order), $helper->getLoggingInfo($order));
     }
     if (is_array($resultInit) || $resultInit == true) {
         $payment->setAdditionalInformation('transactionId', $resultInit['transactionId']);
         $payment->setAdditionalInformation('transactionShortId', $resultInit['transactionShortId']);
         $resultRequest = $client->callPaymentRequest($helper->getRequestHead($order), $helper->getRequestCustomer($order), $helper->getRequestBasket($order), $helper->getRequestPayment($order), $helper->getLoggingInfo($order));
         if (is_array($resultRequest) || $resultRequest == true) {
             $payment->setAdditionalInformation('descriptor', $resultRequest['descriptor']);
             if ($this->getHelper()->getRpConfigData($order, $this->_code, 'address_normalization')) {
                 $billingAddress = $order->getBillingAddress();
                 $shippingAddress = $order->getShippingAddress();
                 $billingAddress->setStreet(implode(' ', array($resultRequest['address']['street'], $resultRequest['address']['street-number'])));
                 $billingAddress->setPostcode($resultRequest['address']['zip-code']);
                 $billingAddress->setCity($resultRequest['address']['city']);
                 if ($billingAddress->getCustomerAddressId() == $shippingAddress->getCustomerAddressId()) {
                     $shippingAddress->setStreet(implode(' ', array($resultRequest['address']['street'], $resultRequest['address']['street-number'])));
                     $shippingAddress->setPostcode($resultRequest['address']['zip-code']);
                     $shippingAddress->setCity($resultRequest['address']['city']);
                 }
             }
             $resultConfirm = $client->callPaymentConfirm($helper->getRequestHead($order), $helper->getLoggingInfo($order));
             if (!is_array($resultConfirm) && !$resultConfirm == true) {
                 $this->_abortBackToPayment('PAYMENT_REQUEST Declined');
             }
         } else {
             $this->_abortBackToPayment('PAYMENT_REQUEST Declined');
         }
     } else {
         $this->_abortBackToPayment('Gateway Offline');
     }
     $this->_cleanSession();
     return $this;
 }
开发者ID:nschoen,项目名称:magento-module,代码行数:49,代码来源:Abstract.php

示例7: payment

 /**
  * Processing the payment or preauth
  * @return booelan Indicator of success
  */
 public function payment(Varien_Object $payment, $amount)
 {
     //Gathering data from session
     $token = Mage::getSingleton('core/session')->getToken();
     //Create Payment Processor
     $paymentHelper = Mage::helper("paymill/paymentHelper");
     $fcHelper = Mage::helper("paymill/fastCheckoutHelper");
     $paymentProcessor = $paymentHelper->createPaymentProcessor($this->getCode(), $token);
     //Always load client if email doesn't change
     $clientId = $fcHelper->getClientId();
     if (isset($clientId) && !is_null(Mage::helper("paymill/customerHelper")->getClientData())) {
         $paymentProcessor->setClientId($clientId);
     }
     //Loading Fast Checkout Data (if enabled and given)
     if ($fcHelper->hasData($this->_code) && $token === 'dummyToken') {
         $paymentId = $fcHelper->getPaymentId($this->_code);
         if (isset($paymentId) && !is_null($fcHelper->getPaymentData($this->_code))) {
             $paymentProcessor->setPaymentId($paymentId);
         }
     }
     $success = $paymentProcessor->processPayment(!$this->_preauthFlag);
     $this->_existingClientHandling($clientId);
     if ($success) {
         if ($this->_preauthFlag) {
             $payment->setAdditionalInformation('paymillPreauthId', $paymentProcessor->getPreauthId());
         } else {
             $payment->setAdditionalInformation('paymillTransactionId', $paymentProcessor->getTransactionId());
         }
         $payment->setAdditionalInformation('paymillPrenotificationDate', $this->_getPrenotificationDate($payment->getOrder()));
         //Allways update the client
         $clientId = $paymentProcessor->getClientId();
         $fcHelper->saveData($this->_code, $clientId);
         //Save payment data for FastCheckout (if enabled)
         if ($fcHelper->isFastCheckoutEnabled()) {
             //Fast checkout enabled
             $paymentId = $paymentProcessor->getPaymentId();
             $fcHelper->saveData($this->_code, $clientId, $paymentId);
         }
         return true;
     }
     $this->_errorCode = $paymentProcessor->getErrorCode();
     return false;
 }
开发者ID:SiWe0401,项目名称:paymill-magento,代码行数:47,代码来源:MethodModelAbstract.php

示例8: _callDoAuthorize

 /**
  * Call DoAuthorize
  *
  * @param int $amount
  * @param Varien_Object $payment
  * @param string $parentTransactionId
  * @return Mage_Paypal_Model_Api_Abstract
  * @throws Mage_Paypal_Model_Api_ProcessableException
  */
 protected function _callDoAuthorize($amount, $payment, $parentTransactionId)
 {
     $apiData = $this->_pro->getApi()->getData();
     foreach ($apiData as $k => $v) {
         if (is_object($v)) {
             unset($apiData[$k]);
         }
     }
     Mage::getSingleton('checkout/session')->setPaypalTransactionData($apiData);
     $this->_pro->resetApi();
     $api = $this->_setApiProcessableErrors()->setAmount($amount)->setCurrencyCode($payment->getOrder()->getBaseCurrencyCode())->setTransactionId($parentTransactionId)->callDoAuthorization();
     $payment->setAdditionalInformation($this->_authorizationCountKey, $payment->getAdditionalInformation($this->_authorizationCountKey) + 1);
     return $api;
 }
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:23,代码来源:Express.php

示例9: createOrder

 public function createOrder(Varien_Object $payment, $amount, $authorize)
 {
     $store_id = Mage::app()->getStore()->getStoreId();
     $logger = Mage::helper('worldpay/logger');
     if ($payment->getOrder()) {
         $orderId = $payment->getOrder()->getIncrementId();
         $order = $payment->getOrder();
     } else {
         $quote = $payment->getQuote();
         $orderId = $quote->getReservedOrderId();
         $quote->save();
     }
     $session = Mage::getSingleton('core/session');
     $token = $session->getData('payment_token');
     $savedCard = $session->getData('saved_card');
     $logger->log('Begin create order');
     $session->setData('wp_3dsSuccess', false);
     $session->setData('wp_orderCode', false);
     $worldpay = $this->setupWorldpay();
     $checkout = Mage::getSingleton('checkout/session')->getQuote();
     $billing = $checkout->getBillingAddress();
     $order_description = Mage::getStoreConfig('payment/worldpay/description', $store_id);
     if (!$order_description) {
         $order_description = "Order";
     }
     $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
     $name = $billing->getName();
     $billing_address = array("address1" => $billing->getStreet(1), "address2" => $billing->getStreet(2), "address3" => $billing->getStreet(3), "postalCode" => $billing->getPostcode(), "city" => $billing->getCity(), "state" => "", "countryCode" => $billing->getCountry());
     try {
         $mode = Mage::getStoreConfig('payment/worldpay_mode', Mage::app()->getStore()->getStoreId());
         $settlementCurrency = Mage::getStoreConfig('payment/worldpay/settlementcurrency', Mage::app()->getStore()->getStoreId());
         $createOrderRequest = array('token' => $token, 'orderDescription' => $order_description, 'amount' => $amount * 100, 'currencyCode' => $currency_code, 'name' => $name, 'billingAddress' => $billing_address, 'customerOrderCode' => $orderId, 'settlementCurrency' => $settlementCurrency, 'successUrl' => Mage::getUrl('worldpay/apm/success', array('_secure' => true)), 'pendingUrl' => Mage::getUrl('worldpay/apm/pending', array('_secure' => true)), 'failureUrl' => Mage::getUrl('worldpay/apm/failure', array('_secure' => true)), 'cancelUrl' => Mage::getUrl('worldpay/apm/cancel', array('_secure' => true)));
         $logger->log('Order Request: ' . print_r($createOrderRequest, true));
         $response = $worldpay->createApmOrder($createOrderRequest);
         $logger->log('Order Response: ' . print_r($response, true));
         if ($response['paymentStatus'] === 'SUCCESS') {
             $this->setStore($payment->getOrder()->getStoreId());
             $logger->log('Order: ' . $response['orderCode'] . ' SUCCESS');
             $payment->setStatus(self::STATUS_APPROVED);
             $payment->setAmount($amount);
             $payment->setLastTransId($orderId);
             $payment->setTransactionId($response['orderCode']);
             $payment->setAdditionalInformation("worldpayOrderCode", $response['orderCode']);
             $payment->setShouldCloseParentTransaction(1)->setIsTransactionClosed(1)->registerCaptureNotification($amount);
         } else {
             if ($response['paymentStatus'] == 'PRE_AUTHORIZED') {
                 $logger->log('Order: ' . $response['orderCode'] . ' PRE_AUTHORIZED');
                 $payment->setAmount($amount);
                 $payment->setAdditionalInformation("worldpayOrderCode", $response['orderCode']);
                 $payment->setLastTransId($orderId);
                 $payment->setTransactionId($response['orderCode']);
                 $payment->setIsTransactionClosed(false);
                 $session->setData('wp_redirectURL', $response['redirectURL']);
                 $session->setData('wp_orderCode', $response['orderCode']);
             } else {
                 if (isset($response['paymentStatusReason'])) {
                     throw new Exception($response['paymentStatusReason']);
                 } else {
                     throw new Exception(print_r($response, true));
                 }
             }
         }
     } catch (Exception $e) {
         $payment->setStatus(self::STATUS_ERROR);
         $payment->setAmount($amount);
         $payment->setLastTransId($orderId);
         $logger->log($e->getMessage());
         Mage::throwException('Payment failed, please try again later ' . $e->getMessage());
     }
     return $this;
 }
开发者ID:ao,项目名称:worldpay-magento-1,代码行数:71,代码来源:Abstract.php

示例10: _processResponse

 /**
  * @desc authorise response
  * Process the response of the soap
  *
  * @param Varien_Object $payment
  * @param stdClass      $response
  * @param null          $request
  *
  * @return $this
  * @todo Add comment with checkout Authorised
  */
 protected function _processResponse(Varien_Object $payment, $response, $request = null)
 {
     if (!$response instanceof stdClass) {
         return false;
     }
     switch ($request) {
         case "authorise":
         case "authorise3d":
             if ($response->paymentResult->fraudResult) {
                 $fraudResult = $response->paymentResult->fraudResult->accountScore;
                 $payment->setAdyenTotalFraudScore($fraudResult);
             }
             $responseCode = $response->paymentResult->resultCode;
             $pspReference = $response->paymentResult->pspReference;
             // save pspreference to match with notification
             $payment->setAdyenPspReference($pspReference);
             break;
         case "refund":
             $responseCode = $response->refundResult->response;
             $pspReference = $response->refundResult->pspReference;
             break;
         case "cancel_or_refund":
             $responseCode = $response->cancelOrRefundResult->response;
             $pspReference = $response->cancelOrRefundResult->pspReference;
             break;
         case "capture":
             $responseCode = $response->captureResult->response;
             $pspReference = $response->captureResult->pspReference;
             break;
         default:
             $responseCode = null;
             $this->writeLog("Unknown data type by Adyen");
             break;
     }
     switch ($responseCode) {
         case "RedirectShopper":
             $payment->setAdditionalInformation('paRequest', $response->paymentResult->paRequest);
             $payment->setAdditionalInformation('md', $response->paymentResult->md);
             $payment->setAdditionalInformation('issuerUrl', $response->paymentResult->issuerUrl);
             Mage::getSingleton('customer/session')->setRedirectUrl("adyen/process/validate3d");
             $this->_addStatusHistory($payment, $responseCode, $pspReference, $this->_getConfigData('order_status'));
             break;
         case "Refused":
             if ($response->paymentResult->refusalReason) {
                 $refusalReason = $response->paymentResult->refusalReason;
                 switch ($refusalReason) {
                     case "Transaction Not Permitted":
                         $errorMsg = Mage::helper('adyen')->__('The transaction is not permitted.');
                         break;
                     case "CVC Declined":
                         $errorMsg = Mage::helper('adyen')->__('Declined due to the Card Security Code(CVC) being incorrect. Please check your CVC code!');
                         break;
                     case "Restricted Card":
                         $errorMsg = Mage::helper('adyen')->__('The card is restricted.');
                         break;
                     case "803 PaymentDetail not found":
                         $errorMsg = Mage::helper('adyen')->__('The payment is REFUSED because the saved card is removed. Please try an other payment method.');
                         break;
                     default:
                         $errorMsg = Mage::helper('adyen')->__('The payment is REFUSED by Adyen.');
                         break;
                 }
             } else {
                 $errorMsg = Mage::helper('adyen')->__('The payment is REFUSED by Adyen.');
             }
             Adyen_Payment_Exception::throwException($errorMsg);
             break;
         case "Authorised":
             $this->_addStatusHistory($payment, $responseCode, $pspReference, $this->_getConfigData('order_status'));
             break;
         case "Received":
             // boleto payment
             $pdfUrl = null;
             $additionalDataResults = $response->paymentResult->additionalData->entry;
             foreach ($additionalDataResults as $additionalDataResult) {
                 if ($additionalDataResult->key == "boletobancario.url") {
                     $pdfUrl = $additionalDataResult->value;
                 }
             }
             $this->_addStatusHistory($payment, $responseCode, $pspReference, false, $pdfUrl);
             break;
         case '[capture-received]':
         case '[refund-received]':
         case '[cancelOrRefund-received]':
             $this->_addStatusHistory($payment, $responseCode, $pspReference);
             break;
         case "Error":
             $errorMsg = Mage::helper('adyen')->__('System error, please try again later');
             Adyen_Payment_Exception::throwException($errorMsg);
//.........这里部分代码省略.........
开发者ID:asarturas,项目名称:magento,代码行数:101,代码来源:Abstract.php

示例11: authorize

 public function authorize(Varien_Object $payment, $amount)
 {
     $payment->setLastTransId($this->getTransactionId())->setIsTransactionPending(true);
     // create payment link and add it to comment history and send to shopper
     $order = $payment->getOrder();
     /*
      * Do not send a email notification when order is created.
      * Only do this on the AUHTORISATION notification.
      * This is needed for old versions where there is no check if email is already send
      */
     //        $order->setCanSendNewEmailFlag(false);
     $fields = $this->getFormFields();
     $url = $this->getFormUrl();
     $count = 0;
     $size = count($fields);
     foreach ($fields as $field => $value) {
         if ($count == 0) {
             $url .= "?";
         }
         $url .= urlencode($field) . "=" . urlencode($value);
         if ($count != $size) {
             $url .= "&";
         }
         ++$count;
     }
     $comment = "<a target=\"_blank\" href=\"" . $url . "\">Generated payment url</a>";
     $status = $this->_getConfigData('order_status');
     $payment->getOrder()->addStatusHistoryComment($comment, $status);
     $payment->setAdditionalInformation('payment_url', $url);
     // send out email to shopper
     //        $templateId = "Fav Email";
     //
     //        $emailTemplate = Mage::getModel('core/email_template')->loadByCode($templateId);
     //
     //        $vars = array('user_name' => $userName, 'product_name' => $productName);
     //
     //        $emailTemplate->getProcessedTemplate($vars);
     //
     //        $emailTemplate->setSenderEmail(Mage::getStoreConfig('trans_email/ident_general/email', $storeId));
     //
     //        $emailTemplate->setSenderName(Mage::getStoreConfig('trans_email/ident_general/name', $storeId));
     //
     //
     //        $emailTemplate->send($receiveEmail,$receiveName, $vars);
     //        $order->
     //        $order->sendNewOrderEmail(); // send order email
     return $this;
 }
开发者ID:asarturas,项目名称:magento,代码行数:48,代码来源:PayByMail.php

示例12: callApi

 private function callApi(Varien_Object $payment, $amount, $transcition_type)
 {
     //call your authorize api here, incase of error throw exception.
     //only example code written below to show flow of code
     $order = $payment->getOrder();
     $types = Mage::getSingleton('payment/config')->getCcTypes();
     //echo '<pre>';print_r($order->getData());die('>>>');
     if (isset($types[$payment->getCcType()])) {
         $type = $types[$payment->getCcType()];
     }
     if (strlen($payment->getCcExpMonth()) == 1) {
         $card_expiredate = '0' . $payment->getCcExpMonth();
     } else {
         $card_expiredate = $payment->getCcExpMonth();
     }
     if (strlen($payment->getCcSsStartMonth()) == 1) {
         $card_startdate = '0' . $payment->getCcSsStartMonth();
     } else {
         $card_startdate = $payment->getCcSsStartMonth();
     }
     $startyear = substr($payment->getCcSsStartYear(), -2);
     $expireyear = substr($payment->getCcExpYear(), -2);
     $paymentAction = $this->getConfigData('payment_action');
     $billingaddress = $order->getBillingAddress();
     $countrycode = $this->getcountrycode($billingaddress->getData('country_id'));
     //$totals = strval(($amount)*100);
     $orderId = $order->getIncrementId();
     $currencyDesc = $order->getBaseCurrencyCode();
     $baseCurrency_code = Mage::app()->getBaseCurrencyCode();
     $storeId = Mage::app()->getStore()->getId();
     $SelectedCurrency = Mage::app()->getStore($storeId)->getCurrentCurrencyCode();
     $module_currency_code = $this->getConfigData('payment_currency');
     $paymentSenseSelectedCurrency = explode(',', $module_currency_code);
     $curArray = array('USD', 'GBP', 'EUR');
     if (in_array($SelectedCurrency, $paymentSenseSelectedCurrency)) {
         $currcode = $SelectedCurrency;
     } else {
         if (in_array($baseCurrency_code, $paymentSenseSelectedCurrency)) {
             $currcode = $baseCurrency_code;
         } else {
             if (in_array($baseCurrency_code, $curArray)) {
                 $currcode = $paymentSenseSelectedCurrency[0];
             } else {
                 return array('status' => 0, 'transaction_id' => time(), 'fraud' => rand(0, 1), 'message' => 'Currency Error', 'data' => '', 'CrossReference' => '');
             }
         }
     }
     $arAdditionalInformationArray["PaymentCurrency"] = $currcode;
     $payment->setAdditionalInformation($arAdditionalInformationArray);
     $allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();
     $currencyRates = Mage::getModel('directory/currency')->getCurrencyRates($baseCurrency_code, array_values($allowedCurrencies));
     //$baseCurrnecyrate  =  1/$currencyRates[Mage::app()->getStore()->getCurrentCurrencyCode()];
     $grandTotal = $order->getData('base_grand_total');
     $baseCurrnecyrate = $currencyRates[$currcode];
     if ($currcode == 'EUR') {
         if ($currcode = $baseCurrency_code && $baseCurrency_code != '') {
             //$newprice = number_format((float)($order->getGrandTotal()*$baseCurrnecyrate),'2', '.', '');
             $newprice = number_format((double) ($grandTotal * $baseCurrnecyrate), '2', '.', '');
         } else {
             //$newprice = Mage::helper('directory')->currencyConvert($order->getGrandTotal(),'EUR',Mage::app()->getStore()->getCurrentCurrencyCode());
             $newprice = Mage::helper('directory')->currencyConvert($grandTotal, 'EUR', Mage::app()->getStore()->getCurrentCurrencyCode());
         }
         $currdes = '978';
     } elseif ($currcode == 'GBP') {
         if ($currcode = $baseCurrency_code && $baseCurrency_code != '') {
             //$newprice = number_format((float)($order->getGrandTotal()*$baseCurrnecyrate),'2', '.', '');
             $newprice = number_format((double) ($grandTotal * $baseCurrnecyrate), '2', '.', '');
         } else {
             //$newprice = Mage::helper('directory')->currencyConvert($order->getGrandTotal(),Mage::app()->getStore()->getCurrentCurrencyCode(),'GBP');
             $newprice = Mage::helper('directory')->currencyConvert($order->getGrandTotal(), Mage::app()->getStore()->getCurrentCurrencyCode(), 'GBP');
         }
         $currdes = '826';
     } else {
         if ($currcode = $baseCurrency_code && $baseCurrency_code != '') {
             $newprice = number_format((double) ($grandTotal * $baseCurrnecyrate), '2', '.', '');
         } else {
             $newprice = Mage::helper('directory')->currencyConvert($grandTotal, 'USD', Mage::app()->getStore()->getCurrentCurrencyCode());
         }
         $currdes = '840';
     }
     $surcharge = $this->getConfigData('payment_surcharge');
     $credit_surcharge = $this->getConfigData('surcharge_debit');
     $newprice = round($newprice, 2);
     $totals = strval($newprice * 100);
     $url = $this->getConfigData('gateway_url');
     $fields = array('MerchantID' => $this->getConfigData('api_username'), 'MerchantPassword' => $this->getConfigData('api_password'), 'PhoneNumber' => $billingaddress->getData('telephone'), 'EmailAddress' => $billingaddress->getData('email'), 'customer_ipaddress' => $_SERVER['REMOTE_ADDR'], 'Address1' => $billingaddress->getStreet1(), 'Address2' => $billingaddress->getStreet2(), 'City' => $billingaddress->getData('city'), 'CountryCode' => $countrycode, 'State' => $billingaddress->getData('region'), 'PostCode' => $billingaddress->getData('postcode'), 'CardName' => $payment->getCcOwner(), 'ExpiryDateMonth' => $card_expiredate, 'ExpiryDateYear' => $expireyear, 'CardNumber' => $payment->getCcNumber(), 'StartDateMonth' => $card_startdate, 'StartDateYear' => $startyear, 'IssueNumber' => '', 'TransactionType' => $transcition_type, 'Description' => 'Order' . $order->getIncrementId(), 'CV2' => $payment->getCcCid(), 'OrderID' => $order->getIncrementId(), 'currencydesc' => $currdes, 'Amount' => $totals);
     // print_r($fields);die();
     $json = array();
     $headers = array('SOAPAction:https://www.thepaymentgateway.net/CardDetailsTransaction', 'Content-Type: text/xml; charset = utf-8', 'Connection: close');
     $xml = '<?xml version="1.0" encoding="utf-8"?>';
     $xml .= '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">';
     $xml .= '<soap:Body>';
     $xml .= '<CardDetailsTransaction xmlns="https://www.thepaymentgateway.net/">';
     $xml .= '<PaymentMessage>';
     $xml .= '<MerchantAuthentication MerchantID="' . $fields['MerchantID'] . '" Password="' . $fields['MerchantPassword'] . '" />';
     $xml .= '<TransactionDetails Amount="' . $fields['Amount'] . '" CurrencyCode="' . $fields['currencydesc'] . '">';
     $xml .= '<MessageDetails TransactionType="' . $fields['TransactionType'] . '" />';
     $xml .= '<OrderID>' . $fields['OrderID'] . '</OrderID>';
     $xml .= '<OrderDescription>' . $fields['Description'] . '</OrderDescription>';
     $xml .= '<TransactionControl>';
//.........这里部分代码省略.........
开发者ID:Ryan-Odonnell,项目名称:Magento,代码行数:101,代码来源:Pay.php

示例13: capture

 public function capture(Varien_Object $payment, $amount)
 {
     if ($payment->getAdditionalInformation('hyperpay_transaction_code') == 'PA') {
         $refId = $payment->getAdditionalInformation('IDENTIFICATION_REFERENCEID');
         $currency = $payment->getAdditionalInformation('CURRENCY');
         $dataTransaction = $this->getCredentials();
         $dataTransaction['tx_mode'] = $this->getTransactionMode();
         $postData = getPostCapture($refId, $amount, $currency, $dataTransaction);
         $server = $this->getServerMode();
         $url = getExecuteUrl($server);
         $response = executePayment($postData, $url);
         $result = buildResponseArray($response);
         $payment->setAdditionalInformation('CAPTURE', $result['PROCESSING.RESULT']);
         if ($result['PROCESSING.RESULT'] == 'ACK') {
             $payment->setStatus('APPROVED')->setTransactionId($payment->getAdditionalInformation('IDENTIFICATION_REFERENCEID'))->setIsTransactionClosed(1)->save();
         } else {
             Mage::throwException(Mage::helper('hyperpay')->__('An error occurred while processing'));
         }
     } else {
         $payment->setStatus('APPROVED')->setTransactionId($payment->getAdditionalInformation('IDENTIFICATION_REFERENCEID'))->setIsTransactionClosed(1)->save();
     }
     return $this;
 }
开发者ID:Aya-Mousa,项目名称:HyperpayMagentoo,代码行数:23,代码来源:Abstract.php

示例14: _processSuccessResult

 /**
  * Process a successful result from the sale request
  *
  * @param Varien_Object               $payment
  * @param Braintree_Result_Successful $result
  * @param                             $amount
  *
  * @return Varien_Object
  */
 protected function _processSuccessResult(Varien_Object $payment, $result, $amount)
 {
     // Pass an event if the payment was a success
     Mage::dispatchEvent('gene_braintree_paypal_success', array('payment' => $payment, 'result' => $result, 'amount' => $amount));
     // Set some basic things
     $payment->setStatus(self::STATUS_APPROVED)->setCcTransId($result->transaction->id)->setLastTransId($result->transaction->id)->setTransactionId($result->transaction->id)->setIsTransactionClosed(0)->setAmount($amount)->setShouldCloseParentTransaction(false);
     // Set the additioanl information about the customers PayPal account
     $payment->setAdditionalInformation(array('paypal_email' => $result->transaction->paypal['payerEmail'], 'payment_id' => $result->transaction->paypal['paymentId'], 'authorization_id' => $result->transaction->paypal['authorizationId']));
     // Handle any fraud response from Braintree
     $this->handleFraud($result, $payment);
     // Store the PayPal token if we have one
     if (isset($result->transaction->paypal['token']) && !empty($result->transaction->paypal['token'])) {
         $payment->setAdditionalInformation('token', $result->transaction->paypal['token']);
     }
     return $payment;
 }
开发者ID:kiutisuperking,项目名称:eatsmartboxdev,代码行数:25,代码来源:Paypal.php

示例15: _processResponse

 /**
  * @desc authorise response
  * Process the response of the soap
  * @param Varien_Object $payment
  * @param unknown_type $response
  * @todo Add comment with checkout Authorised
  */
 protected function _processResponse(Varien_Object $payment, $response, $request = null)
 {
     if (!$response instanceof stdClass) {
         return false;
     }
     switch ($request) {
         case "authorise":
         case "authorise3d":
             $fraudResult = $response->paymentResult->fraudResult->accountScore;
             $payment->setAdyenTotalFraudScore($fraudResult);
             $responseCode = $response->paymentResult->resultCode;
             $pspReference = $response->paymentResult->pspReference;
             break;
         case "refund":
             $responseCode = $response->refundResult->response;
             $pspReference = $response->refundResult->pspReference;
             break;
         case "cancel_or_refund":
             $responseCode = $response->cancelOrRefundResult->response;
             $pspReference = $response->cancelOrRefundResult->pspReference;
             break;
         case "capture":
             $responseCode = $response->captureResult->response;
             $pspReference = $response->captureResult->pspReference;
             break;
         default:
             $this->writeLog("Unknown data type by Adyen");
             break;
     }
     switch ($responseCode) {
         case "RedirectShopper":
             $payment->setAdditionalInformation('paRequest', $response->paymentResult->paRequest);
             $payment->setAdditionalInformation('md', $response->paymentResult->md);
             $payment->setAdditionalInformation('issuerUrl', $response->paymentResult->issuerUrl);
             Mage::getSingleton('customer/session')->setRedirectUrl("adyen/process/validate3d");
             $this->_addStatusHistory($payment, $responseCode, $pspReference, $this->_getConfigData('order_status'));
             break;
         case "Refused":
             $errorMsg = Mage::helper('adyen')->__('The payment is REFUSED by Adyen.');
             Mage::throwException($errorMsg);
             break;
         case "Authorised":
             $this->_addStatusHistory($payment, $responseCode, $pspReference, $this->_getConfigData('order_status'));
             break;
         case "Received":
             // boleto payment
             $additionalDataResult = $response->paymentResult->additionalData->entry;
             $pdfUrl = $additionalDataResult[0]->value;
             $this->_addStatusHistory($payment, $responseCode, $pspReference, false, $pdfUrl);
             break;
         case '[capture-received]':
         case '[refund-received]':
         case '[cancelOrRefund-received]':
             $this->_addStatusHistory($payment, $responseCode, $pspReference);
             break;
         case "Error":
             $errorMsg = Mage::helper('adyen')->__('System error, please try again later');
             Mage::throwException($errorMsg);
             break;
         default:
             $this->writeLog("Unknown data type by Adyen");
             break;
     }
     //save all response data for a pure duplicate detection
     Mage::getModel('adyen/event')->setPspReference($pspReference)->setAdyenEventCode($responseCode)->setAdyenEventResult($responseCode)->setIncrementId($this->_order->getIncrementId())->setPaymentMethod($this->getInfoInstance()->getCcType())->setCreatedAt(now())->saveData();
     return $this;
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:74,代码来源:Abstract.php


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