Skip to content

Commit 3226649

Browse files
5.35.0
Co-authored-by: Kevin Laguerre <klaguerre@paypal.com>
1 parent f3685cc commit 3226649

16 files changed

+299
-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+
## 5.35.0
4+
- Add `UpcomingRetryDate` field to `Transaction`
5+
- Add `RemainingFileEvidenceStorage` to Dispute
6+
- Add transfer type to `Transaction`
7+
- Add `transaction_retried` webhook
8+
39
## 5.34.0
410
- Add Session Id to Customer Recommendations Payload
511

src/Braintree/Braintree.csproj

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,18 @@
44
<PropertyGroup>
55
<Description>Braintree Client Library</Description>
66
<Copyright>Copyright © Braintree, a division of PayPal, Inc. 2021</Copyright>
7-
<VersionPrefix>5.34.0</VersionPrefix>
7+
<VersionPrefix>5.35.0</VersionPrefix>
88
<Authors>Braintree</Authors>
99
<!-- We target NET standard 2.0 so that we can support NET Core 2.1. When NET Core 2.1 reaches EOL, we can update to Net Standard 2.1 -->
1010
<TargetFrameworks>net452;netstandard2.0</TargetFrameworks>
1111
<AssemblyName>Braintree</AssemblyName>
1212
<PackageId>Braintree</PackageId>
1313
<PackageTags>braintree;paypal;venmo;intenational;payments;gateway;currencies;money;visa;mastercard;bitcoin;maestro;apple pay;android pay;amex;jcb;diners club;discover;american express</PackageTags>
1414
<PackageReleaseNotes>
15-
- Add Session Id to Customer Recommendations Payload
15+
- Add UpcomingRetryDate field to Transaction
16+
- Add RemainingFileEvidenceStorage to Dispute
17+
- Add transfer type to Transaction
18+
- Add transaction_retried webhook
1619
</PackageReleaseNotes>
1720
<PackageProjectUrl>https://github.com/braintree/braintree_dotnet</PackageProjectUrl>
1821
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>

src/Braintree/Dispute.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ public class Dispute
9191
public virtual string ReasonCode { get; protected set; }
9292
public virtual string ReasonDescription { get; protected set; }
9393
public virtual string ReferenceNumber { get; protected set; }
94+
public virtual decimal? RemainingFileEvidenceStorage { get; protected set; }
9495
public virtual TransactionDetails TransactionDetails { get; protected set; }
9596
public virtual DisputeTransaction Transaction { get; protected set; }
9697
public List<DisputeStatusHistory> StatusHistory;
@@ -136,6 +137,7 @@ public Dispute(NodeWrapper node)
136137
ReasonCode = node.GetString("reason-code");
137138
ReasonDescription = node.GetString("reason-description");
138139
ReferenceNumber = node.GetString("reference-number");
140+
RemainingFileEvidenceStorage = node.GetDecimal("remaining-file-evidence-storage");
139141

140142
if (node.GetNode("transaction") != null) {
141143
TransactionDetails = new TransactionDetails(node.GetNode("transaction"));

src/Braintree/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// Build Number
3333
// Revision
3434
//
35-
[assembly: AssemblyVersion("5.34.0.0")]
36-
[assembly: AssemblyFileVersion("5.34.0.0")]
35+
[assembly: AssemblyVersion("5.35.0.0")]
36+
[assembly: AssemblyFileVersion("5.35.0.0")]

src/Braintree/Transaction.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ public enum ACHReasonCodes
116116
public class Transaction
117117
{
118118

119+
public virtual bool? AccountFundingTransaction { get; protected set; }
119120
public virtual string AchReturnCode { get; protected set; }
120121
public virtual string AcquirerReferenceNumber { get; protected set; }
121122
public virtual string AdditionalProcessorResponse { get; protected set; }
@@ -185,6 +186,7 @@ public class Transaction
185186
public virtual string RetrievalReferenceNumber { get; protected set; }
186187
public virtual List<String> RetryIds { get; protected set; }
187188
public virtual RiskData RiskData { get; protected set; }
189+
public virtual string UpcomingRetryDate { get; protected set; }
188190
// NEXT_MAJOR_VERSION remove SamsungPayCardDetails
189191
#pragma warning disable 618
190192
public virtual SamsungPayCardDetails SamsungPayCardDetails { get; protected set; }
@@ -225,6 +227,7 @@ protected internal Transaction(NodeWrapper node, IBraintreeGateway gateway)
225227
return;
226228

227229
Id = node.GetString("id");
230+
AccountFundingTransaction = node.GetBoolean("account-funding-transaction");
228231
Amount = node.GetDecimal("amount");
229232
AvsErrorResponseCode = node.GetString("avs-error-response-code");
230233
AvsPostalCodeResponseCode = node.GetString("avs-postal-code-response-code");
@@ -473,6 +476,7 @@ protected internal Transaction(NodeWrapper node, IBraintreeGateway gateway)
473476
Retried = node.GetBoolean("retried");
474477
RetriedTransactionId = node.GetString("retried-transaction-id");
475478
RetryIds = node.GetStrings("retry-ids/*");
479+
UpcomingRetryDate = node.GetString("upcoming-retry-date");
476480
DebitNetwork = node.GetEnum("debit-network", TransactionDebitNetwork.UNRECOGNIZED);
477481
}
478482

src/Braintree/TransactionRequest.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ public string ThreeDSecureToken {
106106
}
107107
public string TransactionSource { get; set; }
108108
public TransactionType? Type { get; set; }
109+
public TransferRequest Transfer { get; set; }
109110
[ObsoleteAttribute("the Venmo SDK integration is deprecated. Use Pay with Venmo instead https://developer.paypal.com/braintree/docs/guides/venmo/overview", false)]
110111
public string VenmoSdkPaymentMethodCode { get; set; }
111112

@@ -204,6 +205,7 @@ protected virtual RequestBuilder BuildRequest(string root)
204205
builder.AddElement("three-d-secure-token", ThreeDSecureToken ?? "");
205206
#pragma warning restore 618
206207
builder.AddElement("transaction-source", TransactionSource);
208+
if (Transfer != null) builder.AddElement("transfer", Transfer);
207209
if (Type != null) builder.AddElement("type", Type.GetDescription());
208210
// NEXT_MAJOR_VERSION Remove this pragma warning when we remove VenmoSdkPaymentMethodCode
209211
// We have this so we can build the SDK without obsolete error messages

src/Braintree/TransferRequest.cs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#pragma warning disable 1591
2+
3+
using System.Collections.Generic;
4+
using System;
5+
6+
namespace Braintree
7+
{
8+
9+
public class TransferRequest : Request
10+
{
11+
12+
public string Type { get; set; }
13+
14+
public override string ToXml()
15+
{
16+
return ToXml("transfer");
17+
}
18+
19+
public override string ToXml(string root)
20+
{
21+
return BuildRequest(root).ToXml();
22+
}
23+
24+
public override string ToQueryString()
25+
{
26+
return ToQueryString("transfer");
27+
}
28+
29+
public override string ToQueryString(string root)
30+
{
31+
return BuildRequest(root).ToQueryString();
32+
}
33+
34+
protected virtual RequestBuilder BuildRequest(string root)
35+
{
36+
var builder = new RequestBuilder(root);
37+
if (Type != null) {
38+
builder.AddElement("type", Type);
39+
}
40+
return builder;
41+
}
42+
}
43+
}

src/Braintree/WebhookNotification.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public enum WebhookKind
4444
[Description("subscription_went_active")] SUBSCRIPTION_WENT_ACTIVE,
4545
[Description("subscription_went_past_due")] SUBSCRIPTION_WENT_PAST_DUE,
4646
[Description("transaction_disbursed")] TRANSACTION_DISBURSED,
47+
[Description("transaction_retried")] TRANSACTION_RETRIED,
4748
[Description("transaction_reviewed")] TRANSACTION_REVIEWED,
4849
[Description("transaction_settled")] TRANSACTION_SETTLED,
4950
[Description("transaction_settlement_declined")] TRANSACTION_SETTLEMENT_DECLINED,

src/Braintree/WebhookTestingGateway.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ private string SubjectSampleXml(WebhookKind kind, string id)
4848
// Convert to switch statement
4949
if (kind == WebhookKind.TRANSACTION_DISBURSED) {
5050
return TransactionDisbursedSampleXml(id);
51+
} else if (kind == WebhookKind.TRANSACTION_RETRIED) {
52+
return TransactionRetriedSampleXml(id);
5153
} else if (kind == WebhookKind.TRANSACTION_REVIEWED) {
5254
return TransactionReviewedSampleXml(id);
5355
} else if (kind == WebhookKind.TRANSACTION_SETTLED) {
@@ -170,6 +172,18 @@ private string TransactionDisbursedSampleXml(string id)
170172
);
171173
}
172174

175+
private string TransactionRetriedSampleXml(string id)
176+
{
177+
return Node("transaction",
178+
Node("id", id),
179+
Node("amount", "100.00"),
180+
Node("status", "submitted_for_settlement"),
181+
Node("type", "sale"),
182+
Node("currency-iso-code", "USD"),
183+
Node("retried-transaction-id", "original_txn_id")
184+
);
185+
}
186+
173187
private string TransactionSettledSampleXml(string id)
174188
{
175189
return Node("transaction",

test/Braintree.Tests.Integration/DisputeIntegrationTest.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,22 @@ public void AddFileEvidence_addsEvidence()
150150
Assert.NotNull(foundEvidence);
151151
}
152152

153+
[Test]
154+
public void AddFileEvidence_updatesRemainingFileEvidenceStorage()
155+
{
156+
DocumentUpload document = createSampleDocumentUpload();
157+
Dispute dispute = createSampleDispute();
158+
decimal? initialStorage = dispute.RemainingFileEvidenceStorage;
159+
160+
Assert.NotNull(initialStorage);
161+
162+
DisputeEvidence evidence = gateway.Dispute.AddFileEvidence(dispute.Id, document.Id).Target;
163+
164+
Dispute updatedDispute = gateway.Dispute.Find(dispute.Id).Target;
165+
decimal? updatedStorage = updatedDispute.RemainingFileEvidenceStorage;
166+
Assert.Less(updatedStorage, initialStorage);
167+
}
168+
153169
[Test]
154170
public void AddFileEvidence_addsEvidenceWithCategory()
155171
{
@@ -1171,4 +1187,4 @@ public async Task<DocumentUpload> createSampleDocumentUploadAsync() {
11711187
return documentUploadResult.Target;
11721188
}
11731189
}
1174-
}
1190+
}

0 commit comments

Comments
 (0)