spec/integration/braintree/transaction_spec.rb in braintree-2.22.0 vs spec/integration/braintree/transaction_spec.rb in braintree-2.23.0

- old
+ new

@@ -119,20 +119,19 @@ end.to raise_error(Braintree::ValidationsFailed) end end describe "self.create" do - describe "card type indicators" do it "sets the prepaid field if the card is prepaid" do result = Braintree::Transaction.create( :type => "sale", :amount => 1_00, :credit_card => { - :number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::Prepaid, - :expiration_date => "05/2009" - } + :number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::Prepaid, + :expiration_date => "05/2009" + } ) result.transaction.credit_card_details.prepaid.should == Braintree::CreditCard::Prepaid::Yes end end @@ -871,10 +870,23 @@ result.transaction.vault_customer.should be_nil result.transaction.vault_credit_card.should be_nil end end end + + describe "venmo_sdk" do + it "can create a card with a venmo sdk payment method code" do + result = Braintree::Transaction.create( + :type => "sale", + :amount => Braintree::Test::TransactionAmounts::Authorize, + :venmo_sdk_payment_method_code => Braintree::Test::VenmoSDK::VisaPaymentMethodCode + ) + result.success?.should == true + result.transaction.credit_card_details.bin.should == "400934" + result.transaction.credit_card_details.last_4.should == "1881" + end + end end describe "self.create!" do it "returns the transaction if valid" do transaction = Braintree::Transaction.create!( @@ -992,10 +1004,11 @@ expect do Braintree::Transaction.refund!(transaction.id,invalid_refund_amount) end.to raise_error(Braintree::ValidationsFailed) end end + describe "self.sale" do it "returns a successful result with type=sale if successful" do result = Braintree::Transaction.sale( :amount => Braintree::Test::TransactionAmounts::Authorize, :credit_card => { @@ -1730,9 +1743,39 @@ it "raises a NotFoundError exception if transaction cannot be found" do expect do Braintree::Transaction.find("invalid-id") end.to raise_error(Braintree::NotFoundError, 'transaction with id "invalid-id" not found') + end + + context "disbursement_details" do + it "includes disbursement_details on found transactions" do + found_transaction = Braintree::Transaction.find("deposittransaction") + + found_transaction.disbursed?.should == true + disbursement = found_transaction.disbursement_details + + disbursement.disbursement_date.should == "2013-04-10" + disbursement.settlement_amount.should == "100.00" + disbursement.settlement_currency_iso_code.should == "USD" + disbursement.settlement_currency_exchange_rate.should == "1" + disbursement.funds_held?.should == false + end + + it "is not disbursed" do + result = Braintree::Transaction.create( + :type => "sale", + :amount => Braintree::Test::TransactionAmounts::Authorize, + :credit_card => { + :number => Braintree::Test::CreditCardNumbers::Visa, + :expiration_date => "05/2009" + } + ) + result.success?.should == true + created_transaction = result.transaction + + created_transaction.disbursed?.should == false + end end end describe "self.void" do it "returns a successful result if successful" do