Skip to content

Commit

Permalink
Adicionando método get_pix_message
Browse files Browse the repository at this point in the history
Signed-off-by: Rodrigo Câmara <rodrigoarenacamara@gmail.com>
  • Loading branch information
roarena committed Jul 6, 2022
1 parent 1db33f1 commit 610caea
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
15 changes: 15 additions & 0 deletions pynubank/nubank.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,3 +302,18 @@ def find_pix_identifier(table_item: dict):
return

return identifier_data['value']

@requires_auth_mode(AuthMode.APP)
def get_pix_message(self, transaction_id: str):
message = ''
response = self._make_graphql_request('pix_receipt_screen', {'type': 'TRANSFER_IN', 'id': transaction_id})
if 'errors' in response.keys():
return

screen_pieces = response['data']['viewer']['savingsAccount']['getGenericReceiptScreen']['screenPieces']

for screen_piece in screen_pieces:
if screen_piece['__typename'] == 'ReceiptMessagePiece':
message = screen_piece['messageContent']

return message
6 changes: 6 additions & 0 deletions pynubank/utils/mocked_responses/pix_receipt_screen.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
}
]
},
{
"__typename": "ReceiptMessagePiece",
"fallbackMessage": "Atualize seu app para ver todas as informações!",
"messageTitle": "Descrição",
"messageContent": "Mensagem enviada via PIX"
},
{
"__typename": "ReceiptTablePiece",
"fallbackMessage": "Atualize seu app para ver todas as informações!",
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def read(fname):

setup(
name='pynubank',
version='2.18.0',
version='2.18.1',
url='https://github.com/andreroggeri/pynubank',
author='André Roggeri Campos',
author_email='a.roggeri.c@gmail.com',
Expand Down

0 comments on commit 610caea

Please sign in to comment.