Sha256: 11e2089a0306ba7fbb0e0297716cac46fa719031146d6a11f85dfe4c57627c30

Contents?: true

Size: 1.23 KB

Versions: 32

Compression:

Stored size: 1.23 KB

Contents

require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
require File.expand_path(File.dirname(__FILE__) + "/client_api/spec_helper")

describe Braintree::TransactionLineItem do
  describe "self.find_all" do
    it "returns line_items for the specified transaction" do
      result = Braintree::Transaction.create(
        :type => "sale",
        :amount => Braintree::Test::TransactionAmounts::Authorize,
        :credit_card => {
          :number => Braintree::Test::CreditCardNumbers::Visa,
          :expiration_date => "05/2009"
        },
        :line_items => [
          {
            :quantity => "1.0232",
            :name => "Name #1",
            :kind => "debit",
            :unit_amount => "45.1232",
            :total_amount => "45.15",
          },
        ],
      )
      result.success?.should == true
      transaction = result.transaction

      line_items = Braintree::TransactionLineItem.find_all(transaction.id)

      line_item = line_items[0]
      line_item.quantity.should == BigDecimal("1.0232")
      line_item.name.should == "Name #1"
      line_item.kind.should == "debit"
      line_item.unit_amount.should == BigDecimal("45.1232")
      line_item.total_amount.should == BigDecimal("45.15")
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
braintree-4.14.0 spec/integration/braintree/transaction_line_item_spec.rb
braintree-4.13.0 spec/integration/braintree/transaction_line_item_spec.rb
braintree-4.12.0 spec/integration/braintree/transaction_line_item_spec.rb
braintree-4.11.0 spec/integration/braintree/transaction_line_item_spec.rb
braintree-4.10.0 spec/integration/braintree/transaction_line_item_spec.rb
braintree-4.9.0 spec/integration/braintree/transaction_line_item_spec.rb
braintree-4.8.0 spec/integration/braintree/transaction_line_item_spec.rb
braintree-4.7.0 spec/integration/braintree/transaction_line_item_spec.rb
braintree-4.6.0 spec/integration/braintree/transaction_line_item_spec.rb
braintree-4.5.0 spec/integration/braintree/transaction_line_item_spec.rb
braintree-4.4.0 spec/integration/braintree/transaction_line_item_spec.rb
braintree-4.3.0 spec/integration/braintree/transaction_line_item_spec.rb
braintree-4.2.0 spec/integration/braintree/transaction_line_item_spec.rb
braintree-4.1.0 spec/integration/braintree/transaction_line_item_spec.rb
braintree-4.0.0 spec/integration/braintree/transaction_line_item_spec.rb
braintree-3.4.0 spec/integration/braintree/transaction_line_item_spec.rb
braintree-3.3.0 spec/integration/braintree/transaction_line_item_spec.rb
braintree-3.2.0 spec/integration/braintree/transaction_line_item_spec.rb
braintree-3.1.0 spec/integration/braintree/transaction_line_item_spec.rb
braintree-3.0.1 spec/integration/braintree/transaction_line_item_spec.rb