public function setCurrency($currency) { if (!array_key_exists(strtoupper($currency), SipsCurrency::getCurrencies())) { throw new InvalidArgumentException("Unknown currency"); } $this->parameters['currencyCode'] = SipsCurrency::convertCurrencyToSipsCurrencyCode($currency); }
protected function validateCurrency($currency) { if (!array_key_exists(strtoupper($currency), SipsCurrency::getCurrencies())) { throw new InvalidArgumentException("Unknown currency"); } }
/** @test */ public function HasCurrencyList() { $sipsCurrency = new SipsCurrency(); $this->assertEquals(array('EUR' => '978', 'USD' => '840', 'CHF' => '756', 'GBP' => '826', 'CAD' => '124', 'JPY' => '392', 'MXP' => '484', 'TRY' => '949', 'AUD' => '036', 'NZD' => '554', 'NOK' => '578', 'BRC' => '986', 'ARP' => '032', 'KHR' => '116', 'TWD' => '901', 'SEK' => '752', 'DKK' => '208', 'KRW' => '410', 'SGD' => '702', 'XPF' => '953', 'XOF' => '952'), $sipsCurrency->getCurrencies()); }