Skip to content

Commit

Permalink
Revert "Notification messages (#72)"
Browse files Browse the repository at this point in the history
This reverts commit 8c2ea0a.
  • Loading branch information
ricardo8990 committed Jul 24, 2019
1 parent 8c2ea0a commit d401b14
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 27 deletions.
1 change: 0 additions & 1 deletion arcusd/contracts/operationinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ def __init__(self,
self.status = status
self.operation = operation
self.error_message = error_message
self.notification = None
24 changes: 0 additions & 24 deletions arcusd/daemon/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ def execute_op(request_id: str, op_type: OperationType, funct,
op_info.status = OperationStatus.failed
if hasattr(exc, 'message'):
op_info.error_message = exc.message
op_info.notification = error_interpreter(exc)
else:
op_info.error_message = format(exc)
capture_exception(exc)
Expand All @@ -35,26 +34,3 @@ def execute_op(request_id: str, op_type: OperationType, funct,
update_task_info({'request_id': request_id},
{'callback_response': resp})
return op_info


def error_interpreter(error):
switcher = {
'R7': 'Esta cuenta tiene pagos domiciliados activos '
'y no acepta este tipo de pago',
'R18': 'Límite de pagos excedido, intenta más tarde',
'R36': 'Posible pago duplicado'
}
switcher.update(dict.fromkeys(['R5', 'R1', 'R2', 'R4', 'R29'],
'Por favor, verifica el número de cuenta '
'e intenta de nuevo'))
switcher.update(dict.fromkeys(['R3', 'R11', 'R41'],
'Este proveedor no acepta pagos parciales, '
'asegúrate de cubrir el monto en su '
'totalidad'))
switcher.update(dict.fromkeys(['R8', 'R12'],
'El balance en esta cuenta '
'ya ha sido cubierto'))
if hasattr(error, 'code') and error.code in switcher:
return switcher.get(error.code)
else:
return None
2 changes: 1 addition & 1 deletion tests/test_contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ def test_contract_encoder():
'"operation": {"id": 987765, "amount": 1599900, '
'"currency": "MXN", "transaction_fee": 1000, '
'"hours_to_fulfill": 0, "status": "success"}, '
'"error_message": null, "notification": null}')
'"error_message": null}')
1 change: 0 additions & 1 deletion tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ def test_failed_payment(send_op_result):
assert op_info.request_id == request_id
assert op_info.tran_type == OperationType.payment
assert op_info.status == OperationStatus.failed
assert op_info.notification is None


@patch(SEND_OP_RESULT, return_value=dict(status='ok'))
Expand Down

0 comments on commit d401b14

Please sign in to comment.