diff --git a/django_sofortueberweisung/admin.py b/django_sofortueberweisung/admin.py index 17bc159..d101769 100644 --- a/django_sofortueberweisung/admin.py +++ b/django_sofortueberweisung/admin.py @@ -8,5 +8,6 @@ class SofortTransactionAdmin(admin.ModelAdmin): list_filter = ('status', 'status_reason') ordering = ('-created_at',) fields = ('transaction_id', 'created_at', 'last_modified', 'status', 'status_reason') + readonly_fields = ['created_at', 'last_modified'] admin.site.register(SofortTransaction, SofortTransactionAdmin) diff --git a/tests/tests.py b/tests/tests.py index 839dc6a..1d3df62 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -3,19 +3,18 @@ from __future__ import unicode_literals -import os, sys import re -import xmltodict -from requests import Response -from testfixtures import replace +import sys +import xmltodict from django.conf.urls import include, url from django.test import Client, TestCase +from requests import Response +from testfixtures import replace from django_sofortueberweisung import settings as django_sofortueberweisung_settings from django_sofortueberweisung.models import SofortTransaction -from django_sofortueberweisung.wrappers import SofortWrapper, DjangoSofortError - +from django_sofortueberweisung.wrappers import SofortWrapper from .test_response_mockups import TEST_RESPONSES try: @@ -153,34 +152,8 @@ def test_known_transaction_refund_error(self): self.assertGreaterEqual(refund.errors.count(), 1) self.assertTrue(refund.errors.filter(error_code='5003')) - def _create_test_transaction(self, transaction_id): return SofortTransaction.objects.create( transaction_id=transaction_id, payment_url='https://www.sofort.com/payment/go/'+transaction_id ) - - -class TestSofortTransactions(TestCase): - auth = { - 'PROJECT_ID': '299010', - 'USER': '135335', - 'API_KEY': 'aeb2075b1455a8ce874749e973e61cca', - } - cafile = os.path.join(os.path.abspath(os.path.join(os.path.abspath(os.path.dirname(os.path.dirname(__file__))), 'django_sofortueberweisung')), 'cacert.pem') - - def test_valid_transaction(self): - sofort_wrapper = SofortWrapper(auth=self.auth) - sofort_transaction = sofort_wrapper.init( - amount=1.0, - email_customer='tech@particulate.me', - phone_customer=None, - user_variables=None, - sender='Test', - reasons=['Just a test.'], - currency_code='EUR' - ) - self.assertEqual(sofort_transaction.status, '') - # TODO: let the transaction be accepted by sofort.com - # TODO: let the transaction be refunded by sofort.com - self.assertFalse(sofort_transaction.refresh_from_sofort(sofort_wrapper=sofort_wrapper))