本文整理汇总了PHP中Varien_Object::setStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Object::setStatus方法的具体用法?PHP Varien_Object::setStatus怎么用?PHP Varien_Object::setStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Object
的用法示例。
在下文中一共展示了Varien_Object::setStatus方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
/**
* Instantiate state and set it to state object
*
* @param string $paymentAction
* @param Varien_Object $stateObject
*/
public function initialize($paymentAction, $stateObject)
{
$stateObject->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT);
$stateObject->setStatus('pending_payment');
$stateObject->setIsNotified(false);
$stateObject->save();
}
示例2: order
public function order(Varien_Object $payment, $amount)
{
$order = $payment->getOrder();
$order_id = $order->getId();
$order_increment_id = $order->getIncrementId();
$store_id = $order->getStoreId();
$ccType = $payment->getCcType();
// reorder
$reorder_increment_id = explode('-', $order_increment_id);
// reorder
$order_increment_id = $reorder_increment_id[0];
$order_suffix_id = @$reorder_increment_id[1];
$expiration = strtotime('+' . $this->_getStoreConfig($ccType, 'expiration') . 'days');
$transaction_expiration = date('Y-m-d', $expiration);
$increment = $this->_getStoreConfig('slips', 'order_id_increment');
$order_increment_prefix = $this->_getOrderIncrementPrefix($store_id);
$number = $order_increment_id - $order_increment_prefix;
if (!empty($order_suffix_id)) {
$number *= pow(10, strlen($order_suffix_id));
$number += $order_suffix_id;
}
$number += $increment;
$data = array('order_id' => $order_id, 'amount' => $amount, 'expiration' => $transaction_expiration, 'number' => $number);
$result = Mage::getModel('utils/sql')->insert('gamuza_slips_transactions', $data);
if (!$result) {
Mage::throwException(Mage::helper('slips')->__('Unable to save the Slip and Deposit informations. Please verify your database.'));
}
$this->setStore($payment->getOrder()->getStoreId());
$payment->setAmount($amount);
$payment->setLastTransId($order_id);
$payment->setStatus(self::STATUS_APPROVED);
return $this;
}
示例3: _prepareResponseObject
/**
* Return response object
*
* @return Varien_Object
*/
protected function _prepareResponseObject()
{
$responseObject = new Varien_Object();
$responseObject->setStatus(false);
$responseObject->setResponse(null);
$responseObject->setMessage(null);
return $responseObject;
}
示例4: initialize
/**
* Instantiate state and set it to state object
*
* @param string $paymentAction
* @param Varien_Object $stateObject
* @SuppressWarnings("unused")
*/
public function initialize($action, $stateObject)
{
if ($status = $this->getConfigData('order_status')) {
$stateObject->setStatus($status);
$state = $this->_getAssignedState($status);
$stateObject->setState($state);
$stateObject->setIsNotified(true);
}
return $this;
}
示例5: initialize
/**
* set the state and status of order
* will be executed instead of authorize()
*
* @param string $paymentAction
* @param Varien_Object $stateObject
* @return Paymentnetwork_Pnsofortueberweisung_Model_Pnsofort
*/
public function initialize($paymentAction, $stateObject)
{
$holdingStatus = Mage::getStoreConfig('payment/sofort/pnsofort_order_status_holding', $this->getStore());
if ($holdingStatus == 'unchanged') {
return $this;
}
$stateObject->setState(Mage_Sales_Model_Order::STATE_HOLDED);
$stateObject->setStatus($holdingStatus);
$stateObject->setIsNotified(false);
return $this;
}
示例6: 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;
}
示例7: initialize
/**
* Instantiate state and set it to state object
*
* @param string $paymentAction
* @param Varien_Object $stateObject
*/
public function initialize($paymentAction, $stateObject)
{
$stateObject->setData('payment_action', $paymentAction);
$stateObject->setState(MageOrder::STATE_PENDING_PAYMENT);
$stateObject->setStatus('pending_payment');
$stateObject->setIsNotified(false);
$stateObject->save();
if (empty($this->_code)) {
throw new RuntimeException('Internal model code must be setted');
}
if (empty($this->_formBlockType)) {
throw new RuntimeException('Name for the block with additional payment method information must be setted');
}
if (empty($this->_initialApiMethod)) {
throw new RuntimeException('Initial API method for model payment flow must be setted');
}
}
示例8: _prepareCollection
protected function _prepareCollection()
{
/** @var $connector Smile_DigitalOceanManager_Model_Connector*/
$connector = Mage::getModel('digitaloceanmanager/connector');
$droplets = $connector->getDropletList();
$collection = new Varien_Data_Collection();
foreach ($droplets as $droplet) {
$obj = new Varien_Object();
$obj->setId($droplet->id);
$obj->setName($droplet->name);
$obj->setVcpus($droplet->vcpus);
$obj->setMemory($droplet->memory);
$obj->setDisk($droplet->disk);
$obj->setStatus($droplet->status);
$obj->setRegion($droplet->region->name);
$collection->addItem($obj);
}
$this->setCollection($collection);
return parent::_prepareCollection();
}
示例9: capture
/**
* Capture payment
*
* @param Varien_Object $orderPayment
* @return Mage_Payment_Model_Abstract
*/
public function capture(Varien_Object $payment, $amount)
{
$payment->setStatus(self::STATUS_APPROVED)->setLastTransId($this->getTransactionId());
return $this;
}
示例10: capture
/**
* Capture preatutharized amount
* @param Varien_Object $payment
* @param <type> $amount
*/
public function capture(Varien_Object $payment, $amount)
{
if (!$this->canCapture()) {
return $this;
}
if (Mage::app()->getRequest()->getParam('transId')) {
// Capture is called from response action
$payment->setStatus(self::STATUS_APPROVED);
return $this;
}
}
示例11: _authorize
/**
* Authorize or Capture payment
*
* @param Varien_Object|Mage_Sales_Model_Order_Payment $payment
* @param float $amount
* @param bool $capture
* @return $this
*/
private function _authorize(Varien_Object $payment, $amount, $capture)
{
$order = $payment->getOrder();
/* @var $order Mage_Sales_Model_Order */
$multiToken = false;
$cardData = null;
$additionalData = new Varien_Object($payment->getAdditionalData() ? unserialize($payment->getAdditionalData()) : null);
$secureToken = $additionalData->getSecuresubmitToken() ? $additionalData->getSecuresubmitToken() : null;
$saveCreditCard = !!(bool) $additionalData->getCcSaveFuture();
$customerId = $additionalData->getCustomerId();
if ($saveCreditCard) {
$multiToken = true;
$cardData = new HpsCreditCard();
$cardData->number = $payment->getCcLast4();
$cardData->expYear = $payment->getCcExpYear();
$cardData->expMonth = $payment->getCcExpMonth();
}
$chargeService = $this->_getChargeService();
$cardHolder = $this->_getCardHolderData($order);
$details = $this->_getTxnDetailsData($order);
$cardOrToken = new HpsTokenData();
$cardOrToken->tokenValue = $secureToken;
try {
if ($capture) {
if ($payment->getCcTransId()) {
$response = $chargeService->capture($payment->getCcTransId(), $amount);
} else {
$response = $chargeService->charge($amount, strtolower($order->getBaseCurrencyCode()), $cardOrToken, $cardHolder, $multiToken, $details);
}
} else {
$response = $chargeService->authorize($amount, strtolower($order->getBaseCurrencyCode()), $cardOrToken, $cardHolder, $multiToken, $details);
}
$this->_debugChargeService($chargeService);
$payment->setStatus(self::STATUS_APPROVED);
$payment->setAmount($amount);
$payment->setLastTransId($response->transactionId);
$payment->setCcTransId($response->transactionId);
$payment->setTransactionId($response->transactionId);
$payment->setIsTransactionClosed(0);
if ($multiToken) {
$tokenData = $response->tokenData;
/* @var $tokenData HpsTokenData */
if ($tokenData->responseCode == '0') {
if ($customerId > 0) {
Mage::helper('hps_securesubmit')->saveMultiToken($response->tokenData->tokenValue, $cardData, $response->cardType, $customerId);
} else {
Mage::helper('hps_securesubmit')->saveMultiToken($response->tokenData->tokenValue, $cardData, $response->cardType);
}
} else {
Mage::log('Requested multi token has not been generated for the transaction # ' . $response->transactionId, Zend_Log::WARN);
}
}
} catch (HpsCreditException $e) {
Mage::logException($e);
$this->_debugChargeService($chargeService, $e);
$payment->setStatus(self::STATUS_DECLINED);
$this->throwUserError($e->getMessage(), $e->resultText, TRUE);
} catch (HpsException $e) {
$this->_debugChargeService($chargeService, $e);
$payment->setStatus(self::STATUS_ERROR);
$this->throwUserError($e->getMessage(), NULL, TRUE);
} catch (Exception $e) {
$this->_debugChargeService($chargeService, $e);
Mage::logException($e);
$payment->setStatus(self::STATUS_ERROR);
$this->throwUserError($e->getMessage());
}
return $this;
}
示例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;
}
示例13: setStatus
/**
* Sets status to object but not for self::STATUS_ORDER_IS_CLOSED status
*
* @param $status
* @return Enterprise_Rma_Model_Item_Status
*/
public function setStatus($status)
{
if (!$this->getSequenceStatus() || !$this->_isSpecialStatus) {
$this->setSequenceStatus($status);
}
return parent::setStatus($status);
}
示例14: cancel
/**
* Camcel payment
*
* @param Varien_Object $payment
* @return Phoenix_Moneybookers_Model_Abstract
*/
public function cancel(Varien_Object $payment)
{
$payment->setStatus(self::STATUS_DECLINED)->setTransactionId($this->getTransactionId())->setIsTransactionClosed(1);
return $this;
}
示例15: capture
/**
* this method is called if we are authorising AND capturing a transaction
*/
public function capture(Varien_Object $payment, $amount)
{
// throw new Exception('who calls me?');
if (preg_match('/sales_order_create/i', $_SERVER['REQUEST_URI']) && $this->getConfigData('paypage_enable') == '1') {
$payment->setStatus('N/A')->setCcTransId('Litle VT')->setLastTransId('Litle VT')->setTransactionId('Litle VT')->setIsTransactionClosed(0)->setCcType('Litle VT');
return;
}
$this->isFromVT($payment, 'capture');
$order = $payment->getOrder();
if (!empty($order)) {
$orderId = $order->getIncrementId();
$orderSource = "ecommerce";
if ($orderId > 200000000) {
$orderSource = "recurring";
}
$info = $this->getInfoInstance();
if (!$info->getAdditionalInformation('orderSource')) {
$info->setAdditionalInformation('orderSource', $orderSource);
}
$amountToPass = Mage::helper('creditcard')->formatAmount($amount, true);
$isPartialCapture = $amount < $order->getGrandTotal() ? 'true' : 'false';
$isSale = $payment->getCcTransId() != null ? false : true;
if (!$isSale) {
$hash = array('litleTxnId' => $payment->getParentTransactionId(), 'amount' => $amountToPass, 'partial' => $isPartialCapture);
} else {
$hash_temp = array('orderId' => $orderId, 'id' => $orderId, 'amount' => $amountToPass, 'orderSource' => $info->getAdditionalInformation('orderSource'), 'billToAddress' => $this->getBillToAddress($payment), 'shipToAddress' => $this->getAddressInfo($payment), 'enhancedData' => $this->getEnhancedData($payment));
$payment_hash = $this->creditCardOrPaypageOrToken($payment, $info);
$hash = array_merge($hash_temp, $payment_hash);
}
$merchantData = $this->merchantData($payment);
$hash_in = array_merge($hash, $merchantData);
$litleRequest = new LitleOnlineRequest();
if ($isSale) {
$litleResponse = $litleRequest->saleRequest($hash_in);
Mage::helper('palorus')->saveCustomerInsight($payment, $litleResponse);
} else {
$litleResponse = $litleRequest->captureRequest($hash_in);
}
if (!is_null($info->getAdditionalInformation('cc_should_save'))) {
$this->_saveToken($payment, $litleResponse);
}
}
$this->processResponse($payment, $litleResponse);
return $this;
}