diff --git a/init.php b/init.php index d919fcd099..8dc6406a23 100644 --- a/init.php +++ b/init.php @@ -65,6 +65,7 @@ require(dirname(__FILE__) . '/lib/Dispute.php'); require(dirname(__FILE__) . '/lib/EphemeralKey.php'); require(dirname(__FILE__) . '/lib/Event.php'); +require(dirname(__FILE__) . '/lib/ExchangeRate.php'); require(dirname(__FILE__) . '/lib/FileUpload.php'); require(dirname(__FILE__) . '/lib/Invoice.php'); require(dirname(__FILE__) . '/lib/InvoiceItem.php'); diff --git a/lib/ExchangeRate.php b/lib/ExchangeRate.php new file mode 100644 index 0000000000..a6a2b7d024 --- /dev/null +++ b/lib/ExchangeRate.php @@ -0,0 +1,44 @@ + 'Stripe\\Customer', 'dispute' => 'Stripe\\Dispute', 'ephemeral_key' => 'Stripe\\EphemeralKey', + 'exchange_rate' => 'Stripe\\ExchangeRate', 'list' => 'Stripe\\Collection', 'login_link' => 'Stripe\\LoginLink', 'invoice' => 'Stripe\\Invoice', diff --git a/tests/ExchangeRateTest.php b/tests/ExchangeRateTest.php new file mode 100644 index 0000000000..7be6148f38 --- /dev/null +++ b/tests/ExchangeRateTest.php @@ -0,0 +1,52 @@ +mockRequest( + 'GET', + '/v1/exchange_rates/usd', + array(), + array( + 'id' => 'usd', + 'object' => 'exchange_rates', + 'rates' => array('eur' => 0.845876), + ) + ); + + $currency = "usd"; + $rates = ExchangeRate::retrieve($currency); + $this->assertEquals('exchange_rates', $rates->object); + } + + public function testList() + { + $this->mockRequest( + 'GET', + '/v1/exchange_rates', + array(), + array( + 'object' => 'list', + 'data' => array( + array( + 'id' => 'eur', + 'object' => 'exchange_rates', + 'rates' => array('usd' => 1.18221), + ), + array( + 'id' => 'usd', + 'object' => 'exchange_rates', + 'rates' => array('eur' => 0.845876), + ), + ), + ) + ); + + $listRates = ExchangeRate::all(); + $this->assertTrue(is_array($listRates->data)); + $this->assertEquals('exchange_rates', $listRates->data[0]->object); + } +}