Skip to content
Snippets Groups Projects
Commit ea7cf3a2 authored by Jason Bau's avatar Jason Bau Committed by Diana Huang
Browse files

add parameterization of cybersource creds

parent 4d81383e
No related merge requests found
......@@ -5,6 +5,7 @@ import hmac
import binascii
from hashlib import sha1
from django.conf import settings
from collections import OrderedDict
from django.http import HttpResponse
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.
Reverse engineered from PHP version provided by cybersource
"""
shared_secret = "ELIDED"
merchant_id = "ELIDED"
serial_number = "ELIDED"
orderPage_version = "7"
shared_secret = settings.CYBERSOURCE.get('SHARED_SECRET','')
merchant_id = settings.CYBERSOURCE.get('MERCHANT_ID','')
serial_number = settings.CYBERSOURCE.get('SERIAL_NUMBER','')
orderPage_version = settings.CYBERSOURCE.get('ORDERPAGE_VERSION','7')
params['merchantID'] = merchant_id
params['orderPage_timestamp'] = int(time.time()*1000)
params['orderPage_version'] = orderPage_version
......
......@@ -191,6 +191,8 @@ if SEGMENT_IO_LMS_KEY:
MITX_FEATURES['SEGMENT_IO_LMS'] = ENV_TOKENS.get('SEGMENT_IO_LMS', False)
CYBERSOURCE = AUTH_TOKENS.get('CYBERSOURCE', CYBERSOURCE)
SECRET_KEY = AUTH_TOKENS['SECRET_KEY']
AWS_ACCESS_KEY_ID = AUTH_TOKENS["AWS_ACCESS_KEY_ID"]
......
......@@ -431,6 +431,14 @@ ZENDESK_URL = None
ZENDESK_USER = None
ZENDESK_API_KEY = None
##### CyberSource Payment parameters #####
CYBERSOURCE = {
'SHARED_SECRET': '',
'MERCHANT_ID' : '',
'SERIAL_NUMBER' : '',
'ORDERPAGE_VERSION': '7',
}
################################# open ended grading config #####################
#By setting up the default settings with an incorrect user name and password,
......
......@@ -7,27 +7,32 @@
<%block name="title"><title>${_("Your Shopping Cart")}</title></%block>
<section class="container cart-list">
<table>
<thead>
<tr><td>Qty</td><td>Description</td><td>Unit Price</td><td>Price</td></tr>
</thead>
<tbody>
% for idx,item in enumerate(shoppingcart_items):
<tr><td>${item.qty}</td><td>${item.line_desc}</td><td>${item.unit_cost}</td><td>${item.line_cost}</td>
<td><a data-item-idx="${idx}" class='remove_line_item' href='#'>[x]</a></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>
</tbody>
</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>
% if shoppingcart_items:
<table>
<thead>
<tr><td>Qty</td><td>Description</td><td>Unit Price</td><td>Price</td></tr>
</thead>
<tbody>
% for idx,item in enumerate(shoppingcart_items):
<tr><td>${item.qty}</td><td>${item.line_desc}</td><td>${item.unit_cost}</td><td>${item.line_cost}</td>
<td><a data-item-idx="${idx}" class='remove_line_item' href='#'>[x]</a></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>
</tbody>
</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
</section>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment