diff --git a/src/asaaspy/client/resources/pix.py b/src/asaaspy/client/resources/pix.py index 088fd49..4928f57 100644 --- a/src/asaaspy/client/resources/pix.py +++ b/src/asaaspy/client/resources/pix.py @@ -35,7 +35,9 @@ def create_qrcode(self, qrcode: StaticQRCodeSchema) -> StaticQRCodeViewSchema: ) return StaticQRCodeViewSchema(**response) - def delete_qrcode(self, id): ... # noqa E704 + def delete_qrcode(self, id) -> bool: + response = self.call("DELETE", f"v3/pix/qrCodes/static/{id}") + return response.get("deleted", False) # Transacoes PIX def pay_qrcode(self, id): ... # noqa E704 diff --git a/tests/asaas_sandbox_vcr.yml b/tests/asaas_sandbox_vcr.yml index cb16bf3..2e7c707 100644 --- a/tests/asaas_sandbox_vcr.yml +++ b/tests/asaas_sandbox_vcr.yml @@ -2882,6 +2882,81 @@ "string": "{\"id\":\"PRELUDIA00000000525658ASA\",\"encodedImage\":\"iVBORw0KGgoAAAANSUhEUgAAAcIAAAHCAQAAAABUY/ToAAADEUlEQVR4Xu2VTW7rMBCDs9P9b9RjeZeGf3JSoPBDN28McOIoIw4/ZiGlfTz/WF+Pn8q/VsmrKnlVJa+q5FWVvKr/Rh4P1jpez3oeXCRB87qemFgtOZpEh1WD9eHgxiNkxl9yMIkh9m8mZy1ej7cufMmbkPDRKz1RNJS8FSkY3HkhsFfcx3eUnEw+swLZjsQolLGns+RcEmfOE7582Vny19cAMuUDx9invk//QLBuiavkWBK/X9yDsLwT5+3wFgamaC05mCTqDLoYIHWnKIffUHIyqaJL5EqGbOLx+FvQlBxLQtVQhqDyQhTEK5G4kmPJaLBzFchDt9MXgHPllZxLQgGiNglJwwDU1kvOJtXq0OWli3eAQrJ1KTgtOZfUgEcsA3uFcIcpBT8lR5N7AJYMckghSyt5LRiWHEzSDw8cdJJTqFRG728oOZkEpwFG/FBzpqHXNyS55FiSO9s4h3chzjyjbZKj5GiSQ6yeJ4Ov3W9PydGkMZp4CchTIClVv29YAJacS6LljE62W1EqaCtRS44lOcMEJHGlUNlWuKyUnE2aPXIL4nFI4CSXvAPJCR1qpGD0gHvTAkoOJqVrZKe95wWJlPSSs0lCcKk4F7Ww88/9vC0l55KYaogDD3j48ZVgDpNoKTmWlFn4y5FVEGgpiKFOd8mxJLwrTnrhYRA5GtjGUXIyyfPNhER6EAplSxnbksNJee2BQkQfQneELSXnkvQsNMLpMS+cazLxWXIwCbNP2jvM0dDErSWHlxxOQsyAD4nsEIoFXjclx5KoTM9aQgXyDQMgVsmxpI9evnz4zI3wqvDKaFtyMAkFAJXs5GSidCUmqeRkMhSNe2xc+70DX3IyKZB2P3LSFDZCyfFkSuOlnzIadAnUjjjGJeeS2Fn4MOC/rdgM3/50l5xLosvqQ5c5LBErsJScTb5kD/WJkXe+EMCklLwN+eNFK3PMABJX8gbk0z9iC+zltT2WksNJycc+bxm31z3HWKGUnEtCkgjuZX7gjR1uAe+DN3qXHE3+qUpeVcmrKnlVJa+q5FXdjPwG0zZatu9LEUUAAAAASUVORK5CYII=\",\"payload\":\"00020126580014br.gov.bcb.pix0136e3326671-e7d7-40bc-b54d-d8303f8140e85204000053039865802BR5914Preludian Tech6009Guarulhos62290525PRELUDIA00000000525658ASA630427C9\",\"allowsMultiplePayments\":true,\"expirationDate\":null,\"externalReference\":null}" } } + }, + { + "request": { + "method": "DELETE", + "uri": "https://sandbox.asaas.com/api/v3/pix/qrCodes/static/PRELUDIA00000000525658ASA", + "body": "", + "headers": { + "host": [ + "sandbox.asaas.com" + ], + "accept": [ + "*/*" + ], + "accept-encoding": [ + "gzip, deflate" + ], + "connection": [ + "keep-alive" + ], + "content-type": [ + "application/json" + ], + "user-agent": [ + "AsaasPy" + ] + } + }, + "response": { + "status": { + "code": 200, + "message": "" + }, + "headers": { + "Content-Type": [ + "application/json;charset=utf-8" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Connection": [ + "keep-alive" + ], + "Date": [ + "Fri, 01 Nov 2024 02:37:50 GMT" + ], + "Set-Cookie": [ + "AWSALBTG=z9DSp7wPrBOMXvNEzpn8/KbtQzrJp6wjDiOP47yEDWnWh+BqAthvH2AOC3yU/Bx5zYBexJ/pcy5K9k+azp6mdVtxyJLtKKiZM0onSL9nuLnbuWwPgxAiF/7ASmkBKOIkR6AILMBSDDiqlYec0oYt52/YvgOQxX2PxYeCTMqghCyo; Expires=Fri, 08 Nov 2024 02:37:49 GMT; Path=/", + "AWSALBTGCORS=z9DSp7wPrBOMXvNEzpn8/KbtQzrJp6wjDiOP47yEDWnWh+BqAthvH2AOC3yU/Bx5zYBexJ/pcy5K9k+azp6mdVtxyJLtKKiZM0onSL9nuLnbuWwPgxAiF/7ASmkBKOIkR6AILMBSDDiqlYec0oYt52/YvgOQxX2PxYeCTMqghCyo; Expires=Fri, 08 Nov 2024 02:37:49 GMT; Path=/; SameSite=None; Secure", + "AWSALB=U6HIgMAvq1ahrQWfY3ovm+IVdcNxeaKFV2eOMJj1eDrYfNjYw9qorvTAzDpVtu3bowB2mUrKB9Jl69QZ9uAI5foHFpA+YIZ+8+ksii6K92kLa0UJ0vLYtQnLaQjT; Expires=Fri, 08 Nov 2024 02:37:49 GMT; Path=/", + "AWSALBCORS=U6HIgMAvq1ahrQWfY3ovm+IVdcNxeaKFV2eOMJj1eDrYfNjYw9qorvTAzDpVtu3bowB2mUrKB9Jl69QZ9uAI5foHFpA+YIZ+8+ksii6K92kLa0UJ0vLYtQnLaQjT; Expires=Fri, 08 Nov 2024 02:37:49 GMT; Path=/; SameSite=None; Secure", + "JSESSIONID=A4B3CF0C02510B31B1ADDA530D7E2AE6107DDCCE3F7C3131BB0D8540A8D5D6CD1DA77B6ED75A791B34788A4DC37A60BCCD726752FB5B933709E5AA4094567373.n1; Path=/; Secure; HttpOnly" + ], + "Server": [ + "nginx" + ], + "X-Cache": [ + "Miss from cloudfront" + ], + "Via": [ + "1.1 2a0fdfa56513675d5c5b25c2795727b0.cloudfront.net (CloudFront)" + ], + "X-Amz-Cf-Pop": [ + "FOR50-P1" + ], + "Alt-Svc": [ + "h3=\":443\"; ma=86400" + ], + "X-Amz-Cf-Id": [ + "n0-Wczd7N76ZQfLs8_TK2hrt9i4RW0MTYqzWUikXETrx4rglNRYXPQ==" + ] + }, + "body": { + "string": "{\"deleted\":true,\"id\":\"PRELUDIA00000000525658ASA\"}" + } + } } ] } diff --git a/tests/pix/test_pix_resource.py b/tests/pix/test_pix_resource.py index 12c4385..1946066 100644 --- a/tests/pix/test_pix_resource.py +++ b/tests/pix/test_pix_resource.py @@ -37,6 +37,9 @@ def test_create_static_qrcode(self, asaas_svc): return_data = asaas_svc.pix.create_qrcode(request) assert isinstance(return_data, StaticQRCodeViewSchema) + def test_delete_static_qrcode(self, asaas_svc): + assert asaas_svc.pix.delete_qrcode("PRELUDIA00000000525658ASA") + def test_delete_key_by_id_should_trigger_error_400(self, asaas_svc): with pytest.raises(AsaasClientError) as exc: asaas_svc.pix.delete_key("39006e1e-7c57-4944-ab22-10d957a0d1c9")