Example #1
0
 /**
  * Test processIpnRequest() currency check for recurring profile
  *
  * @param string $currencyCode
  * @dataProvider currencyProvider
  * @magentoDataFixture Mage/Paypal/_files/recurring_profile.php
  * @magentoConfigFixture current_store payment/paypal_direct/active 1
  * @magentoConfigFixture current_store payment/paypal_express/active 1
  * @magentoConfigFixture current_store paypal/general/merchant_country US
  * @magentoConfigFixture current_store sales_email/order/enabled 0
  */
 public function testProcessIpnRequestRecurringCurrency($currencyCode)
 {
     $ipnData = (require __DIR__ . '/../_files/ipn_recurring_profile.php');
     $ipnData['mc_currency'] = $currencyCode;
     $this->_model->processIpnRequest($ipnData, $this->_createMockedHttpAdapter());
     $recurringProfile = Mage::getModel('Mage_Sales_Model_Recurring_Profile');
     $recurringProfile->loadByInternalReferenceId('5-33949e201adc4b03fbbceafccba893ce');
     $orderIds = $recurringProfile->getChildOrderIds();
     $this->assertEquals(1, count($orderIds));
     $order = Mage::getModel('Mage_Sales_Model_Order');
     $order->load($orderIds[0]);
     $this->_assertOrder($order, $currencyCode);
 }
Example #2
0
 protected function _registerPaymentCapture()
 {
     try {
         Mage::log("Before looking up PayPal PAP cookie\n");
         $papModel = Mage::getModel('pap/pap');
         $postData = $this->_request;
         $customdata = explode('~~~a469ccb0-767c-4fed-96de-99427e1783aa~~~', $postData['custom']);
         //            $saleData = isset($customdata[0]) ? $customdata[0] : null;
         $cookieValue = isset($customdata[1]) ? $customdata[1] : null;
         Mage::log("Before PayPal PAP register sale for cookie {$cookieValue}\n");
         $papModel->registerOrder($this->_getOrder(), null, isset($cookieValue) ? $cookieValue : null);
         Mage::log("After successful PayPal PAP register sale for cookie {$cookieValue}\n");
     } catch (Exception $e) {
         Mage::log('Caught exception while trying to log PayPal sale to PAP: ' . $e->getMessage() . "\n");
     }
     parent::_registerPaymentCapture();
 }
Example #3
0
 /**
  * Process a refund or a chargeback
  */
 protected function _registerPaymentRefund()
 {
     if (Mage::getStoreConfig(self::CONFIG_IPN_REFUND_METHOD) == Aligent_Paypal_Model_System_Config_Source_Refundmethod::METHOD_DEFAULT) {
         return parent::_registerPaymentRefund();
     } else {
         $this->_importPaymentInformation();
         $reason = $this->getRequestData('reason_code');
         $isRefundFinal = !$this->_info->isReversalDisputable($reason);
         $amount = -1 * $this->getRequestData('mc_gross');
         Mage::log('IPN Refund received.  Reason Code: ' . $reason . ' isRefundFinal: ' . $isRefundFinal . ' Amount: ' . $amount);
         $vCommentText = Mage::helper('paypal')->__('Refunded amount of %s. Transaction ID: "%s".', $this->_order->getBaseCurrency()->formatTxt($amount), $this->getRequestData('txn_id'));
         $vCommentText .= ' Reason: ' . $this->_info->explainReasonCode($reason);
         $this->_createIpnComment($vCommentText, true);
         $this->_order->save();
         $vCommentText .= " for order #" . $this->_order->getIncrementId();
         $oNotification = Mage::getModel('adminnotification/inbox');
         $oNotification->setSeverity(Mage_AdminNotification_Model_Inbox::SEVERITY_MINOR);
         $oNotification->setDateAdded(date("c", time()));
         $oNotification->setTitle('Paypal Refund IPN Received');
         $oNotification->setDescription($vCommentText);
         $oNotification->save();
     }
 }
Example #4
0
 protected function _processOrder()
 {
     Mage::dispatchEvent('wyomind_advancedinventory_paypal_order_place_success', array('order' => $this->_getOrder()));
     parent::_processOrder();
 }