Merge pull request #5916 from edx/will/ecom-543
Send transaction type for donations and verified certificates
This commit is contained in:
@@ -1246,6 +1246,16 @@ class DonationViewTest(ModuleStoreTestCase):
|
||||
payment_info["payment_params"]["merchant_defined_data1"],
|
||||
unicode(course_id)
|
||||
)
|
||||
self.assertEqual(
|
||||
payment_info["payment_params"]["merchant_defined_data2"],
|
||||
"donation_course"
|
||||
)
|
||||
else:
|
||||
self.assertEqual(payment_info["payment_params"]["merchant_defined_data1"], "")
|
||||
self.assertEqual(
|
||||
payment_info["payment_params"]["merchant_defined_data2"],
|
||||
"donation_general"
|
||||
)
|
||||
|
||||
processor_response_params = PaymentFakeView.response_post_params(payment_info["payment_params"])
|
||||
|
||||
|
||||
@@ -490,6 +490,12 @@ def donate(request):
|
||||
reverse("shoppingcart.views.postpay_callback")
|
||||
)
|
||||
|
||||
# Add extra to make it easier to track transactions
|
||||
extra_data = [
|
||||
unicode(course_id) if course_id else "",
|
||||
"donation_course" if course_id else "donation_general"
|
||||
]
|
||||
|
||||
response_params = json.dumps({
|
||||
# The HTTP end-point for the payment processor.
|
||||
"payment_url": get_purchase_endpoint(),
|
||||
@@ -498,7 +504,7 @@ def donate(request):
|
||||
"payment_params": get_signed_purchase_params(
|
||||
cart,
|
||||
callback_url=callback_url,
|
||||
extra_data=([unicode(course_id)] if course_id else None)
|
||||
extra_data=extra_data
|
||||
),
|
||||
})
|
||||
|
||||
|
||||
@@ -697,8 +697,30 @@ class TestCreateOrder(ModuleStoreTestCase):
|
||||
data = json.loads(response.content)
|
||||
self.assertEqual(data['override_custom_receipt_page'], "http://testserver/shoppingcart/postpay_callback/")
|
||||
|
||||
# Verify that the course ID is included in "merchant-defined data"
|
||||
# Verify that the course ID and transaction type are included in "merchant-defined data"
|
||||
self.assertEqual(data['merchant_defined_data1'], unicode(self.course.id))
|
||||
self.assertEqual(data['merchant_defined_data2'], "verified")
|
||||
|
||||
def test_create_order_already_verified_prof_ed(self):
|
||||
# Verify the student so we don't need to submit photos
|
||||
self._verify_student()
|
||||
|
||||
# Create a prof ed course
|
||||
course = CourseFactory.create()
|
||||
CourseModeFactory(mode_slug="professional", course_id=course.id)
|
||||
|
||||
# Create an order for a prof ed course
|
||||
url = reverse('verify_student_create_order')
|
||||
params = {
|
||||
'course_id': unicode(course.id)
|
||||
}
|
||||
response = self.client.post(url, params)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
# Verify that the course ID and transaction type are included in "merchant-defined data"
|
||||
data = json.loads(response.content)
|
||||
self.assertEqual(data['merchant_defined_data1'], unicode(course.id))
|
||||
self.assertEqual(data['merchant_defined_data2'], "professional")
|
||||
|
||||
def test_create_order_set_donation_amount(self):
|
||||
# Verify the student so we don't need to submit photos
|
||||
|
||||
@@ -238,7 +238,7 @@ def create_order(request):
|
||||
params = get_signed_purchase_params(
|
||||
cart,
|
||||
callback_url=callback_url,
|
||||
extra_data=[unicode(course_id)]
|
||||
extra_data=[unicode(course_id), current_mode.slug]
|
||||
)
|
||||
|
||||
params['success'] = True
|
||||
|
||||
Reference in New Issue
Block a user