Skip to content

Commit fce1e1a

Browse files
braintreepsspikovski-pubklaguerrePay
committed
4.38.0
Co-authored-by: Sharon Pikovski <[email protected]> Co-authored-by: Kevin Laguerre <[email protected]>
1 parent aa072db commit fce1e1a

16 files changed

+164
-5
lines changed

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.38.0
4+
* Add `upcoming_retry_date` field to Transaction
5+
* Add `remaining_file_evidence_storage` to Dispute
6+
* Add `transaction_retried` webhook
7+
* Add AFT `transfer_type` to Transaction
8+
39
## 4.37.0
410
* Add Session Id to Customer Recommendations Payload
511

braintree/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
from braintree.transaction_gateway import TransactionGateway
7979
from braintree.transaction_line_item import TransactionLineItem
8080
from braintree.transaction_search import TransactionSearch
81+
from braintree.transfer import Transfer
8182
from braintree.unknown_payment_method import UnknownPaymentMethod
8283
from braintree.us_bank_account import UsBankAccount
8384
from braintree.validation_error_collection import ValidationErrorCollection

braintree/transaction.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
from braintree.successful_result import SuccessfulResult
4040
from braintree.three_d_secure_info import ThreeDSecureInfo
4141
from braintree.transaction_line_item import TransactionLineItem
42+
from braintree.transfer import Transfer
4243
from braintree.us_bank_account import UsBankAccount
4344
from braintree.venmo_account import VenmoAccount
4445
from braintree.visa_checkout_card import VisaCheckoutCard
@@ -105,6 +106,7 @@ class Transaction(Resource):
105106

106107
def __repr__(self):
107108
detail_list = [
109+
"account_funding_transaction",
108110
"acquirer_reference_number",
109111
"additional_processor_response",
110112
"amount",
@@ -163,6 +165,7 @@ def __repr__(self):
163165
"tax_amount",
164166
"tax_exempt",
165167
"type",
168+
"upcoming_retry_date",
166169
"updated_at",
167170
"voice_referral_number",
168171
]
@@ -471,6 +474,7 @@ def clone_signature():
471474
@staticmethod
472475
def create_signature():
473476
return [
477+
"account_funding_transaction",
474478
"amount",
475479
# NEXT_MAJOR_VERSION use google_pay_card in public API (map to android_pay_card internally)
476480
{"android_pay_card": ["number", "cryptogram", "expiration_month", "expiration_year", "eci_indicator", "source_card_type", "source_card_last_four", "google_transaction_id"]},
@@ -659,6 +663,11 @@ def create_signature():
659663
]
660664
},
661665
"transaction_source",
666+
{
667+
"transfer":[
668+
"type",
669+
]
670+
},
662671
"type", "venmo_sdk_payment_method_code", # NEXT_MJOR_VERSION remove venmo_sdk_payment_method_code
663672
]
664673

@@ -882,6 +891,8 @@ def __init__(self, gateway, attributes):
882891
self.network_transaction_id = attributes["network_transaction_id"]
883892
if "payment_facilitator" in attributes:
884893
self.payment_facilitator = PaymentFacilitator(attributes.pop("payment_facilitator"))
894+
if "transfer" in attributes:
895+
self.transfer = Transfer(attributes.pop("transfer"))
885896

886897
@property
887898
def vault_billing_address(self):

braintree/transfer.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from braintree.attribute_getter import AttributeGetter
2+
3+
class Transfer(AttributeGetter):
4+
def __init__(self, attributes):
5+
AttributeGetter.__init__(self, attributes)

braintree/version.py

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

braintree/webhook_notification.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class Kind(object):
6060
SubscriptionWentActive = "subscription_went_active"
6161
SubscriptionWentPastDue = "subscription_went_past_due"
6262
TransactionDisbursed = "transaction_disbursed"
63+
TransactionRetried = "transaction_retried"
6364
TransactionReviewed = "transaction_reviewed"
6465
TransactionSettled = "transaction_settled"
6566
TransactionSettlementDeclined = "transaction_settlement_declined"

braintree/webhook_testing_gateway.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ def __subject_sample_xml(self, kind, id):
4141
return self.__connected_merchant_paypal_status_changed_xml(id)
4242
elif kind == WebhookNotification.Kind.TransactionDisbursed:
4343
return self.__transaction_disbursed_sample_xml(id)
44+
elif kind == WebhookNotification.Kind.TransactionRetried:
45+
return self.__transaction_retried_sample_xml(id)
4446
elif kind == WebhookNotification.Kind.TransactionReviewed:
4547
return self.__transaction_reviewed_sample_xml(id)
4648
elif kind == WebhookNotification.Kind.TransactionSettled:
@@ -127,6 +129,18 @@ def __transaction_disbursed_sample_xml(self, id):
127129
</transaction>
128130
""" % id
129131

132+
def __transaction_retried_sample_xml(self, id):
133+
return """
134+
<transaction>
135+
<id>%s</id>
136+
<amount>100</amount>
137+
<status>submitted_for_settlement</status>
138+
<type>sale</type>
139+
<currency-iso-code>USD</currency-iso-code>
140+
<retried-transaction-id>original_txn_id</retried-transaction-id>
141+
</transaction>
142+
""" % id
143+
130144
def __transaction_reviewed_sample_xml(self, id):
131145
return """
132146
<transaction-review>

dev_requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
twine>=1.9,<2.0
1+
twine>=4.0,<6.0
22
-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.37.0",
15+
version="4.38.0",
1616
description="Braintree Python Library",
1717
long_description=long_description,
1818
author="Braintree",

tests/integration/test_disputes.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,31 @@ def test_find_returns_dispute_with_given_id(self):
277277
self.assertEqual(dispute.transaction.id, "open_disputed_transaction")
278278
self.assertEqual(None, dispute.transaction.installment_count)
279279
self.assertNotEqual(None, dispute.graphql_id)
280+
281+
def test_dispute_contains_remaining_file_evidence_storage(self):
282+
dispute = self.create_sample_dispute()
283+
284+
self.assertIsNotNone(dispute.remaining_file_evidence_storage)
285+
self.assertTrue(isinstance(dispute.remaining_file_evidence_storage, int))
286+
287+
def test_remaining_file_evidence_storage_changes_after_file_evidence_addition(self):
288+
dispute = self.create_sample_dispute()
289+
290+
initial_storage = dispute.remaining_file_evidence_storage
291+
self.assertIsNotNone(initial_storage)
292+
initial_storage_value = int(initial_storage)
293+
294+
document = self.create_evidence_document()
295+
296+
result = Dispute.add_file_evidence(dispute.id, document.id)
297+
self.assertTrue(result.is_success)
298+
299+
updated_dispute = Dispute.find(dispute.id)
300+
301+
self.assertIsNotNone(updated_dispute.remaining_file_evidence_storage)
302+
updated_storage_value = int(updated_dispute.remaining_file_evidence_storage)
303+
304+
self.assertLess(updated_storage_value, initial_storage_value)
280305

281306
def test_find_raises_error_when_dispute_not_found(self):
282307
with self.assertRaisesRegex(NotFoundError, "dispute with id 'invalid-id' not found"):

0 commit comments

Comments
 (0)