Skip to content

Comments

adding classmethod to ensure balance check#215

Open
nk7up wants to merge 6 commits intomasterfrom
qa/SAC-29321
Open

adding classmethod to ensure balance check#215
nk7up wants to merge 6 commits intomasterfrom
qa/SAC-29321

Conversation

@nk7up
Copy link
Contributor

@nk7up nk7up commented Nov 3, 2025

Description of change

JIRA: https://qlik-dev.atlassian.net/browse/SAC-29321

  1. Converted the method to a classmethod to ensure the balance is topped up before running into any class level test runs. The setUpClass method is defined in the tap overrides the base_case one in tap-tester to ensure balance check is done at this level before any class invoked tests run.
  2. Also, added a check just before the stream 'transfers' to ensure the balance is adequate before doing any transfer operations
  3. Removed fields such as customer_account as it is not part of the actual fields returned by the tap itself. For now excluded these.

Manual QA steps

Risks

Rollback steps

  • revert this branch

AI generated code

https://internal.qlik.dev/general/ways-of-working/code-reviews/#guidelines-for-ai-generated-code

  • this PR has been written with the help of GitHub Copilot or another generative AI tool

@nk7up nk7up requested a review from bhtowles November 3, 2025 20:09


def setUp(self):
"""Verify that you have set the prerequisites to run the tap (creds, etc.)"""
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need to call it in both places right?

Copy link
Contributor Author

@nk7up nk7up Nov 6, 2025

Choose a reason for hiding this comment

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

It was mainly kept as a safety net kind of to check if the classmethod works or not. I can remove it.

def setUpClass(cls):
"""Run the class-level balance ensure (so setUpClass-level creates are safe)."""
# run the existing ensure_available_balance logic early
cls.ensure_available_balance()
Copy link
Contributor

@bhtowles bhtowles Nov 4, 2025

Choose a reason for hiding this comment

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

Would like to add logging to the ensure balance method so we can monitor this over time. Also consider bumping the check from 1,000 to 10,000 for both comparison and top-up amount.

Suggested change
cls.ensure_available_balance()
if balance.get('currency') == 'usd':
balance_usd = balance.get('currency', 0)
LOGGER.info("balance_usd: %s, pending_usd: %s", balance_usd, pending_amount_usd)
if balance_usd - pending_amount_usd <= 100000:
LOGGER.info("Balance - Pending has fallen below $1,000. Adding $1,000 to balance")
stripe_client.PaymentIntent.create(

@nk7up nk7up requested a review from bhtowles December 16, 2025 21:18
@nk7up
Copy link
Contributor Author

nk7up commented Dec 16, 2025

@bhtowles updated logic and expected keys for all fields

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