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