Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Remove deprecated Braintree payment gateway plugin (#19554)
Lukasz Ostrowskic67b386f49a4
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex ec9df038a8..34cb811153 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -7,6 +7,7 @@ All notable, unreleased changes to this project will be documented in this file.### Breaking changes- Removed the deprecated Authorize.Net payment gateway plugin (`mirumee.payments.authorize_net`).+- Removed the deprecated Braintree payment gateway plugin (`mirumee.payments.braintree`).- Apps will be no longer to be granted with `MANAGE_APPS` permission. In certain cases, this permission was able to be assigned by the authorized user.App with such permission was not able to *act* like an admin app, but permission technically was granted.diff --git a/pyproject.toml b/pyproject.tomlindex 81466b90f0..4718523a33 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -19,7 +19,6 @@ dependencies = ["babel>=2.18.0,<2.19","boto3~=1.43","botocore~=1.42",- "braintree>=4.2,<4.32","cryptography>=49.0.0","dj-database-url>=3.1.2,<4","dj-email-url>=1,<2",diff --git a/saleor/payment/gateways/braintree/__init__.py b/saleor/payment/gateways/braintree/__init__.pydeleted file mode 100644index 2b5f41617c..0000000000--- a/saleor/payment/gateways/braintree/__init__.py+++ /dev/null@@ -1,348 +0,0 @@-import braintree as braintree_sdk-from braintree.exceptions.braintree_error import BraintreeError-from django.core.exceptions import ImproperlyConfigured--from ....core.telemetry import saleor_attributes, tracer-from ... import TransactionKind-from ...interface import (- CustomerSource,- GatewayConfig,- GatewayResponse,- PaymentData,- PaymentMethodInfo,- TokenConfig,-)-from .errors import DEFAULT_ERROR_MESSAGE, BraintreeException, handle_braintree_error--# Error codes whitelist should be a dict of code: error_msg_override-# if no error_msg_override is provided,-# then error message returned by the gateway will be used-ERROR_CODES_WHITELIST = {- "91506": """- Cannot refund transaction unless it is settled.- Please try again later. Settlement time might vary depending- on the issuers bank."""-}---def get_billing_data(payment_information: PaymentData) -> dict:- billing: dict[str, str] = {}- if payment_information.billing:- billing_info = payment_information.billing- billing = {- "first_name": billing_info.first_name,- "last_name": billing_info.last_name,- "company": billing_info.company_name,- "postal_code": billing_info.postal_code,- "street_address": billing_info.street_address_1,- "extended_address": billing_info.street_address_2,- "locality": billing_info.city,- "region": billing_info.country_area,- "country_code_alpha2": billing_info.country,- }- return billing---def get_customer_data(payment_information: PaymentData) -> dict:- """Provide customer info, use only for new customer creation."""- return {- "order_id": payment_information.graphql_payment_id,- "billing": get_billing_data(payment_information),- "risk_data": {"customer_ip": payment_information.customer_ip_address or ""},- "customer": {"email": payment_information.customer_email},- }---def get_error_for_client(errors: list) -> str:- """Filter all error messages and decides which one is visible for the client."""- if not errors:- return ""- default_msg = "Unable to process transaction. Please try again in a moment"- for error in errors:- if error["code"] in ERROR_CODES_WHITELIST:- return ERROR_CODES_WHITELIST[error["code"]] or error["message"]- return default_msg---def extract_gateway_response(braintree_result) -> dict:- """Extract data from Braintree response that will be stored locally."""- errors: list[dict[str, str] | None] = []- if not braintree_result.is_success:- errors = [- {"code": error.code, "message": error.message}- for error in braintree_result.errors.deep_errors- ]- bt_transaction = braintree_result.transaction-- if not bt_transaction:- return {"errors": errors}- return {- "transaction_id": getattr(bt_transaction, "id", ""),- "currency": bt_transaction.currency_iso_code,- "amount": bt_transaction.amount, # Decimal type- "credit_card": bt_transaction.credit_card,- "customer_id": bt_transaction.customer_details.id,- "errors": errors,- }---def get_braintree_gateway(- sandbox_mode, merchant_id, public_key, private_key, merchant_account_id-):- if not all([merchant_id, private_key, public_key]):- raise ImproperlyConfigured("Incorrectly configured Braintree gateway.")- environment = braintree_sdk.Environment.Sandbox- if not sandbox_mode:- environment = braintree_sdk.Environment.Production-- config = braintree_sdk.Configuration(- environment=environment,- merchant_id=merchant_id,- public_key=public_key,- private_key=private_key,- )- gateway = braintree_sdk.BraintreeGateway(config=config)- return gateway---def get_client_token(- config: GatewayConfig, token_config: TokenConfig | None = None-) -> str:- gateway = get_braintree_gateway(**config.connection_params)- with tracer.start_as_current_span("braintree.client_token.generate") as span:- span.set_attribute(saleor_attributes.COMPONENT, "payment")- parameters = create_token_params(config, token_config)- return gateway.client_token.generate(parameters)---def create_token_params(- config: GatewayConfig, token_config: TokenConfig | None = None-) -> dict:- params = {}- if "merchant_account_id" in config.connection_params:- merchant_account_id = config.connection_params["merchant_account_id"]- if merchant_account_id:- params["merchant_account_id"] = merchant_account_id-- if token_config:- customer_id = token_config.customer_id- if customer_id and config.store_customer:- params["customer_id"] = customer_id- return params---def authorize(- payment_information: PaymentData, config: GatewayConfig-) -> GatewayResponse:- try:- if not payment_information.customer_id:- result = transaction_for_new_customer(payment_information, config)- else:- result = transaction_for_existing_customer(payment_information, config)- except BraintreeError as exc:- handle_braintree_error(exc)-- gateway_response = extract_gateway_response(result)- error = get_error_for_client(gateway_response["errors"])- kind = TransactionKind.CAPTURE if config.auto_capture else TransactionKind.AUTH- credit_card = gateway_response.get("credit_card", {})- brand = credit_card.get("card_type", "")- brand = brand.lower() if brand is not None else ""- transaction_id = gateway_response.get("transaction_id", payment_information.token)-- return GatewayResponse(- is_success=result.is_success,- action_required=False,- kind=kind,- amount=gateway_response.get("amount", payment_information.amount),- currency=gateway_response.get("currency", payment_information.currency),- customer_id=gateway_response.get("customer_id"),- transaction_id=transaction_id, # type: ignore[arg-type]- error=error,- payment_method_info=PaymentMethodInfo(- last_4=credit_card.get("last_4"),- exp_year=credit_card.get("expiration_year"),- exp_month=credit_card.get("expiration_month"),- brand=brand,- name=credit_card.get("cardholder_name"),- type="card",- ),- raw_response=gateway_response,- )---def transaction_for_new_customer(- payment_information: PaymentData, config: GatewayConfig-):- gateway = get_braintree_gateway(**config.connection_params)-- with tracer.start_as_current_span("braintree.transaction.sale") as span:- span.set_attribute(saleor_attributes.COMPONENT, "payment")- params = get_customer_data(payment_information)- merchant_account_id = config.connection_params["merchant_account_id"]- if merchant_account_id:- params["merchant_account_id"] = merchant_account_id-- try:- return gateway.transaction.sale(- {- "amount": str(payment_information.amount),- "payment_method_nonce": payment_information.token,- "options": {- "submit_for_settlement": config.auto_capture,- "store_in_vault_on_success": payment_information.reuse_source,- "three_d_secure": {"required": config.require_3d_secure},- },- **params,- }- )- except BraintreeError as exc:- handle_braintree_error(exc)---def transaction_for_existing_customer(- payment_information: PaymentData, config: GatewayConfig-):- gateway = get_braintree_gateway(**config.connection_params)- with tracer.start_as_current_span("braintree.transaction.sale") as span:- span.set_attribute(saleor_attributes.COMPONENT, "payment")- params = get_customer_data(payment_information)- merchant_account_id = config.connection_params["merchant_account_id"]- if merchant_account_id:- params["merchant_account_id"] = merchant_account_id-- try:- return gateway.transaction.sale(- {- "amount": str(payment_information.amount),- "customer_id": payment_information.customer_id,- "options": {"submit_for_settlement": config.auto_capture},- **params,- }- )- except BraintreeError as exc:- handle_braintree_error(exc)---def capture(payment_information: PaymentData, config: GatewayConfig) -> GatewayResponse:- gateway = get_braintree_gateway(**config.connection_params)-- try:- with tracer.start_as_current_span(- "braintree.transaction.submit_for_settlement"- ) as span:- span.set_attribute(saleor_attributes.COMPONENT, "payment")- result = gateway.transaction.submit_for_settlement(- transaction_id=payment_information.token,- amount=str(payment_information.amount),- )- except BraintreeError as exc:- handle_braintree_error(exc)-- gateway_response = extract_gateway_response(result)- error = get_error_for_client(gateway_response["errors"])-- return GatewayResponse(- is_success=result.is_success,- action_required=False,- kind=TransactionKind.CAPTURE,- amount=gateway_response.get("amount", payment_information.amount),- currency=gateway_response.get("currency", payment_information.currency),- transaction_id=gateway_response.get(- "transaction_id", payment_information.token- ), # type: ignore[arg-type]- error=error,- raw_response=gateway_response,- )---def void(payment_information: PaymentData, config: GatewayConfig) -> GatewayResponse:- gateway = get_braintree_gateway(**config.connection_params)-- try:- with tracer.start_as_current_span("braintree.transaction.void") as span:- span.set_attribute(saleor_attributes.COMPONENT, "payment")- result = gateway.transaction.void(transaction_id=payment_information.token)- except BraintreeError as exc:- handle_braintree_error(exc)-- gateway_response = extract_gateway_response(result)- error = get_error_for_client(gateway_response["errors"])-- return GatewayResponse(- is_success=result.is_success,- action_required=False,- kind=TransactionKind.VOID,- amount=gateway_response.get("amount", payment_information.amount),- currency=gateway_response.get("currency", payment_information.currency),- transaction_id=gateway_response.get(- "transaction_id", payment_information.token- ), # type: ignore[arg-type]- error=error,- raw_response=gateway_response,- )---def refund(payment_information: PaymentData, config: GatewayConfig) -> GatewayResponse:- gateway = get_braintree_gateway(**config.connection_params)-- try:- with tracer.start_as_current_span("braintree.transaction.refund") as span:- span.set_attribute(saleor_attributes.COMPONENT, "payment")- result = gateway.transaction.refund(- transaction_id=payment_information.token,- amount_or_options=str(payment_information.amount),- )- except braintree_sdk.exceptions.NotFoundError as e:- raise BraintreeException(DEFAULT_ERROR_MESSAGE) from e-- gateway_response = extract_gateway_response(result)- error = get_error_for_client(gateway_response["errors"])-- return GatewayResponse(- is_success=result.is_success,- action_required=False,- kind=TransactionKind.REFUND,- amount=gateway_response.get("amount", payment_information.amount),- currency=gateway_response.get("currency", payment_information.currency),- transaction_id=gateway_response.get(- "transaction_id", payment_information.token- ), # type: ignore[arg-type]- error=error,- raw_response=gateway_response,- )---def process_payment(- payment_information: PaymentData, config: GatewayConfig-) -> GatewayResponse:- auth_resp = authorize(payment_information, config)- return auth_resp---def list_client_sources(- config: GatewayConfig, customer_id: str-) -> list[CustomerSource]:- gateway = get_braintree_gateway(**config.connection_params)- with tracer.start_as_current_span("braintree.customer.find") as span:- span.set_attribute(saleor_attributes.COMPONENT, "payment")- customer = gateway.customer.find(customer_id)- if not customer:- return []- return [- extract_credit_card_data(card, "braintree") for card in customer.credit_cards- ]---def extract_credit_card_data(card, gateway_name):- credit_card = PaymentMethodInfo(- exp_year=int(card.expiration_year),- exp_month=int(card.expiration_month),- last_4=card.last_4,- name=card.cardholder_name,- )- return CustomerSource(- id=card.unique_number_identifier,- gateway=gateway_name,- credit_card_info=credit_card,- )diff --git a/saleor/payment/gateways/braintree/errors.py b/saleor/payment/gateways/braintree/errors.pydeleted file mode 100644index 8656ba482f..0000000000--- a/saleor/payment/gateways/braintree/errors.py+++ /dev/null@@ -1,51 +0,0 @@-# We are NOT handling errors from:-# - Braintree Marketplace-# - Dispute-# - Apple Pay-# - OAuth-# - Venmo-# - Search-# - Recurring Billing-# - 3D Secure-# - Customer-# as they are not currently supported.-#-# For the full list of errors please refer to:-# https://developers.braintreepayments.com/reference/general/validation-errors/all/python#transaction-from braintree.exceptions.authentication_error import AuthenticationError-from braintree.exceptions.authorization_error import AuthorizationError-from braintree.exceptions.gateway_timeout_error import GatewayTimeoutError-from braintree.exceptions.not_found_error import NotFoundError-from braintree.exceptions.request_timeout_error import RequestTimeoutError-from braintree.exceptions.server_error import ServerError-from braintree.exceptions.service_unavailable_error import ServiceUnavailableError-from braintree.exceptions.too_many_requests_error import TooManyRequestsError-from braintree.exceptions.upgrade_required_error import UpgradeRequiredError--DEFAULT_ERROR_MESSAGE = (- "Unable to process the transaction. Transaction's token is incorrect or expired."-)---class BraintreeException(Exception):- pass---BRAINTREE_ERROR_MESSAGES = {- AuthenticationError: "Authentication error",- AuthorizationError: "Authorization error",- NotFoundError: DEFAULT_ERROR_MESSAGE,- RequestTimeoutError: "Request timeout error",- UpgradeRequiredError: "Upgrade required error",- TooManyRequestsError: "Too many requests error",- ServerError: "Server error",- ServiceUnavailableError: "Server unavailable error",- GatewayTimeoutError: "Gateway timeout error",-}---def handle_braintree_error(exc):- msg = BRAINTREE_ERROR_MESSAGES.get(- type(exc), "Unexpected http response " + str(exc)- )- raise BraintreeException(msg)diff --git a/saleor/payment/gateways/braintree/plugin.py b/saleor/payment/gateways/braintree/plugin.pydeleted file mode 100644index 031bc7fb9f..0000000000--- a/saleor/payment/gateways/braintree/plugin.py+++ /dev/null@@ -1,181 +0,0 @@-from typing import TYPE_CHECKING--from saleor.plugins.base_plugin import BasePlugin, ConfigurationTypeField--from ..utils import get_supported_currencies-from . import (- GatewayConfig,- authorize,- capture,- get_client_token,- list_client_sources,- process_payment,- refund,- void,-)--GATEWAY_NAME = "Braintree"--if TYPE_CHECKING:- from ...interface import CustomerSource- from . import GatewayResponse, PaymentData, TokenConfig---class DeprecatedBraintreeGatewayPlugin(BasePlugin):- """Deprecated.-- This plugin is deprecated and will be removed in future version.- """-- PLUGIN_ID = "mirumee.payments.braintree"- PLUGIN_NAME = GATEWAY_NAME- CONFIGURATION_PER_CHANNEL = True-- DEFAULT_CONFIGURATION = [- {"name": "Public API key", "value": None},- {"name": "Secret API key", "value": None},- {"name": "Use sandbox", "value": True},- {"name": "Merchant ID", "value": None},- {"name": "Merchant Account ID", "value": None},- {"name": "Store customers card", "value": False},- {"name": "Automatic payment capture", "value": True},- {"name": "Require 3D secure", "value": False},- {"name": "Supported currencies", "value": ""},- ]-- CONFIG_STRUCTURE = {- "Public API key": {- "type": ConfigurationTypeField.SECRET,- "help_text": "Provide Braintree public API key.",- "label": "Public Key",- },- "Secret API key": {- "type": ConfigurationTypeField.SECRET,- "help_text": "Provide Braintree private API key.",- "label": "Private Key",- },- "Merchant ID": {- "type": ConfigurationTypeField.STRING,- "help_text": "Provide Braintree merchant ID.",- "label": "Merchant ID",- },- "Merchant Account ID": {- "type": ConfigurationTypeField.STRING,- "help_text": "Optional. If empty, the default account will be used.",- "label": "Merchant Account ID",- },- "Use sandbox": {- "type": ConfigurationTypeField.BOOLEAN,- "help_text": "Determines if Saleor should use Braintree sandbox API.",- "label": "Sandbox mode",- },- "Store customers card": {- "type": ConfigurationTypeField.BOOLEAN,- "help_text": "Determines if Saleor should store cards on payments"- " in Braintree customer.",- "label": "Store customer cards",- },- "Automatic payment capture": {- "type": ConfigurationTypeField.BOOLEAN,- "help_text": "Determines if Saleor should automatically capture payments.",- "label": "Automatic payment capture",- },- "Require 3D secure": {- "type": ConfigurationTypeField.BOOLEAN,- "help_text": (- "Determines if Saleor should enforce 3D Secure during payment."- ),- "label": "Require 3D Secure",- },- "Supported currencies": {- "type": ConfigurationTypeField.STRING,- "help_text": "Determines currencies supported by gateway."- " Please enter currency codes separated by a comma.",- "label": "Supported currencies",- },- }-- def __init__(self, *args, **kwargs):- super().__init__(*args, **kwargs)- configuration = {item["name"]: item["value"] for item in self.configuration}- self.config = GatewayConfig(- gateway_name=GATEWAY_NAME,- auto_capture=configuration["Automatic payment capture"],- supported_currencies=configuration["Supported currencies"],- connection_params={- "sandbox_mode": configuration["Use sandbox"],- "merchant_id": configuration["Merchant ID"],- "merchant_account_id": configuration["Merchant Account ID"],- "public_key": configuration["Public API key"],- "private_key": configuration["Secret API key"],- },- store_customer=configuration["Store customers card"],- require_3d_secure=configuration["Require 3D secure"],- )-- def _get_gateway_config(self) -> GatewayConfig:- return self.config-- def authorize_payment(- self, payment_information: "PaymentData", previous_value- ) -> "GatewayResponse":- if not self.active:- return previous_value- return authorize(payment_information, self._get_gateway_config())-- def capture_payment(- self, payment_information: "PaymentData", previous_value- ) -> "GatewayResponse":- if not self.active:- return previous_value- return capture(payment_information, self._get_gateway_config())-- def refund_payment(- self, payment_information: "PaymentData", previous_value- ) -> "GatewayResponse":- if not self.active:- return previous_value- return refund(payment_information, self._get_gateway_config())-- def void_payment(- self, payment_information: "PaymentData", previous_value- ) -> "GatewayResponse":- if not self.active:- return previous_value- return void(payment_information, self._get_gateway_config())-- def process_payment(- self, payment_information: "PaymentData", previous_value- ) -> "GatewayResponse":- if not self.active:- return previous_value- return process_payment(payment_information, self._get_gateway_config())-- def list_payment_sources(- self, customer_id: str, previous_value- ) -> list["CustomerSource"]:- if not self.active:- return previous_value- sources = list_client_sources(self._get_gateway_config(), customer_id)- previous_value.extend(sources)- return previous_value-- def get_client_token(self, token_config: "TokenConfig", previous_value):- if not self.active:- return previous_value- return get_client_token(self._get_gateway_config(), token_config)-- def get_supported_currencies(self, previous_value):- if not self.active:- return previous_value- config = self._get_gateway_config()- return get_supported_currencies(config, GATEWAY_NAME)-- def get_payment_config(self, previous_value):- if not self.active:- return previous_value- config = self._get_gateway_config()- return [- {"field": "store_customer_card", "value": config.store_customer},- {"field": "client_token", "value": get_client_token(config=config)},- ]diff --git a/saleor/payment/gateways/braintree/tests/__init__.py b/saleor/payment/gateways/braintree/tests/__init__.pydeleted file mode 100644index e69de29bb2..0000000000diff --git a/saleor/payment/gateways/braintree/tests/cassettes/test_braintree/test_authorize_and_save_customer_id.yaml b/saleor/payment/gateways/braintree/tests/cassettes/test_braintree/test_authorize_and_save_customer_id.yamldeleted file mode 100644index bef1d6f3aa..0000000000--- a/saleor/payment/gateways/braintree/tests/cassettes/test_braintree/test_authorize_and_save_customer_id.yaml+++ /dev/null@@ -1,97 +0,0 @@-interactions:-- request:- body: <transaction><amount>100.0</amount><payment_method_nonce>fake-valid-nonce</payment_method_nonce><options><submit_for_settlement- type="boolean">true</submit_for_settlement><store_in_vault_on_success type="boolean">true</store_in_vault_on_success><three_d_secure><required- type="boolean">false</required></three_d_secure></options><order_id type="integer">8</order_id><billing><first_name>John</first_name><last_name>Doe</last_name><company>Mirumee- Software</company><postal_code>53-601</postal_code><street_address>Tęczowa- 7</street_address><extended_address></extended_address><locality>WROCŁAW</locality><region></region><country_code_alpha2>PL</country_code_alpha2></billing><risk_data><customer_ip></customer_ip></risk_data><customer><email>[email protected]</email></customer><type>sale</type></transaction>- headers:- Accept:- - application/xml- Accept-Encoding:- - gzip- Connection:- - keep-alive- Content-Length:- - '820'- Content-type:- - application/xml- User-Agent:- - Braintree Python 3.49.0- X-ApiVersion:- - '5'- method: POST- uri: https://api.sandbox.braintreegateway.com/merchants/9m6qhfxsqzm3cgzw/transactions- response:- body:- string: !!binary |- H4sIABWIE10AA8RY23LbNhB9z1dolJm80SR1i5zQTD1J4zTT2GlqJ7VfPCABiohJgAFAWcrXd8Gb- SBGU1Zl2+ibunsVlbzgr780mTUZrIiTl7GzsnjjjEWEhx5StzsY31++t5fiN/8xTAjGJQgUo/9lo- 5FHs48wN4vk68mz40DKpkMqlL/MgpUoRfB9xcS+JUglJCVOeXQE0Vm0z4kuUEM8ufmpZmAsBe28t- KrkF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QewAuwPHPCk8b+4lNEUrYuUi8WOlMvnKtpGEfi1PAoEo0zVUJb9mTHaGtrqN36cEEhff- J3zF7TW44iRjqzeErangTAPOJDy3Ad8ArWvWrxqfIBkC4nPJdS6Wv0tNTFCiYjgx8W/YA+OPQGxa- shKESUDVTl9+VqpcQAwhIVd5ollnC7WvaV4FTafh4dtBW7LqvGgreNJC1ILKfVLm0BfhXWMPO0xH- 2u2zPLK0FrGQtHftK2t3cZyHxbSwO8FOtk85w4v38+Db1xxfuAm+iNd370+/37pL5+riMr1kv+4x- T13y1Rihk9iQHTmjP3JSVS1YQWgp9H3hYyeYT8KlEyxmS0SWZI7cGcE4RNFkhieazw+aliuvCUu5- JfHDQFU3+ooid6u6Gv2smELei22HnTQve4EgsFCVIboVwLACijQ7coBp8M0K1Ui5Iz/tKbN06dCg- WHpUggu+Y4FWiJEHcJOsXaKP1+JRkkPnJD7KKByjLy8vafdv+R9f/Jhh+/93QyOpEqR8imAGMFLP- PJChoNkgfW3pm4ej4OZWBnSJYwsYoqU9aqigPSQcSygjFo68t49+jy14eg3cG1NZ1K1RR8pVeF1q- A51/aKyFXt0/W3dR4LX6TxK410D1NvrySY4RY6S/KsR8rTlERMjQ66+35Y9WGc2eFtwQ5EKWowUm- Cqb5egztqsyxac0l5u27mN7/QkfCyUY7AF5BYT6GntEgU4FNmxbMw9AwdkBEBu6ub57lihwa2UqC- gfB3oA3a3oStnnqLMmDSeTkTaqZTduJ73Yk9ewjU5aItp3Qpa5uODoKeXqsgsE+t1bBcFQOpsaAU- dY4SOHrEjdOotCIBY86BSa0ZWoeyty7TIT0j6pGLh7352Xd0T3YWk4U7my8np549gBti/DoC6CDj- r2PUTYiCfBI5/P/eS8uZtl+JIfP2PxMN4zAn2cE/Hg7aGv/caCz6o6f574phgx1Vwh8+xgG7jG+n- X7JgMo/uPpxvbtOVi9PbDqPqvFD+s78BAAD//wMAxyyLJusWAAA=- headers:- Cache-Control:- - max-age=0, private, must-revalidate- Content-Encoding:- - gzip- Content-Security-Policy:- - frame-ancestors 'self'- Content-Type:- - application/xml; charset=utf-8- Date:- - Wed, 26 Jun 2019 14:58:29 GMT- ETag:- - W/"56150bda74a4f07c25cb1c1b05c341cd"- Strict-Transport-Security:- - max-age=31536000; includeSubDomains- Transfer-Encoding:- - chunked- Vary:- - Accept-Encoding- X-Authentication:- - basic_auth- X-BroxyId:- - 01-1561561108.960-79.110.196.19-4474532- X-Content-Type-Options:- - nosniff- X-Frame-Options:- - SAMEORIGIN- X-Request-Id:- - 01-1561561108.960-79.110.196.19-4474532- X-Runtime:- - '0.603314'- X-User:- - wgs3tg8h39pyypyc- X-XSS-Protection:- - 1; mode=block- status:- code: 201- message: Created-version: 1diff --git a/saleor/payment/gateways/braintree/tests/cassettes/test_braintree/test_authorize_one_time.yaml b/saleor/payment/gateways/braintree/tests/cassettes/test_braintree/test_authorize_one_time.yamldeleted file mode 100644index 3046a62995..0000000000--- a/saleor/payment/gateways/braintree/tests/cassettes/test_braintree/test_authorize_one_time.yaml+++ /dev/null@@ -1,95 +0,0 @@-interactions:-- request:- body: <transaction><amount>80.00</amount><payment_method_nonce>fake-valid-nonce</payment_method_nonce><options><submit_for_settlement- type="boolean">false</submit_for_settlement><store_in_vault_on_success type="boolean">false</store_in_vault_on_success><three_d_secure><required- type="boolean">false</required></three_d_secure></options><order_id type="integer">1</order_id><billing><first_name>John</first_name><last_name>Doe</last_name><company>Mirumee- Software</company><postal_code>53-601</postal_code><street_address>Tęczowa- 7</street_address><extended_address></extended_address><locality>WROCŁAW</locality><region></region><country_code_alpha2>PL</country_code_alpha2></billing><risk_data><customer_ip></customer_ip></risk_data><customer><email>[email protected]</email></customer><type>sale</type></transaction>- headers:- Accept:- - application/xml- Accept-Encoding:- - gzip- Connection:- - keep-alive- Content-Length:- - '822'- Content-type:- - application/xml- User-Agent:- - Braintree Python 3.49.0- X-ApiVersion:- - '5'- method: POST- uri: https://api.sandbox.braintreegateway.com/merchants/9m6qhfxsqzm3cgzw/transactions- response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Au+h0qODiXwAA- AP//AwCzQks1ThUAAA==- headers:- Cache-Control:- - max-age=0, private, must-revalidate- Content-Encoding:- - gzip- Content-Security-Policy:- - frame-ancestors 'self'- Content-Type:- - application/xml; charset=utf-8- Date:- - Wed, 26 Jun 2019 14:57:24 GMT- ETag:- - W/"699549b866d4f0d64241106d9b3872ad"- Strict-Transport-Security:- - max-age=31536000; includeSubDomains- Transfer-Encoding:- - chunked- Vary:- - Accept-Encoding- X-Authentication:- - basic_auth- X-BroxyId:- - 01-1561561043.981-79.110.196.19-4468768- X-Content-Type-Options:- - nosniff- X-Frame-Options:- - SAMEORIGIN- X-Request-Id:- - 01-1561561043.981-79.110.196.19-4468768- X-Runtime:- - '0.367291'- X-User:- - wgs3tg8h39pyypyc- X-XSS-Protection:- - 1; mode=block- status:- code: 201- message: Created-version: 1diff --git a/saleor/payment/gateways/braintree/tests/cassettes/test_braintree/test_authorize_with_customer_id.yaml b/saleor/payment/gateways/braintree/tests/cassettes/test_braintree/test_authorize_with_customer_id.yamldeleted file mode 100644index 2f4d11f9ae..0000000000--- a/saleor/payment/gateways/braintree/tests/cassettes/test_braintree/test_authorize_with_customer_id.yaml+++ /dev/null@@ -1,96 +0,0 @@-interactions:-- request:- body: <transaction><amount>100.0</amount><customer_id>810066863</customer_id><options><submit_for_settlement- type="boolean">true</submit_for_settlement></options><order_id type="integer">1</order_id><billing><first_name>John</first_name><last_name>Doe</last_name><company>Mirumee- Software</company><postal_code>53-601</postal_code><street_address>Tęczowa- 7</street_address><extended_address></extended_address><locality>WROCŁAW</locality><region></region><country_code_alpha2>PL</country_code_alpha2></billing><risk_data><customer_ip></customer_ip></risk_data><customer><email>[email protected]</email></customer><type>sale</type></transaction>- headers:- Accept:- - application/xml- Accept-Encoding:- - gzip- Connection:- - keep-alive- Content-Length:- - '647'- Content-type:- - application/xml- User-Agent:- - Braintree Python 3.49.0- X-ApiVersion:- - '5'- method: POST- uri: https://api.sandbox.braintreegateway.com/merchants/9m6qhfxsqzm3cgzw/transactions- response:- body:- string: !!binary |- H4sIAA2PE10AA8RY23LbNhB9z1dolJm80SQlWZETmWla124ydZxJnYv84gEJUIRNAgwA6uKv74I3- kSIoqzPt9E3cPVgAe8NZzd9tkniwIkJSzs6H7okzHBAWcEzZ8nz49fbSmg3feS/mSiAmUaAA5b0Y- DOYUe2cr4YfpTzm34UPLpEIqk57M/IQqRfB9yMW9JErFJCFMze0SoLFqmxJPopjM7fynlgWZELD3- 1qKSW3AE4v3+9cvc7oo1GCU8Y8pzHefEceZ2+ak1CRFBhJiyUBBooQXHS6jIEkIkD9UaCdjUBMrv- kPmWQTdgND4fKpGRoV1sgqQi4igoFxiQYN+d2/Xv/L6CIHCThdRA++B8iOFT0YQMvZHjnlnO1BpN- b93TN6PZG3d8B56oF+TrsxT/s/W7BaW/peJwA/1RhHQG7pxOZ9NxFVMQh1RIZTGUkP2bgTJG/bqA- JyliW4OGJIjGniJS/UI2KEljcgLguV3IC8ya+JIqk9004swkD9HGIF3G3Eexdvli/O0JX52pux8f- w5uL39fXF4vRzcXiaW7vMNotdtMvc5/GMdRC7SPTxrWHvI88YnO7Idhzk3fBIfl2ny1PeddFlg7+- qtO00hQ4qQQhkGsYCyKld/vq5Wjmvg2e+BoNXuvyaqlLX28UYVgHvRCbgsgDFFO19b5/ufnt1cvx- yH37/jucshIXKEGWUPymeHCo67iozNOxNXUgz5uy6o5QHmJbXPszjxHD+noNYRunl1ooTiM08j7/- uYM25X0rxt7nG+OSsWkJA58LGnhTd7q3ptLkWdFIBPBFmDFsKvZaI8uaREKgbUsJsWh0U5ORFAlF- wX273rm3wmQcZSrigj49b75h1kcqiIyYiKbp0Xn/r3WGdgqbWsfx6WxQHZPDxvPu0vSAupGaR6HG- z6HK/OsEx25Gp2zjVkhJjGWZCytpESG4sMBHKWeSGK+W4xpXb6O9a3hWDwIqE+2oma0cxOTXWK32- pB+gHDtCDV3CK7ZGW9A8kCLL4WGU3cDOU8ED2A38UFUHyuG5pcXl7a9jaJsHQ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OtoLet5WTmCfs1WzXBUBqbGg- FHWOEjh6yI3TqLRCAWPOgUmtHlr7srcq0z49I2rNxePe/Ow5uic709HUPR3N3PHc7sH1MX4dAXSQ- 8VcxaidETj6J7P9/77XljJuvRN/y5j8TNeMwJ9nBPx4OrjX+uVGv6I6e5r8r+hfsqBL+42Pks0/R- Yvwl9Uen4c2Pu+0iuVsHP65bjKr1Qnkv/gYAAP//AwDwN4xn6xYAAA==- headers:- Cache-Control:- - max-age=0, private, must-revalidate- Content-Encoding:- - gzip- Content-Security-Policy:- - frame-ancestors 'self'- Content-Type:- - application/xml; charset=utf-8- Date:- - Wed, 26 Jun 2019 15:28:13 GMT- ETag:- - W/"28e2684be1cc92eb4a235606b105596c"- Strict-Transport-Security:- - max-age=31536000; includeSubDomains- Transfer-Encoding:- - chunked- Vary:- - Accept-Encoding- X-Authentication:- - basic_auth- X-BroxyId:- - 01-1561562892.756-79.110.196.19-4630334- X-Content-Type-Options:- - nosniff- X-Frame-Options:- - SAMEORIGIN- X-Request-Id:- - 01-1561562892.756-79.110.196.19-4630334- X-Runtime:- - '0.707386'- X-User:- - wgs3tg8h39pyypyc- X-XSS-Protection:- - 1; mode=block- status:- code: 201- message: Created-version: 1diff --git a/saleor/payment/gateways/braintree/tests/cassettes/test_braintree/test_capture.yaml b/saleor/payment/gateways/braintree/tests/cassettes/test_braintree/test_capture.yamldeleted file mode 100644index cf16b0b389..0000000000--- a/saleor/payment/gateways/braintree/tests/cassettes/test_braintree/test_capture.yaml+++ /dev/null@@ -1,91 +0,0 @@-interactions:-- request:- body: <transaction><amount>80.00</amount></transaction>- headers:- Accept:- - application/xml- Accept-Encoding:- - gzip- Connection:- - keep-alive- Content-Length:- - '49'- Content-type:- - application/xml- User-Agent:- - Braintree Python 3.49.0- X-ApiVersion:- - '5'- method: PUT- uri: https://api.sandbox.braintreegateway.com/merchants/9m6qhfxsqzm3cgzw/transactions/m30bcfym/submit_for_settlement- response:- body:- string: !!binary |- H4sIAICXFF0AA+x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P//AwDsdykahxYAAA==- headers:- Cache-Control:- - max-age=0, private, must-revalidate- Content-Encoding:- - gzip- Content-Security-Policy:- - frame-ancestors 'self'- Content-Type:- - application/xml; charset=utf-8- Date:- - Thu, 27 Jun 2019 10:16:32 GMT- ETag:- - W/"7a366120ce51506866b65bb1c9efd773"- Strict-Transport-Security:- - max-age=31536000; includeSubDomains- Transfer-Encoding:- - chunked- Vary:- - Accept-Encoding- X-Authentication:- - basic_auth- X-BroxyId:- - 02-1561630591.877-79.110.196.19-1517576- X-Content-Type-Options:- - nosniff- X-Frame-Options:- - SAMEORIGIN- X-Request-Id:- - 02-1561630591.877-79.110.196.19-1517576- X-Runtime:- - '0.436030'- X-User:- - wgs3tg8h39pyypyc- X-XSS-Protection:- - 1; mode=block- status:- code: 200- message: OK-version: 1diff --git a/saleor/payment/gateways/braintree/tests/cassettes/test_braintree/test_capture_incorrect_token.yaml b/saleor/payment/gateways/braintree/tests/cassettes/test_braintree/test_capture_incorrect_token.yamldeleted file mode 100644index 6a6c7c4c04..0000000000--- a/saleor/payment/gateways/braintree/tests/cassettes/test_braintree/test_capture_incorrect_token.yaml+++ /dev/null@@ -1,59 +0,0 @@-interactions:-- request:- body: <transaction><amount>80.00</amount></transaction>- headers:- Accept:- - application/xml- Accept-Encoding:- - gzip- Connection:- - keep-alive- Content-Length:- - '49'- Content-type:- - application/xml- User-Agent:- - Braintree Python 3.49.0- X-ApiVersion:- - '5'- method: PUT- uri: https://api.sandbox.braintreegateway.com/merchants/9m6qhfxsqzm3cgzw/transactions/12345/submit_for_settlement- response:- body:- string: !!binary |- H4sIAMmsFF0AAwAAAP//AwAAAAAAAAAAAA==- headers:- Cache-Control:- - no-cache- Content-Encoding:- - gzip- Content-Security-Policy:- - frame-ancestors 'self'- Content-Type:- - application/xml; charset=utf-8- Date:- - Thu, 27 Jun 2019 11:47:21 GMT- Strict-Transport-Security:- - max-age=31536000; includeSubDomains- Transfer-Encoding:- - chunked- Vary:- - Accept-Encoding- X-Authentication:- - basic_auth- X-BroxyId:- - 02-1561636040.719-79.110.196.19-2068338- X-Content-Type-Options:- - nosniff- X-Frame-Options:- - SAMEORIGIN- X-Request-Id:- - 02-1561636040.719-79.110.196.19-2068338- X-Runtime:- - '0.079389'- X-XSS-Protection:- - 1; mode=block- status:- code: 404- message: Not Found-version: 1diff --git a/saleor/payment/gateways/braintree/tests/cassettes/test_braintree/test_list_customer_sources.yaml b/saleor/payment/gateways/braintree/tests/cassettes/test_braintree/test_list_customer_sources.yamldeleted file mode 100644index 0b5e698572..0000000000--- a/saleor/payment/gateways/braintree/tests/cassettes/test_braintree/test_list_customer_sources.yaml+++ /dev/null@@ -1,74 +0,0 @@-interactions:-- request:- body: null- headers:- Accept:- - application/xml- Accept-Encoding:- - gzip- Connection:- - keep-alive- Content-type:- - application/xml- User-Agent:- - Braintree Python 3.49.0- X-ApiVersion:- - '5'- method: GET- uri: https://api.sandbox.braintreegateway.com/merchants/9m6qhfxsqzm3cgzw/customers/595109854- response:- body:- string: !!binary |- H4sIALIJGl0AA6RUTW/jOAy991cEvqv+aBI4hePOALsNsMC2h207214GtEXH2ujDleQ06a8f2Y5j- p2kPi7mJ7z1SFEUyudkJPtmiNkzJpRdeBt4EZa4ok+ul9/hwS2LvJr1I8tpYJVCnF5NJwmg6W8zC- YBHPponvrAZ0ZF6CtMTZCzF/LYudeX0XV/n6/S3xx2yjLpg2lkgQOJGMLz2ra/T8luLwFZMrUYHc- n+EogPHUorHfcAei4njppInf4Y2iKpU8j1fA7gx7w8ww+8ndGsEiJWAndl/h0qPOtEygl0ZBuCDB- nETzh3B6PYuvo8VL4g8OrX9d0f/nPzh097cfQAqGnJoupTVXGfCmos9XT+90tbAv//5V3D1swr8f- vs/u/3gMEn/QHB5BmSU5aGoOaYDWsPca9pTvEIdlTKbTIIziOPGbc483ItLESJ+YAffeoz1WlIpT- 1J9+Z6dRomkNBjx9lBup3qSLNGCDrJZW74kqCDOmBpnjWH9OHh1/79u6GIfeJ6d9P4bPpFzlYN1I- pY//jJRHtNdTzJgdXtKZA1lAzfvEM6U4gvTSpoKNtCUHca3d7xCN65o3DxgF/cj0LrirmG7zIUJJ- W6Zh5GbmI/iJeo+gXfmi4ETeoidqpB9zL4AbPHiNMhm6NF/dzrIfTzVdhZyuyu3L7eK/5zAO7ld3- 4k7++aGhW+cSgdvSNduoJUZYL2MC1khqzdPS2spc+z4Yg9ZcZhqY6x/EtavOG+yb3eFXsBco7U+B- tlT0J1dr5W9dn19Wcn2Dcsu0ko1gaUDSTO3cGjzGP97omtGtUZKB3AypnaC9tN150zSM4zDxD0bP- uVS04qP56IGjQGMFriB3ynGH88ApWuft2h38B6yXmTozuWZV85Gnm2EYVas26FZBnBfz18TvrJ6r- JXutkchaZO1AuMowt6p0SoNsFuVxkM2nMWCMMwinSGkORTSlUTNGX7oeY//e5mxjbFEKRQzdfNGQ- R37koV0a3bh+WpF2VYy35QlgWgQo1ei67CzAsBPSi18AAAD//wMAbbQ9a4MHAAA=- headers:- Cache-Control:- - max-age=0, private, must-revalidate- Content-Encoding:- - gzip- Content-Security-Policy:- - frame-ancestors 'self'- Content-Type:- - application/xml; charset=utf-8- Date:- - Mon, 01 Jul 2019 13:25:06 GMT- ETag:- - W/"fa7463946d8a584cba7f76b35320371b"- Strict-Transport-Security:- - max-age=31536000; includeSubDomains- Transfer-Encoding:- - chunked- Vary:- - Accept-Encoding- X-Authentication:- - basic_auth- X-BroxyId:- - 01-1561987505.981-79.110.196.19-688015- X-Content-Type-Options:- - nosniff- X-Frame-Options:- - SAMEORIGIN- X-Request-Id:- - 01-1561987505.981-79.110.196.19-688015- X-Runtime:- - '0.148342'- X-User:- - wgs3tg8h39pyypyc- X-XSS-Protection:- - 1; mode=block- status:- code: 200- message: OK-version: 1diff --git a/saleor/payment/gateways/braintree/tests/cassettes/test_braintree/test_refund.yaml b/saleor/payment/gateways/braintree/tests/cassettes/test_braintree/test_refund.yamldeleted file mode 100644index 29a90eb5ff..0000000000--- a/saleor/payment/gateways/braintree/tests/cassettes/test_braintree/test_refund.yaml+++ /dev/null@@ -1,91 +0,0 @@-interactions:-- request:- body: <transaction><amount>10.00</amount></transaction>- headers:- Accept:- - application/xml- Accept-Encoding:- - gzip- Connection:- - keep-alive- Content-Length:- - '49'- Content-type:- - application/xml- User-Agent:- - Braintree Python 3.49.0- X-ApiVersion:- - '5'- method: POST- uri: https://api.sandbox.braintreegateway.com/merchants/9m6qhfxsqzm3cgzw/transactions/rjfqmf3r/refund- response:- body:- string: !!binary |- H4sIAHyMFF0AA6xYWW/bOBB+768wXKBvjHwkadIq6hZ7YFts26DbNu2+BJQ0shhLpEJSPvrrd6hb- FuV4gX2zZj4eM5zjG7tvdmky2YBUTPCb6fxsNp0AD0TI+Opm+vXLH+Rq+sZ75mpJuaKBRpT3bDJx- Wehdvnx83KXq2nXww8iUpjpXnsr9lGkN4X0k5L0CrRNIgWvXqQAGq/cZeIGEkKG8+DDSIJcST98T- pgTBS4D3+9fPrjMUGzBNRc61N5+dzWauU30ZRQoyiCnXhAaBERK8X8pkngIoEektleA6NlBhRO4T- i27CWXIz1TKHqVMeQpUGeRJUyBCRuP/cdZrfhbkSKPqJUD0xLriZhvipWQpTbzGbX5PZJVm8/DK7- frW4frWc/4OOaBYU6/MsPH39Ate3Cyp3Ky3QAvNRvOnh1VEYMak04TQFizKh47pApBnle4sGUsoS- T4PSv8COplkCZwh2nVJeYrbgK6Zt+2ax4DZ5RHcDzztdC12fJQmG9WnWeu9FzF2nIzgw2ftNYBi1- nz2rvQ9lvE3+bgKu1pQ4pSUARk0YSlDK+/Li+eJq/jr4KbZ08tJkSk9d+W2ngYfm+Uqx7UFEQBOm- 997d50+/vni+XMxfv73DW9biEiVhhXls863AFE3KFLtYkssZRmxXVtuIgS73pdm3IqE8NOZ1hH2c- WUpoksV04d3+1UK78rEVS+/2k3XJ0raEo88lC7zL+eXBmlpTREUnENAXUc5DW9o2GlVlF5WS7ntK- fItOYTRpLR+ixzRaStcZQ5jVGZWaoVPb4niAsh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/YruxPMtxrj4yPJRNkIYP2NrMehu2akeEceR0- eTmdtH/X3Jva4zpjoD5d6jilz6q6hGkU9PReBcV6aq+Gh+kYGy/BtDPxCnj1SFjnIkUiiYT7yMzQ- jE9j0Vun5Jieg94KuX5qkrOxSuNlmqFmM8Y763foP3pBgkCZf4tGRt2m49mj4ujMenStdRZuVnjh- n+9jn3+Mfyw/Z/7iIgrSLA3u5umH5buRObpde2QyHm3gbWv3gvRbGt5drL///LEMvv9x7n//cOE6- ne17fcZ79i8AAAD//wMAWT2eIDAVAAA=- headers:- Cache-Control:- - max-age=0, private, must-revalidate- Content-Encoding:- - gzip- Content-Security-Policy:- - frame-ancestors 'self'- Content-Type:- - application/xml; charset=utf-8- Date:- - Thu, 27 Jun 2019 09:29:32 GMT- ETag:- - W/"b388a46c06219ff1b5c06ca13a829475"- Strict-Transport-Security:- - max-age=31536000; includeSubDomains- Transfer-Encoding:- - chunked- Vary:- - Accept-Encoding- X-Authentication:- - basic_auth- X-BroxyId:- - 01-1561627771.449-79.110.196.19-157306- X-Content-Type-Options:- - nosniff- X-Frame-Options:- - SAMEORIGIN- X-Request-Id:- - 01-1561627771.449-79.110.196.19-157306- X-Runtime:- - '0.470029'- X-User:- - wgs3tg8h39pyypyc- X-XSS-Protection:- - 1; mode=block- status:- code: 201- message: Created-version: 1diff --git a/saleor/payment/gateways/braintree/tests/cassettes/test_braintree/test_refund_incorrect_token.yaml b/saleor/payment/gateways/braintree/tests/cassettes/test_braintree/test_refund_incorrect_token.yamldeleted file mode 100644index be7f93ce15..0000000000--- a/saleor/payment/gateways/braintree/tests/cassettes/test_braintree/test_refund_incorrect_token.yaml+++ /dev/null@@ -1,59 +0,0 @@-interactions:-- request:- body: <transaction><amount>10.00</amount></transaction>- headers:- Accept:- - application/xml- Accept-Encoding:- - gzip- Connection:- - keep-alive- Content-Length:- - '49'- Content-type:- - application/xml- User-Agent:- - Braintree Python 3.49.0- X-ApiVersion:- - '5'- method: POST- uri: https://api.sandbox.braintreegateway.com/merchants/9m6qhfxsqzm3cgzw/transactions/token/refund- response:- body:- string: !!binary |- H4sIAFGRFF0AAwAAAP//AwAAAAAAAAAAAA==- headers:- Cache-Control:- - no-cache- Content-Encoding:- - gzip- Content-Security-Policy:- - frame-ancestors 'self'- Content-Type:- - application/xml; charset=utf-8- Date:- - Thu, 27 Jun 2019 09:50:09 GMT- Strict-Transport-Security:- - max-age=31536000; includeSubDomains- Transfer-Encoding:- - chunked- Vary:- - Accept-Encoding- X-Authentication:- - basic_auth- X-BroxyId:- - 01-1561629008.541-79.110.196.19-1330461- X-Content-Type-Options:- - nosniff- X-Frame-Options:- - SAMEORIGIN- X-Request-Id:- - 01-1561629008.541-79.110.196.19-1330461- X-Runtime:- - '0.072617'- X-XSS-Protection:- - 1; mode=block- status:- code: 404- message: Not Found-version: 1diff --git a/saleor/payment/gateways/braintree/tests/cassettes/test_braintree/test_void.yaml b/saleor/payment/gateways/braintree/tests/cassettes/test_braintree/test_void.yamldeleted file mode 100644index c6ef5b1777..0000000000--- a/saleor/payment/gateways/braintree/tests/cassettes/test_braintree/test_void.yaml+++ /dev/null@@ -1,91 +0,0 @@-interactions:-- request:- body: null- headers:- Accept:- - application/xml- Accept-Encoding:- - gzip- Connection:- - keep-alive- Content-Length:- - '0'- Content-type:- - application/xml- User-Agent:- - Braintree Python 3.49.0- X-ApiVersion:- - '5'- method: PUT- uri: https://api.sandbox.braintreegateway.com/merchants/9m6qhfxsqzm3cgzw/transactions/narvpy2m/void- response:- body:- string: !!binary |- H4sIAJmwFF0AA8RY23LbNhB991dolJm8wRQly3YdmmnaNJNmmksTp5n2JQOSKxExCbAAKEv5+i4I- kiJFUNZ0OtM3cffgsou9nFXwfJtnkw1IxQS/nfrns+kEeCwSxte30893r8j19Hl4FmhJuaKxRlR4- NpkELAk5lZtiN88DDz+MTGmqSxVuBEsgCbz602j0roBQ0QwCr/ppZHEpJZ60I0wJggdC+Mvnj4E3- FBswzUXJdXg9O5/NAq/+MoocZJxSrgm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elvk1+3+ddmTUFDkle+EiUT722pSoJlO8cYQfub3XDwg- renILCiBiOm93n7WqlLiG2I4rsvMsMcO6lDT9gRDi7Ht7aEdWX1fupMi6yAaQe0+pUqsitjV+P0e- 05P2q6xYEaOlPIbuqUNl4y6RlHHF+vc32MssaJ2JCPPP2TEbvm+i1KEuOfu7hDopcQd8O4ZlfZCf- JtuB54Ko5H4kC1t9TWn7WVhPWCRlGKly12MTbSeuEIAb1W9qUhfHBFTkxYmjR4tvd6hnuT1Z6Y53- 1kcjE5r1kEJa/i2RdE053ONsoppBxNyuQ3uUwEIHIS0Y3mIotzZ6QyP/td29kWnU7uFI+7/b3Erq- YLBtAvm5kxaWkYolK0apZUfflvWKN5MCqYxICLI3YtznbAA9JF5LaicWr3xwjumVBNuigxcnTFVJ- 59SB3UU0tX2kLo+Nj1hJh3frb4qc0/wTgXaNZGqrt+0ypZzDcFd8843p7yuAsc5sjhUPxL7mQItu- iEqpLO1PQOPU3IyIfZX7bTozg/v4Pmbw58uJcNgaB2CPku5rmPkJIxWZrmvDMo4dIwG+yIjtxvKi- 1HBsnLLtnybfsKmb9S5s3YgJ48hySzuvGR5iq+5XU3UDbwzU54kdp/TpZJcqjoIe36sil4/t1TJQ- nSLlIJiKJkYBr74SzklRkZXEEeTIFNUOlGPR26TpmJ6DfhDy/mC2DWemAM8u55f+xdL3l4E3ghtj- 4+YF6FE23rxRPyAqaghq/F+0KzJbdFvh2PLuvwYtdXAH2dE/BY6udf7xMEpUxv5KGF/QasLk9Zs0- 4u/SPxcfi2i+XEX5q13Cf1q+zbGx7WFnvQ4Vnv0DAAD//wMAlbC0Mz4WAAA=- headers:- Cache-Control:- - max-age=0, private, must-revalidate- Content-Encoding:- - gzip- Content-Security-Policy:- - frame-ancestors 'self'- Content-Type:- - application/xml; charset=utf-8- Date:- - Thu, 27 Jun 2019 12:03:37 GMT- ETag:- - W/"f01d9b3327e8588400a4d6abd49138e1"- Strict-Transport-Security:- - max-age=31536000; includeSubDomains- Transfer-Encoding:- - chunked- Vary:- - Accept-Encoding- X-Authentication:- - basic_auth- X-BroxyId:- - 02-1561637017.231-79.110.196.19-2159579- X-Content-Type-Options:- - nosniff- X-Frame-Options:- - SAMEORIGIN- X-Request-Id:- - 02-1561637017.231-79.110.196.19-2159579- X-Runtime:- - '0.314119'- X-User:- - wgs3tg8h39pyypyc- X-XSS-Protection:- - 1; mode=block- status:- code: 200- message: OK-version: 1diff --git a/saleor/payment/gateways/braintree/tests/cassettes/test_braintree/test_void_incorrect_token.yaml b/saleor/payment/gateways/braintree/tests/cassettes/test_braintree/test_void_incorrect_token.yamldeleted file mode 100644index 97e74526b9..0000000000--- a/saleor/payment/gateways/braintree/tests/cassettes/test_braintree/test_void_incorrect_token.yaml+++ /dev/null@@ -1,59 +0,0 @@-interactions:-- request:- body: null- headers:- Accept:- - application/xml- Accept-Encoding:- - gzip- Connection:- - keep-alive- Content-Length:- - '0'- Content-type:- - application/xml- User-Agent:- - Braintree Python 3.49.0- X-ApiVersion:- - '5'- method: PUT- uri: https://api.sandbox.braintreegateway.com/merchants/9m6qhfxsqzm3cgzw/transactions/incorrect_token/void- response:- body:- string: !!binary |- H4sIAD/GFF0AAwAAAP//AwAAAAAAAAAAAA==- headers:- Cache-Control:- - no-cache- Content-Encoding:- - gzip- Content-Security-Policy:- - frame-ancestors 'self'- Content-Type:- - application/xml; charset=utf-8- Date:- - Thu, 27 Jun 2019 13:35:59 GMT- Strict-Transport-Security:- - max-age=31536000; includeSubDomains- Transfer-Encoding:- - chunked- Vary:- - Accept-Encoding- X-Authentication:- - basic_auth- X-BroxyId:- - 02-1561642559.027-79.110.196.19-2739397- X-Content-Type-Options:- - nosniff- X-Frame-Options:- - SAMEORIGIN- X-Request-Id:- - 02-1561642559.027-79.110.196.19-2739397- X-Runtime:- - '0.078084'- X-XSS-Protection:- - 1; mode=block- status:- code: 404- message: Not Found-version: 1diff --git a/saleor/payment/gateways/braintree/tests/test_braintree.py b/saleor/payment/gateways/braintree/tests/test_braintree.pydeleted file mode 100644index 1d7990ea41..0000000000--- a/saleor/payment/gateways/braintree/tests/test_braintree.py+++ /dev/null@@ -1,464 +0,0 @@-from decimal import Decimal-from unittest.mock import Mock, patch--import graphene-import pytest-from braintree import Environment, ErrorResult, SuccessfulResult, Transaction-from braintree.errors import Errors-from braintree.validation_error import ValidationError-from django.core.exceptions import ImproperlyConfigured--from ....interface import CustomerSource, GatewayConfig, PaymentMethodInfo, TokenConfig-from ....utils import create_payment_information-from .. import (- TransactionKind,- authorize,- capture,- extract_gateway_response,- get_braintree_gateway,- get_client_token,- get_customer_data,- get_error_for_client,- list_client_sources,- refund,- void,-)-from ..errors import DEFAULT_ERROR_MESSAGE, BraintreeException--DEFAULT_ERROR = "Unable to process transaction. Please try again in a moment"---def braintree_success_response():- return Mock(- spec=SuccessfulResult,- is_success=True,- transaction=Mock(- id="1x02131",- spec=Transaction,- amount=Decimal("80.00"),- created_at="2018-10-20 18:34:22",- credit_card="", # FIXME we should provide a proper CreditCard mock- customer_details=Mock(id=None),- additional_processor_response="",- gateway_rejection_reason="",- processor_response_code="1000",- processor_response_text="Approved",- processor_settlement_response_code="",- processor_settlement_response_text="",- risk_data="",- currency_iso_code="EUR",- status="authorized",- ),- )---def braintree_error():- return Mock(- spec=ValidationError,- code="91507",- attribute="base",- message="Cannot submit for settlement unless status is authorized.",- )---def braintree_error_response(braintree_error):- return Mock(- spec=ErrorResult,- is_success=False,- transaction=None,- errors=Mock(spec=Errors, deep_errors=[braintree_error]),- )---def gateway_config():- return GatewayConfig(- gateway_name="braintree",- auto_capture=False,- store_customer=False,- connection_params={- "sandbox_mode": False,- "merchant_id": "123",- "public_key": "456",- "private_key": "789",- "merchant_account_id": "",- },- supported_currencies="USD",- )---def test_get_customer_data(payment_dummy):- payment = payment_dummy- payment_info = create_payment_information(payment)- result = get_customer_data(payment_info)- payment_global_id = graphene.Node.to_global_id("Payment", payment.id)- expected_result = {- "order_id": payment_global_id,- "billing": {- "first_name": payment.billing_first_name,- "last_name": payment.billing_last_name,- "company": payment.billing_company_name,- "postal_code": payment.billing_postal_code,- "street_address": payment.billing_address_1[:255],- "extended_address": payment.billing_address_2[:255],- "locality": payment.billing_city,- "region": payment.billing_country_area,- "country_code_alpha2": payment.billing_country_code,- },- "risk_data": {"customer_ip": payment.customer_ip_address or ""},- "customer": {"email": payment.billing_email},- }- assert result == expected_result---def test_get_error_for_client(braintree_error, monkeypatch):- # no error- assert get_error_for_client([]) == ""-- error = {"code": braintree_error.code, "message": braintree_error.message}-- # error not whitelisted- monkeypatch.setattr("saleor.payment.gateways.braintree.ERROR_CODES_WHITELIST", {})- assert get_error_for_client([error]) == DEFAULT_ERROR-- monkeypatch.setattr(- "saleor.payment.gateways.braintree.ERROR_CODES_WHITELIST",- {braintree_error.code: ""},- )- assert get_error_for_client([error]) == braintree_error.message-- monkeypatch.setattr(- "saleor.payment.gateways.braintree.ERROR_CODES_WHITELIST",- {braintree_error.code: "Error msg override"},- )- assert get_error_for_client([error]) == "Error msg override"---def test_extract_gateway_response(braintree_success_response):- result = extract_gateway_response(braintree_success_response)- t = braintree_success_response.transaction- expected_result = {- "currency": t.currency_iso_code,- "amount": t.amount,- "credit_card": t.credit_card,- "errors": [],- "transaction_id": t.id,- "customer_id": None,- }- assert result == expected_result---def test_extract_gateway_response_no_transaction(- braintree_error_response, braintree_error-):- result = extract_gateway_response(braintree_error_response)- assert result == {- "errors": [{"code": braintree_error.code, "message": braintree_error.message}]- }---def test_get_braintree_gateway(gateway_config):- connection_params = gateway_config.connection_params- result = get_braintree_gateway(**gateway_config.connection_params)- assert connection_params["sandbox_mode"] is False- assert result.config.environment == Environment.Production- assert result.config.merchant_id == connection_params["merchant_id"]- assert result.config.public_key == connection_params["public_key"]- assert result.config.private_key == connection_params["private_key"]---def test_get_braintree_gateway_sandbox(gateway_config):- gateway_config.connection_params["sandbox_mode"] = True- result = get_braintree_gateway(**gateway_config.connection_params)- assert result.config.environment == Environment.Sandbox---def test_get_braintree_gateway_inproperly_configured(gateway_config):- gateway_config.connection_params["private_key"] = None- with pytest.raises(ImproperlyConfigured):- get_braintree_gateway(**gateway_config.connection_params)---@patch("saleor.payment.gateways.braintree.get_braintree_gateway")-def test_get_client_token(mock_gateway, gateway_config):- expected_token = "client-token"- mock_generate = Mock(return_value=expected_token)- mock_gateway.return_value = Mock(client_token=Mock(generate=mock_generate))- token = get_client_token(gateway_config)- mock_gateway.assert_called_once_with(**gateway_config.connection_params)- mock_generate.assert_called_once_with({})- assert token == expected_token---def gateway_config_with_merchant_account_id(gateway_config):- gateway_config.connection_params["merchant_account_id"] = "foobar"- return gateway_config---@patch("saleor.payment.gateways.braintree.get_braintree_gateway")-def test_get_client_token_with_merchant_account_id(- mock_gateway, gateway_config_with_merchant_account_id-):- expected_token = "client-token"- mock_generate = Mock(return_value=expected_token)- mock_gateway.return_value = Mock(client_token=Mock(generate=mock_generate))- token = get_client_token(gateway_config_with_merchant_account_id)- mock_gateway.assert_called_once_with(- **gateway_config_with_merchant_account_id.connection_params- )- mock_generate.assert_called_once_with({"merchant_account_id": "foobar"})- assert token == expected_token---def gateway_config_with_store_enabled(gateway_config):- gateway_config.store_customer = True- return gateway_config---@patch("saleor.payment.gateways.braintree.get_braintree_gateway")-def test_get_client_token_with_customer_id(- mock_gateway, gateway_config_with_store_enabled-):- expected_token = "client-token"- mock_generate = Mock(return_value=expected_token)- mock_gateway.return_value = Mock(client_token=Mock(generate=mock_generate))- token = get_client_token(- gateway_config_with_store_enabled, TokenConfig(customer_id="1234")- )- mock_gateway.assert_called_once_with(- **gateway_config_with_store_enabled.connection_params- )- mock_generate.assert_called_once_with({"customer_id": "1234"})- assert token == expected_token---def gateway_config_with_merchant_account_id_and_store_enabled(- gateway_config_with_merchant_account_id,-):- gateway_config_with_merchant_account_id.store_customer = True- return gateway_config_with_merchant_account_id---@patch("saleor.payment.gateways.braintree.get_braintree_gateway")-def test_get_client_token_with_customer_id_and_merchant_account_id(- mock_gateway, gateway_config_with_merchant_account_id_and_store_enabled-):- expected_token = "client-token"- mock_generate = Mock(return_value=expected_token)- mock_gateway.return_value = Mock(client_token=Mock(generate=mock_generate))- token = get_client_token(- gateway_config_with_merchant_account_id_and_store_enabled,- TokenConfig(customer_id="1234"),- )- mock_gateway.assert_called_once_with(- **gateway_config_with_merchant_account_id_and_store_enabled.connection_params- )- mock_generate.assert_called_once_with(- {- "customer_id": "1234",- "merchant_account_id": "foobar",- }- )- assert token == expected_token---@patch("saleor.payment.gateways.braintree.get_braintree_gateway")-def test_get_client_token_with_no_customer_id_when_disabled(- mock_gateway, gateway_config-):- expected_token = "client-token"- mock_generate = Mock(return_value=expected_token)- mock_gateway.return_value = Mock(client_token=Mock(generate=mock_generate))- token = get_client_token(gateway_config, TokenConfig(customer_id="1234"))- mock_gateway.assert_called_once_with(**gateway_config.connection_params)- mock_generate.assert_called_once_with({})- assert token == expected_token---@patch("saleor.payment.gateways.braintree.get_braintree_gateway")-def test_authorize_error_response(- mock_gateway, payment_dummy, braintree_error_response, gateway_config-):- payment = payment_dummy- payment_token = "payment-token"- mock_response = Mock(return_value=braintree_error_response)- mock_gateway.return_value = Mock(transaction=Mock(sale=mock_response))-- payment_info = create_payment_information(payment, payment_token)- response = authorize(payment_info, gateway_config)-- assert response.raw_response == extract_gateway_response(braintree_error_response)- assert not response.is_success- assert response.error == DEFAULT_ERROR---def sandbox_braintree_gateway_config(gateway_config):- """Set up your environment variables to record sandbox."""- gateway_config.connection_params = {- "merchant_id": "9m6qhfxsqzm3cgzw", # CHANGE WHEN RECORDING, DO NOT COMMIT- "public_key": "fake_public_key", # CHANGE WHEN RECORDING- "private_key": "fake_private_key", # CHANGE WHEN RECORDING- "sandbox_mode": True,- "merchant_account_id": "",- }- gateway_config.auto_capture = True- return gateway_config--[email protected](filter_headers=["authorization"], decode_compressed_response=True)-def test_authorize_one_time(- payment_dummy, sandbox_braintree_gateway_config, braintree_success_response-):- payment = payment_dummy-- payment_info = create_payment_information(payment, "fake-valid-nonce")- sandbox_braintree_gateway_config.auto_capture = False-- response = authorize(payment_info, sandbox_braintree_gateway_config)- assert not response.error- assert response.kind == TransactionKind.AUTH- assert response.amount == braintree_success_response.transaction.amount- assert response.currency == braintree_success_response.transaction.currency_iso_code- assert response.is_success is True- assert response.payment_method_info.last_4 == "1881"- assert response.payment_method_info.brand == "visa"- assert response.payment_method_info.type == "card"- assert response.payment_method_info.exp_month == "12"- assert response.payment_method_info.exp_year == "2020"--[email protected](filter_headers=["authorization"], decode_compressed_response=True)-def test_authorize_and_save_customer_id(- payment_dummy, sandbox_braintree_gateway_config-):- CUSTOMER_ID = "595109854" # retrieved from sandbox- payment = payment_dummy-- payment_info = create_payment_information(payment, "fake-valid-nonce")- payment_info.amount = 100.00- payment_info.reuse_source = True-- sandbox_braintree_gateway_config.store_customer = True- response = authorize(payment_info, sandbox_braintree_gateway_config)- assert not response.error- assert response.customer_id == CUSTOMER_ID--[email protected](filter_headers=["authorization"], decode_compressed_response=True)-def test_authorize_with_customer_id(payment_dummy, sandbox_braintree_gateway_config):- CUSTOMER_ID = "810066863" # retrieved from sandbox- payment = payment_dummy-- payment_info = create_payment_information(payment, None)- payment_info.amount = 100.00- payment_info.customer_id = CUSTOMER_ID-- response = authorize(payment_info, sandbox_braintree_gateway_config)- assert not response.error- assert response.customer_id == CUSTOMER_ID- assert response.is_success--[email protected](filter_headers=["authorization"], decode_compressed_response=True)-def test_refund(payment_txn_captured, sandbox_braintree_gateway_config):- amount = Decimal("10.00")- TRANSACTION_ID = "rjfqmf3r"- payment_info = create_payment_information(- payment_txn_captured, TRANSACTION_ID, amount- )- response = refund(payment_info, sandbox_braintree_gateway_config)- assert not response.error-- assert response.kind == TransactionKind.REFUND- assert response.amount == amount- assert response.currency == "EUR"- assert response.is_success is True--[email protected](filter_headers=["authorization"])-def test_refund_incorrect_token(payment_txn_captured, sandbox_braintree_gateway_config):- payment = payment_txn_captured- amount = Decimal("10.00")-- payment_info = create_payment_information(payment, "token", amount)- with pytest.raises(BraintreeException) as e:- refund(payment_info, sandbox_braintree_gateway_config)- assert str(e.value) == DEFAULT_ERROR_MESSAGE--[email protected](filter_headers=["authorization"], decode_compressed_response=True)-def test_capture(payment_txn_preauth, sandbox_braintree_gateway_config):- payment = payment_txn_preauth- amount = Decimal("80.00")-- payment_info = create_payment_information(payment, "m30bcfym", amount)- response = capture(payment_info, sandbox_braintree_gateway_config)- assert not response.error-- assert response.kind == TransactionKind.CAPTURE- assert response.amount == amount- assert response.currency == "EUR"- assert response.is_success is True--[email protected](filter_headers=["authorization"])-def test_capture_incorrect_token(payment_txn_preauth, sandbox_braintree_gateway_config):- payment_info = create_payment_information(payment_txn_preauth, "12345")- with pytest.raises(BraintreeException) as e:- capture(payment_info, sandbox_braintree_gateway_config)- assert str(e.value) == DEFAULT_ERROR_MESSAGE--[email protected](filter_headers=["authorization"], decode_compressed_response=True)-def test_void(payment_txn_preauth, sandbox_braintree_gateway_config):- payment = payment_txn_preauth- payment_info = create_payment_information(payment, "narvpy2m")- response = void(payment_info, sandbox_braintree_gateway_config)- assert not response.error-- assert response.kind == TransactionKind.VOID- assert response.is_success is True--[email protected](filter_headers=["authorization"])-def test_void_incorrect_token(payment_txn_preauth, sandbox_braintree_gateway_config):- payment = payment_txn_preauth-- payment_info = create_payment_information(payment, "incorrect_token")- with pytest.raises(BraintreeException) as e:- void(payment_info, sandbox_braintree_gateway_config)- assert str(e.value) == DEFAULT_ERROR_MESSAGE--[email protected](filter_headers=["authorization"], decode_compressed_response=True)-def test_list_customer_sources(sandbox_braintree_gateway_config):- CUSTOMER_ID = "595109854" # retrieved from sandbox- expected_credit_card = PaymentMethodInfo(- last_4="1881", exp_year=2020, exp_month=12, name=None- )- expected_customer_source = CustomerSource(- id="d0b52c80b648ae8e5a14eddcaf24d254",- gateway="braintree",- credit_card_info=expected_credit_card,- )- sources = list_client_sources(sandbox_braintree_gateway_config, CUSTOMER_ID)- assert sources == [expected_customer_source]diff --git a/saleor/payment/gateways/braintree/tests/test_errors.py b/saleor/payment/gateways/braintree/tests/test_errors.pydeleted file mode 100644index 3badea5ae5..0000000000--- a/saleor/payment/gateways/braintree/tests/test_errors.py+++ /dev/null@@ -1,33 +0,0 @@-import pytest-from braintree.exceptions.authentication_error import AuthenticationError-from braintree.exceptions.authorization_error import AuthorizationError-from braintree.exceptions.gateway_timeout_error import GatewayTimeoutError-from braintree.exceptions.not_found_error import NotFoundError-from braintree.exceptions.request_timeout_error import RequestTimeoutError-from braintree.exceptions.server_error import ServerError-from braintree.exceptions.service_unavailable_error import ServiceUnavailableError-from braintree.exceptions.too_many_requests_error import TooManyRequestsError-from braintree.exceptions.upgrade_required_error import UpgradeRequiredError-from django.core.exceptions import ValidationError--from saleor.payment.gateways.braintree import BraintreeException, handle_braintree_error--- "braintree_error",- [- AuthenticationError,- AuthorizationError,- NotFoundError,- RequestTimeoutError,- UpgradeRequiredError,- TooManyRequestsError,- ServerError,- ServiceUnavailableError,- GatewayTimeoutError,- ValidationError, # ensure that we can handle all type of errors- ],-)-def test_handle_braintree_error(braintree_error):- with pytest.raises(BraintreeException):- handle_braintree_error(braintree_error("Message"))diff --git a/saleor/settings.py b/saleor/settings.pyindex aea24a3c8b..b230d7c553 100644--- a/saleor/settings.py+++ b/saleor/settings.py@@ -928,7 +928,6 @@ BUILTIN_PLUGINS = ["saleor.payment.gateways.dummy.plugin.DeprecatedDummyGatewayPlugin","saleor.payment.gateways.dummy_credit_card.plugin.DeprecatedDummyCreditCardGatewayPlugin","saleor.payment.gateways.stripe.plugin.StripeGatewayPlugin",- "saleor.payment.gateways.braintree.plugin.DeprecatedBraintreeGatewayPlugin","saleor.payment.gateways.razorpay.plugin.DeprecatedRazorpayGatewayPlugin","saleor.plugins.user_email.plugin.UserEmailPlugin","saleor.plugins.admin_email.plugin.AdminEmailPlugin",diff --git a/uv.lock b/uv.lockindex f5358e2b1b..d64e2de2c5 100644--- a/uv.lock+++ b/uv.lock@@ -249,18 +249,6 @@ wheels = [{ url = "https://files.pythonhosted.org/packages/27/7e/6e64821077cd2efc4aa51b7d638fb6d48e1c7c450201c529fbaf1de8bfd3/botocore-1.43.14-py3-none-any.whl", hash = "sha256:1f4a2a95ea78c10398e78431e98c1fe47adb54a7b10a32975144c1f541186658", size = 15061424, upload-time = "2026-05-22T19:28:32.682Z" },]-[[package]]-name = "braintree"-version = "4.31.0"-source = { registry = "https://pypi.org/simple" }-dependencies = [- { name = "requests", marker = "platform_python_implementation != 'PyPy'" },-]-sdist = { url = "https://files.pythonhosted.org/packages/c4/0b/aa7b9074d0758165953ef6c62a96aacec888fd57138e0eb3f25be9515e67/braintree-4.31.0.tar.gz", hash = "sha256:de383469ae0f824efba7e2d726c13927090d6a9305e1c49de1cb258b2868d43d", size = 103599, upload-time = "2024-10-29T17:31:57.906Z" }-wheels = [- { url = "https://files.pythonhosted.org/packages/26/88/9397720744fc5f795eebbdbd3dd25daa394c31423929026626d22f85fb2d/braintree-4.31.0-py2.py3-none-any.whl", hash = "sha256:426011f92418703809007f387c3ce13b03535ad6f67244171ff2b417369e3693", size = 149758, upload-time = "2024-10-29T17:31:56.269Z" },-]-[[package]]name = "cachetools"version = "5.5.2"@@ -2497,7 +2485,6 @@ dependencies = [{ name = "babel", marker = "platform_python_implementation != 'PyPy'" },{ name = "boto3", marker = "platform_python_implementation != 'PyPy'" },{ name = "botocore", marker = "platform_python_implementation != 'PyPy'" },- { name = "braintree", marker = "platform_python_implementation != 'PyPy'" },{ name = "celery", extra = ["redis", "sqs"], marker = "platform_python_implementation != 'PyPy'" },{ name = "cryptography", marker = "platform_python_implementation != 'PyPy'" },{ name = "dj-database-url", marker = "platform_python_implementation != 'PyPy'" },@@ -2608,7 +2595,6 @@ requires-dist = [{ name = "babel", specifier = ">=2.18.0,<2.19" },{ name = "boto3", specifier = "~=1.43" },{ name = "botocore", specifier = "~=1.42" },- { name = "braintree", specifier = ">=4.2,<4.32" },{ name = "celery", extras = ["redis", "sqs"], specifier = ">=5.6.3,<6.0.0" },{ name = "cryptography", specifier = ">=49.0.0" },{ name = "dj-database-url", specifier = ">=3.1.2,<4" },