Hi,
A fallback method can be implemented - I've got nothing against it. It should perhaps be an opt-out since fx rates are not necessarily identical between sources and a business/user may require strict adherence to a specific source.
I guess that rules out the factory then :).
Fine, maybe some opinions will crop up with these emails...
Well, it would break the standard but since it would be a contrived currency it would be a small exception. Warrant more discussion given the rising articifical economy on all those MMORPG games...:)
I'll look through your comments on the PHP source - largely provisional in any case. Already it seems likely the factory will go. getFormula() was a simple method to return a text string of the fx relationship - the Traveller Equation. Method should be named better...
Just to check, validation of Country Codes should be handled by Zend_Locale or Zend_Currency? I figured Currency, but if the codes are attached to a Locale...
Regards,
Pádraic
Pádraic Brady
http://blog.quantum-star.com
A fallback method can be implemented - I've got nothing against it. It should perhaps be an opt-out since fx rates are not necessarily identical between sources and a business/user may require strict adherence to a specific source.
I guess that rules out the factory then :).
I don't care either. Let the community decide, eh
Fine, maybe some opinions will crop up with these emails...
Just a thought: Should it be possible to add own currencies like credit
points? It'd be a cool feature, but it'd break the standard as well.
Well, it would break the standard but since it would be a contrived currency it would be a small exception. Warrant more discussion given the rising articifical economy on all those MMORPG games...:)
I'll look through your comments on the PHP source - largely provisional in any case. Already it seems likely the factory will go. getFormula() was a simple method to return a text string of the fx relationship - the Traveller Equation. Method should be named better...
Just to check, validation of Country Codes should be handled by Zend_Locale or Zend_Currency? I figured Currency, but if the codes are attached to a Locale...
Regards,
Pádraic
Pádraic Brady
http://blog.quantum-star.com
----- Original Message ----
From: André Hoffmann <[EMAIL PROTECTED]>
To: Pádraic Brady <[EMAIL PROTECTED]>
Cc: Zend Framework General <[email protected]>
Sent: Saturday, September 23, 2006 7:33:03 PM
Subject: Re: [fw-general] Additional Web Services?
I agree with almost everything, but what I had liked to see would have been a fallback method, as you might use it in a shop and you just don't want t rely on one single server.
That wouldn't work if we were gonna use a factory.
--
best regards,
André Hoffmann
Germany
From: André Hoffmann <[EMAIL PROTECTED]>
To: Pádraic Brady <[EMAIL PROTECTED]>
Cc: Zend Framework General <[email protected]>
Sent: Saturday, September 23, 2006 7:33:03 PM
Subject: Re: [fw-general] Additional Web Services?
I agree with almost everything, but what I had liked to see would have been a fallback method, as you might use it in a shop and you just don't want t rely on one single server.
That wouldn't work if we were gonna use a factory.
On 9/22/06, Pádraic Brady <[EMAIL PROTECTED]> wrote:
I don't care either. Let the community decide, eh?
Just a thought: Should it be possible to add own currencies like credit points? It'd be a cool feature, but it'd break the standard as well.
We should somehow use Zend_Locale to achieve this.
Already covered by Zend_Currency. (or at least it will be ;) )
- This component will support serialization as you might need to store rates
-
One should be able to define a standard currency.
Allow Object Chaining.
todo: decide whether to name it Zend_Service_ExchangeRates or Zend_Service_Currency ;)
Private constructor..? public function __construct();
public function setSource($source)
public function getSource()
What does this method do?
Same thing here..I don't get the purpose.
Covered by Zend_Currency.
Hi André,
I'm just going to paste what I had below on Zend_Service_Currency before I hit the mailing list and you got there before me :). It's in no way final (obviously) and took the layout of the ZF Proposal format. When you have your own version we can compare notes and talk about development when you're available at some point.
Ignore the ExchangeRates name - Service_Currency works for me...:)
I don't care either. Let the community decide, eh?
Regards,
Pádraic
Initial Draft Overview: Zend_Service_ExchangeRates
20 September 2006
Overview
--------
The purpose of this class is to utilise one or more FX rate sources to perform FX translations or return spot FX rates between any two currencies. Currencies will be denoted with Country Codes compliant with ISO 4217.
Just a thought: Should it be possible to add own currencies like credit points? It'd be a cool feature, but it'd break the standard as well.
References
----------
Pear_Service_ExchangeRates
XMethods WSDL
Component Requirements, Constraints, and Acceptance Criteria
------------------------------------------------------------
- This component will fetch spot FX rates from a selection of possible services incl. at a minumum ECB (European Central Bank) and FRB (US Federal Reserve) published rates.
- This component will validate Country Currency codes correctly against a) Zend_Currency or b) the UNECE published list.
We should somehow use Zend_Locale to achieve this.
- This component will perform FX translations between any two currencies.
- This component will return correct rate for translation between any two currencies.
- This component will correctly handle locale issues such as comma/period differences from en_UK or en_US and mainland Europe.
Already covered by Zend_Currency. (or at least it will be ;) )
- This component may save data for a specified time using Zend_Cache.
- This component may include a factory method.
- This component will allow subclassing for alternative rate sources from country specific institutions.
- This component will support serialization as you might need to store rates
-
Dependencies
------------
Zend_Service_Exception
Zend_Service_Rest
Zend_Currency
Zend_Cache
Theory of Operation
-------------------
Based on any two compliant ISO 4217 Country Currency codes, Zend_Service_Currency would fetch the relevant exchange rate from a selected source, or range of sources, and either:
a) perform a currency translation and return the result; or
b) return the relevant exchange rate
One should be able to define a standard currency.
Milestones / Tasks
------------------
- Milestone 1: Publish relevant design notes and background on design decisions
- Milestone 2: Write Unit Tests for Use Case #1 and check implementing code into Incubator
- Milestone 3: Write Unit Tests/Code for remaining Use Cases and check implementing code into Incubator
- Milestone 4: Write documentation sufficient for core Use Cases
- Milestone 5: Perform review and additional refactoring. Assess additional Use Cases (if any).
Class Index
-----------
Zend_Service_ExchangeRates_Interface
Zend_Service_ExchangeRates
Zend_Service_ExchangeRates_ECB
Zend_Service_ExchangeRates_FRB
Zend_Service_ExchangeRates_XMethods
Zend_Service_ExchangeRates_CountryCodes_Interface
Zend_Service_ExchangeRates_CountryCodes_UNECE
Use Cases
---------
<?php
/* en_UK query (no Zend_Currency use)
*
* Simple use case fetching the FX rate for translating between two currencies.
*/
// Fetch instance based on source (European Central Bank) from static
// Factory method
$fx = Zend_Service_ExchangeRates::factory('ECB');
// set To and From currencies (ISO 4217 Currency Codes)
$fx->setFromCurrency('EUR');
$fx->setToCurrency('USD');
// return the rate...
echo $fx->getFXRate();
Allow Object Chaining.
?>
Class Skeletons
---------------
<?php
class Zend_Service_ExchangeRates {
todo: decide whether to name it Zend_Service_ExchangeRates or Zend_Service_Currency ;)
protected $source = '';
protected $toCode = '';
protected $fromCode = '';
protected $options = array();
protected $sourceURL = '';
protected $fxRate = 1;
private function __construct();
Private constructor..? public function __construct();
public static function factory($source, $options);
public function setFromCurrency($fromCode);
public function setToCurrency($toCode);
public function setSource($source)
public function getSource()
public function translate($amount);
What does this method do?
public function getFormula();
Same thing here..I don't get the purpose.
private function isValidCurrency();
private function format();
Covered by Zend_Currency.
public abstract function getFXRate();
public abstract function getAllRates();
}
?>
Pádraic Brady
http://blog.quantum-star.com----- Original Message ----
From: André Hoffmann < [EMAIL PROTECTED]>
To: Pádraic Brady < [EMAIL PROTECTED]>
Cc: [email protected]
Sent: Thursday, September 21, 2006 4:25:56 PM
Subject: Re: [fw-general] Additional Web Services?
What a coincidence. I already added a proposal for Zend_Service_Currency a few minutes before your mail, but then I didn't have time to start filling it with content. Maybe the both of us could work something out together?On 9/21/06, Pádraic Brady < [EMAIL PROTECTED]> wrote:Hi,
I was considering raising a proposal for adding several additional web services I (at least) will be needing at some point in the future. It would be nice to add them to the Framework if they were acceptable. Suggestions would be:
- Exchange Rates (several sources, incl. UN, ECB and FRB)
- Technorati API
I thought I'd throw these two suggestions out there and see what folk thought about them. If they are deemed worthwhile adding to the Framework I'm willing to put together a proposal for at least one of them.
FYI: these are present in some form (even if only alpha) on PEAR. Haven't used PEAR's Exchange Rates implementation but it seems to cover the main sources in a Beta dated last November.
Thoughts?
Best regards,
Pádraic
Pádraic Brady
http://blog.quantum-star.com
--
best regards,
André Hoffmann
Germany
--
best regards,
André Hoffmann
Germany
--
best regards,
André Hoffmann
Germany
