File tree 2 files changed +1
-33
lines changed
src/Omnipay/Common/Message
tests/Omnipay/Common/Message
2 files changed +1
-33
lines changed Original file line number Diff line number Diff line change @@ -301,7 +301,7 @@ public function toFloat($value)
301
301
}
302
302
303
303
/**
304
- * Validates and returns the formated amount.
304
+ * Validates and returns the formatted amount.
305
305
*
306
306
* @throws InvalidRequestException on any validation failure.
307
307
* @return string The amount formatted to the correct number of decimal places for the selected currency.
@@ -311,17 +311,6 @@ public function getAmount()
311
311
$ amount = $ this ->getParameter ('amount ' );
312
312
313
313
if ($ amount !== null ) {
314
- // Don't allow integers for currencies that support decimals.
315
- // This is for legacy reasons - upgrades from v0.9
316
- if ($ this ->getCurrencyDecimalPlaces () > 0 ) {
317
- if (is_int ($ amount ) || (is_string ($ amount ) && false === strpos ((string ) $ amount , '. ' ))) {
318
- throw new InvalidRequestException (
319
- 'Please specify amount as a string or float, '
320
- . 'with decimal places (e.g. \'10.00 \' to represent $10.00). '
321
- );
322
- };
323
- }
324
-
325
314
$ amount = $ this ->toFloat ($ amount );
326
315
327
316
// Check for a negative amount.
Original file line number Diff line number Diff line change @@ -179,27 +179,6 @@ public function testGetAmountNoDecimalsRounding()
179
179
$ this ->request ->getAmount ();
180
180
}
181
181
182
- /**
183
- * @expectedException Omnipay\Common\Exception\InvalidRequestException
184
- */
185
- public function testAmountWithIntThrowsException ()
186
- {
187
- // ambiguous value, avoid errors upgrading from v0.9
188
- $ this ->assertSame ($ this ->request , $ this ->request ->setAmount (10 ));
189
- $ this ->request ->getAmount ();
190
- }
191
-
192
- /**
193
- * @expectedException Omnipay\Common\Exception\InvalidRequestException
194
- */
195
- public function testAmountWithIntStringThrowsException ()
196
- {
197
- // ambiguous value, avoid errors upgrading from v0.9
198
- // Some currencies only take integers, so an integer (in a string) should be valid.
199
- $ this ->assertSame ($ this ->request , $ this ->request ->setAmount ('10 ' ));
200
- $ this ->request ->getAmount ();
201
- }
202
-
203
182
public function testGetAmountInteger ()
204
183
{
205
184
$ this ->assertSame ($ this ->request , $ this ->request ->setAmount ('13.66 ' ));
You can’t perform that action at this time.
0 commit comments