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

Commit f1c11e6

Browse files
feat: Add list unverified payment methods api
1 parent ae83c2f commit f1c11e6

File tree

5 files changed

+40
-0
lines changed

5 files changed

+40
-0
lines changed

graphql_api/types/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from ..helpers.ariadne import ariadne_load_local_graphql
55
from .account import account, account_bindable
6+
from .billing import billing_bindable
67
from .branch import branch, branch_bindable
78
from .bundle_analysis import (
89
bundle_analysis,
@@ -90,6 +91,7 @@
9091
enums = ariadne_load_local_graphql(__file__, "./enums")
9192
errors = ariadne_load_local_graphql(__file__, "./errors")
9293
types = [
94+
billing,
9395
branch,
9496
bundle_analysis_comparison,
9597
bundle_analysis_report,
@@ -140,6 +142,7 @@
140142
bindables = [
141143
*enum_types.enum_types,
142144
*mutation_resolvers,
145+
billing_bindable,
143146
branch_bindable,
144147
bundle_analysis_comparison_bindable,
145148
bundle_analysis_comparison_result_bindable,
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from graphql_api.helpers.ariadne import ariadne_load_local_graphql
2+
3+
from .billing import billing_bindable
4+
5+
billing = ariadne_load_local_graphql(__file__, "billing.graphql")
6+
7+
8+
__all__ = ["billing_bindable"]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
type Billing {
2+
unVerifiedPaymentMethods: [UnverifiedPaymentMethod!]!
3+
}
4+
5+
type UnverifiedPaymentMethod {
6+
paymentMethodId: String!
7+
hostedVerificationUrl: String
8+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from ariadne import ObjectType
2+
from graphql import GraphQLResolveInfo
3+
4+
from codecov_auth.models import Owner
5+
from services.billing import BillingService
6+
7+
billing_bindable = ObjectType("Billing")
8+
9+
10+
@billing_bindable.field("unverifiedPaymentMethods")
11+
def resolve_unverified_payment_methods(
12+
owner: Owner, info: GraphQLResolveInfo
13+
) -> list[dict]:
14+
return BillingService(requesting_user=owner).get_unverified_payment_methods()

graphql_api/types/owner/owner.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,3 +396,10 @@ def resolve_upload_token_required(
396396
@require_shared_account_or_part_of_org
397397
def resolve_activated_user_count(owner: Owner, info: GraphQLResolveInfo) -> int:
398398
return owner.activated_user_count
399+
400+
401+
402+
@owner_bindable.field("billing")
403+
@sync_to_async
404+
@require_part_of_org
405+
def resolve_billing(owner: Owner, info: GraphQLResolveInfo) -> dict | None:

0 commit comments

Comments
 (0)