Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encontrei um problema! #14

Closed
controlado opened this issue Mar 22, 2022 · 1 comment
Closed

Encontrei um problema! #14

controlado opened this issue Mar 22, 2022 · 1 comment

Comments

@controlado
Copy link
Contributor

Olá! 😶‍🌫️
Primeiramente, obrigado por fazer esse código!

Achei um problema na função de cancelar os pagamentos; como diz na documentação oficial do Picpay, caso o pagamento já esteja aprovado, é necessário o authorizationId além do referenceId, porém no seu código, só trabalha um parâmetro, independente da condição...

def cancellation(self, reference_id: str) -> dict:
        # Documentação da função...

        path = f"payments/{reference_id}/cancellations"

        json = {  # Aqui deveria ter o parâmetro "authorizationId".
            "referenceId": reference_id,
        }

        request = self._request(method="post", path=path, json=json)

        return request

Mas no caso, creio que poderia ser um parâmetro opcional, já que não é necessário passar a autorização sempre ⏑

Documentação do PicPay! 🪙

image

Sugestão de solução? 🫂

Essa foi a forma em que pensei.
Novamente, muito obrigado pelo seu trabalho, me ajudou bastante!

def cancellation(self, reference_id: str, authorization_id: str = None) -> dict:
        path = f"payments/{reference_id}/cancellations"

        json = {
            "referenceId": reference_id,
        }

        if authorization_id:
            json["authorizationId"] = authorization_id

        request = self._request(method="post", path=path, json=json)

        return request
@hudsonbrendon
Copy link
Owner

Boa cara, manda um PR se possível, se não assim, que possível eu corrijo isso.

controlado added a commit to controlado/picpay-python that referenced this issue Apr 5, 2022
controlado added a commit to controlado/picpay-python that referenced this issue Apr 5, 2022
hudsonbrendon added a commit that referenced this issue Apr 6, 2022
Correção da função de cancelamento. #14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants