Skip to content

Commit a16c113

Browse files
braintreepsDavid Johnson
andcommitted
4.41.0
Co-authored-by: David Johnson <djohnson14@paypal.com>
1 parent 761857f commit a16c113

21 files changed

Lines changed: 270 additions & 184 deletions

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 4.41.0
4+
* Add extra fields in `sender` and `receiver` details in `transfer` to `Transaction`
5+
* Remove unused error code `AdjustmentAmountMustBeGreaterThanZero`
6+
* Removed `venmo_merchant_data` from `Transaction`
7+
* Filter CreditCardVerification.search() to only return credit card verifications
8+
39
## 4.40.0
410
* Add `payment_account_reference` to `Transaction::ApplePayCard`, `Transaction::AndroidPayCard`, `Transaction::CreditCard`, and `CreditCardVerification`
511
* Add `processing_merchant_category_code` field in `Transaction`

Jenkinsfile

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,15 @@ pipeline {
1010
SLACK_CHANNEL = "#auto-team-sdk-builds"
1111
}
1212

13+
options {
14+
buildDiscarder(logRotator(numToKeepStr: '50'))
15+
timestamps()
16+
timeout(time: 120, unit: 'MINUTES')
17+
}
18+
1319
stages {
1420
stage("Audit") {
1521
parallel {
16-
// Runs a static code analysis scan and posts results to the PayPal Polaris server
1722
stage("CodeQL") {
1823
agent {
1924
node {
@@ -36,5 +41,63 @@ pipeline {
3641
}
3742
}
3843
}
44+
45+
stage("SDK Tests") {
46+
when {
47+
branch 'master'
48+
}
49+
50+
parallel {
51+
stage("Python 3.5 Stretch") {
52+
agent {
53+
node {
54+
label ""
55+
customWorkspace "workspace/${REPO_NAME}"
56+
}
57+
}
58+
59+
steps {
60+
build job: 'python_3.5-stretch_server_sdk_master', wait: true
61+
}
62+
63+
post {
64+
failure {
65+
script {
66+
FAILED_STAGE = env.STAGE_NAME
67+
}
68+
}
69+
}
70+
}
71+
72+
stage("Python 3.12 Bullseye") {
73+
agent {
74+
node {
75+
label ""
76+
customWorkspace "workspace/${REPO_NAME}"
77+
}
78+
}
79+
80+
steps {
81+
build job: 'python_3.12-bullseye_server_sdk_master', wait: true
82+
}
83+
84+
post {
85+
failure {
86+
script {
87+
FAILED_STAGE = env.STAGE_NAME
88+
}
89+
}
90+
}
91+
}
92+
}
93+
}
94+
}
95+
96+
post {
97+
unsuccessful {
98+
slackSend color: "danger",
99+
channel: "${env.SLACK_CHANNEL}",
100+
message: "${env.JOB_NAME} - #${env.BUILD_NUMBER} Failure after ${currentBuild.durationString} at stage \"${FAILED_STAGE}\"(<${env.BUILD_URL}|Open>)"
101+
}
39102
}
40103
}

braintree/apple_pay_gateway.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from html import escape
1+
from urllib.parse import quote
22
from braintree.apple_pay_options import ApplePayOptions
33
from braintree.error_result import ErrorResult
44
from braintree.successful_result import SuccessfulResult
@@ -18,7 +18,7 @@ def register_domain(self, domain):
1818
return ErrorResult(self.gateway, response["api_error_response"])
1919

2020
def unregister_domain(self, domain):
21-
self.config.http().delete(self.config.base_merchant_path() + "/processing/apple_pay/unregister_domain?url=" + escape(domain))
21+
self.config.http().delete(self.config.base_merchant_path() + "/processing/apple_pay/unregister_domain?url=" + quote(domain))
2222
return SuccessfulResult()
2323

2424
def registered_domains(self):

braintree/credit_card_verification_gateway.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def __criteria(self, query):
3333
def __fetch(self, query, ids):
3434
criteria = self.__criteria(query)
3535
criteria["ids"] = CreditCardVerificationSearch.ids.in_list(ids).to_param()
36+
criteria["verification_type"] = ["credit_card"]
3637
response = self.config.http().post(self.config.base_merchant_path() + "/verifications/advanced_search", {"search": criteria})
3738
return [CreditCardVerification(self.gateway, item) for item in
3839
ResourceCollection._extract_as_array(response["credit_card_verifications"], "verification")]
@@ -42,7 +43,9 @@ def search(self, *query):
4243
if isinstance(query[0], list):
4344
query = query[0]
4445

45-
response = self.config.http().post(self.config.base_merchant_path() + "/verifications/advanced_search_ids", {"search": self.__criteria(query)})
46+
search_params = self.__criteria(query)
47+
search_params["verification_type"] = ["credit_card"]
48+
response = self.config.http().post(self.config.base_merchant_path() + "/verifications/advanced_search_ids", {"search": search_params})
4649
return ResourceCollection(query, response, self.__fetch)
4750

4851
def __fetch_verifications(self, query, verification_ids):

braintree/error_codes.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,6 @@ class Modification(object):
453453
IdToRemoveIsInvalid = "92025"
454454

455455
class Transaction(object):
456-
AdjustmentAmountMustBeGreaterThanZero = "95605"
457456
AmountCannotBeNegative = "81501"
458457
AmountDoesNotMatch3DSecureAmount = "91585"
459458
AmountIsInvalid = AmountFormatIsInvalid = "81503"

braintree/transaction.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -581,12 +581,6 @@ def create_signature():
581581
"currency_amount",
582582
"currency_iso_code"
583583
],
584-
"venmo_merchant_data": [
585-
"venmo_merchant_public_id",
586-
"originating_transaction_id",
587-
"originating_merchant_id",
588-
"originating_merchant_kind"
589-
],
590584
"venmo": [
591585
"profile_id"
592586
],
@@ -670,8 +664,10 @@ def create_signature():
670664
{
671665
"sender": [
672666
"account_reference_number",
667+
"date_of_birth",
673668
"first_name",
674669
"last_name",
670+
"middle_name",
675671
"tax_id",
676672
{
677673
"address": [
@@ -686,6 +682,7 @@ def create_signature():
686682
"account_reference_number",
687683
"first_name",
688684
"last_name",
685+
"middle_name",
689686
"tax_id",
690687
{
691688
"address": [

braintree/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Version = "4.40.0"
1+
Version = "4.41.0"

dev_requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
twine>=4.0,<6.0
1+
twine>=1.15.0,<2.0; python_version < '3.6'
2+
twine>=4.0,<6.0; python_version >= '3.6'
23
-r requirements.txt

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
setup(
1414
name="braintree",
15-
version="4.40.0",
15+
version="4.41.0",
1616
description="Braintree Python Library",
1717
long_description=long_description,
1818
author="Braintree",

tests/integration/test_bank_account_instant_verification.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ def assert_has_attributes(self, obj, expected_attributes):
3535
self.assert_has_attributes(actual_value, expected_value)
3636
elif callable(expected_value):
3737
# Handle type checks and regex patterns
38-
self.assertTrue(expected_value(actual_value), f"Expected {key} to match predicate, got {actual_value}")
38+
self.assertTrue(expected_value(actual_value), "Expected {} to match predicate, got {}".format(key, actual_value))
3939
elif expected_value is not None:
40-
self.assertEqual(expected_value, actual_value, f"Expected {key} to be {expected_value}, got {actual_value}")
40+
self.assertEqual(expected_value, actual_value, "Expected {} to be {}, got {}".format(key, expected_value, actual_value))
4141
else:
42-
self.assertIsNotNone(actual_value, f"Expected {key} to not be None")
42+
self.assertIsNotNone(actual_value, "Expected {} to not be None".format(key))
4343

4444
def generate_us_bank_account_nonce_via_open_banking(self):
4545
config = Configuration(
@@ -87,7 +87,7 @@ def generate_us_bank_account_nonce_via_open_banking(self):
8787
'Content-Type': 'application/json',
8888
'Accept': 'application/json',
8989
'Braintree-Version': '2019-01-01',
90-
'User-Agent': f'Braintree Python Library {braintree.version.Version}',
90+
'User-Agent': 'Braintree Python Library {}'.format(braintree.version.Version),
9191
'X-ApiVersion': Configuration.api_version()
9292
}
9393

@@ -100,11 +100,11 @@ def generate_us_bank_account_nonce_via_open_banking(self):
100100
)
101101

102102
if response.status_code != 200:
103-
raise Exception(f'HTTP error {response.status_code}: {response.text}')
104-
103+
raise Exception('HTTP error {}: {}'.format(response.status_code, response.text))
104+
105105
response_data = response.json()
106106
if 'tenant_token' not in response_data:
107-
raise Exception(f'Open Banking tokenization failed: {response_data}')
107+
raise Exception('Open Banking tokenization failed: {}'.format(response_data))
108108

109109
return response_data['tenant_token']
110110

@@ -116,7 +116,7 @@ def test_create_jwt_creates_a_jwt_with_valid_request(self):
116116

117117
result = self.gateway.bank_account_instant_verification.create_jwt(request)
118118

119-
self.assertTrue(result.is_success, f"Expected success but got errors: {getattr(result, 'errors', 'none')}")
119+
self.assertTrue(result.is_success, "Expected success but got errors: {}".format(getattr(result, 'errors', 'none')))
120120
self.assertIsNotNone(result.bank_account_instant_verification_jwt)
121121
self.assertIsNotNone(result.bank_account_instant_verification_jwt.jwt)
122122
self.assertNotEqual("", result.bank_account_instant_verification_jwt.jwt)
@@ -167,7 +167,7 @@ def test_charge_us_bank_creates_transaction_directly_with_nonce_and_provides_ach
167167

168168
transaction_result = self.us_bank_gateway.transaction.sale(transaction_request)
169169

170-
self.assertTrue(transaction_result.is_success, f"Expected transaction success but got failure with validation errors")
170+
self.assertTrue(transaction_result.is_success, "Expected transaction success but got failure with validation errors")
171171
transaction = transaction_result.transaction
172172

173173
expected_transaction = {
@@ -210,7 +210,7 @@ def test_open_finance_flow_tokenizes_bank_account_via_open_finance_api_vaults_wi
210210
}
211211

212212
payment_method_result = self.us_bank_gateway.payment_method.create(payment_method_request)
213-
self.assertTrue(payment_method_result.is_success, f"Expected payment method creation success but got failure with validation errors")
213+
self.assertTrue(payment_method_result.is_success, "Expected payment method creation success but got failure with validation errors")
214214

215215
us_bank_account = payment_method_result.payment_method
216216

@@ -242,7 +242,7 @@ def test_open_finance_flow_tokenizes_bank_account_via_open_finance_api_vaults_wi
242242
}
243243

244244
transaction_result = self.us_bank_gateway.transaction.sale(transaction_request)
245-
self.assertTrue(transaction_result.is_success, f"Expected transaction success but got failure")
245+
self.assertTrue(transaction_result.is_success, "Expected transaction success but got failure")
246246
transaction = transaction_result.transaction
247247

248248
expected_transaction = {

0 commit comments

Comments
 (0)