braintree-rails 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <search-results>
3
+ <page-size type="integer">50</page-size>
4
+ <ids type="array">
5
+ <item>dz558w</item>
6
+ </ids>
7
+ </search-results>
@@ -0,0 +1,115 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <credit-card-transactions type="collection">
3
+ <current-page-number type="integer">1</current-page-number>
4
+ <page-size type="integer">50</page-size>
5
+ <total-items type="integer">1</total-items>
6
+ <transaction>
7
+ <id>transactionid</id>
8
+ <status>authorized</status>
9
+ <type>sale</type>
10
+ <currency-iso-code>USD</currency-iso-code>
11
+ <amount>9.00</amount>
12
+ <merchant-account-id>n3dbctrrrwc9vb3j</merchant-account-id>
13
+ <order-id nil="true"></order-id>
14
+ <created-at type="datetime">2013-02-02T04:38:56Z</created-at>
15
+ <updated-at type="datetime">2013-02-02T04:38:56Z</updated-at>
16
+ <customer>
17
+ <id>customer_id</id>
18
+ <first-name>Brain93</first-name>
19
+ <last-name>Tree33</last-name>
20
+ <company nil="true"></company>
21
+ <email nil="true"></email>
22
+ <website nil="true"></website>
23
+ <phone nil="true"></phone>
24
+ <fax nil="true"></fax>
25
+ </customer>
26
+ <billing>
27
+ <id>xh</id>
28
+ <first-name>Brain</first-name>
29
+ <last-name>Tree</last-name>
30
+ <company>Braintree</company>
31
+ <street-address>1350 Crane Avenue</street-address>
32
+ <extended-address>Suite 340</extended-address>
33
+ <locality>Menlo Park</locality>
34
+ <region>California</region>
35
+ <postal-code>63091</postal-code>
36
+ <country-name>United States of America</country-name>
37
+ <country-code-alpha2>US</country-code-alpha2>
38
+ <country-code-alpha3>USA</country-code-alpha3>
39
+ <country-code-numeric>840</country-code-numeric>
40
+ </billing>
41
+ <refund-id nil="true"></refund-id>
42
+ <refund-ids type="array"/>
43
+ <refunded-transaction-id nil="true"></refunded-transaction-id>
44
+ <settlement-batch-id nil="true"></settlement-batch-id>
45
+ <shipping>
46
+ <id nil="true"></id>
47
+ <first-name nil="true"></first-name>
48
+ <last-name nil="true"></last-name>
49
+ <company nil="true"></company>
50
+ <street-address nil="true"></street-address>
51
+ <extended-address nil="true"></extended-address>
52
+ <locality nil="true"></locality>
53
+ <region nil="true"></region>
54
+ <postal-code nil="true"></postal-code>
55
+ <country-name nil="true"></country-name>
56
+ <country-code-alpha2 nil="true"></country-code-alpha2>
57
+ <country-code-alpha3 nil="true"></country-code-alpha3>
58
+ <country-code-numeric nil="true"></country-code-numeric>
59
+ </shipping>
60
+ <custom-fields>
61
+ </custom-fields>
62
+ <avs-error-response-code nil="true"></avs-error-response-code>
63
+ <avs-postal-code-response-code>M</avs-postal-code-response-code>
64
+ <avs-street-address-response-code>M</avs-street-address-response-code>
65
+ <cvv-response-code>I</cvv-response-code>
66
+ <gateway-rejection-reason nil="true"></gateway-rejection-reason>
67
+ <processor-authorization-code>W05DGY</processor-authorization-code>
68
+ <processor-response-code>1000</processor-response-code>
69
+ <processor-response-text>Approved</processor-response-text>
70
+ <purchase-order-number nil="true"></purchase-order-number>
71
+ <tax-amount nil="true"></tax-amount>
72
+ <tax-exempt type="boolean">false</tax-exempt>
73
+ <credit-card>
74
+ <token>credit_card_id</token>
75
+ <bin>510510</bin>
76
+ <last-4>5100</last-4>
77
+ <card-type>MasterCard</card-type>
78
+ <expiration-month>01</expiration-month>
79
+ <expiration-year>2035</expiration-year>
80
+ <customer-location>US</customer-location>
81
+ <cardholder-name>Brain Tree</cardholder-name>
82
+ <prepaid>Unknown</prepaid>
83
+ <healthcare>Unknown</healthcare>
84
+ <debit>Unknown</debit>
85
+ <durbin-regulated>Unknown</durbin-regulated>
86
+ <commercial>Unknown</commercial>
87
+ <payroll>Unknown</payroll>
88
+ <issuing-bank>Unknown</issuing-bank>
89
+ <country-of-issuance>Unknown</country-of-issuance>
90
+ </credit-card>
91
+ <status-history type="array">
92
+ <status-event>
93
+ <timestamp type="datetime">2013-02-02T04:38:56Z</timestamp>
94
+ <status>authorized</status>
95
+ <amount>9.00</amount>
96
+ <user>linyang84</user>
97
+ <transaction-source>API</transaction-source>
98
+ </status-event>
99
+ </status-history>
100
+ <plan-id nil="true"></plan-id>
101
+ <subscription-id nil="true"></subscription-id>
102
+ <subscription>
103
+ <billing-period-end-date nil="true"></billing-period-end-date>
104
+ <billing-period-start-date nil="true"></billing-period-start-date>
105
+ </subscription>
106
+ <add-ons type="array"/>
107
+ <discounts type="array"/>
108
+ <descriptor>
109
+ <name nil="true"></name>
110
+ <phone nil="true"></phone>
111
+ </descriptor>
112
+ <recurring type="boolean">false</recurring>
113
+ <channel nil="true"></channel>
114
+ </transaction>
115
+ </credit-card-transactions>
@@ -11,7 +11,7 @@ describe 'Address Integration' do
11
11
  customer.addresses.create!(attributes)
12
12
  braintree_customer = Braintree::Customer.find(customer.id)
13
13
  braintree_address = braintree_customer.addresses.first
14
-
14
+
15
15
  attributes.each do |key, value|
16
16
  braintree_address.send(key).must_equal value
17
17
  end
@@ -42,5 +42,4 @@ describe 'Address Integration' do
42
42
  address.persisted?.must_equal false
43
43
  address.frozen?.must_equal true
44
44
  end
45
-
46
- end
45
+ end
@@ -10,7 +10,7 @@ describe BraintreeRails::CreditCards do
10
10
  braintree_customer = Braintree::Customer.find('customer_id')
11
11
  braintree_credit_cards = braintree_customer.credit_cards
12
12
  credit_cards = BraintreeRails::CreditCards.new(braintree_customer, braintree_credit_cards)
13
-
13
+
14
14
  credit_cards.size.must_equal braintree_credit_cards.size
15
15
 
16
16
  braintree_credit_cards.each do |braintree_credit_card|
@@ -55,4 +55,4 @@ describe BraintreeRails::CreditCards do
55
55
  braintree_customer.credit_cards.wont_include credit_card
56
56
  end
57
57
  end
58
- end
58
+ end
@@ -0,0 +1,39 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '../unit_test_helper'))
2
+
3
+ describe BraintreeRails::Transactions do
4
+
5
+ before do
6
+ stub_braintree_request(:get, '/customers/customer_id', :body => fixture('customer.xml'))
7
+ stub_braintree_request(:get, '/payment_methods/credit_card_id', :body => fixture('credit_card.xml'))
8
+ end
9
+
10
+ describe '#initialize' do
11
+ it 'should load an array of Braintree::Transaction' do
12
+ stub_braintree_request(:post, '/transactions/advanced_search_ids', :body => fixture('transaction_ids.xml'))
13
+ stub_braintree_request(:post, '/transactions/advanced_search', :body => fixture('transactions.xml'))
14
+
15
+ braintree_transactions = Braintree::Transaction.search do |search|
16
+ search.customer_id.is 'customer_id'
17
+ search.payment_method_token.is 'credit_card_id'
18
+ end
19
+
20
+ transactions = BraintreeRails::Transactions.new(BraintreeRails::Customer.new('customer_id'))
21
+
22
+ transactions.map(&:id).sort.must_equal braintree_transactions.map(&:id).sort
23
+ end
24
+ end
25
+
26
+ describe '#lazy_loading' do
27
+ it 'should not load if not necessary' do
28
+ lambda {BraintreeRails::Transactions.new(BraintreeRails::Customer.new('customer_id'))}.must_be_silent
29
+ end
30
+
31
+ it 'load from Braintree when needed' do
32
+ transactions = BraintreeRails::Transactions.new(BraintreeRails::Customer.new('customer_id'))
33
+ stub_braintree_request(:post, '/transactions/advanced_search_ids', :body => fixture('transaction_ids.xml'))
34
+ stub_braintree_request(:post, '/transactions/advanced_search', :body => fixture('transactions.xml'))
35
+
36
+ transactions.find('transactionid').wont_be :blank?
37
+ end
38
+ end
39
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: braintree-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-29 00:00:00.000000000 Z
12
+ date: 2013-02-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: braintree
@@ -228,6 +228,8 @@ files:
228
228
  - test/fixtures/customer.xml
229
229
  - test/fixtures/transaction.xml
230
230
  - test/fixtures/transaction_error.xml
231
+ - test/fixtures/transaction_ids.xml
232
+ - test/fixtures/transactions.xml
231
233
  - test/integration/braintree_rails/address_integration_test.rb
232
234
  - test/integration/braintree_rails/credit_card_integration_test.rb
233
235
  - test/integration/braintree_rails/customer_integration_test.rb
@@ -253,9 +255,9 @@ require_paths:
253
255
  required_ruby_version: !ruby/object:Gem::Requirement
254
256
  none: false
255
257
  requirements:
256
- - - ! '>='
258
+ - - '='
257
259
  - !ruby/object:Gem::Version
258
- version: '0'
260
+ version: 1.9.3
259
261
  required_rubygems_version: !ruby/object:Gem::Requirement
260
262
  none: false
261
263
  requirements: