Merge branch 'ry' of github.com:Gluejar/regluit
commit
ec37368e71
|
@ -215,10 +215,12 @@ def amazonPaymentReturn(request):
|
|||
output = "payment complete"
|
||||
output += request.method + "\n" + str(request.REQUEST.items())
|
||||
|
||||
|
||||
signature = request.GET['signature']
|
||||
status = request.GET['status']
|
||||
reference = request.GET['callerReference']
|
||||
token = request.GET['tokenID']
|
||||
status = request.GET['status']
|
||||
|
||||
|
||||
# BUGUBG - Should we verify the signature here?
|
||||
#
|
||||
|
@ -318,11 +320,24 @@ def amazonPaymentReturn(request):
|
|||
logging.error("Amazon co-branded return-url FAILED with exception:")
|
||||
traceback.print_exc()
|
||||
|
||||
cancel_path = "{0}?{1}".format(reverse('pledge_cancel'),
|
||||
urllib.urlencode({'tid':transaction.id}))
|
||||
cancel_url = urlparse.urljoin(settings.BASE_URL, cancel_path)
|
||||
|
||||
return HttpResponseRedirect(cancel_url)
|
||||
# BUGBUG: check to see whether status is AMAZON_STATUS_ADBANDONED
|
||||
# if so, ultimately figure out the campaign whose transaction is being canceled out.
|
||||
# for the moment, return the user to BASE_URL
|
||||
|
||||
if request.REQUEST.get("status") == AMAZON_STATUS_ADBANDONED:
|
||||
return HttpResponseRedirect(settings.BASE_URL)
|
||||
|
||||
|
||||
try:
|
||||
cancel_path = "{0}?{1}".format(reverse('pledge_cancel'),
|
||||
urllib.urlencode({'tid':transaction.id}))
|
||||
cancel_url = urlparse.urljoin(settings.BASE_URL, cancel_path)
|
||||
|
||||
return HttpResponseRedirect(cancel_url)
|
||||
except Exception, e:
|
||||
# BUGBUG -- we should find a better place to send user...but back to front page is ok for now.
|
||||
logging.error("Amazon co-branded return-url FAILED with exception: {0}".format(e))
|
||||
return HttpResponseRedirect(settings.BASE_URL)
|
||||
|
||||
|
||||
class AmazonRequest:
|
||||
|
|
|
@ -126,6 +126,8 @@ def paySandbox(test, selenium, url, authorize=False, already_at_url=False, sleep
|
|||
print "Tranasction Complete"
|
||||
|
||||
def payAmazonSandbox(sel):
|
||||
|
||||
# login to Amazon payments
|
||||
login_email = WebDriverWait(sel,20).until(lambda d: d.find_element_by_css_selector("input#ap_email"))
|
||||
login_email.click()
|
||||
login_email.clear()
|
||||
|
@ -145,6 +147,8 @@ def payAmazonSandbox(sel):
|
|||
|
||||
print "looking for payment_confirm", sel.current_url
|
||||
payment_confirm = WebDriverWait(sel,20).until(lambda d: d.find_elements_by_css_selector("input[type='image']"))
|
||||
print "payment_confirm ", payment_confirm
|
||||
print "len(payment_confirm)", len(payment_confirm)
|
||||
time.sleep(1)
|
||||
payment_confirm[-1].click()
|
||||
|
||||
|
|
|
@ -228,14 +228,13 @@ def support_campaign(unglue_it_url = settings.LIVE_SERVER_TEST_URL, do_local=Tru
|
|||
premium_button = WebDriverWait(sel,20).until(lambda d: d.find_element_by_css_selector('input[type="radio"][value="1"]'))
|
||||
premium_button.click()
|
||||
|
||||
print "making $10 pledge"
|
||||
|
||||
# now we have to replace the current preapproval amount with 10
|
||||
sel.execute_script("""document.getElementById("id_preapproval_amount").value="10";""")
|
||||
|
||||
## enter a $10 pledge -- entering the pledge after clicking on premium is needed because clicking on premium fills in pledge amount
|
||||
#preapproval_amount_input = WebDriverWait(sel,20).until(lambda d: d.find_element_by_css_selector("input#id_preapproval_amount"))
|
||||
#preapproval_amount_input.send_keys("10")
|
||||
|
||||
print "making $10 pledge"
|
||||
# must also pick a premium level -- otherwise there will not be a pledge_button -- let's pick the first premium ($1)
|
||||
premium_button = WebDriverWait(sel,20).until(lambda d: d.find_element_by_css_selector('input[type="radio"][value="1"]'))
|
||||
premium_button.click()
|
||||
|
||||
pledge_button = WebDriverWait(sel,20).until(lambda d: d.find_element_by_css_selector("input[value*='Pledge']"))
|
||||
pledge_button.click()
|
||||
|
@ -246,7 +245,9 @@ def support_campaign(unglue_it_url = settings.LIVE_SERVER_TEST_URL, do_local=Tru
|
|||
print "Now trying to pay PayPal", sel.current_url
|
||||
paySandbox(None, sel, sel.current_url, authorize=True, already_at_url=True, sleep_time=5)
|
||||
elif backend == 'amazon':
|
||||
print "before payAmazonSandbox"
|
||||
payAmazonSandbox(sel)
|
||||
print "after payAmazonSandbox"
|
||||
|
||||
|
||||
# should be back on a pledge complete page
|
||||
|
|
Loading…
Reference in New Issue