Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Conversation

@suejung-sentry
Copy link
Contributor

@suejung-sentry suejung-sentry commented Jan 30, 2025

Another piece of work for the ACH microdeposits delayed payment verification flow - codecov/engineering-team#2622

This PR adds an endpoint to fetch from Stripe any payment methods awaiting delayed payment notification (e.g., ACH 2-day later microdeposits).
It hooks into our GraphQL api at a new billing key that we can extend and add to as we cut over stuff from the existing /internal/account-details REST api.

It will be used by gazebo UI to reflect this waiting status to the user in that 2-day period.

@codecov-notifications
Copy link

codecov-notifications bot commented Jan 30, 2025

Codecov Report

Attention: Patch coverage is 95.83333% with 2 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
services/billing.py 93.75% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@codecov-qa
Copy link

codecov-qa bot commented Jan 30, 2025

Codecov Report

Attention: Patch coverage is 95.83333% with 2 lines in your changes missing coverage. Please review.

Project coverage is 95.98%. Comparing base (354b640) to head (09fea39).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

@github-actions
Copy link
Contributor

✅ All tests successful. No failed tests were found.

📣 Thoughts on this report? Let Codecov know! | Powered by Codecov

@suejung-sentry suejung-sentry marked this pull request as ready for review January 30, 2025 18:57
@suejung-sentry suejung-sentry requested a review from a team as a code owner January 30, 2025 18:57
Copy link
Contributor

@ajay-sentry ajay-sentry left a comment

Choose a reason for hiding this comment

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

lgtm!

@codecov-public-qa
Copy link

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
2716 1 2715 6
View the top 1 failed tests by shortest run time
graphql_api/tests/test_billing.py::BillingTestCase::test_fetch_unverified_payment_methods
Stack Traces | 0.467s run time
self = <graphql_api.tests.test_billing.BillingTestCase testMethod=test_fetch_unverified_payment_methods>

    def test_fetch_unverified_payment_methods(self):
        query = """
            query {
                owner(username: "%s") {
                    billing {
                        unverifiedPaymentMethods {
                            paymentMethodId
                            hostedVerificationUrl
                        }
                    }
                }
            }
        """ % (self.owner.username)
    
        payment_intent = PaymentIntent.construct_from(
            {
                "payment_method": "pm_123",
                "next_action": {
                    "type": "verify_with_microdeposits",
                    "verify_with_microdeposits": {
                        "hosted_verification_url": "https://verify.stripe.com/1"
                    },
                },
            },
            "fake_api_key",
        )
    
        setup_intent = SetupIntent.construct_from(
            {
                "payment_method": "pm_456",
                "next_action": {
                    "type": "verify_with_microdeposits",
                    "verify_with_microdeposits": {
                        "hosted_verification_url": "https://verify.stripe.com/2"
                    },
                },
            },
            "fake_api_key",
        )
    
        with (
            patch(
                "services.billing.stripe.PaymentIntent.list"
            ) as payment_intent_list_mock,
            patch("services.billing.stripe.SetupIntent.list") as setup_intent_list_mock,
        ):
            payment_intent_list_mock.return_value.data = [payment_intent]
            setup_intent_list_mock.return_value.data = [setup_intent]
    
            result = self.gql_request(query, owner=self.owner)
    
        assert "errors" not in result
        data = result["owner"]["billing"]["unverifiedPaymentMethods"]
>       assert len(data) == 2
E       TypeError: object of type 'NoneType' has no len()

graphql_api/tests/test_billing.py:67: TypeError

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

@codecov
Copy link

codecov bot commented Jan 30, 2025

Codecov Report

Attention: Patch coverage is 95.83333% with 2 lines in your changes missing coverage. Please review.

Project coverage is 96.07%. Comparing base (354b640) to head (09fea39).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
services/billing.py 93.75% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1115      +/-   ##
==========================================
- Coverage   96.07%   96.07%   -0.01%     
==========================================
  Files         836      837       +1     
  Lines       19611    19656      +45     
==========================================
+ Hits        18842    18885      +43     
- Misses        769      771       +2     
Flag Coverage Δ
unit 95.98% <95.83%> (-0.01%) ⬇️
unit-latest-uploader 95.98% <95.83%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@suejung-sentry suejung-sentry added this pull request to the merge queue Jan 30, 2025
Merged via the queue into main with commit 7e5a947 Jan 30, 2025
28 of 32 checks passed
@suejung-sentry suejung-sentry deleted the sshin/microdeposits branch January 30, 2025 23:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants