Repository: dallinger/dallinger
Issue: MTurk API expects bonus amounts to be 2 decimal places

## Traceback from Bill Thompson:
```
Jun 07 11:04:26 dlgr-4df82116 app/worker.1: Traceback (most recent call last): 
Jun 07 11:04:26 dlgr-4df82116 app/worker.1:   File "/app/.heroku/src/dallinger/dallinger/mturk.py", line 495, in grant_bonus 
Jun 07 11:04:26 dlgr-4df82116 app/worker.1:     UniqueRequestToken=self._request_token() 
Jun 07 11:04:26 dlgr-4df82116 app/worker.1:   File "/app/.heroku/python/lib/python3.6/site-packages/botocore/client.py", line 314, in _api_call 
Jun 07 11:04:26 dlgr-4df82116 app/worker.1:     return self._make_api_call(operation_name, kwargs) 
Jun 07 11:04:26 dlgr-4df82116 app/worker.1:   File "/app/.heroku/python/lib/python3.6/site-packages/botocore/client.py", line 612, in _make_api_call 
Jun 07 11:04:26 dlgr-4df82116 app/worker.1:     raise error_class(parsed_response, operation_name) 
Jun 07 11:04:26 dlgr-4df82116 app/worker.1: botocore.exceptions.ClientError: An error occurred (ValidationException) when calling the SendBonus operation: 1 validation error detected: Value '0.9752' at 'bonusAmount' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[0-9]+(\\.)?[0-9]{0,2}$ 
Jun 07 11:04:26 dlgr-4df82116 app/worker.1: During handling of the above exception, another exception occurred: 
Jun 07 11:04:26 dlgr-4df82116 app/worker.1: Traceback (most recent call last): 
Jun 07 11:04:26 dlgr-4df82116 app/worker.1:   File "/app/.heroku/src/dallinger/dallinger/recruiters.py", line 387, in reward_bonus 
Jun 07 11:04:26 dlgr-4df82116 app/worker.1:     return self.mturkservice.grant_bonus(assignment_id, amount, reason) 
Jun 07 11:04:26 dlgr-4df82116 app/worker.1:   File "/app/.heroku/src/dallinger/dallinger/mturk.py", line 503, in grant_bonus 
Jun 07 11:04:26 dlgr-4df82116 app/worker.1:     raise MTurkServiceException(error) 
Jun 07 11:04:26 dlgr-4df82116 app/worker.1: dallinger.mturk.MTurkServiceException: Failed to pay assignment 3JRJSWSMQIETDXZLD6FLQQTNRLGE38 bonus of 0.9752: An error occurred (ValidationException) when calling the SendBonus operation: 1 validation error detected: Value '0.9752' at 'bonusAmount' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[0-9]+(\\.)?[0-9]{0,2}$
```



Changed files:
dallinger/mturk.py, tests/test_mturk.py

diff --git a/dallinger/mturk.py b/dallinger/mturk.py
index e44f922b..ae39e8e0 100644
--- a/dallinger/mturk.py
+++ b/dallinger/mturk.py
@@ -485,11 +485,11 @@ class MTurkService(object):
         """
         assignment = self.get_assignment(assignment_id)
         worker_id = assignment['worker_id']
-
+        amount_str = "{:.2f}".format(amount)
         try:
             return self._is_ok(self.mturk.send_bonus(
                 WorkerId=worker_id,
-                BonusAmount=str(amount),
+                BonusAmount=amount_str,
                 AssignmentId=assignment_id,
                 Reason=reason,
                 UniqueRequestToken=self._request_token()
@@ -497,7 +497,7 @@ class MTurkService(object):
         except ClientError as ex:
             error = "Failed to pay assignment {} bonus of {}: {}".format(
                 assignment_id,
-                amount,
+                amount_str,
                 str(ex)
             )
             raise MTurkServiceException(error)
diff --git a/tests/test_mturk.py b/tests/test_mturk.py
index 4eda8ced..ab5fa9a6 100644
--- a/tests/test_mturk.py
+++ b/tests/test_mturk.py
@@ -981,7 +981,7 @@ class TestMTurkServiceWithFakeConnection(object):
 
         with_mock.grant_bonus(
             assignment_id='some assignment id',
-            amount=2.99,
+            amount=2.9857,
             reason='above and beyond'
         )
 
@@ -1001,7 +1001,7 @@ class TestMTurkServiceWithFakeConnection(object):
         with pytest.raises(MTurkServiceException) as execinfo:
             with_mock.grant_bonus(
                 assignment_id='some assignment id',
-                amount=2.99,
+                amount=2.9857,
                 reason='above and beyond'
             )