Mage_AmazonPayments_Model_Api_Asp_Amount Class Reference

List of all members.

Public Member Functions

 init ($amount)
 setValue ($value)
 setCurrencyCode ($currencyCode)
 getValue ()
 getCurrencyCode ()
 toString ()

Protected Attributes

 $_amountStringTemplate = "/^([A-Z]{3})\s([0-9]{1,}|[0-9]{1,}[.][0-9]{1,})$/"
 $_valueStringTemplate = "/^([0-9]{1,}|[0-9]{1,}[.][0-9]{1,})$/"
 $_currencyCodeStringTemplate = "/^([A-Z]{3})$/"


Detailed Description

Definition at line 34 of file Amount.php.


Member Function Documentation

getCurrencyCode (  ) 

Get amount currency code

Returns:
string

Definition at line 125 of file Amount.php.

00126     {
00127         return $this->_currencyCode;
00128     }

getValue (  ) 

Get amount value

Returns:
string

Definition at line 115 of file Amount.php.

00116     {
00117         return $this->_value;
00118     }

init ( amount  ) 

Init object

Parameters:
string $amount - union amount
Returns:
Mage_AmazonPayments_Model_Api_Asp_Amount

Definition at line 67 of file Amount.php.

00068     {
00069         $tmpArr = array();
00070         if (!preg_match($this->_amountStringTemplate, $amount, $tmpArr)) {
00071             return false;
00072         }
00073         $this->_value = $tmpArr[2];
00074         $this->_currencyCode = $tmpArr[1];
00075         return $this;
00076     }

setCurrencyCode ( currencyCode  ) 

Set amount currency code

Parameters:
string $currencyCode
Returns:
Mage_AmazonPayments_Model_Api_Asp_Amount

Definition at line 100 of file Amount.php.

00101     {
00102         $tmpArr = array();
00103         if (!preg_match($this->_currencyCodeStringTemplate, $currencyCode, $tmpArr)) {
00104             return false;
00105         }
00106         $this->_currencyCode = $tmpArr[1];
00107         return $this;
00108     }

setValue ( value  ) 

Set amount value

Parameters:
string $value
Returns:
Mage_AmazonPayments_Model_Api_Asp_Amount

Definition at line 84 of file Amount.php.

00085     {
00086         $tmpArr = array();
00087         if (!preg_match($this->_valueStringTemplate, $value, $tmpArr)) {
00088             return false;
00089         }
00090         $this->_value = $tmpArr[1];
00091         return $this;
00092     }

toString (  ) 

Return union amount string

Returns:
string

Definition at line 135 of file Amount.php.

00136     {
00137         return $this->getCurrencyCode() . ' ' . $this->getValue();
00138     }


Member Data Documentation

$_amountStringTemplate = "/^([A-Z]{3})\s([0-9]{1,}|[0-9]{1,}[.][0-9]{1,})$/" [protected]

Definition at line 49 of file Amount.php.

$_currencyCodeStringTemplate = "/^([A-Z]{3})$/" [protected]

Definition at line 59 of file Amount.php.

$_valueStringTemplate = "/^([0-9]{1,}|[0-9]{1,}[.][0-9]{1,})$/" [protected]

Definition at line 54 of file Amount.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:31 2009 for Magento by  doxygen 1.5.8