def ogone_notify_handler(self, request): response = Ogone(request=request, settings=self.settings) if response.is_valid(): fpath = request.get_full_path() query_string = fpath.split("?", 1)[1] transaction_feedback = query_string.split('&') result = {} for item in transaction_feedback: k, v = item.split("=") result[k] = v # Default transaction feedback parameters status = result.get('STATUS', False) orderid = result.get('orderID', '') payid = result.get('PAYID', '') ncerror = result.get('NCERROR', '') amount = result.get('amount', '') currency = result.get('currency', '') if status and get_status_category(int(status)) == SUCCESS_STATUS: ogone_payment_accepted.send(sender=self, order_id=orderid, \ amount=amount, currency=currency, pay_id=payid, status=status, ncerror=ncerror) return self.ogone_success_handler( request, response=result, description=get_status_description(int(status))) if status and get_status_category(int(status)) == CANCEL_STATUS: ogone_payment_cancelled.send(sender=self, order_id=orderid, \ amount=amount, currency=currency, pay_id=payid, status=status, ncerror=ncerror) return self.ogone_cancel_handler( request, response=result, description=get_status_description(int(status))) if status and get_status_category( int(status)) == DECLINE_STATUS or EXCEPTION_STATUS: ogone_payment_failed.send(sender=self, order_id=orderid, \ amount=amount, currency=currency, pay_id=payid, status=status, ncerror=ncerror) return self.ogone_failure_handler( request, response=result, description=get_status_description(int(status))) else: return HttpResponse('signature validation failed!')
def ogone_notify_handler(self, request): response = Ogone(request=request, settings=self.settings) if response.is_valid(): fpath = request.get_full_path() query_string = fpath.split("?", 1)[1] transaction_feedback = query_string.split('&') result = {} for item in transaction_feedback: k, v = item.split("=") result[k] = v # Default transaction feedback parameters status = result.get('STATUS', False) orderid = result.get('orderID', '') payid = result.get('PAYID', '') ncerror = result.get('NCERROR', '') amount = result.get('amount', '') currency = result.get('currency', '') if status and get_status_category(int(status)) == SUCCESS_STATUS: ogone_payment_accepted.send(sender=self, order_id=orderid, \ amount=amount, currency=currency, pay_id=payid, status=status, ncerror=ncerror) return self.ogone_success_handler(request, response=result, description=get_status_description(int(status))) if status and get_status_category(int(status)) == CANCEL_STATUS: ogone_payment_cancelled.send(sender=self, order_id=orderid, \ amount=amount, currency=currency, pay_id=payid, status=status, ncerror=ncerror) return self.ogone_cancel_handler(request, response=result, description=get_status_description(int(status))) if status and get_status_category(int(status)) == DECLINE_STATUS or EXCEPTION_STATUS: ogone_payment_failed.send(sender=self, order_id=orderid, \ amount=amount, currency=currency, pay_id=payid, status=status, ncerror=ncerror) return self.ogone_failure_handler(request, response=result, description=get_status_description(int(status))) else: return HttpResponse('signature validation failed!')
def get_status_category(self): return status_codes.get_status_category(self.get_status())