Example #1
0
 /**
  * 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();
 }
Example #2
0
 /**
  * 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;
 }
 /**
  * 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;
 }
 /**
  * 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');
     }
 }
Example #5
0
 public function getPayerInfoFromOrder($order)
 {
     $billingAddress = $order->getBillingAddress();
     $address = new Varien_Object();
     $address->setStreet($billingAddress->getStreet(1));
     $address->setNumber($billingAddress->getStreet(2));
     $address->setCity($billingAddress->getCity());
     $address->setState($billingAddress->getRegionCode());
     $address->setCountry('Brasil');
     $address->setZipCode(Zend_Filter::filterStatic($billingAddress->getPostcode(), 'Digits'));
     $payer = new Varien_Object();
     $payer->setCpfCnpj($order->getCustomerTaxvat());
     $payer->setName($order->getCustomerName());
     $payer->setPhonePrefix($this->getPhonePrefix($billingAddress->getTelephone()));
     $payer->setPhone($this->getPhone($billingAddress->getTelephone()));
     $payer->setEmail($order->getCustomerEmail());
     $payer->setAddress($address);
     Mage::dispatchEvent('iugu_get_payer_info_from_order_after', array('order' => $order, 'payer_info' => $payer));
     return $payer;
 }
 /**
  * Instantiate state and set it to state object
  *
  * @param string $paymentAction
  * @param Varien_Object $stateObject
  */
 public function initialize($paymentAction, $stateObject)
 {
     switch ($paymentAction) {
         case Mage_Paypal_Model_Config::PAYMENT_ACTION_AUTH:
         case Mage_Paypal_Model_Config::PAYMENT_ACTION_SALE:
             $payment = $this->getInfoInstance();
             $order = $payment->getOrder();
             $order->setCanSendNewEmailFlag(false);
             $payment->setAmountAuthorized($order->getTotalDue());
             $payment->setBaseAmountAuthorized($order->getBaseTotalDue());
             $this->_generateSecureSilentPostHash($payment);
             $request = $this->_buildTokenRequest($payment);
             $response = $this->_postRequest($request);
             $this->_processTokenErrors($response, $payment);
             $order = $payment->getOrder();
             $order->setCanSendNewEmailFlag(false);
             $stateObject->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT);
             $stateObject->setStatus('pending_payment');
             $stateObject->setIsNotified(false);
             break;
         default:
             break;
     }
 }
 /**
  * @param string $paymentAction
  * @param Varien_Object $stateObject
  * @return Payone_Core_Model_Payment_Method_Abstract
  *
  * @throws Payone_Core_Exception_PaymentMethodConfigNotFound
  */
 public function initialize($paymentAction, $stateObject)
 {
     /** @var $payment Mage_Sales_Model_Order_Payment */
     $payment = $this->getInfoInstance();
     /** @var $order Mage_Sales_Model_Order */
     $order = $payment->getOrder();
     $configPayment = $this->getConfigByOrder($order);
     // Never send confirmation email, we do it during Tx-Status processing
     $order->setCanSendNewEmailFlag(false);
     // Execute Payment Initialization
     $service = $this->getFactory()->getServiceInitializePayment($configPayment);
     $service->setConfigStore($this->getConfigStore($order->getStoreId()));
     $response = $service->execute($payment);
     // @comment by default state=new and status=pending
     if ($this->getRedirectUrl() != '') {
         $stateObject->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT);
         $this->setRedirectToQuotePaymentMethod();
     }
     return $this;
 }
Example #8
0
 /**
  * Instantiate state and set it to state object
  *
  * @param string $paymentAction
  * @param Varien_Object $stateObject
  */
 public function initialize($paymentAction, $stateObject)
 {
     switch ($paymentAction) {
         case Mage_Paypal_Model_Config::PAYMENT_ACTION_AUTH:
         case Mage_Paypal_Model_Config::PAYMENT_ACTION_SALE:
             $payment = $this->getInfoInstance();
             $order = $payment->getOrder();
             $order->setCanSendNewEmailFlag(false);
             $payment->setAmountAuthorized($order->getTotalDue());
             $payment->setBaseAmountAuthorized($order->getBaseTotalDue());
             $this->_setPaymentFormUrl($payment);
             $stateObject->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT);
             $stateObject->setStatus('pending_payment');
             $stateObject->setIsNotified(false);
             break;
         default:
             break;
     }
 }
Example #9
0
 /**
  * Method that will be executed instead of authorize or capture
  * if flag isInitilizeNeeded set to true
  *
  * @param   string $paymentAction
  * @param   Varien_Object $stateObject
  * @return  Mage_Payment_Model_Abstract
  */
 public function initialize($paymentAction, $stateObject)
 {
     $state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
     $stateObject->setState($state);
     $stateObject->setStatus(self::ORDER_STATUS);
     $stateObject->setIsNotified(false);
 }
 /**
  * Processes order status and return information about order status and state
  * Doesn' change anything to the order. Just returns an object showing what to do.
  * @param $statusCode
  * @return Varien_Object
  */
 public function processStatus($statusCode)
 {
     $return = new Varien_Object();
     $return->setStateChanged(true);
     $return->setIsTransactionPending(true);
     //payment is pending?
     switch ($statusCode) {
         case '1':
             $return->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT);
             $return->setIsCustomerNotified($this->getCode() != 'pagseguro_cc');
             if ($this->getCode() == 'pagseguro_cc') {
                 $return->setStateChanged(false);
             }
             $return->setMessage('Aguardando pagamento: o comprador iniciou a transação,
             mas até o momento o PagSeguro não recebeu nenhuma informação sobre o pagamento.');
             break;
         case '2':
             $return->setState(Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW);
             $return->setIsCustomerNotified(true);
             $return->setMessage('Em análise: o comprador optou por pagar com um cartão de crédito e
                 o PagSeguro está analisando o risco da transação.');
             break;
         case '3':
             $return->setState(Mage_Sales_Model_Order::STATE_PROCESSING);
             $return->setIsCustomerNotified(true);
             $return->setMessage('Paga: a transação foi paga pelo comprador e o PagSeguro já recebeu uma confirmação
                 da instituição financeira responsável pelo processamento.');
             $return->setIsTransactionPending(false);
             break;
         case '4':
             $return->setMessage('Disponível: a transação foi paga e chegou ao final de seu prazo de liberação sem
                 ter sido retornada e sem que haja nenhuma disputa aberta.');
             $return->setIsCustomerNotified(false);
             $return->setStateChanged(false);
             $return->setIsTransactionPending(false);
             break;
         case '5':
             $return->setState(Mage_Sales_Model_Order::STATE_PROCESSING);
             $return->setIsCustomerNotified(false);
             $return->setIsTransactionPending(false);
             $return->setMessage('Em disputa: o comprador, dentro do prazo de liberação da transação,
                 abriu uma disputa.');
             break;
         case '6':
             $return->setState(Mage_Sales_Model_Order::STATE_CLOSED);
             $return->setIsCustomerNotified(false);
             $return->setIsTransactionPending(false);
             $return->setMessage('Devolvida: o valor da transação foi devolvido para o comprador.');
             break;
         case '7':
             $return->setState(Mage_Sales_Model_Order::STATE_CANCELED);
             $return->setIsCustomerNotified(true);
             $return->setMessage('Cancelada: a transação foi cancelada sem ter sido finalizada.');
             break;
         default:
             $return->setIsCustomerNotified(false);
             $return->setStateChanged(false);
             $return->setMessage('Codigo de status inválido retornado pelo PagSeguro. (' . $statusCode . ')');
     }
     return $return;
 }
Example #11
0
 /**
  * Instantiate state and set it to state object
  *
  * @param string $paymentAction
  * @param Varien_Object $stateObject
  */
 public function initialize($paymentAction, $stateObject)
 {
     switch ($paymentAction) {
         case Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE:
         case Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE:
             $payment = $this->getInfoInstance();
             $order = $payment->getOrder();
             $order->setCanSendNewEmailFlag(false);
             $payment->setAmountAuthorized($order->getTotalDue());
             $payment->setBaseAmountAuthorized($order->getBaseTotalDue());
             $stateObject->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT);
             $stateObject->setStatus('pending_payment');
             $stateObject->setIsNotified(false);
             break;
         default:
             break;
     }
 }
Example #12
0
 /**
  * This method is called during order creation to initialize the payment.
  *
  * @param string $paymentAction
  * @param Varien_Object $stateObject
  * @return Customweb_SaferpayCw_Model_Method
  */
 public function initialize($paymentAction, $stateObject)
 {
     $stateObject->setStatus(self::SAFERPAYCW_STATUS_PENDING);
     $stateObject->setState(self::STATE_PENDING);
     $stateObject->setIsNotified(false);
     return $this;
 }