Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions stubs/braintree/braintree/address.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from _typeshed import Incomplete
from typing import Final

from braintree.configuration import Configuration as Configuration
from braintree.error_result import ErrorResult as ErrorResult
Expand All @@ -7,13 +8,13 @@ from braintree.successful_result import SuccessfulResult as SuccessfulResult

class Address(Resource):
class ShippingMethod:
SameDay: str
NextDay: str
Priority: str
Ground: str
Electronic: str
ShipToStore: str
PickupInStore: str
SameDay: Final = "same_day"
NextDay: Final = "next_day"
Priority: Final = "priority"
Ground: Final = "ground"
Electronic: Final = "electronic"
ShipToStore: Final = "ship_to_store"
PickupInStore: Final = "pickup_in_store"

@staticmethod
def create(params: Incomplete | None = None): ...
Expand Down
7 changes: 4 additions & 3 deletions stubs/braintree/braintree/apple_pay_card.pyi
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from _typeshed import Incomplete
from typing import Final

from braintree.resource import Resource as Resource
from braintree.subscription import Subscription

class ApplePayCard(Resource):
class CardType:
AmEx: str
MasterCard: str
Visa: str
AmEx: Final = "Apple Pay - American Express"
MasterCard: Final = "Apple Pay - MasterCard"
Visa: Final = "Apple Pay - Visa"
Comment on lines +9 to +11
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Personal opinion: These user facing strings with no further meaning to the computer should just be Final[str] = ..., while something like GatewayRejected: Final = "gateway_rejected" below makes sense.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Also just a personal opinion: I feel it's easier to indiscriminately copy&paste from source, w/o having to think too much about what arbitrarily counts as an identifier vs a human readable string, which other contributors may not notice and follow in the same way.

There's an argument about the risk of the string changing, causing more churn, but I doubt these are likely to change without a major revision:

  • braintree_python won't even remove dead code without a major version bump
  • this card type, for example, is part of the result object for a transaction, it's likely users already highly depend on the value of this string for their transaction logs


is_expired: Incomplete
subscriptions: list[Subscription]
Expand Down
47 changes: 24 additions & 23 deletions stubs/braintree/braintree/credit_card.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from _typeshed import Incomplete
from enum import Enum
from typing import Final

from braintree.address import Address as Address
from braintree.configuration import Configuration as Configuration
Expand All @@ -9,33 +10,33 @@ from braintree.subscription import Subscription

class CreditCard(Resource):
class CardType:
AmEx: str
CarteBlanche: str
ChinaUnionPay: str
DinersClubInternational: str
Discover: str
Electron: str
Elo: str
Hiper: str
Hipercard: str
JCB: str
Laser: str
UK_Maestro: str
Maestro: str
MasterCard: str
Solo: str
Switch: str
Visa: str
Unknown: str
AmEx: Final = "American Express"
CarteBlanche: Final = "Carte Blanche"
ChinaUnionPay: Final = "China UnionPay"
DinersClubInternational: Final = "Diners Club"
Discover: Final = "Discover"
Electron: Final = "Electron"
Elo: Final = "Elo"
Hiper: Final = "Hiper"
Hipercard: Final = "Hipercard"
JCB: Final = "JCB"
Laser: Final = "Laser"
UK_Maestro: Final = "UK Maestro"
Maestro: Final = "Maestro"
MasterCard: Final = "MasterCard"
Solo: Final = "Solo"
Switch: Final = "Switch"
Visa: Final = "Visa"
Unknown: Final = "Unknown"

class CustomerLocation:
International: str
US: str
International: Final = "international"
US: Final = "us"

class CardTypeIndicator:
Yes: str
No: str
Unknown: str
Yes: Final = "Yes"
No: Final = "No"
Unknown: Final = "Unknown"

class DebitNetwork(Enum):
Accel = "ACCEL"
Expand Down
9 changes: 5 additions & 4 deletions stubs/braintree/braintree/credit_card_verification.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from _typeshed import Incomplete
from decimal import Decimal
from typing import Final

from braintree.attribute_getter import AttributeGetter as AttributeGetter
from braintree.configuration import Configuration as Configuration
Expand All @@ -9,10 +10,10 @@ from braintree.three_d_secure_info import ThreeDSecureInfo as ThreeDSecureInfo

class CreditCardVerification(AttributeGetter):
class Status:
Failed: str
GatewayRejected: str
ProcessorDeclined: str
Verified: str
Failed: Final = "failed"
GatewayRejected: Final = "gateway_rejected"
ProcessorDeclined: Final = "processor_declined"
Verified: Final = "verified"

amount: Decimal | None
currency_iso_code: Incomplete
Expand Down
5 changes: 3 additions & 2 deletions stubs/braintree/braintree/disbursement.pyi
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from decimal import Decimal
from typing import Final

from braintree.merchant_account import MerchantAccount as MerchantAccount
from braintree.resource import Resource as Resource
from braintree.transaction_search import TransactionSearch as TransactionSearch

class Disbursement(Resource):
class Type:
Credit: str
Debit: str
Credit: Final = "credit"
Debit: Final = "debit"

amount: Decimal
merchant_account: MerchantAccount
Expand Down
61 changes: 31 additions & 30 deletions stubs/braintree/braintree/dispute.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from _typeshed import Incomplete
from decimal import Decimal
from typing import Final

from braintree.attribute_getter import AttributeGetter as AttributeGetter
from braintree.configuration import Configuration as Configuration
Expand All @@ -12,46 +13,46 @@ from braintree.transaction_details import TransactionDetails as TransactionDetai

class Dispute(AttributeGetter):
class Status:
Accepted: str
AutoAccepted: str
Disputed: str
Expired: str
Lost: str
Open: str
UnderReview: str
Won: str
Accepted: Final = "accepted"
AutoAccepted: Final = "auto_accepted"
Disputed: Final = "disputed"
Expired: Final = "expired"
Lost: Final = "lost"
Open: Final = "open"
UnderReview: Final = "under_review"
Won: Final = "won"

class Reason:
CancelledRecurringTransaction: str
CreditNotProcessed: str
Duplicate: str
Fraud: str
General: str
InvalidAccount: str
NotRecognized: str
ProductNotReceived: str
ProductUnsatisfactory: str
Retrieval: str
TransactionAmountDiffers: str
CancelledRecurringTransaction: Final = "cancelled_recurring_transaction"
CreditNotProcessed: Final = "credit_not_processed"
Duplicate: Final = "duplicate"
Fraud: Final = "fraud"
General: Final = "general"
InvalidAccount: Final = "invalid_account"
NotRecognized: Final = "not_recognized"
ProductNotReceived: Final = "product_not_received"
ProductUnsatisfactory: Final = "product_unsatisfactory"
Retrieval: Final = "retrieval"
TransactionAmountDiffers: Final = "transaction_amount_differs"

class Kind:
Chargeback: str
PreArbitration: str
Retrieval: str
Chargeback: Final = "chargeback"
PreArbitration: Final = "pre_arbitration"
Retrieval: Final = "retrieval"

class ChargebackProtectionLevel:
Effortless: str
Standard: str
NotProtected: str
Effortless: Final = "effortless"
Standard: Final = "standard"
NotProtected: Final = "not_protected"

class PreDisputeProgram:
NONE: str
VisaRdr: str
NONE: Final = "none"
VisaRdr: Final = "visa_rdr"

class ProtectionLevel:
EffortlessCBP: str
StandardCBP: str
NoProtection: str
EffortlessCBP: Final = "Effortless Chargeback Protection tool"
StandardCBP: Final = "Chargeback Protection tool"
NoProtection: Final = "No Protection"

@staticmethod
def accept(id): ...
Expand Down
3 changes: 2 additions & 1 deletion stubs/braintree/braintree/document_upload.pyi
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from _typeshed import Incomplete
from typing import Final

from braintree.configuration import Configuration as Configuration
from braintree.resource import Resource as Resource
from braintree.successful_result import SuccessfulResult as SuccessfulResult

class DocumentUpload(Resource):
class Kind:
EvidenceDocument: str
EvidenceDocument: Final = "evidence_document"

@staticmethod
def create(params: Incomplete | None = None): ...
Expand Down
Loading