add parameterization of cybersource creds

This commit is contained in:
Jason Bau
2013-08-07 23:29:33 -07:00
committed by Diana Huang
parent 4d81383e0a
commit ea7cf3a24e
4 changed files with 39 additions and 23 deletions

View File

@@ -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):
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

View File

@@ -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"]

View File

@@ -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,

View File

@@ -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> </tbody>
</table> </table>
<form action="https://orderpagetest.ic3.com/hop/orderform.jsp" method="post">
% for pk, pv in params.iteritems():
<input type="hidden" name="${pk}" value="${pv}" />
% endfor
<input type="submit" value="Check Out" />
</form>
% else:
<p>You have selected no items for purchase.</p>
% endif
<form action="https://orderpagetest.ic3.com/hop/orderform.jsp" method="post">
% for pk, pv in params.iteritems():
<input type="hidden" name="${pk}" value="${pv}" />
% endfor
<input type="submit" value="Check Out" />
</form>
</section> </section>