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


PHP Varien_Object::setTransactionId方法代码示例

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


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

示例1: capture

 /**
  * For Svea, Deliver order
  *
  * @param Varien_Object $payment
  * @param float $amount
  * @return type
  */
 public function capture(Varien_Object $payment, $amount)
 {
     //Alternative: $sveaOrderId = $payment->getTransactionId(), comes with -capture
     $sveaOrderId = $this->getInfoInstance()->getAdditionalInformation('svea_order_id');
     if (empty($sveaOrderId)) {
         if (!$this->getConfigData('autodeliver')) {
             $errorTranslated = Mage::helper('svea_webpay')->responseCodes("", 'no_orderid');
             Mage::throwException($errorTranslated);
         }
         $sveaOrderId = $this->getInfoInstance()->getAdditionalInformation('svea_order_id');
     }
     $order = $payment->getOrder();
     $countryCode = $order->getBillingAddress()->getCountryId();
     $paymentMethodConfig = $this->getSveaStoreConfClass($order->getStoreId());
     $conf = new SveaMageConfigProvider($paymentMethodConfig);
     $sveaObject = WebPay::deliverOrder($conf);
     $response = $sveaObject->setCountryCode($countryCode)->setOrderId($sveaOrderId)->deliverPaymentPlanOrder()->doRequest();
     if ($response->accepted == 1) {
         $successMessage = Mage::helper('svea_webpay')->__('delivered');
         $orderStatus = $this->getConfigData('paid_order_status') ?: $order->getStatus();
         if (!empty($orderStatus)) {
             $order->addStatusToHistory($orderStatus, $successMessage, false);
         }
         $rawDetails = $this->_sveaResponseToArray($response);
         $payment->setTransactionId($response->contractNumber)->setIsTransactionClosed(false)->setTransactionAdditionalInfo(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $rawDetails);
     } else {
         $errorMessage = $response->errormessage;
         $statusCode = $response->resultcode;
         $errorTranslated = Mage::helper('svea_webpay')->responseCodes($statusCode, $errorMessage);
         $order->addStatusToHistory($order->getStatus(), $errorTranslated, false);
         Mage::throwException($errorTranslated);
     }
 }
开发者ID:LybeAB,项目名称:magento-module,代码行数:40,代码来源:PaymentPlan.php

示例2: order

 /**
  * WPF Create method piggyback-ing the Magento's internal Authorize method
  *
  * @param Mage_Sales_Model_Order_Payment|Varien_Object $payment
  * @param String $amount
  * @return EMerchantPay_Genesis_Model_Checkout
  * @throws Mage_Core_Exception
  */
 public function order(Varien_Object $payment, $amount)
 {
     Mage::log('Checkout transaction for order #' . $payment->getOrder()->getIncrementId());
     try {
         $this->getHelper()->initClient($this->getCode());
         /** @var Mage_Sales_Model_Order $order */
         $order = $payment->getOrder();
         $billing = $order->getBillingAddress();
         $shipping = $order->getShippingAddress();
         $genesis = new \Genesis\Genesis('WPF\\Create');
         $genesis->request()->setTransactionId($this->getHelper()->genTransactionId($order->getIncrementId()))->setCurrency($order->getBaseCurrencyCode())->setAmount($amount)->setUsage($this->getHelper()->__('Magento Payment'))->setDescription($this->getHelper()->getItemList($order))->setCustomerPhone($billing->getTelephone())->setCustomerEmail($order->getCustomerEmail())->setNotificationUrl($this->getHelper()->getNotifyURL('checkout'))->setReturnSuccessUrl($this->getHelper()->getSuccessURL('checkout'))->setReturnFailureUrl($this->getHelper()->getFailureURL('checkout'))->setReturnCancelUrl($this->getHelper()->getCancelURL('checkout'))->setBillingFirstName($billing->getData('firstname'))->setBillingLastName($billing->getData('lastname'))->setBillingAddress1($billing->getStreet(1))->setBillingAddress2($billing->getStreet(2))->setBillingZipCode($billing->getPostcode())->setBillingCity($billing->getCity())->setBillingState($billing->getRegion())->setBillingCountry($billing->getCountry())->setShippingFirstName($shipping->getData('firstname'))->setShippingLastName($shipping->getData('lastname'))->setShippingAddress1($shipping->getStreet(1))->setShippingAddress2($shipping->getStreet(2))->setShippingZipCode($shipping->getPostcode())->setShippingCity($shipping->getCity())->setShippingState($shipping->getRegion())->setShippinCountry($shipping->getCountry())->setLanguage($this->getHelper()->getLocale());
         foreach ($this->getTransactionTypes() as $type) {
             $genesis->request()->addTransactionType($type);
         }
         $genesis->execute();
         $payment->setTransactionId($genesis->response()->getResponseObject()->unique_id)->setIsTransactionPending(true)->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_ORDER);
         $payment->setSkipTransactionCreation(true);
         // Save the redirect url with our
         $this->getHelper()->getCheckoutSession()->setEmerchantPayCheckoutRedirectUrl($genesis->response()->getResponseObject()->redirect_url);
     } catch (Exception $exception) {
         Mage::logException($exception);
         Mage::throwException($this->getHelper()->__($exception->getMessage()));
     }
     return $this;
 }
开发者ID:snehamalvankar,项目名称:magento-ce-emp-plugin,代码行数:33,代码来源:Checkout.php

示例3: capture

 public function capture(Varien_Object $payment, $amount)
 {
     $order = $payment->getOrder();
     $billing = $order->getBillingAddress();
     $shipping = $order->getShippingAddress();
     $amount = round($order->getGrandTotal(), 2);
     try {
         $params = array("sellerId" => $this->getSid(), "merchantOrderId" => $order->getIncrementId(), "token" => Mage::app()->getRequest()->getParam('token'), "currency" => $order->getOrderCurrencyCode(), "total" => $amount, "billingAddr" => array("name" => $billing->getName(), "addrLine1" => $billing->getStreet(1), "addrLine2" => $billing->getStreet(2), "city" => $billing->getCity(), "state" => $billing->getRegion(), "zipCode" => $billing->getPostcode(), "country" => $billing->getCountry(), "email" => $order->getCustomerEmail(), "phoneNumber" => $billing->getTelephone()));
         if ($shipping) {
             $shippingAddr = array("name" => $shipping->getName(), "addrLine1" => $shipping->getStreet(1), "addrLine2" => $shipping->getStreet(2), "city" => $shipping->getCity(), "state" => $shipping->getRegion(), "zipCode" => $shipping->getPostcode(), "country" => $shipping->getCountry(), "email" => $order->getCustomerEmail(), "phoneNumber" => $billing->getTelephone());
             array_merge($shippingAddr, $params);
         }
         $charge = Twocheckout_Charge::auth($params);
     } catch (Twocheckout_Error $e) {
         Mage::throwException(Mage::helper('paygate')->__($e->getMessage()));
     }
     if ($charge['response']['responseCode'] == 'APPROVED') {
         $payment->setTransactionId($charge['response']['transactionId'])->setIsTransactionClosed(0);
         $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true)->save();
         $order->setData('ext_order_id', $charge['response']['transactionId']);
         $order->save();
     } else {
         Mage::throwException(Mage::helper('paygate')->__('Payment capturing error: %s', "Could not Authorize Transaction"));
     }
     return $this;
 }
开发者ID:sarmadhassan,项目名称:magento-2checkout-api,代码行数:26,代码来源:Payment.php

示例4: refund

 public function refund(Varien_Object $payment, $amount)
 {
     $transactionId = $payment->getParentTransactionId();
     try {
         Stripe_Charge::retrieve($transactionId)->refund();
     } catch (Exception $e) {
         $this->debugData($e->getMessage());
         Mage::throwException(Mage::helper('paygate')->__('Payment refunding error.'));
     }
     $payment->setTransactionId($transactionId . '-' . Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND)->setParentTransactionId($transactionId)->setIsTransactionClosed(1)->setShouldCloseParentTransaction(1);
     return $this;
 }
开发者ID:FaisalRiaz115,项目名称:Inchoo_Stripe,代码行数:12,代码来源:Payment.php

示例5: capture

 /**
  * Capture payment method
  *
  * @param Varien_Object $payment
  * @param float $amount
  * @return $this
  * @throws Mage_Core_Exception
  */
 public function capture(Varien_Object $payment, $amount)
 {
     $order = $payment->getOrder();
     $billingAddress = $order->getBillingAddress();
     try {
         $api = Stripe\Charge::create(array('amount' => $amount * 100, 'currency' => strtolower($order->getBaseCurrencyCode()), 'card' => array('number' => $payment->getCcNumber(), 'exp_month' => sprintf('%02d', $payment->getCcExpMonth()), 'exp_year' => $payment->getCcExpYear(), 'cvc' => $payment->getCcCid(), 'name' => $billingAddress->getName(), 'address_line1' => $billingAddress->getStreet(1), 'address_line2' => $billingAddress->getStreet(2), 'address_zip' => $billingAddress->getPostcode(), 'address_state' => $billingAddress->getRegion(), 'address_country' => $billingAddress->getCountry()), 'description' => sprintf('#%s, %s', $order->getIncrementId(), $order->getCustomerEmail())));
     } catch (Exception $e) {
         $this->debugData($e->getMessage());
         Mage::throwException(Mage::helper('boolfly_stripe')->__('Payment capturing error.'));
     }
     $payment->setTransactionId($api->id)->setIsTransactionClosed(0);
     return $this;
 }
开发者ID:patrickphp4,项目名称:MagentoCodeTutorial,代码行数:21,代码来源:Payment.php

示例6: refund

 public function refund(Varien_Object $payment, $amount)
 {
     $pagarme = Mage::getModel('pagarme/api');
     $transaction = $pagarme->refund($payment->getPagarmeTransactionId());
     if ($transaction->getErrors()) {
         $messages = array();
         foreach ($transaction->getErrors() as $error) {
             $messages[] = $error->getMessage() . '.';
         }
         Mage::throwException(implode("\n", $messages));
     }
     $payment->setTransactionId($payment->getPagarmeTransactionId() . '-' . Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND)->setParentTransactionId($payment->getParentTransactionId())->setIsTransactionClosed(1)->setShouldCloseParentTransaction(1)->setTransactionAdditionalInfo(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, array('status' => $transaction->getStatus()));
     return $this;
 }
开发者ID:hiuryanderson,项目名称:pagarme-magento,代码行数:14,代码来源:Cc.php

示例7: authorize

 /**
  * Capture payment method
  *
  * @param Varien_Object $payment
  * @param float $amount
  *
  * @return Iways_PayPalPlus_Model_Payment
  */
 public function authorize(Varien_Object $payment, $amount)
 {
     $paymentId = Mage::app()->getRequest()->getParam('paymentId');
     $payerId = Mage::app()->getRequest()->getParam('PayerID');
     $ppPayment = Mage::getModel('iways_paypalplus/api')->executePayment($paymentId, $payerId);
     Mage::getSingleton('customer/session')->setPayPalPaymentId(null);
     Mage::getSingleton('customer/session')->setPayPalPaymentPatched(null);
     if (!$ppPayment) {
         throw new Exception('Payment could not be executed.');
     }
     $payment->setTransactionId($ppPayment->getId());
     if ($ppPayment->getState() == self::PPP_STATUS_APPROVED) {
         $payment->setStatus(self::STATUS_APPROVED);
     }
     return $this;
 }
开发者ID:sickdaflip,项目名称:Iways_PayPalPlus-1.4.5,代码行数:24,代码来源:Payment.php

示例8: authenticationCompleteAction

 /**
  * Process autentication complete action
  *
  */
 public function authenticationCompleteAction()
 {
     try {
         if ($validator = $this->_getValidator()) {
             $request = $this->getRequest();
             $data = new Varien_Object();
             $data->setTransactionId($request->getParam('MD'));
             $data->setPaResPayload($request->getParam('PaRes'));
             $validator->authenticate($data);
             Mage::register('current_centinel_validator', $validator);
         }
     } catch (Exception $e) {
         Mage::register('current_centinel_validator', false);
     }
     $this->loadLayout()->renderLayout();
 }
开发者ID:par-orillonsoft,项目名称:Magento,代码行数:20,代码来源:IndexController.php

示例9: capture

 /**
  * For Svea, Deliver order
  *
  * @param Varien_Object $payment
  * @param type $amount
  * @return type
  */
 public function capture(Varien_Object $payment, $amount)
 {
     // Check if we are trying to deliver an existing order, or this is an autodeliver
     // If no flag e.g. -capture, or if no transactionid, assume this is not sent from admin
     //TODO: Make sure compatible with onestep checkout
     $sveaOrderId = $payment->getTransactionId();
     if (empty($sveaOrderId) || preg_match('/[A-Za-z]/', $sveaOrderId) == FALSE) {
         if (!$this->getConfigData('autodeliver')) {
             $errorTranslated = Mage::helper('svea_webpay')->responseCodes("", 'no_orderid');
             Mage::throwException($errorTranslated);
         }
         $sveaOrderId = $this->getInfoInstance()->getAdditionalInformation('svea_order_id');
     }
     $order = $payment->getOrder();
     $paymentMethodConfig = $this->getSveaStoreConfClass($order->getStoreId());
     $invoice = $this->getCurrentInvoice();
     Mage::helper('svea_webpay')->getDeliverInvoiceRequest($invoice, $paymentMethodConfig, $sveaOrderId);
     $sveaObject = $invoice->getData('svea_deliver_request');
     $response = $sveaObject->deliverInvoiceOrder()->doRequest();
     if ($response->accepted == 1) {
         $successMessage = Mage::helper('svea_webpay')->__('delivered');
         $orderStatus = $this->getConfigData('paid_order_status') ?: $order->getStatus();
         if (!empty($orderStatus)) {
             $order->addStatusToHistory($orderStatus, $successMessage, false);
         }
         $rawDetails = $this->_sveaResponseToArray($response);
         $payment->setTransactionId($response->invoiceId)->setIsTransactionClosed(false)->setTransactionAdditionalInfo(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $rawDetails);
     } else {
         $errorMessage = $response->errormessage;
         $statusCode = $response->resultcode;
         $errorTranslated = Mage::helper('svea_webpay')->responseCodes($statusCode, $errorMessage);
         if ($order->canCancel()) {
             $order->addStatusToHistory($order->getStatus(), $errorTranslated, false);
             $order->cancel();
             $order->save();
         }
         return Mage::throwException($errorTranslated);
     }
     return $this;
 }
开发者ID:LybeAB,项目名称:magento-module,代码行数:47,代码来源:Invoice.php

示例10: callLookup

 /**
  * Call centinel api lookup method
  *
  * @return Mage_Centinel_Model_Api
  */
 public function callLookup($data)
 {
     $result = new Varien_Object();
     $month = strlen($data->getCardExpMonth()) == 1 ? '0' . $data->getCardExpMonth() : $data->getCardExpMonth();
     $currencyCode = $data->getCurrencyCode();
     $currencyNumber = isset(self::$_iso4217Currencies[$currencyCode]) ? self::$_iso4217Currencies[$currencyCode] : '';
     if (!$currencyNumber) {
         return $result->setErrorNo(1)->setErrorDesc(Mage::helper('payment')->__('Unsupported currency code: %s.', $currencyCode));
     }
     $clientResponse = $this->_call('cmpi_lookup', array('Amount' => round($data->getAmount() * 100), 'CurrencyCode' => $currencyNumber, 'CardNumber' => $data->getCardNumber(), 'CardExpMonth' => $month, 'CardExpYear' => $data->getCardExpYear(), 'OrderNumber' => $data->getOrderNumber()));
     $result->setErrorNo($clientResponse->getValue('ErrorNo'));
     $result->setErrorDesc($clientResponse->getValue('ErrorDesc'));
     $result->setTransactionId($clientResponse->getValue('TransactionId'));
     $result->setEnrolled($clientResponse->getValue('Enrolled'));
     $result->setAcsUrl($clientResponse->getValue('ACSUrl'));
     $result->setPayload($clientResponse->getValue('Payload'));
     $result->setEciFlag($clientResponse->getValue('EciFlag'));
     return $result;
 }
开发者ID:hyhoocchan,项目名称:mage-local,代码行数:24,代码来源:Api.php

示例11: _refund

 /**
  * @param Varien_Object|Mage_Sales_Model_Order_Payment $payment
  * @param $amount
  * @return Hps_Securesubmit_Model_Payment
  */
 protected function _refund(Varien_Object $payment, $amount)
 {
     $transactionId = $payment->getCcTransId();
     $order = $payment->getOrder();
     /* @var $order Mage_Sales_Model_Order */
     $chargeService = $this->_getChargeService();
     $cardHolder = $this->_getCardHolderData($order);
     $details = $this->_getTxnDetailsData($order);
     try {
         $refundResponse = $chargeService->refundTransaction($amount, strtolower($order->getBaseCurrencyCode()), $transactionId, $cardHolder, $details);
         $payment->setTransactionId($refundResponse->transactionId)->setParentTransactionId($transactionId)->setIsTransactionClosed(1)->setShouldCloseParentTransaction(1);
     } catch (HpsException $e) {
         $this->_debugChargeService($chargeService, $e);
         $this->throwUserError($e->getMessage());
     } catch (Exception $e) {
         $this->_debugChargeService($chargeService, $e);
         Mage::logException($e);
         $this->throwUserError($e->getMessage());
     }
     $this->_debugChargeService($chargeService);
     return $this;
 }
开发者ID:rcclaudrey,项目名称:dev,代码行数:27,代码来源:Payment.php

示例12: 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

示例13: order

 /**
  * Order payment method
  *
  * @param Varien_Object $payment
  * @param float $amount
  *
  * @return Amazon_Payments_Model_PaymentMethod
  */
 public function order(Varien_Object $payment, $amount)
 {
     if (!$amount) {
         return $this;
     }
     $orderReferenceId = $payment->getAdditionalInformation('order_reference');
     if (!$orderReferenceId) {
         $orderReferenceId = Mage::getSingleton('checkout/session')->getAmazonOrderReferenceId();
         if (!$orderReferenceId) {
             Mage::throwException('Please log in to your Amazon account by clicking the Amazon pay button.');
         }
         $payment->setAdditionalInformation('order_reference', $orderReferenceId);
     }
     $payment->setTransactionId($orderReferenceId);
     $order = $payment->getOrder();
     // If previous order submission failed (e.g. bad credit card), must validate order status to prevent multiple setOrderReferenceDetails()
     if ($this->_getErrorCheck()) {
         $orderReferenceDetails = $this->_getApi()->getOrderReferenceDetails($orderReferenceId);
     }
     if (!$this->_getErrorCheck() || $orderReferenceDetails->getOrderReferenceStatus()->getState() == 'Draft') {
         $apiResult = $this->_getApi()->setOrderReferenceDetails($orderReferenceId, $order->getBaseGrandTotal(), $order->getBaseCurrencyCode(), $order->getIncrementId(), $this->_getApi()->getConfig()->getStoreName());
     }
     try {
         $apiResult = $this->_getApi()->confirmOrderReference($orderReferenceId);
     } catch (Exception $e) {
         Mage::throwException("Please try another Amazon payment method." . "\n\n" . substr($e->getMessage(), 0, strpos($e->getMessage(), 'Stack trace')));
         $this->_setErrorCheck();
         return;
     }
     $payment->setIsTransactionClosed(false);
     $payment->setSkipOrderProcessing(true);
     $message = Mage::helper('payment')->__(($this->getConfigData('is_async') ? 'Asynchronous ' : '') . 'Order of %s sent to Amazon Payments.', $order->getStore()->convertPrice($amount, true, false));
     $payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_ORDER, null, false, $message);
     switch ($this->getConfigData('payment_action')) {
         case self::ACTION_AUTHORIZE:
             $this->_authorize($payment, $amount, false);
             break;
         case self::ACTION_AUTHORIZE_CAPTURE:
             $this->_authorize($payment, $amount, true);
             break;
         default:
             break;
     }
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:53,代码来源:PaymentMethod.php

示例14: refund

 /**
  * refund the amount with transaction id
  *
  * @access public
  * @param string $payment Varien_Object object
  * @return Mage_Payment_Model_Abstract
  */
 public function refund(Varien_Object $payment, $amount)
 {
     $error = false;
     if ($payment->getRefundTransactionId() && $amount > 0) {
         $payment->setTransactionId($payment->getRefundTransactionId());
         $payment->setTrxtype(self::TRXTYPE_CREDIT);
         $request = $this->_buildBasicRequest($payment);
         $request->setAmt(round($amount, 2));
         $result = $this->_postRequest($request);
         if ($this->getConfigData('debug')) {
             $payment->setCcDebugRequestBody($result->getRequestBody())->setCcDebugResponseSerialized(serialize($result));
         }
         if ($result->getResultCode() == self::RESPONSE_CODE_APPROVED) {
             $payment->setStatus(self::STATUS_SUCCESS);
             $payment->setCcTransId($result->getPnref());
         } else {
             $error = $result->getRespmsg() ? $result->getRespmsg() : Mage::helper('paygate')->__('Error in refunding the payment.');
         }
     } else {
         $error = Mage::helper('paygate')->__('Error in refunding the payment');
     }
     if ($error !== false) {
         Mage::throwException($error);
     }
     return $this;
 }
开发者ID:HelioFreitas,项目名称:magento-pt_br,代码行数:33,代码来源:Pro.php

示例15: capture

 public function capture(Varien_Object $payment, $amount)
 {
     $session = Mage::getSingleton('adminhtml/session');
     //
     // Verify if remote interface is enabled
     //
     if (!$this->_canDoCapture($payment->getOrder())) {
         return $this;
     }
     if ((int) $this->getConfigData('remoteinterface', $payment->getOrder() ? $payment->getOrder()->getStoreId() : null) != 1) {
         $this->addOrderComment($payment->getOrder(), Mage::helper('epay')->__('EPAY_LABEL_73'));
         return $this;
     }
     try {
         //
         // Read info directly from the database
         $read = Mage::getSingleton('core/resource')->getConnection('core_read');
         $row = $read->fetchRow("select * from epay_order_status where orderid = '" . $payment->getOrder()->getIncrementId() . "'");
         if ($row["status"] == '1') {
             $epayamount = (string) ($amount * 100);
             $tid = $row["tid"];
             $param = array('merchantnumber' => $this->getConfigData('merchantnumber', $payment->getOrder() ? $payment->getOrder()->getStoreId() : null), 'transactionid' => $tid, 'amount' => $epayamount, 'group' => '', 'pbsResponse' => 0, 'epayresponse' => 0, 'pwd' => $this->getConfigData('remoteinterfacepassword', $payment->getOrder() ? $payment->getOrder()->getStoreId() : null));
             $client = new SoapClient('https://ssl.ditonlinebetalingssystem.dk/remote/payment.asmx?WSDL');
             $result = $client->capture($param);
             if ($result->captureResult == 1) {
                 //
                 // Success - transaction captured!
                 //
                 $this->addOrderComment($payment->getOrder(), "Transaction with id: " . $tid . " has been captured by amount: " . number_format($amount, 2, ",", "."));
                 if (!$payment->getParentTransactionId() || $tid != $payment->getParentTransactionId()) {
                     $payment->setTransactionId($tid);
                 }
                 $payment->setIsTransactionClosed(0);
             } else {
                 if ($result->epayresponse != -1) {
                     if ($result->epayresponse == -1002) {
                         $this->addOrderComment($payment->getOrder(), "Transaction could not be deleted by ePay: " . $result->epayresponse . ". Forretningsnummeret findes ikke.");
                         throw new Exception("Transaction could not be captured by ePay: " . $result->epayresponse . ". Forretningsnummeret findes ikke.");
                     } else {
                         if ($result->epayresponse == -1003 || $result->epayresponse == -1006) {
                             $this->addOrderComment($payment->getOrder(), "Transaction could not be captured by ePay: " . $result->epayresponse . ". Der er ikke adgang til denne funktion (API / Remote Interface).");
                             throw new Exception("Transaction could not be captured by ePay: " . $result->epayresponse . ". Der er ikke adgang til denne funktion (API / Remote Interface).");
                         } else {
                             $this->addOrderComment($payment->getOrder(), 'Transaction could not be captured by ePay: ' . $result->epayresponse . '. ' . $this->getEpayErrorText($result->epayresponse));
                             throw new Exception('Transaction could not be captured by ePay: ' . $result->epayresponse . '. ' . $this->getEpayErrorText($result->epayresponse));
                         }
                     }
                 } else {
                     throw new Exception("Transaction could not be captured by ePay: " . $result->pbsResponse . '. ' . $this->getPbsErrorText($result->pbsResponse));
                 }
             }
         } else {
             //
             // Somehow the order was not found - this must be an error!
             //
             throw new Exception("Order not found - please check the epay_order_status table!");
         }
     } catch (Exception $e) {
         $session->addException($e, $e->getMessage() . " - Go to the ePay administration to capture the payment manually.");
     }
     return $this;
 }
开发者ID:EpayGlenn,项目名称:magento,代码行数:62,代码来源:Standard.php


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