Commit 7c3e57b6 by Clinton Blackburn Committed by Clinton Blackburn

Removed unused method from CyberSource payment processor

SOL-2125
parent 18743016
...@@ -194,25 +194,6 @@ class Cybersource(BasePaymentProcessor): ...@@ -194,25 +194,6 @@ class Cybersource(BasePaymentProcessor):
return parameters return parameters
@staticmethod
def get_single_seat(basket):
"""
Return the first product encountered in the basket with the product
class of 'seat'. Return None if no such products were found.
"""
try:
seat_class = ProductClass.objects.get(slug='seat')
except ProductClass.DoesNotExist:
# this occurs in test configurations where the seat product class is not in use
return None
for line in basket.lines.all():
product = line.product
if product.get_product_class() == seat_class:
return product
return None
def handle_processor_response(self, response, basket=None): def handle_processor_response(self, response, basket=None):
""" """
Handle a response (i.e., "merchant notification") from CyberSource. Handle a response (i.e., "merchant notification") from CyberSource.
......
...@@ -13,7 +13,6 @@ from django.test import override_settings ...@@ -13,7 +13,6 @@ from django.test import override_settings
from freezegun import freeze_time from freezegun import freeze_time
from oscar.apps.payment.exceptions import UserCancelled, TransactionDeclined, GatewayError from oscar.apps.payment.exceptions import UserCancelled, TransactionDeclined, GatewayError
from oscar.core.loading import get_model from oscar.core.loading import get_model
from oscar.test import factories
from ecommerce.extensions.payment.exceptions import ( from ecommerce.extensions.payment.exceptions import (
InvalidSignatureError, InvalidCybersourceDecision, PartialAuthorizationError, PCIViolation, InvalidSignatureError, InvalidCybersourceDecision, PartialAuthorizationError, PCIViolation,
...@@ -191,47 +190,6 @@ class CybersourceTests(CybersourceMixin, PaymentProcessorTestCaseMixin, TestCase ...@@ -191,47 +190,6 @@ class CybersourceTests(CybersourceMixin, PaymentProcessorTestCaseMixin, TestCase
self.assertRaises(PartialAuthorizationError, self.processor.handle_processor_response, response, self.assertRaises(PartialAuthorizationError, self.processor.handle_processor_response, response,
basket=self.basket) basket=self.basket)
def test_get_single_seat(self):
"""
The single-seat helper for cybersource reporting should correctly
and return the first 'seat' product encountered in a basket.
"""
get_single_seat = Cybersource.get_single_seat
# finds the seat when it's the only product in the basket.
self.assertEqual(get_single_seat(self.basket), self.product)
# finds the first seat added, when there's more than one.
basket = factories.create_basket(empty=True)
other_seat = factories.ProductFactory(
product_class=self.seat_product_class,
stockrecords__price_currency='USD',
stockrecords__partner__short_code='test',
)
basket.add_product(self.product)
basket.add_product(other_seat)
self.assertEqual(get_single_seat(basket), self.product)
# finds the seat when there's a mixture of product classes.
basket = factories.create_basket(empty=True)
other_product = factories.ProductFactory(
stockrecords__price_currency='USD',
stockrecords__partner__short_code='test2',
)
basket.add_product(other_product)
basket.add_product(self.product)
self.assertEqual(get_single_seat(basket), self.product)
self.assertNotEqual(get_single_seat(basket), other_product)
# returns None when there's no seats.
basket = factories.create_basket(empty=True)
basket.add_product(other_product)
self.assertIsNone(get_single_seat(basket))
# returns None for an empty basket.
basket = factories.create_basket(empty=True)
self.assertIsNone(get_single_seat(basket))
@httpretty.activate @httpretty.activate
def test_issue_credit(self): def test_issue_credit(self):
""" """
......
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