/** * @return \JMS\Payment\CoreBundle\Entity\ExtendedData|null */ public function getExtendedData() { if (null !== $this->extendedData) { return $this->extendedData; } if (null !== $this->payment) { return $this->payment->getPaymentInstruction()->getExtendedData(); } else { if (null !== $this->credit) { return $this->credit->getPaymentInstruction()->getExtendedData(); } } return null; }
/** * This method adds a Credit container to this PaymentInstruction. * * This method is called automatically from Credit::__construct(). * * @param Credit $credit * @return void */ public function addCredit(Credit $credit) { if ($credit->getPaymentInstruction() !== $this) { throw new \InvalidArgumentException('This credit container belongs to another instruction.'); } $this->credits->add($credit); }
public function testConstructor() { $credit = new Credit($instruction = $this->getInstruction(), 100.23); $this->assertSame($instruction, $credit->getPaymentInstruction()); $this->assertEquals(0.0, $credit->getCreditedAmount()); $this->assertEquals(0.0, $credit->getCreditingAmount()); $this->assertInstanceOf('Doctrine\\Common\\Collections\\ArrayCollection', $credit->getTransactions()); $this->assertEquals(0, count($credit->getTransactions())); $this->assertEquals(0.0, $credit->getReversingAmount()); $this->assertSame(CreditInterface::STATE_NEW, $credit->getState()); $this->assertEquals(100.23, $credit->getTargetAmount()); $this->assertFalse($credit->isAttentionRequired()); $this->assertNull($credit->getId()); }