public function getDebit($uri) { return \Balanced\Debit::get($uri); }
function testGetDispute() { $card = self::_createCardwithDispute(); $debit = $card->debit(5566, null, null, null, null, null); $timeout = 12 * 60; $interval = 10; $begin_time = microtime(true); while (true) { $polled_debit = Debit::get($debit->href); $polled_dispute = $polled_debit->dispute; if (get_class($polled_dispute) == 'Balanced\\Dispute') { $dispute = $polled_dispute; } if (isset($dispute)) { break; } $elapsed_time = microtime(true) - $begin_time; if ($elapsed_time > $timeout) { throw new RoutingException('Timeout'); } error_log("Polling disputes... elapsed {$elapsed_time} ", 0); sleep($interval); } $this->assertInstanceOf('Balanced\\Dispute', $dispute); $this->assertEquals($dispute->status, "pending"); $this->assertEquals($dispute->reason, "fraud"); $this->assertEquals($dispute->amount, $debit->amount); }