Sanitize Input for Price Variables

- Updated the model to automatically format the price
- Updated the samples to reflect the new changes
- More Unit Tests
This commit is contained in:
japatel
2014-11-03 16:02:23 -06:00
parent 3c02790138
commit d11533110b
19 changed files with 290 additions and 46 deletions

View File

@@ -3,6 +3,8 @@
namespace PayPal\Api;
use PayPal\Common\PPModel;
use PayPal\Common\FormatConverter;
use PayPal\Validation\NumericValidator;
/**
* Class Currency
@@ -42,12 +44,14 @@ class Currency extends PPModel
/**
* amount up to N digit after the decimals separator as defined in ISO 4217 for the appropriate currency code.
*
* @param string $value
* @param string|double $value
*
* @return $this
*/
public function setValue($value)
{
NumericValidator::validate($value, "Value");
$value = FormatConverter::formatToTwoDecimalPlaces($value);
$this->value = $value;
return $this;
}