/** * Test case for adding / getting PayPal Order Payment history item */ public function testCreatePayPalOrderPayment() { $oOrderPayment = new oePayPalOrderPayment(); $oOrderPayment->setOrderId('123'); $oOrderPayment->setTransactionId('transactionId'); $oOrderPayment->setCorrelationId('correlationId'); $oOrderPayment->setAmount(50); $oOrderPayment->setRefundedAmount(12.13); $oOrderPayment->setAction('capture'); $oOrderPayment->setDate('2012-04-13 15:16:32'); $oOrderPayment->setStatus('status'); $oOrderPayment->setCurrency('LTL'); $oOrderPayment->save(); $oOrderPaymentLoaded = new oePayPalOrderPayment(); $oOrderPaymentLoaded->load($oOrderPayment->getPaymentId()); $this->assertEquals('123', $oOrderPaymentLoaded->getOrderId()); $this->assertEquals('transactionId', $oOrderPaymentLoaded->getTransactionId()); $this->assertEquals('correlationId', $oOrderPaymentLoaded->getCorrelationId()); $this->assertEquals(50, $oOrderPaymentLoaded->getAmount()); $this->assertEquals(12.13, $oOrderPaymentLoaded->getRefundedAmount()); $this->assertEquals('capture', $oOrderPaymentLoaded->getAction()); $this->assertEquals('2012-04-13 15:16:32', $oOrderPaymentLoaded->getDate()); $this->assertEquals('status', $oOrderPaymentLoaded->getStatus()); $this->assertEquals('LTL', $oOrderPaymentLoaded->getCurrency()); }
/** * Test case for oePayPalOrderPayment::oePayPalOrderPaymentList() * Gets PayPal Order Payment history list * * @return null */ public function testLoadOrderPayments() { $oOrderPayment = new oePayPalOrderPayment(); $oOrderPayment->setPaymentId(1); $oOrderPayment->setOrderId("123"); $oOrderPayment->setAmount(50); $oOrderPayment->setAction("OEPAYPAL_STATUS_COMPLETED"); $oOrderPayment->setDate("2012-04-13 12:13:15"); $oOrderPayment->save(); $oOrderPayment->setPaymentId(2); $oOrderPayment->setDate("2012-02-01"); $oOrderPayment->save(); $oOrderPayment->setPaymentId(3); $oOrderPayment->setDate("2012-01-15"); $oOrderPayment->save(); $oOrderPaymentList = new oePayPalOrderPaymentList(); $oOrderPaymentList->load("123"); $this->assertEquals(3, count($oOrderPaymentList)); $i = 1; foreach ($oOrderPaymentList as $oOrderPayment) { $this->assertEquals($i++, $oOrderPayment->getPaymentId()); } }