Skip to content

Commit

Permalink
Fixed a python 2 issue with a naming conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
JostCrow committed Sep 6, 2022
1 parent 771fc9b commit 8ed6deb
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 47 deletions.
44 changes: 0 additions & 44 deletions djadyen/notifications/hmac.py

This file was deleted.

2 changes: 1 addition & 1 deletion djadyen/notifications/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from django.views.generic import View

from ..models import AdyenNotification
from .hmac import get_signature
from .signing import get_signature

logger = logging.getLogger("adyen")

Expand Down
24 changes: 23 additions & 1 deletion djadyen/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
from django.http import JsonResponse, HttpResponseRedirect
from django.views.generic.detail import DetailView

from .choices import Status
import Adyen

from djadyen import settings
from djadyen.choices import Status

logger = logging.getLogger("adyen")

Expand Down Expand Up @@ -31,8 +34,27 @@ class AdyenResponseView(DetailView):

def get(self, request, *args, **kwargs):
self.object = self.get_object()

if self.object.get_price_in_cents() == 0:
self.handle_authorised(self.object)

resultRedirect = request.GET.get("redirectResult")
if resultRedirect:
ady = Adyen.Adyen()
# Setting global values
ady.payment.client.platform = settings.DJADYEN_ENVIRONMENT
ady.payment.client.xapikey = settings.DJADYEN_SERVER_KEY
ady.payment.client.app_name = settings.DJADYEN_APPNAME
# Setting request data.
request = {
"details": {
"redirectResult": resultRedirect,
},
}
# Requesting the status.
result = ady.checkout.payments_details(request)
if result.message.get("resultCode") == "Authorised":
self.handle_authorised(self.object)
return super(AdyenResponseView, self).get(request, *args, **kwargs)

def handle_authorised(self, order):
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# see http://setuptools.readthedocs.io/en/latest/setuptools.html#configuring-setup-using-setup-cfg-files
[metadata]
name = djadyen
version = 2.0.4a19
version = 2.0.4a21
description = Django adyen payment integration
long_description = file: README.rst
url = https://github.com/maykinmedia/djadyen
Expand Down

0 comments on commit 8ed6deb

Please sign in to comment.