diff --git a/app/views.py b/app/views.py index fbf2e7182abb34363b828bb7a32c8e4759ac6f34..6bdfe9dbc050ea09cbdbc5a918c7354aee9dffbf 100644 --- a/app/views.py +++ b/app/views.py @@ -70,7 +70,7 @@ class Verify(APIView): Ejemplo: { "file_hash": "1957db7fe23e4be1740ddeb941ddda7ae0a6b782e536a9e00b5aa82db1e84547", - "ots": "NzNkYzA5OGJkODlmZjdlMjc4OGFjMzJlNmU2ODdiOTdmODdiMTBjMWIyNzg5OTFlMDNkN2E2YWVkMDk3ODJkZTAxLTB4NGM2ZmNiNDBhMmUyZGVjYzc2YWQzMjM3MDU2NzZjMjljYWE1MmIyYjZkMDdiMDIzYjBhY2EzOWYzZGIxYmRlZg==" + "rd": "NzNkYzA5OGJkODlmZjdlMjc4OGFjMzJlNmU2ODdiOTdmODdiMTBjMWIyNzg5OTFlMDNkN2E2YWVkMDk3ODJkZTAxLTB4NGM2ZmNiNDBhMmUyZGVjYzc2YWQzMjM3MDU2NzZjMjljYWE1MmIyYjZkMDdiMDIzYjBhY2EzOWYzZGIxYmRlZg==" } """ @@ -87,6 +87,8 @@ class Verify(APIView): def post(self, request): try: + + if not request.data.get('file_hash'): raise ValidationError('file_hash') @@ -120,7 +122,8 @@ class Verify(APIView): return Response({_('status'): _('success'), _('permanent_ots'): base64.b64encode(permanent_ots.encode('utf-8')).decode('utf-8'), _('messages'): _('file_uploaded') % ( - file_hash, str(block.number), str(Utils.datetime_from_timestamp(block.timestamp)))}, + file_hash, str(block.number), str(Utils.datetime_from_timestamp(block.timestamp))), + _('attestation_time'): str(Utils.datetime_from_timestamp(block.timestamp))}, status=status.HTTP_200_OK) else: return Response({_('status'): _('failure'), _('messages'): _('file_not_found')}, @@ -140,7 +143,7 @@ class Verify(APIView): permanent_ots = PERMANENT_OTS_PREFIX + '-' + original_file_hash + '-' + ots_hash + '-' + tx_hash + '-' + str(block_number) - return Response({_('status'): _('success'), _('permanent_ots'): base64.b64encode(permanent_ots.encode('utf-8')).decode('utf-8') ,_('messages'): _('file_uploaded') % (original_file_hash, str(block.number), str(Utils.datetime_from_timestamp(block.timestamp)))},status=status.HTTP_200_OK) + return Response({_('status'): _('success'), _('permanent_ots'): base64.b64encode(permanent_ots.encode('utf-8')).decode('utf-8') , _('attestation_time'): str(Utils.datetime_from_timestamp(block.timestamp)),_('messages'): _('file_uploaded') % (original_file_hash, str(block.number), str(Utils.datetime_from_timestamp(block.timestamp)))},status=status.HTTP_200_OK) else: try: transaction = TimestampManager.get_transaction(tx_hash) diff --git a/locale/en/LC_MESSAGES/django.po b/locale/en/LC_MESSAGES/django.po index c9b053c32f0b8094ab75adb0618beb5854409d0c..47746a24b9ed96dd92e9a614aad9b8c8d0d1cd1c 100644 --- a/locale/en/LC_MESSAGES/django.po +++ b/locale/en/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-09-11 17:30-0300\n" +"POT-Creation-Date: 2018-09-20 11:13-0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -22,12 +22,12 @@ msgid "Spanish" msgstr "" #: app/views.py:47 app/views.py:50 app/views.py:52 app/views.py:55 -#: app/views.py:120 app/views.py:126 app/views.py:143 app/views.py:148 -#: app/views.py:152 app/views.py:155 app/views.py:157 app/views.py:160 +#: app/views.py:122 app/views.py:128 app/views.py:145 app/views.py:150 +#: app/views.py:154 app/views.py:157 app/views.py:159 app/views.py:162 msgid "status" msgstr "" -#: app/views.py:47 app/views.py:120 app/views.py:143 +#: app/views.py:47 app/views.py:122 app/views.py:145 msgid "success" msgstr "" @@ -35,45 +35,49 @@ msgstr "" msgid "temporary_ots" msgstr "" -#: app/views.py:50 app/views.py:52 app/views.py:55 app/views.py:126 -#: app/views.py:152 app/views.py:155 app/views.py:157 app/views.py:160 +#: app/views.py:50 app/views.py:52 app/views.py:55 app/views.py:128 +#: app/views.py:154 app/views.py:157 app/views.py:159 app/views.py:162 msgid "failure" msgstr "" -#: app/views.py:50 app/views.py:52 app/views.py:55 app/views.py:122 -#: app/views.py:126 app/views.py:143 app/views.py:148 app/views.py:152 -#: app/views.py:155 app/views.py:157 app/views.py:160 +#: app/views.py:50 app/views.py:52 app/views.py:55 app/views.py:124 +#: app/views.py:128 app/views.py:145 app/views.py:150 app/views.py:154 +#: app/views.py:157 app/views.py:159 app/views.py:162 msgid "messages" msgstr "" -#: app/views.py:50 app/views.py:155 +#: app/views.py:50 app/views.py:157 msgid "parameter_missing" msgstr "" -#: app/views.py:52 app/views.py:157 +#: app/views.py:52 app/views.py:159 msgid "could_not_connect" msgstr "" -#: app/views.py:55 app/views.py:160 +#: app/views.py:55 app/views.py:162 msgid "operation_failed" msgstr "" -#: app/views.py:121 app/views.py:143 +#: app/views.py:123 app/views.py:145 msgid "permanent_ots" msgstr "" -#: app/views.py:122 app/views.py:143 +#: app/views.py:124 app/views.py:145 msgid "file_uploaded" msgstr "" -#: app/views.py:126 app/views.py:152 +#: app/views.py:128 app/views.py:154 msgid "file_not_found" msgstr "" -#: app/views.py:148 +#: app/views.py:145 +msgid "attestation_time" +msgstr "" + +#: app/views.py:150 msgid "pending" msgstr "" -#: app/views.py:148 +#: app/views.py:150 msgid "transaction_pending" msgstr "" diff --git a/locale/es/LC_MESSAGES/django.po b/locale/es/LC_MESSAGES/django.po index 5de55e6ec290caacc941afcc5e0797018dd9ab1c..6ee02237e562b3caf48085dae8e381dab8e48a33 100644 --- a/locale/es/LC_MESSAGES/django.po +++ b/locale/es/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-09-11 17:30-0300\n" +"POT-Creation-Date: 2018-09-20 11:13-0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -23,12 +23,12 @@ msgid "Spanish" msgstr "" #: app/views.py:47 app/views.py:50 app/views.py:52 app/views.py:55 -#: app/views.py:120 app/views.py:126 app/views.py:143 app/views.py:148 -#: app/views.py:152 app/views.py:155 app/views.py:157 app/views.py:160 +#: app/views.py:122 app/views.py:128 app/views.py:145 app/views.py:150 +#: app/views.py:154 app/views.py:157 app/views.py:159 app/views.py:162 msgid "status" msgstr "status" -#: app/views.py:47 app/views.py:120 app/views.py:143 +#: app/views.py:47 app/views.py:122 app/views.py:145 msgid "success" msgstr "success" @@ -36,46 +36,50 @@ msgstr "success" msgid "temporary_ots" msgstr "temporary_rd" -#: app/views.py:50 app/views.py:52 app/views.py:55 app/views.py:126 -#: app/views.py:152 app/views.py:155 app/views.py:157 app/views.py:160 +#: app/views.py:50 app/views.py:52 app/views.py:55 app/views.py:128 +#: app/views.py:154 app/views.py:157 app/views.py:159 app/views.py:162 msgid "failure" msgstr "failure" -#: app/views.py:50 app/views.py:52 app/views.py:55 app/views.py:122 -#: app/views.py:126 app/views.py:143 app/views.py:148 app/views.py:152 -#: app/views.py:155 app/views.py:157 app/views.py:160 +#: app/views.py:50 app/views.py:52 app/views.py:55 app/views.py:124 +#: app/views.py:128 app/views.py:145 app/views.py:150 app/views.py:154 +#: app/views.py:157 app/views.py:159 app/views.py:162 msgid "messages" msgstr "messages" -#: app/views.py:50 app/views.py:155 +#: app/views.py:50 app/views.py:157 msgid "parameter_missing" msgstr "Parámetro faltante: %s" -#: app/views.py:52 app/views.py:157 +#: app/views.py:52 app/views.py:159 msgid "could_not_connect" msgstr "No se pudo conectar a la Blockchain" -#: app/views.py:55 app/views.py:160 +#: app/views.py:55 app/views.py:162 msgid "operation_failed" msgstr "No se pudo realizar la operación" -#: app/views.py:121 app/views.py:143 +#: app/views.py:123 app/views.py:145 msgid "permanent_ots" msgstr "permanent_rd" -#: app/views.py:122 app/views.py:143 +#: app/views.py:124 app/views.py:145 msgid "file_uploaded" msgstr "El archivo %s fue ingresado en el bloque %s el %s" -#: app/views.py:126 app/views.py:152 +#: app/views.py:128 app/views.py:154 msgid "file_not_found" msgstr "No se encontró el archivo" -#: app/views.py:148 +#: app/views.py:145 +msgid "attestation_time" +msgstr "Attestation Time" + +#: app/views.py:150 msgid "pending" msgstr "pending" -#: app/views.py:148 +#: app/views.py:150 msgid "transaction_pending" msgstr "La transacción se encuentra pendiente de subida a la Blockchain"