Skip to content

Commit

Permalink
2.103.0
Browse files Browse the repository at this point in the history
  • Loading branch information
braintreeps committed Aug 6, 2020
1 parent 24feda5 commit 14da8d8
Show file tree
Hide file tree
Showing 23 changed files with 437 additions and 75 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
# 2.103.0
* Add `RiskThreshold` to gateway rejection reasons
* Add `network_transaction_id` to `CreditCardVerification`
* Add `product_sku` to `Transaction`
* Add `phone_number` and `shipping_method` to `AddressDetails`
* Add `customer_device_id`, `customer_location_zip`, and `customer_tenure` to `RiskData`
* Add validation errors:
* `Transaction::ProductSkuIsInvalid`
* `Transaction::ShippingMethodIsInvalid`
* `Transaction::ShippingPhoneNumberIsInvalid`
* `Transaction::BillingPhoneNumberIsInvalid`
* `RiskData::CustomerBrowserIsTooLong`
* `RiskData::CustomerDeviceIdIsTooLong`
* `RiskData::CustomerLocationZipInvalidCharacters`
* `RiskData::CustomerLocationZipIsInvalid`
* `RiskData::CustomerLocationZipIsTooLong`
* `RiskData::CustomerTenureIsTooLong`
* Add `processed_with_network_token` to `Transaction`
* Add `is_network_tokenized` to `CreditCard`
* Add `created_at` accessor to `dispute.transaction` on dispute webhooks (closes #200)

# 2.102.0
* Add `threeDSecurePassThru` parameters to `Customer.create`, `PaymentMethod.create`, `CreditCard.create`, `Customer.update`, `PaymentMethod.update`, and `CreditCard.update`
* Add `recurring_customer_consent`and `recurring_max_amount` options to `authentication_insight`to payment method nonce create
Expand Down
29 changes: 25 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,35 @@ task :dev_console do
end

namespace :test do

# Usage:
# rake test:unit
# rake test:unit[configuration_spec]
# rake test:unit[configuration_spec,"accepts merchant credentials"]
desc "Run unit tests"
RSpec::Core::RakeTask.new(:unit) do |t|
t.pattern = "spec/unit/**/*_spec.rb"
task :unit, [:file_name, :test_name] do |task, args|
if args.file_name.nil?
sh "rspec --pattern spec/unit/**/*_spec.rb"
elsif args.test_name.nil?
sh "rspec --pattern spec/unit/**/#{args.file_name}.rb --format documentation --color"
else
sh "rspec --pattern spec/unit/**/#{args.file_name}.rb --example '#{args.test_name}' --format documentation --color"
end
end

# Usage:
# rake test:integration
# rake test:integration[plan_spec]
# rake test:integration[plan_spec,"gets all plans"]
desc "Run integration tests"
RSpec::Core::RakeTask.new(:integration) do |t|
t.pattern = "spec/integration/**/*_spec.rb"
task :integration, [:file_name, :test_name] do |task, args|
if args.file_name.nil?
sh "rspec --pattern spec/integration/**/*_spec.rb"
elsif args.test_name.nil?
sh "rspec --pattern spec/integration/**/#{args.file_name}.rb --format documentation --color"
else
sh "rspec --pattern spec/integration/**/#{args.file_name}.rb --example '#{args.test_name}' --format documentation --color"
end
end

task :all => [:unit, :integration]
Expand Down
4 changes: 2 additions & 2 deletions lib/braintree/address_gateway.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ def self._create_signature # :nodoc:

def self._shared_signature # :nodoc:
[:company, :country_code_alpha2, :country_code_alpha3, :country_code_numeric,
:country_name, :extended_address, :first_name,
:last_name, :locality, :postal_code, :region, :street_address]
:country_name, :extended_address, :first_name, :last_name, :locality, :phone_number,
:postal_code, :region, :street_address]
end

def self._update_signature # :nodoc:
Expand Down
6 changes: 5 additions & 1 deletion lib/braintree/credit_card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@ def venmo_sdk?
@venmo_sdk
end

def is_network_tokenized?
@is_network_tokenized
end

class << self
protected :new
end
Expand All @@ -247,7 +251,7 @@ def self._attributes # :nodoc:
[
:billing_address, :bin, :card_type, :cardholder_name, :created_at, :customer_id, :expiration_month,
:expiration_year, :last_4, :token, :updated_at, :prepaid, :payroll, :product_id, :commercial, :debit, :durbin_regulated,
:healthcare, :country_of_issuance, :issuing_bank, :image_url
:healthcare, :country_of_issuance, :issuing_bank, :image_url, :is_network_tokenized?
]
end

Expand Down
1 change: 1 addition & 0 deletions lib/braintree/credit_card_verification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ module Status
attr_reader :merchant_account_id
attr_reader :network_response_code
attr_reader :network_response_text
attr_reader :network_transaction_id
attr_reader :processor_response_code
attr_reader :processor_response_text
attr_reader :processor_response_type
Expand Down
1 change: 1 addition & 0 deletions lib/braintree/dispute/transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class Transaction # :nodoc:
include BaseModule

attr_reader :amount
attr_reader :created_at
attr_reader :id
attr_reader :order_id
attr_reader :purchase_order_number
Expand Down
13 changes: 13 additions & 0 deletions lib/braintree/error_codes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ module Transaction
AmountMustBeGreaterThanZero = "81531"
AmountNotSupportedByProcessor = "815193"
BillingAddressConflict = "91530"
BillingPhoneNumberIsInvalid = "915206"
CannotBeVoided = "91504"
CannotCancelRelease = "91562"
CannotCloneCredit = "91543"
Expand Down Expand Up @@ -376,6 +377,7 @@ module Transaction
ProcessorDoesNotSupportUpdatingOrderId = "915107"
ProcessorDoesNotSupportUpdatingTransactionDetails = "915130"
ProcessorDoesNotSupportVoiceAuthorizations = "91545"
ProductSkuIsInvalid = "915202"
PurchaseOrderNumberIsInvalid = "91548"
PurchaseOrderNumberIsTooLong = "91537"
RefundAmountIsTooLarge = "91521"
Expand All @@ -393,6 +395,8 @@ module Transaction
ShippingAmountCannotBeNegative = "915163"
ShippingAmountFormatIsInvalid = "915162"
ShippingAmountIsTooLarge = "915164"
ShippingMethodIsInvalid = "915203"
ShippingPhoneNumberIsInvalid = "915204"
ShipsFromPostalCodeInvalidCharacters = "915167"
ShipsFromPostalCodeIsInvalid = "915166"
ShipsFromPostalCodeIsTooLong = "915165"
Expand Down Expand Up @@ -800,5 +804,14 @@ module UsBankAccountVerification
UnableToConfirmDepositAmounts = "96105"
InvalidDepositAmounts = "96106"
end

module RiskData
CustomerBrowserIsTooLong = "94701"
CustomerDeviceIdIsTooLong = "94702"
CustomerLocationZipInvalidCharacters = "94703"
CustomerLocationZipIsInvalid = "94704"
CustomerLocationZipIsTooLong = "94705"
CustomerTenureIsTooLong = "94706"
end
end
end
5 changes: 4 additions & 1 deletion lib/braintree/risk_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ module Braintree
class RiskData # :nodoc:
include BaseModule

attr_reader :customer_device_id
attr_reader :customer_location_zip
attr_reader :customer_tenure
attr_reader :decision
attr_reader :device_data_captured
attr_reader :id
attr_reader :fraud_service_provider
attr_reader :id

def initialize(attributes)
set_instance_variables_from_hash attributes unless attributes.nil?
Expand Down
1 change: 1 addition & 0 deletions lib/braintree/test/credit_card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ module CardTypeIndicators
VisaPrepaid = "4500600000000061"

Fraud = "4000111111111511"
RiskThreshold = "4111130000000003"

Visas = %w[4009348888881881 4012888888881881 4111111111111111 4000111111111115 4500600000000061]
Unknowns = %w[1000000000000008]
Expand Down
1 change: 1 addition & 0 deletions lib/braintree/test/nonce.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ module Nonce
PayPalFuturePaymentRefreshToken = "fake-paypal-future-refresh-token-nonce"
SEPA = "fake-sepa-bank-account-nonce"
GatewayRejectedFraud = "fake-gateway-rejected-fraud-nonce"
GatewayRejectedRiskThresholds = "fake-gateway-rejected-risk-thresholds-nonce"
MasterpassAmEx = "fake-masterpass-amex-nonce"
MasterpassDiscover = "fake-masterpass-discover-nonce"
MasterpassMasterCard = "fake-masterpass-mastercard-nonce"
Expand Down
8 changes: 7 additions & 1 deletion lib/braintree/transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ module GatewayRejectionReason
CVV = "cvv"
Duplicate = "duplicate"
Fraud = "fraud"
RiskThreshold = "risk_threshold"
ThreeDSecure = "three_d_secure"
TokenIssuance = "token_issuance"
Unrecognized = "unrecognized"
Expand Down Expand Up @@ -142,6 +143,7 @@ module Status
attr_reader :processor_response_type # Response type from the processor.
attr_reader :processor_settlement_response_code # Settlement response code from the processor.
attr_reader :processor_settlement_response_text # Settlement response text from the processor.
attr_reader :product_sku
attr_reader :purchase_order_number
attr_reader :recurring
attr_reader :refund_ids
Expand Down Expand Up @@ -439,6 +441,10 @@ def void!
return_object_or_raise(:transaction) { void }
end

def processed_with_network_token?
@processed_with_network_token
end

class << self
protected :new
def _new(*args) # :nodoc:
Expand All @@ -447,7 +453,7 @@ def _new(*args) # :nodoc:
end

def self._attributes # :nodoc:
[:amount, :created_at, :credit_card_details, :customer_details, :id, :status, :subscription_details, :type, :updated_at]
[:amount, :created_at, :credit_card_details, :customer_details, :id, :status, :subscription_details, :type, :updated_at, :processed_with_network_token?]
end
end
end
11 changes: 11 additions & 0 deletions lib/braintree/transaction/address_details.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ class Transaction
class AddressDetails # :nodoc:
include BaseModule

module ShippingMethod
SameDay = "same_day"
NextDay = "next_day"
Priority = "priority"
Ground = "ground"
Electronic = "electronic"
ShipToStore = "ship_to_store"
end

attr_reader :company
attr_reader :country_code_alpha2
attr_reader :country_code_alpha3
Expand All @@ -13,8 +22,10 @@ class AddressDetails # :nodoc:
attr_reader :id
attr_reader :last_name
attr_reader :locality
attr_reader :phone_number
attr_reader :postal_code
attr_reader :region
attr_reader :shipping_method
attr_reader :street_address

def initialize(attributes)
Expand Down
5 changes: 3 additions & 2 deletions lib/braintree/transaction_gateway.rb
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,16 @@ def self._create_signature # :nodoc:
:shipping_amount, :discount_amount, :ships_from_postal_code,
:billing_address_id, :payment_method_nonce, :three_d_secure_token, :three_d_secure_authentication_id,
:shared_payment_method_token, :shared_billing_address_id, :shared_customer_id, :shared_shipping_address_id, :shared_payment_method_nonce,
:product_sku,
{:line_items => [:quantity, :name, :description, :kind, :unit_amount, :unit_tax_amount, :total_amount, :discount_amount, :tax_amount, :unit_of_measure, :product_code, :commodity_code, :url]},
{:risk_data => [:customer_browser, :customer_ip]},
{:risk_data => [:customer_browser, :customer_device_id, :customer_ip, :customer_location_zip, :customer_tenure]},
{:credit_card => [:token, :cardholder_name, :cvv, :expiration_date, :expiration_month, :expiration_year, :number]},
{:customer => [:id, :company, :email, :fax, :first_name, :last_name, :phone, :website]},
{
:billing => AddressGateway._shared_signature
},
{
:shipping => AddressGateway._shared_signature
:shipping => AddressGateway._shared_signature + [:shipping_method],
},
{
:three_d_secure_pass_thru => [
Expand Down
2 changes: 1 addition & 1 deletion lib/braintree/version.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Braintree
module Version
Major = 2
Minor = 102
Minor = 103
Tiny = 0

String = "#{Major}.#{Minor}.#{Tiny}"
Expand Down
Loading

0 comments on commit 14da8d8

Please sign in to comment.