Skip to content

Commit

Permalink
5.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
braintreeps committed Jan 26, 2021
1 parent 188436c commit a6e113a
Show file tree
Hide file tree
Showing 23 changed files with 1,104 additions and 45 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
* @braintree/sdk
* @braintree/team-sdk-server
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## 5.3.0
- Add `scaExemption` to `Transaction`
- Deprecate `DeviceSessionId` and `FraudMerchantId` in the `CreditCardRequest` and `TransactionRequest` classes
- Add `currencyIsoCode` field to `TransactionRequest`
- Add `verificationCurrencyIsoCode` field to `CreditCardOptionsRequest` and `PaymentMethodOptionsRequest`
- Add validation error codes:
- `CREDIT_CARD_OPTIONS_VERIFICATION_INVALID_PRESENTMENT_CURRENCY`
- `TRANSACTION_INVALID_PRESENTMENT_CURRENCY`
- Add `Installments` to `TransactionRequest`
- Add `Count` to `InstallmentRequest`
- Add `Installments` and `RefundedInstallments` to `Transaction`
- Add `Adjustment` to `Installment`

## 5.2.0
- Add `AcquirerReferenceNumber` to `Transaction`
- Add `BillingAgreementId` to `PayPalDetails`
Expand Down
32 changes: 32 additions & 0 deletions src/Braintree/Adjustment.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.ComponentModel;

namespace Braintree
{

public enum Kind
{
[Description("refund")] REFUND,
[Description("dispute")] DISPUTE,
[Description("unrecognized")] UNRECOGNIZED
}

public class Adjustment
{
public virtual decimal? Amount { get; protected set; }
public virtual DateTime? ProjectedDisbursementDate { get; protected set; }
public virtual DateTime? ActualDisbursementDate { get; protected set; }
public virtual Kind Kind { get; protected set; }

protected internal Adjustment(NodeWrapper node)
{
Amount = node.GetDecimal("amount");
ProjectedDisbursementDate = node.GetDateTime("projected_disbursement_date");
ActualDisbursementDate = node.GetDateTime("actual_disbursement_date");
Kind = node.GetEnum("kind", Kind.UNRECOGNIZED);
}

[Obsolete("Mock Use Only")]
protected internal Adjustment() { }
}
}
17 changes: 12 additions & 5 deletions src/Braintree/Braintree.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,25 @@
<PropertyGroup>
<Description>Braintree Client Library</Description>
<Copyright>Copyright © Braintree, a division of PayPal, Inc. 2020</Copyright>
<VersionPrefix>5.2.0</VersionPrefix>
<VersionPrefix>5.3.0</VersionPrefix>
<Authors>Braintree</Authors>
<!-- 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 -->
<TargetFrameworks>net452;netstandard2.0</TargetFrameworks>
<AssemblyName>Braintree</AssemblyName>
<PackageId>Braintree</PackageId>
<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>
<PackageReleaseNotes>
- Add `AcquirerReferenceNumber` to `Transaction`
- Add `BillingAgreementId` to `PayPalDetails`
- Add `extensions` to `GraphQLResponse`
- Deprecate `Recurring` in TransactionRequest
- Add scaExemption to Transaction
- Deprecate DeviceSessionId and FraudMerchantId in the CreditCardRequest and TransactionRequest classes
- Add currencyIsoCode field to TransactionRequest
- Add verificationCurrencyIsoCode field to CreditCardOptionsRequest and PaymentMethodOptionsRequest
- Add validation error codes:
- CREDIT_CARD_OPTIONS_VERIFICATION_INVALID_PRESENTMENT_CURRENCY
- TRANSACTION_INVALID_PRESENTMENT_CURRENCY
- Add Installments to TransactionRequest
- Add Count to InstallmentRequest
- Add Installments and RefundedInstallments to Transaction
- Add Adjustment to Installment
</PackageReleaseNotes>
<PackageProjectUrl>https://github.com/braintree/braintree_dotnet</PackageProjectUrl>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
Expand Down
2 changes: 2 additions & 0 deletions src/Braintree/CreditCardOptionsRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class CreditCardOptionsRequest : Request
public string UpdateExistingToken { get; set; }
public string VenmoSdkSession { get; set; }
public string VerificationAccountType { get; set; }
public string VerificationCurrencyIsoCode { get; set; }

public override string ToXml(string root)
{
Expand All @@ -29,6 +30,7 @@ protected virtual RequestBuilder BuildRequest(string root)
AddElement("make-default", MakeDefault).
AddElement("verification-merchant-account-id", VerificationMerchantAccountId).
AddElement("verification-account-type", VerificationAccountType).
AddElement("verification-currency-iso-code", VerificationCurrencyIsoCode).
AddElement("verify-card", VerifyCard).
AddElement("verification-amount", VerificationAmount).
AddElement("fail-on-duplicate-payment-method", FailOnDuplicatePaymentMethod).
Expand Down
8 changes: 8 additions & 0 deletions src/Braintree/CreditCardRequest.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma warning disable 1591

using System;

namespace Braintree
{
/// <summary>
Expand Down Expand Up @@ -32,7 +34,9 @@ public class CreditCardRequest : BaseCreditCardRequest
public ThreeDSecurePassThruRequest ThreeDSecurePassThru { get; set; }
public string BillingAddressId { get; set; }
public string DeviceData { get; set; }
[ObsoleteAttribute("use DeviceData instead", false)]
public string DeviceSessionId { get; set; }
[ObsoleteAttribute("use DeviceData instead", false)]
public string FraudMerchantId { get; set; }
public CreditCardOptionsRequest Options { get; set; }
public string PaymentMethodToken { get; set; }
Expand All @@ -54,8 +58,12 @@ protected override RequestBuilder BuildRequest(string root)
AddElement("billing-address-id", BillingAddressId).
AddElement("device-data", DeviceData).
AddElement("customer-id", CustomerId).
// Remove this pragma warning when we remove DeviceSessionId and FraudMerchantId.
// We have this so we can build the SDK without obsolete error messages
#pragma warning disable 618
AddElement("device-session-id", DeviceSessionId).
AddElement("fraud-merchant-id", FraudMerchantId).
#pragma warning restore 618
AddElement("options", Options).
AddElement("payment-method-nonce", PaymentMethodNonce).
AddElement("venmo-sdk-payment-method-code", VenmoSdkPaymentMethodCode).
Expand Down
31 changes: 31 additions & 0 deletions src/Braintree/Installment.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using System.ComponentModel;
using System.Collections.Generic;

namespace Braintree
{

public class Installment
{
public virtual string Id { get; protected set; }
public virtual decimal? Amount { get; protected set; }
public virtual DateTime? ProjectedDisbursementDate { get; protected set; }
public virtual DateTime? ActualDisbursementDate { get; protected set; }
public virtual List<Adjustment> Adjustments { get; protected set; }

protected internal Installment(NodeWrapper node)
{
Amount = node.GetDecimal("amount");
Id = node.GetString("id");
ProjectedDisbursementDate = node.GetDateTime("projected_disbursement_date");
ActualDisbursementDate = node.GetDateTime("actual_disbursement_date");
Adjustments = new List<Adjustment>();
foreach (var adjustmentNode in node.GetList("adjustments/adjustment")) {
Adjustments.Add(new Adjustment(adjustmentNode));
}
}

[Obsolete("Mock Use Only")]
protected internal Installment() { }
}
}
25 changes: 25 additions & 0 deletions src/Braintree/InstallmentRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
namespace Braintree
{
public class InstallmentRequest : Request
{
public string Count { get; set; }

public override string ToXml(string root)
{
return BuildRequest(root).ToXml();
}

public override string ToQueryString(string root)
{
return BuildRequest(root).ToQueryString();
}

protected virtual RequestBuilder BuildRequest(string root)
{
var builder = new RequestBuilder(root);
builder.AddElement("count", Count);
return builder;
}
}
}

2 changes: 2 additions & 0 deletions src/Braintree/PaymentMethodOptionsRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class PaymentMethodOptionsRequest : Request
public string VerificationMerchantAccountId { get; set; }
public string VerificationAmount { get; set; }
public string VerificationAccountType { get; set; }
public string VerificationCurrencyIsoCode { get; set; }
public PaymentMethodOptionsPayPalRequest OptionsPayPal { get; set; }
public UsBankAccountVerificationMethod? UsBankAccountVerificationMethod { get; set; }

Expand All @@ -29,6 +30,7 @@ protected virtual RequestBuilder BuildRequest(string root)
AddElement("make-default", MakeDefault).
AddElement("verification-merchant-account-id", VerificationMerchantAccountId).
AddElement("verification-account-type", VerificationAccountType).
AddElement("verification-currency-iso-code", VerificationCurrencyIsoCode).
AddElement("verify-card", VerifyCard).
AddElement("us-bank-account-verification-method", UsBankAccountVerificationMethod.GetDescription()).
AddElement("verification-amount", VerificationAmount).
Expand Down
4 changes: 2 additions & 2 deletions src/Braintree/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("5.2.0.0")]
[assembly: AssemblyFileVersion("5.2.0.0")]
[assembly: AssemblyVersion("5.3.0.0")]
[assembly: AssemblyFileVersion("5.3.0.0")]
2 changes: 2 additions & 0 deletions src/Braintree/SandboxValues.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ public class SandboxValues
public class CreditCardNumber
{
public const string VISA = "4111111111111111";
public const string VISA_COUNTRY_OF_ISSUANCE_IE = "4023490000000008";
public const string MASTER_CARD = "5555555555554444";
public const string AMEX = "371449635392376";
public const string HIPER = "6370950000000005";
public const string HIPERCARD = "6062820524845321";
public const string JCB = "3530111333300000";
public const string FRAUD = "4000111111111511";
public const string RISK_THRESHOLD = "4111130000000003";

Expand Down
19 changes: 19 additions & 0 deletions src/Braintree/Transaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,17 @@ public class Transaction
public virtual ThreeDSecureInfo ThreeDSecureInfo { get; protected set; }
public virtual FacilitatedDetails FacilitatedDetails { get; protected set; }
public virtual FacilitatorDetails FacilitatorDetails { get; protected set; }
public virtual string ScaExemptionRequested { get; protected set; }
public virtual decimal? DiscountAmount { get; protected set; }
public virtual decimal? ShippingAmount { get; protected set; }
public virtual string ShipsFromPostalCode { get; protected set; }
public virtual string NetworkTransactionId { get; protected set; }
public virtual DateTime? AuthorizationExpiresAt { get; protected set; }
public virtual string RetrievalReferenceNumber { get; protected set; }
public virtual string AcquirerReferenceNumber { get; protected set; }
public virtual decimal? InstallmentCount { get; protected set; }
public virtual List<Installment> Installments { get; protected set; }
public virtual List<Installment> RefundedInstallments { get; protected set; }

private IBraintreeGateway Gateway;

Expand Down Expand Up @@ -214,6 +218,7 @@ protected internal Transaction(NodeWrapper node, IBraintreeGateway gateway)
}

Type = node.GetEnum("type", TransactionType.UNRECOGNIZED);
ScaExemptionRequested = node.GetString("sca-exemption-requested");
MerchantAccountId = node.GetString("merchant-account-id");
ProcessedWithNetworkToken = node.GetBoolean("processed-with-network-token");
ProcessorAuthorizationCode = node.GetString("processor-authorization-code");
Expand Down Expand Up @@ -385,6 +390,20 @@ protected internal Transaction(NodeWrapper node, IBraintreeGateway gateway)
RetrievalReferenceNumber = node.GetString("retrieval-reference-number");

AcquirerReferenceNumber = node.GetString("acquirer-reference-number");

InstallmentCount = node.GetDecimal("installment-count");

Installments = new List<Installment>();
foreach (var installment in node.GetList("installments/installment"))
{
Installments.Add(new Installment(installment));
}

RefundedInstallments = new List<Installment>();
foreach (var installment in node.GetList("refunded-installments/refunded-installment"))
{
RefundedInstallments.Add(new Installment(installment));
}
}

/// <summary>
Expand Down
16 changes: 13 additions & 3 deletions src/Braintree/TransactionRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ public class TransactionRequest : Request
public TransactionCreditCardRequest CreditCard { get; set; }
public decimal Amount { get; set; }
public string DeviceData { get; set; }
[ObsoleteAttribute("use DeviceData instead", false)]
public string DeviceSessionId { get; set; }
[ObsoleteAttribute("use DeviceData instead", false)]
public string FraudMerchantId { get; set; }
public string Channel { get; set; }
public string OrderId { get; set; }
Expand Down Expand Up @@ -65,6 +67,7 @@ public class TransactionRequest : Request
public string BillingAddressId { get; set; }
public string VenmoSdkPaymentMethodCode { get; set; }
public string PaymentMethodNonce { get; set; }
public string ScaExemption { get; set; }
public decimal? ServiceFeeAmount { get; set; }
public string SharedPaymentMethodToken { get; set; }
public string SharedPaymentMethodNonce { get; set; }
Expand Down Expand Up @@ -92,6 +95,9 @@ public string ThreeDSecureToken {
// NEXT_MAJOR_VERSION Rename Android Pay to Google Pay
public TransactionAndroidPayCardRequest AndroidPayCard { get; set; }
public TransactionApplePayCardRequest ApplePayCard { get; set; }
public string CurrencyIsoCode { get; set; }

public InstallmentRequest InstallmentRequest { get; set; }

public TransactionRequest()
{
Expand Down Expand Up @@ -128,11 +134,11 @@ protected virtual RequestBuilder BuildRequest(string root)
builder.AddElement("order-id", OrderId);
builder.AddElement("product-sku", ProductSku);
builder.AddElement("channel", Channel);
builder.AddElement("device-session-id", DeviceSessionId);
builder.AddElement("fraud-merchant-id", FraudMerchantId);
// Remove this pragma warning when we remove Recurring param.
// Remove this pragma warning when we remove DeviceSessionId, FraudMerchantId, and Recurring.
// We have this so we can build the SDK without obsolete error messages
#pragma warning disable 618
builder.AddElement("device-session-id", DeviceSessionId);
builder.AddElement("fraud-merchant-id", FraudMerchantId);
if (Recurring.HasValue) builder.AddElement("recurring", Recurring);
#pragma warning restore 618
builder.AddElement("transaction-source", TransactionSource);
Expand All @@ -152,6 +158,7 @@ protected virtual RequestBuilder BuildRequest(string root)

if (CustomFields.Count != 0) builder.AddElement("custom-fields", CustomFields);

builder.AddElement("currency-iso-code", CurrencyIsoCode);
builder.AddElement("credit-card", CreditCard);
builder.AddElement("customer", Customer);
builder.AddElement("descriptor", Descriptor);
Expand All @@ -163,6 +170,7 @@ protected virtual RequestBuilder BuildRequest(string root)
builder.AddElement("three-d-secure-pass-thru", ThreeDSecurePassThru);
builder.AddElement("three-d-secure-authentication-id", ThreeDSecureAuthenticationId);
builder.AddElement("venmo-sdk-payment-method-code", VenmoSdkPaymentMethodCode);
builder.AddElement("sca-exemption", ScaExemption);
builder.AddElement("shared-payment-method-token", SharedPaymentMethodToken);
builder.AddElement("shared-payment-method-nonce", SharedPaymentMethodNonce);
builder.AddElement("shared-customer-id", SharedCustomerId);
Expand All @@ -184,6 +192,8 @@ protected virtual RequestBuilder BuildRequest(string root)
builder.AddElement("android-pay-card", AndroidPayCard);
if (ApplePayCard != null)
builder.AddElement("apple-pay-card", ApplePayCard);
if (InstallmentRequest != null)
builder.AddElement("installments", InstallmentRequest);
return builder;
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/Braintree/ValidationErrorCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public enum ValidationErrorCode
CREDIT_CARD_OPTIONS_VERIFICATION_MERCHANT_ACCOUNT_CANNOT_BE_SUB_MERCHANT_ACCOUNT = 91755,
CREDIT_CARD_OPTIONS_VERIFICATION_ACCOUNT_TYPE_IS_INVALID = 91757,
CREDIT_CARD_OPTIONS_VERIFICATION_ACCOUNT_TYPE_NOT_SUPPORTED = 91758,
CREDIT_CARD_OPTIONS_VERIFICATION_INVALID_PRESENTMENT_CURRENCY = 91760,
CREDIT_CARD_PAYMENT_METHOD_CONFLICT = 81725,
CREDIT_CARD_PAYMENT_METHOD_IS_NOT_A_CREDIT_CARD = 91738,
CREDIT_CARD_PAYMENT_METHOD_NONCE_CARD_TYPE_IS_NOT_ACCEPTED = 91734,
Expand Down Expand Up @@ -282,6 +283,7 @@ public enum ValidationErrorCode
TRANSACTION_SHIPS_FROM_POSTAL_CODE_IS_TOO_LONG = 915165,
TRANSACTION_SHIPS_FROM_POSTAL_CODE_IS_INVALID = 915166,
TRANSACTION_SHIPS_FROM_POSTAL_CODE_INVALID_CHARACTERS = 915167,
TRANSACTION_SCA_EXEMPTION_REQUEST_INVALID = 915213,

TRANSACTION_LINE_ITEM_COMMODITY_CODE_IS_TOO_LONG = 95801,
TRANSACTION_LINE_ITEM_DESCRIPTION_IS_TOO_LONG = 95803,
Expand Down Expand Up @@ -315,6 +317,7 @@ public enum ValidationErrorCode
TRANSACTION_EXTERNAL_VAULT_STATUS_IS_INVALID = 915175,
TRANSACTION_EXTERNAL_VAULT_STATUS_WITH_PREVIOUS_NETWORK_TRANSACTION_ID_IS_INVALID = 915177,
TRANSACTION_EXTERNAL_VAULT_PREVIOUS_NETWORK_TRANSACTION_ID_IS_INVALID = 915179,
// NEXT_MAJOR_VERSION remove invalid card type error, the API no longer returns this error
TRANSACTION_EXTERNAL_VAULT_CARD_TYPE_IS_INVALID = 915178,

MERCHANT_COUNTRY_CANNOT_BE_BLANK = 83603,
Expand Down Expand Up @@ -582,6 +585,7 @@ public enum ValidationErrorCode
TRANSACTION_OPTIONS_CREDIT_CARD_ACCOUNT_TYPE_IS_INVALID = 915184,
TRANSACTION_OPTIONS_CREDIT_CARD_ACCOUNT_TYPE_NOT_SUPPORTED = 915185,
TRANSACTION_OPTIONS_CREDIT_CARD_ACCOUNT_TYPE_DEBIT_DOES_NOT_SUPPORT_AUTHS = 915186,
TRANSACTION_INVALID_PRESENTMENT_CURRENCY = 915214,
TRANSACTION_ORDER_ID_IS_TOO_LONG = 91501,
TRANSACTION_PAY_PAL_AUTH_EXPIRED = 91579,
TRANSACTION_PAY_PAL_VAULT_RECORD_MISSING_DATA = 91583,
Expand Down Expand Up @@ -691,6 +695,7 @@ public enum ValidationErrorCode
MERCHANT_ACOUNT_DOES_NOT_MATCH3_D_SECURE_MERCHANT_ACCOUNT = 94284,
AMOUNT_DOES_NOT_MATCH3_D_SECURE_AMOUNT = 94285,

// NEXT_MAJOR_VERSION Remove CustomerBrowserIsTooLong code as it is no longer returned from the gateway
RISK_DATA_CUSTOMER_BROWSER_IS_TOO_LONG = 94701,
RISK_DATA_CUSTOMER_DEVICE_ID_IS_TOO_LONG = 94702,
RISK_DATA_CUSTOMER_LOCATION_ZIP_INVALID_CHARACTERS = 94703,
Expand Down
1 change: 1 addition & 0 deletions test/Braintree.TestUtil/MerchantAccountIDs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ public class MerchantAccountIDs
public static string ANOTHER_US_BANK_MERCHANT_ACCOUNT_ID = "another_us_bank_merchant_account";
public static string ADYEN_MERCHANT_ACCOUNT_ID = "adyen_ma";
public static string BRAZIL_MERCHANT_ACCOUNT_ID = "hiper_brl";
public static string CARD_PROCESSOR_BRAZIL_MERCHANT_ACCOUNT_ID = "card_processor_brl";
}
}
Loading

0 comments on commit a6e113a

Please sign in to comment.