Skip to content

Commit

Permalink
4.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
braintreeps committed Apr 1, 2022
1 parent f521dd0 commit f18d293
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 7 deletions.
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Changelog
## 4.7.0
* Add `AchReturnCode` to transaction object
* Add `retried` boolean to `Transaction`

# 4.6.0

## 4.6.0
* Add `PaymentMethodCustomerDataUpdated` webhook notification support


## 4.5.0
* Add plan create/update/find API endpoint
* Add support for `TransactionReview` webhook notification
Expand Down
2 changes: 2 additions & 0 deletions lib/braintree/transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ module Status
end

attr_reader :acquirer_reference_number
attr_reader :ach_return_code
attr_reader :add_ons
attr_reader :additional_processor_response # The raw response from the processor.
attr_reader :amount
Expand Down Expand Up @@ -146,6 +147,7 @@ module Status
attr_reader :refund_ids
attr_reader :refunded_transaction_id
attr_reader :refunded_installments
attr_reader :retried
attr_reader :retrieval_reference_number
attr_reader :risk_data
attr_reader :samsung_pay_card_details
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 = 4
Minor = 6
Minor = 7
Tiny = 0

String = "#{Major}.#{Minor}.#{Tiny}"
Expand Down
4 changes: 2 additions & 2 deletions spec/integration/braintree/payment_method_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def make_token
venmo_account.default.should == true
venmo_account.token.should == token
venmo_account.username.should == "venmojoe"
venmo_account.venmo_user_id.should == "Venmo-Joe-1"
venmo_account.venmo_user_id.should == "1234567891234567891"
venmo_account.image_url.should include(".png")
venmo_account.source_description.should == "Venmo Account: venmojoe"
venmo_account.customer_id.should == customer.id
Expand Down Expand Up @@ -1163,7 +1163,7 @@ def make_token
venmo_account.default.should == true
venmo_account.image_url.should =~ /venmo/
venmo_account.username.should == "venmojoe"
venmo_account.venmo_user_id.should == "Venmo-Joe-1"
venmo_account.venmo_user_id.should == "1234567891234567891"
venmo_account.source_description.should == "Venmo Account: venmojoe"
venmo_account.customer_id.should == customer.id
end
Expand Down
11 changes: 11 additions & 0 deletions spec/integration/braintree/transaction_search_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,17 @@
collection.maximum_size.should == 0
end

it "searches for settlement_confirmed transaction" do
transaction_id = "settlement_confirmed_txn"

collection = Braintree::Transaction.search do |search|
search.id.is transaction_id
end

collection.maximum_size.should == 1
collection.first.id.should == transaction_id
end

it "finds expired authorizations by status" do
collection = Braintree::Transaction.search do |search|
search.status.in Braintree::Transaction::Status::AuthorizationExpired
Expand Down
35 changes: 34 additions & 1 deletion spec/integration/braintree/transaction_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1947,7 +1947,7 @@
venmo_account_details.should be_a(Braintree::Transaction::VenmoAccountDetails)
venmo_account_details.token.should respond_to(:to_str)
venmo_account_details.username.should == "venmojoe"
venmo_account_details.venmo_user_id.should == "Venmo-Joe-1"
venmo_account_details.venmo_user_id.should == "1234567891234567891"
venmo_account_details.image_url.should include(".png")
venmo_account_details.source_description.should == "Venmo Account: venmojoe"
end
Expand Down Expand Up @@ -6941,6 +6941,39 @@ def create_escrowed_transcation
end
end

describe "retried flag presence in response" do
it "creates a retried transaction" do
result = Braintree::Transaction.sale(
:amount => Braintree::Test::TransactionAmounts::Decline,
:payment_method_token => "network_tokenized_credit_card",
)
transaction = result.transaction
transaction.retried.should == true
end

it "creates a non-retried transaction" do
result = Braintree::Transaction.sale(
:amount => Braintree::Test::TransactionAmounts::Authorize,
:payment_method_token => "network_tokenized_credit_card",
)
transaction = result.transaction
transaction.retried.should == nil
end

it "creates a transaction that is ineligible for retries" do
result = Braintree::Transaction.sale(
:merchant_account_id => SpecHelper::NonDefaultMerchantAccountId,
:credit_card => {
:number => Braintree::Test::CreditCardNumbers::Visa,
:expiration_date => "05/2009"
},
:amount => Braintree::Test::TransactionAmounts::Authorize,
)
transaction = result.transaction
transaction.retried.should == nil
end
end

describe "installments" do
it "creates a transaction with an installment count" do
result = Braintree::Transaction.create(
Expand Down
8 changes: 8 additions & 0 deletions spec/unit/braintree/transaction_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,14 @@
transaction.network_transaction_id.should == "123456789012345"
end

it "accepts ach_return_code" do
transaction = Braintree::Transaction._new(
:gateway,
:ach_return_code => "R01",
)
expect(transaction.ach_return_code).to eq("R01")
end

it "accepts network_response code and network_response_text" do
transaction = Braintree::Transaction._new(
:gateway,
Expand Down

0 comments on commit f18d293

Please sign in to comment.