Permalink
Browse files

make submit return full redirect url

  • Loading branch information...
1 parent f4abdc2 commit 05b3baa9d8d638137e4b597e4c4447a4d17ae15a @Akuryou Akuryou committed Dec 6, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 skrill/models.py
View
@@ -171,7 +171,7 @@ def _get_used_custom_fields_as_csv(self):
return ''
def submit(self, force_submit=False):
- """Submit model content to skrill and return session ID on success."""
+ """Submit model content to skrill and return redirect url with session ID on success."""
assert self.prepare_only == True, "Use this only with prepare_only = True"
assert self.pk != None, "Save PaymentRequest before submitting!"
if not force_submit:
@@ -193,12 +193,13 @@ def submit(self, force_submit=False):
req = urllib2.Request(url=API_URL, data=urllib.urlencode(data))
res = urllib2.urlopen(req).read()
+
# Unfortunately Skrill sends HTTP 200 no matter if the request failed or not.
# In case of error they reply with one big html page. So we test if the result is a session id with length 32
if len(res) != 32:
raise Exception(res)
else:
- return res
+ return "%s?sid=%s" % (API_URL, res)
class StatusReport(models.Model):

0 comments on commit 05b3baa

Please sign in to comment.