public function testRetrieve() { self::authorizeFromEnv(); $d = Stripe_Balance::retrieve(); $this->assertEqual($d->object, "balance"); $this->assertTrue(Stripe_Util::isList($d->available)); $this->assertTrue(Stripe_Util::isList($d->pending)); }
public function get_balance() { try { $bal = Stripe_Balance::retrieve(); return array('mode' => $bal->livemode ? $bal->livemode : 'Test', 'pending_amount' => $bal->pending[0]->amount / 100, 'pending_currency' => strtoupper($bal->pending[0]->currency), 'available_amount' => $bal->available[0]->amount / 100, 'available_currency' => strtoupper($bal->available[0]->currency)); } catch (Exception $e) { $this->error = TRUE; $this->message = $e->getMessage(); $this->code = $e->getCode(); //return FALSE; return array('error' => TRUE, 'code' => $this->code, 'message' => $this->message); } }
/** * Test api credentials by attempting a balance request * * @return bool */ public function testCredentials() { try { \Stripe_Balance::retrieve(); } catch (\Exception $e) { return false; } return true; }