Skip to content

Commit b594aee

Browse files
committed
Add missing return types and annotate PaymentMethodGateway.find()
The Braintree docs don't list the complete list of payment types the library can return, the complete list can be found in braintree.payment_method_parser
1 parent 0235d96 commit b594aee

File tree

2 files changed

+51
-3
lines changed

2 files changed

+51
-3
lines changed

stubs/braintree/braintree/payment_method.pyi

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
from _typeshed import Incomplete
22

3+
from braintree.amex_express_checkout_card import AmexExpressCheckoutCard
34
from braintree.android_pay_card import AndroidPayCard
45
from braintree.apple_pay_card import ApplePayCard
56
from braintree.credit_card import CreditCard
67
from braintree.error_result import ErrorResult
8+
from braintree.europe_bank_account import EuropeBankAccount
9+
from braintree.masterpass_card import MasterpassCard
710
from braintree.paypal_account import PayPalAccount
811
from braintree.resource import Resource
12+
from braintree.samsung_pay_card import SamsungPayCard
13+
from braintree.sepa_direct_debit_account import SepaDirectDebitAccount
914
from braintree.successful_result import SuccessfulResult
15+
from braintree.unknown_payment_method import UnknownPaymentMethod
1016
from braintree.us_bank_account import UsBankAccount
1117
from braintree.venmo_account import VenmoAccount
1218
from braintree.visa_checkout_card import VisaCheckoutCard
@@ -17,7 +23,21 @@ class PaymentMethod(Resource):
1723
@staticmethod
1824
def find(
1925
payment_method_token: str,
20-
) -> AndroidPayCard | ApplePayCard | CreditCard | PayPalAccount | UsBankAccount | VenmoAccount | VisaCheckoutCard: ...
26+
) -> (
27+
AndroidPayCard
28+
| ApplePayCard
29+
| EuropeBankAccount
30+
| CreditCard
31+
| PayPalAccount
32+
| UsBankAccount
33+
| VenmoAccount
34+
| VisaCheckoutCard
35+
| AmexExpressCheckoutCard
36+
| SepaDirectDebitAccount
37+
| MasterpassCard
38+
| SamsungPayCard
39+
| UnknownPaymentMethod
40+
): ...
2141
@staticmethod
2242
def update(payment_method_token: str, params) -> SuccessfulResult | ErrorResult: ...
2343
@staticmethod

stubs/braintree/braintree/payment_method_gateway.pyi

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,43 @@
11
from _typeshed import Incomplete
22

3+
from braintree.amex_express_checkout_card import AmexExpressCheckoutCard
4+
from braintree.android_pay_card import AndroidPayCard
5+
from braintree.apple_pay_card import ApplePayCard
6+
from braintree.credit_card import CreditCard
37
from braintree.error_result import ErrorResult
4-
from braintree.resource import Resource
8+
from braintree.europe_bank_account import EuropeBankAccount
9+
from braintree.masterpass_card import MasterpassCard
10+
from braintree.paypal_account import PayPalAccount
11+
from braintree.samsung_pay_card import SamsungPayCard
12+
from braintree.sepa_direct_debit_account import SepaDirectDebitAccount
513
from braintree.successful_result import SuccessfulResult
14+
from braintree.unknown_payment_method import UnknownPaymentMethod
15+
from braintree.us_bank_account import UsBankAccount
16+
from braintree.venmo_account import VenmoAccount
17+
from braintree.visa_checkout_card import VisaCheckoutCard
618

719
class PaymentMethodGateway:
820
gateway: Incomplete
921
config: Incomplete
1022
def __init__(self, gateway) -> None: ...
1123
def create(self, params: dict[str, Incomplete] | None = None) -> SuccessfulResult | ErrorResult: ...
12-
def find(self, payment_method_token: str) -> Resource: ...
24+
def find(
25+
self, payment_method_token: str
26+
) -> (
27+
AndroidPayCard
28+
| ApplePayCard
29+
| EuropeBankAccount
30+
| CreditCard
31+
| PayPalAccount
32+
| UsBankAccount
33+
| VenmoAccount
34+
| VisaCheckoutCard
35+
| AmexExpressCheckoutCard
36+
| SepaDirectDebitAccount
37+
| MasterpassCard
38+
| SamsungPayCard
39+
| UnknownPaymentMethod
40+
): ...
1341
def update(self, payment_method_token: str, params) -> SuccessfulResult | ErrorResult: ...
1442
def delete(self, payment_method_token: str, options=None) -> SuccessfulResult: ...
1543
options: dict[str, Incomplete]

0 commit comments

Comments
 (0)