I'm using this library inside a django project, and trying to make a payment, it seems to be rejected, but I have not info about why. Also the library just raises an error because it cannot parse the response (which is returned by cybersource)
The communication with cybersourse seems to complete, but I can't get the complete reason of the decline.
Here is the complete trace:
2019-02-11 20:00:19,655- Internal Server Error: /api/compras/pago_oportunidad/
Traceback (most recent call last):
File "/home/apps/.virtualenvs/agritrade/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/home/apps/.virtualenvs/agritrade/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/home/apps/.virtualenvs/agritrade/lib/python3.6/site-packages/django/core/handlers/base.py", line 124, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python3.6/contextlib.py", line 52, in inner
return func(*args, **kwds)
File "/home/apps/.virtualenvs/agritrade/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "/home/apps/.virtualenvs/agritrade/lib/python3.6/site-packages/rest_framework/viewsets.py", line 103, in view
return self.dispatch(request, *args, **kwargs)
File "/home/apps/.virtualenvs/agritrade/lib/python3.6/site-packages/rest_framework/views.py", line 483, in dispatch
response = self.handle_exception(exc)
File "/home/apps/.virtualenvs/agritrade/lib/python3.6/site-packages/rest_framework/views.py", line 443, in handle_exception
self.raise_uncaught_exception(exc)
File "/home/apps/.virtualenvs/agritrade/lib/python3.6/site-packages/rest_framework/views.py", line 480, in dispatch
response = handler(request, *args, **kwargs)
File "./datos/viewsets/compra.py", line 394, in pago_oportunidad
capture=True, code="CLIENT-{}".format(str(perfil.pk)))
File "./datos/utils/cybersource/cybersource.py", line 102, in process_a_payment
return_data, status, body = payment_obj.create_payment(message_body)
File "/home/apps/.virtualenvs/agritrade/lib/python3.6/site-packages/CyberSource/apis/payments_api.py", line 68, in create_payment
(data) = self.create_payment_with_http_info(create_payment_request, **kwargs)
File "/home/apps/.virtualenvs/agritrade/lib/python3.6/site-packages/CyberSource/apis/payments_api.py", line 149, in create_payment_with_http_info
collection_formats=collection_formats)
File "/home/apps/.virtualenvs/agritrade/lib/python3.6/site-packages/CyberSource/api_client.py", line 434, in call_api
_return_http_data_only, collection_formats, _preload_content, _request_timeout)
File "/home/apps/.virtualenvs/agritrade/lib/python3.6/site-packages/CyberSource/api_client.py", line 260, in __call_api
return_data = self.deserialize(response_data, response_type)
File "/home/apps/.virtualenvs/agritrade/lib/python3.6/site-packages/CyberSource/api_client.py", line 338, in deserialize
return self.__deserialize(data, response_type)
File "/home/apps/.virtualenvs/agritrade/lib/python3.6/site-packages/CyberSource/api_client.py", line 378, in __deserialize
return self.__deserialize_model(data, klass)
File "/home/apps/.virtualenvs/agritrade/lib/python3.6/site-packages/CyberSource/api_client.py", line 737, in __deserialize_model
kwargs[attr] = self.__deserialize(value, attr_type)
File "/home/apps/.virtualenvs/agritrade/lib/python3.6/site-packages/CyberSource/api_client.py", line 378, in __deserialize
return self.__deserialize_model(data, klass)
File "/home/apps/.virtualenvs/agritrade/lib/python3.6/site-packages/CyberSource/api_client.py", line 739, in __deserialize_model
instance = klass(**kwargs)
File "/home/apps/.virtualenvs/agritrade/lib/python3.6/site-packages/CyberSource/models/pts_v2_payments_post201_response_error_information.py", line 55, in __init__
self.reason = reason
File "/home/apps/.virtualenvs/agritrade/lib/python3.6/site-packages/CyberSource/models/pts_v2_payments_post201_response_error_information.py", line 85, in reason
.format(reason, allowed_values)
ValueError: Invalid value for `reason` (REJECT), must be one of ['AVS_FAILED', 'CONTACT_PROCESSOR', 'CV_FAILED', 'EXPIRED_CARD', 'PROCESSOR_DECLINED', 'INSUFFICIENT_FUND', 'STOLEN_LOST_CARD', 'ISSUER_UNAVAILABLE', 'UNAUTHORIZED_CARD', 'CVN_NOT_MATCH', 'EXCEEDS_CREDIT_LIMIT', 'INVALID_CVN', 'PAYMENT_REFUSED', 'INVALID_ACCOUNT', 'GENERAL_DECLINE']
Also when this happens the credit card does get an Authorization but it seems it doesn't get captured. This is not ideal and can get the site in trouble.
I'm using this library inside a django project, and trying to make a payment, it seems to be rejected, but I have not info about why. Also the library just raises an error because it cannot parse the response (which is returned by cybersource)
The communication with cybersourse seems to complete, but I can't get the complete reason of the decline.
Here is the complete trace:
Also when this happens the credit card does get an Authorization but it seems it doesn't get captured. This is not ideal and can get the site in trouble.