Commit ea7cf3a2 by Jason Bau Committed by Diana Huang

add parameterization of cybersource creds

parent 4d81383e
...@@ -5,6 +5,7 @@ import hmac ...@@ -5,6 +5,7 @@ import hmac
import binascii import binascii
from hashlib import sha1 from hashlib import sha1
from django.conf import settings
from collections import OrderedDict from collections import OrderedDict
from django.http import HttpResponse from django.http import HttpResponse
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
...@@ -71,10 +72,10 @@ def cybersource_sign(params): ...@@ -71,10 +72,10 @@ def cybersource_sign(params):
params needs to be an ordered dict, b/c cybersource documentation states that order is important. params needs to be an ordered dict, b/c cybersource documentation states that order is important.
Reverse engineered from PHP version provided by cybersource Reverse engineered from PHP version provided by cybersource
""" """
shared_secret = "ELIDED" shared_secret = settings.CYBERSOURCE.get('SHARED_SECRET','')
merchant_id = "ELIDED" merchant_id = settings.CYBERSOURCE.get('MERCHANT_ID','')
serial_number = "ELIDED" serial_number = settings.CYBERSOURCE.get('SERIAL_NUMBER','')
orderPage_version = "7" orderPage_version = settings.CYBERSOURCE.get('ORDERPAGE_VERSION','7')
params['merchantID'] = merchant_id params['merchantID'] = merchant_id
params['orderPage_timestamp'] = int(time.time()*1000) params['orderPage_timestamp'] = int(time.time()*1000)
params['orderPage_version'] = orderPage_version params['orderPage_version'] = orderPage_version
......
...@@ -191,6 +191,8 @@ if SEGMENT_IO_LMS_KEY: ...@@ -191,6 +191,8 @@ if SEGMENT_IO_LMS_KEY:
MITX_FEATURES['SEGMENT_IO_LMS'] = ENV_TOKENS.get('SEGMENT_IO_LMS', False) MITX_FEATURES['SEGMENT_IO_LMS'] = ENV_TOKENS.get('SEGMENT_IO_LMS', False)
CYBERSOURCE = AUTH_TOKENS.get('CYBERSOURCE', CYBERSOURCE)
SECRET_KEY = AUTH_TOKENS['SECRET_KEY'] SECRET_KEY = AUTH_TOKENS['SECRET_KEY']
AWS_ACCESS_KEY_ID = AUTH_TOKENS["AWS_ACCESS_KEY_ID"] AWS_ACCESS_KEY_ID = AUTH_TOKENS["AWS_ACCESS_KEY_ID"]
......
...@@ -431,6 +431,14 @@ ZENDESK_URL = None ...@@ -431,6 +431,14 @@ ZENDESK_URL = None
ZENDESK_USER = None ZENDESK_USER = None
ZENDESK_API_KEY = None ZENDESK_API_KEY = None
##### CyberSource Payment parameters #####
CYBERSOURCE = {
'SHARED_SECRET': '',
'MERCHANT_ID' : '',
'SERIAL_NUMBER' : '',
'ORDERPAGE_VERSION': '7',
}
################################# open ended grading config ##################### ################################# open ended grading config #####################
#By setting up the default settings with an incorrect user name and password, #By setting up the default settings with an incorrect user name and password,
......
...@@ -7,27 +7,32 @@ ...@@ -7,27 +7,32 @@
<%block name="title"><title>${_("Your Shopping Cart")}</title></%block> <%block name="title"><title>${_("Your Shopping Cart")}</title></%block>
<section class="container cart-list"> <section class="container cart-list">
<table> % if shoppingcart_items:
<thead> <table>
<tr><td>Qty</td><td>Description</td><td>Unit Price</td><td>Price</td></tr> <thead>
</thead> <tr><td>Qty</td><td>Description</td><td>Unit Price</td><td>Price</td></tr>
<tbody> </thead>
% for idx,item in enumerate(shoppingcart_items): <tbody>
<tr><td>${item.qty}</td><td>${item.line_desc}</td><td>${item.unit_cost}</td><td>${item.line_cost}</td> % for idx,item in enumerate(shoppingcart_items):
<td><a data-item-idx="${idx}" class='remove_line_item' href='#'>[x]</a></td></tr> <tr><td>${item.qty}</td><td>${item.line_desc}</td><td>${item.unit_cost}</td><td>${item.line_cost}</td>
% endfor <td><a data-item-idx="${idx}" class='remove_line_item' href='#'>[x]</a></td></tr>
<tr><td></td><td></td><td></td><td>Total Cost</td></tr> % endfor
<tr><td></td><td></td><td></td><td>${total_cost}</td></tr> <tr><td></td><td></td><td></td><td>Total Cost</td></tr>
<tr><td></td><td></td><td></td><td>${total_cost}</td></tr>
</tbody>
</table> </tbody>
</table>
<form action="https://orderpagetest.ic3.com/hop/orderform.jsp" method="post">
% for pk, pv in params.iteritems(): <form action="https://orderpagetest.ic3.com/hop/orderform.jsp" method="post">
<input type="hidden" name="${pk}" value="${pv}" /> % for pk, pv in params.iteritems():
% endfor <input type="hidden" name="${pk}" value="${pv}" />
<input type="submit" value="Check Out" /> % endfor
</form> <input type="submit" value="Check Out" />
</form>
% else:
<p>You have selected no items for purchase.</p>
% endif
</section> </section>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment