Skip to content

feat: Expire payment link#1

Open
pantomaxdotco wants to merge 7 commits into
mainfrom
expire_payment_link3
Open

feat: Expire payment link#1
pantomaxdotco wants to merge 7 commits into
mainfrom
expire_payment_link3

Conversation

@pantomaxdotco

Copy link
Copy Markdown
Owner

Requirement:

  • User should be able to expire the payment link using the library
  • User should pass a reason to expire the link

The commit adds a new file, `.panto.json`, which includes configuration settings for the Panto tool. This file specifies the files to be scanned and the project languages.
@pantomaxdotco

Copy link
Copy Markdown
Owner Author

/review

Comment thread setu/deeplink.py
)
return

def _getBaseUrl():

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add 'self' parameter to _getBaseUrl() method for proper instance method usage

def _getBaseUrl(self):
    return PRODUCTION_BASE

Comment thread setu/deeplink.py
return PRODUCTION_BASE

@Decorators.auth_handler
def expire_payment_link(self, platform_bill_id: str):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a 'reason' parameter (and include it in the request payload) in expire_payment_link method to meet the business requirement

@Decorators.auth_handler
def expire_payment_link(self, platform_bill_id: str, reason: str):
    """Expire payment link using a provided reason."""
    base_url = self._getBaseUrl()
    headers = {
        "X-Setu-Product-Instance-ID": self.product_instance_id,
        "Content-Type": "application/json",
    }
    payload = {"reason": reason}
    res = self.session.post(
        f"{base_url}/utilities/bills/{platform_bill_id}/expire",
        headers=headers,
        json=payload,
    )
    return res

Comment thread tests/conftest2.py
"""Fixture to get V1 creds.2"""
return APICredentials(
scheme_id="5bf4376b-6008-43c8-8ce0-a5ea196e3091",
secret="9975fd99-d5ed-416a-9963-5d113dc80582",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Security] "secret" detected here, make sure this is not a hard-coded secret.

# Instead of hardcoding the secret, consider loading it from an environment variable.
import os

@ pytest.fixture
def v1_creds() -> APICredentials:
    """Fixture to get V1 creds.2"""
    return APICredentials(
        scheme_id="5bf4376b-6008-43c8-8ce0-a5ea196e3091",
        secret=os.environ.get("API_SECRET")  # load the secret securely
    )

@pantoaibot

pantoaibot Bot commented Mar 28, 2025

Copy link
Copy Markdown

Reviewed up to commit:d03c60a2a9caff87d53cccdbff6bfa6ab727dff2

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

Successfully merging this pull request may close these issues.

2 participants