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

@@ -46,12 +46,12 @@ $item1 = new Item();
$item1->setName('Ground Coffee 40 oz')
->setCurrency('USD')
->setQuantity(1)
->setPrice('7.50');
->setPrice(7.5);
$item2 = new Item();
$item2->setName('Granola bars')
->setCurrency('USD')
->setQuantity(5)
->setPrice('2.00');
->setPrice(2);
$itemList = new ItemList();
$itemList->setItems(array($item1, $item2));
@@ -61,9 +61,9 @@ $itemList->setItems(array($item1, $item2));
// payment information such as tax, shipping
// charges etc.
$details = new Details();
$details->setShipping('1.20')
->setTax('1.30')
->setSubtotal('17.50');
$details->setShipping(1.2)
->setTax(1.3)
->setSubtotal(17.5);
// ### Amount
// Lets you specify a payment amount.
@@ -71,7 +71,7 @@ $details->setShipping('1.20')
// such as shipping, tax.
$amount = new Amount();
$amount->setCurrency("USD")
->setTotal("20.00")
->setTotal(20)
->setDetails($details);
// ### Transaction