/**
  * Test case for oePayPalPayPalOrder::save()
  * Tests adding / getting PayPal Order Payment history item
  *
  * @return null
  */
 public function testSavePayPalPayPalOrder_update()
 {
     $oOrder = new oePayPalPayPalOrder();
     $oOrder->setOrderId('123');
     $oOrder->setPaymentStatus('pending');
     $oOrder->setCapturedAmount(24.13);
     $oOrder->setRefundedAmount(12.13);
     $oOrder->setVoidedAmount(15.13);
     $oOrder->setTotalOrderSum(299.99);
     $oOrder->setCurrency('LTU');
     $oOrder->setTransactionMode('Sale');
     $oOrder->save();
     $oOrderLoaded = new oePayPalPayPalOrder();
     $oOrderLoaded->load('123');
     $oOrderLoaded->setPaymentStatus('completed');
     $oOrderLoaded->save();
     $oOrderLoaded = new oePayPalPayPalOrder();
     $oOrderLoaded->load('123');
     $this->assertEquals('completed', $oOrderLoaded->getPaymentStatus());
     $this->assertEquals(24.13, $oOrderLoaded->getCapturedAmount());
     $this->assertEquals(12.13, $oOrderLoaded->getRefundedAmount());
     $this->assertEquals(15.13, $oOrderLoaded->getVoidedAmount());
     $this->assertEquals(299.99, $oOrderLoaded->getTotalOrderSum());
     $this->assertEquals('LTU', $oOrderLoaded->getCurrency());
     $this->assertEquals('Sale', $oOrderLoaded->getTransactionMode());
 }
 /**
  * Checks if order is created using current PayPal module.
  * Expected result- false
  */
 public function testIsNewPayPalOrder_False()
 {
     $soxId = '_testOrderId';
     $oPayPalOrderModel = new oePayPalPayPalOrder();
     $oPayPalOrderModel->setOrderId($soxId);
     $oPayPalOrderModel->save();
     $oPayPalOxOrder = $this->getMock('oePayPalOxOrder', array('getPayPalOrder'));
     $oPayPalOxOrder->expects($this->any())->method('getPayPalOrder')->will($this->returnValue($oPayPalOrderModel));
     $oPayPalOrder = $this->getMock('oePayPalOrder_PayPal', array('getEditObject', 'isPayPalOrder'));
     $oPayPalOrder->expects($this->any())->method('getEditObject')->will($this->returnValue($oPayPalOxOrder));
     $oPayPalOrder->expects($this->once())->method('isPayPalOrder')->will($this->returnValue(false));
     $this->assertFalse($oPayPalOrder->isNewPayPalOrder());
 }
 /**
  * Returns loaded oePayPalPayPalOrder object with given id
  *
  * @param string $sOrderId
  *
  * @return oePayPalPayPalOrder
  */
 protected function _getOrder($sOrderId)
 {
     $oOrder = new oePayPalPayPalOrder();
     $oOrder->setOrderId($sOrderId);
     $oOrder->load();
     return $oOrder;
 }
 /**
  * Testing suggest status on partial capture
  */
 public function testGetSuggestStatus_onReauthorize()
 {
     $oOrder = new oePayPalPayPalOrder();
     $oOrder->setOrderId('order');
     $oOrder->setPaymentStatus('pending');
     $oManager = new oePayPalOrderPaymentStatusCalculator();
     $oManager->setOrder($oOrder);
     $this->assertEquals('pending', $oManager->getSuggestStatus('reauthorize'));
 }
 /**
  * Create order with status different than order status calculator returns.
  *
  * @param string $sOrderId order id.
  *
  * @return oePayPalPayPalOrder
  */
 protected function _prepareOrder($sOrderId)
 {
     $oOrder = new oePayPalPayPalOrder();
     $oOrder->setPaymentStatus('pending');
     $oOrder->setOrderId($sOrderId);
     return $oOrder;
 }