braintree 2.74.0 → 4.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (286) hide show
  1. checksums.yaml +5 -5
  2. data/LICENSE +1 -1
  3. data/braintree.gemspec +13 -7
  4. data/lib/braintree/account_updater_daily_report.rb +2 -2
  5. data/lib/braintree/ach_mandate.rb +2 -1
  6. data/lib/braintree/address/country_names.rb +4 -1
  7. data/lib/braintree/address.rb +30 -38
  8. data/lib/braintree/address_gateway.rb +12 -2
  9. data/lib/braintree/advanced_search.rb +8 -0
  10. data/lib/braintree/apple_pay.rb +29 -0
  11. data/lib/braintree/apple_pay_card.rb +28 -4
  12. data/lib/braintree/apple_pay_gateway.rb +37 -0
  13. data/lib/braintree/apple_pay_options.rb +19 -0
  14. data/lib/braintree/authorization_adjustment.rb +23 -0
  15. data/lib/braintree/base_module.rb +10 -0
  16. data/lib/braintree/bin_data.rb +33 -0
  17. data/lib/braintree/client_token.rb +3 -3
  18. data/lib/braintree/client_token_gateway.rb +3 -1
  19. data/lib/braintree/configuration.rb +57 -10
  20. data/lib/braintree/connected_merchant_paypal_status_changed.rb +6 -2
  21. data/lib/braintree/connected_merchant_status_transitioned.rb +6 -2
  22. data/lib/braintree/credentials_parser.rb +5 -1
  23. data/lib/braintree/credit_card.rb +53 -107
  24. data/lib/braintree/credit_card_gateway.rb +43 -30
  25. data/lib/braintree/credit_card_verification.rb +61 -21
  26. data/lib/braintree/credit_card_verification_gateway.rb +19 -6
  27. data/lib/braintree/credit_card_verification_search.rb +1 -1
  28. data/lib/braintree/customer.rb +51 -98
  29. data/lib/braintree/customer_gateway.rb +30 -23
  30. data/lib/braintree/customer_search.rb +1 -1
  31. data/lib/braintree/descriptor.rb +3 -1
  32. data/lib/braintree/disbursement.rb +24 -2
  33. data/lib/braintree/dispute/evidence.rb +24 -0
  34. data/lib/braintree/{transaction/coinbase_details.rb → dispute/paypal_message.rb} +5 -3
  35. data/lib/braintree/dispute/status_history.rb +18 -0
  36. data/lib/braintree/dispute/transaction.rb +20 -0
  37. data/lib/braintree/dispute/transaction_details.rb +2 -1
  38. data/lib/braintree/dispute.rb +114 -10
  39. data/lib/braintree/dispute_gateway.rb +142 -0
  40. data/lib/braintree/dispute_search.rb +31 -0
  41. data/lib/braintree/document_upload.rb +37 -0
  42. data/lib/braintree/document_upload_gateway.rb +38 -0
  43. data/lib/braintree/enriched_customer_data.rb +21 -0
  44. data/lib/braintree/error_codes.rb +328 -109
  45. data/lib/braintree/error_result.rb +8 -1
  46. data/lib/braintree/exceptions.rb +5 -3
  47. data/lib/braintree/exchange_rate.rb +13 -0
  48. data/lib/braintree/exchange_rate_quote.rb +24 -0
  49. data/lib/braintree/exchange_rate_quote_gateway.rb +35 -0
  50. data/lib/braintree/exchange_rate_quote_input.rb +21 -0
  51. data/lib/braintree/exchange_rate_quote_request.rb +18 -0
  52. data/lib/braintree/exchange_rate_quote_response.rb +18 -0
  53. data/lib/braintree/facilitated_details.rb +21 -0
  54. data/lib/braintree/facilitator_details.rb +2 -1
  55. data/lib/braintree/gateway.rb +29 -11
  56. data/lib/braintree/google_pay_card.rb +61 -0
  57. data/lib/braintree/granted_payment_instrument_update.rb +23 -0
  58. data/lib/braintree/graphql_client.rb +34 -0
  59. data/lib/braintree/http.rb +81 -20
  60. data/lib/braintree/local_payment_completed.rb +23 -0
  61. data/lib/braintree/local_payment_expired.rb +21 -0
  62. data/lib/braintree/local_payment_funded.rb +22 -0
  63. data/lib/braintree/local_payment_reversed.rb +19 -0
  64. data/lib/braintree/merchant.rb +11 -4
  65. data/lib/braintree/merchant_account/address_details.rb +4 -1
  66. data/lib/braintree/merchant_account/business_details.rb +4 -1
  67. data/lib/braintree/merchant_account/funding_details.rb +6 -1
  68. data/lib/braintree/merchant_account/individual_details.rb +7 -2
  69. data/lib/braintree/merchant_account.rb +23 -10
  70. data/lib/braintree/merchant_account_gateway.rb +13 -1
  71. data/lib/braintree/merchant_gateway.rb +2 -2
  72. data/lib/braintree/modification.rb +1 -1
  73. data/lib/braintree/oauth_credentials.rb +5 -2
  74. data/lib/braintree/oauth_gateway.rb +8 -14
  75. data/lib/braintree/paginated_result.rb +3 -1
  76. data/lib/braintree/payment_instrument_type.rb +11 -11
  77. data/lib/braintree/payment_method.rb +20 -12
  78. data/lib/braintree/payment_method_customer_data_updated_metadata.rb +24 -0
  79. data/lib/braintree/payment_method_gateway.rb +82 -54
  80. data/lib/braintree/payment_method_nonce.rb +22 -8
  81. data/lib/braintree/payment_method_nonce_details.rb +40 -0
  82. data/lib/braintree/payment_method_nonce_details_payer_info.rb +32 -0
  83. data/lib/braintree/payment_method_nonce_gateway.rb +19 -2
  84. data/lib/braintree/payment_method_parser.rb +28 -0
  85. data/lib/braintree/paypal_account.rb +10 -1
  86. data/lib/braintree/plan.rb +25 -5
  87. data/lib/braintree/plan_gateway.rb +100 -0
  88. data/lib/braintree/processor_response_types.rb +7 -0
  89. data/lib/braintree/resource_collection.rb +8 -3
  90. data/lib/braintree/revoked_payment_method_metadata.rb +22 -0
  91. data/lib/braintree/risk_data/liability_shift.rb +22 -0
  92. data/lib/braintree/risk_data.rb +12 -2
  93. data/lib/braintree/samsung_pay_card.rb +83 -0
  94. data/lib/braintree/sepa_direct_debit_account.rb +60 -0
  95. data/lib/braintree/sepa_direct_debit_account_gateway.rb +25 -0
  96. data/lib/braintree/sepa_direct_debit_account_nonce_details.rb +28 -0
  97. data/lib/braintree/settlement_batch_summary.rb +2 -1
  98. data/lib/braintree/settlement_batch_summary_gateway.rb +2 -0
  99. data/lib/braintree/subscription/status_details.rb +8 -1
  100. data/lib/braintree/subscription.rb +56 -41
  101. data/lib/braintree/subscription_gateway.rb +25 -2
  102. data/lib/braintree/successful_result.rb +23 -1
  103. data/lib/braintree/test/authentication_id.rb +21 -0
  104. data/lib/braintree/test/credit_card.rb +13 -0
  105. data/lib/braintree/test/nonce.rb +28 -20
  106. data/lib/braintree/test/transaction_amounts.rb +1 -0
  107. data/lib/braintree/three_d_secure_info.rb +34 -2
  108. data/lib/braintree/transaction/address_details.rb +24 -4
  109. data/lib/braintree/transaction/apple_pay_details.rb +20 -2
  110. data/lib/braintree/transaction/credit_card_details.rb +45 -6
  111. data/lib/braintree/transaction/customer_details.rb +8 -1
  112. data/lib/braintree/transaction/disbursement_details.rb +6 -1
  113. data/lib/braintree/transaction/google_pay_details.rb +41 -0
  114. data/lib/braintree/transaction/installment/adjustment.rb +33 -0
  115. data/lib/braintree/transaction/installment.rb +28 -0
  116. data/lib/braintree/transaction/local_payment_details.rb +24 -0
  117. data/lib/braintree/transaction/paypal_details.rb +26 -4
  118. data/lib/braintree/transaction/paypal_here_details.rb +23 -0
  119. data/lib/braintree/transaction/{masterpass_card_details.rb → samsung_pay_card_details.rb} +21 -6
  120. data/lib/braintree/transaction/sepa_direct_debit_account_details.rb +27 -0
  121. data/lib/braintree/transaction/status_details.rb +5 -1
  122. data/lib/braintree/transaction/subscription_details.rb +4 -1
  123. data/lib/braintree/transaction/us_bank_account_details.rb +8 -1
  124. data/lib/braintree/transaction/venmo_account_details.rb +5 -1
  125. data/lib/braintree/transaction/visa_checkout_card_details.rb +19 -4
  126. data/lib/braintree/transaction.rb +201 -188
  127. data/lib/braintree/transaction_gateway.rb +124 -30
  128. data/lib/braintree/transaction_line_item.rb +40 -0
  129. data/lib/braintree/transaction_line_item_gateway.rb +19 -0
  130. data/lib/braintree/transaction_review.rb +18 -0
  131. data/lib/braintree/transaction_search.rb +6 -3
  132. data/lib/braintree/unknown_payment_method.rb +3 -2
  133. data/lib/braintree/us_bank_account.rb +24 -8
  134. data/lib/braintree/us_bank_account_gateway.rb +0 -1
  135. data/lib/braintree/us_bank_account_verification.rb +81 -0
  136. data/lib/braintree/us_bank_account_verification_gateway.rb +51 -0
  137. data/lib/braintree/us_bank_account_verification_search.rb +19 -0
  138. data/lib/braintree/util.rb +79 -9
  139. data/lib/braintree/validation_error.rb +13 -3
  140. data/lib/braintree/validation_error_collection.rb +2 -1
  141. data/lib/braintree/venmo_account.rb +11 -4
  142. data/lib/braintree/venmo_profile_data.rb +23 -0
  143. data/lib/braintree/version.rb +2 -2
  144. data/lib/braintree/visa_checkout_card.rb +29 -13
  145. data/lib/braintree/webhook_notification.rb +66 -26
  146. data/lib/braintree/webhook_notification_gateway.rb +5 -3
  147. data/lib/braintree/webhook_testing.rb +2 -2
  148. data/lib/braintree/webhook_testing_gateway.rb +721 -55
  149. data/lib/braintree/xml/generator.rb +6 -4
  150. data/lib/braintree/xml/parser.rb +22 -35
  151. data/lib/braintree/xml/rexml.rb +4 -5
  152. data/lib/braintree.rb +60 -22
  153. data/lib/ssl/api_braintreegateway_com.ca.crt +50 -0
  154. data/spec/fixtures/files/bt_logo.png +0 -0
  155. data/spec/fixtures/files/gif_extension_bt_logo.gif +0 -0
  156. data/spec/fixtures/files/malformed_pdf.pdf +1 -0
  157. data/spec/fixtures/files/too_long.pdf +0 -0
  158. data/spec/integration/braintree/add_on_spec.rb +3 -3
  159. data/spec/integration/braintree/address_spec.rb +30 -113
  160. data/spec/integration/braintree/advanced_search_spec.rb +45 -45
  161. data/spec/integration/braintree/apple_pay_spec.rb +63 -0
  162. data/spec/integration/braintree/braintree_gateway_spec.rb +72 -0
  163. data/spec/integration/braintree/client_api/client_token_spec.rb +14 -32
  164. data/spec/integration/braintree/client_api/spec_helper.rb +104 -65
  165. data/spec/integration/braintree/credit_card_spec.rb +460 -615
  166. data/spec/integration/braintree/credit_card_verification_search_spec.rb +2 -2
  167. data/spec/integration/braintree/credit_card_verification_spec.rb +222 -6
  168. data/spec/integration/braintree/customer_search_spec.rb +8 -8
  169. data/spec/integration/braintree/customer_spec.rb +810 -498
  170. data/spec/integration/braintree/discount_spec.rb +1 -1
  171. data/spec/integration/braintree/dispute_search_spec.rb +167 -0
  172. data/spec/integration/braintree/dispute_spec.rb +333 -0
  173. data/spec/integration/braintree/document_upload_spec.rb +87 -0
  174. data/spec/integration/braintree/error_codes_spec.rb +1 -1
  175. data/spec/integration/braintree/exchange_rate_quote_spec.rb +97 -0
  176. data/spec/integration/braintree/graphql_client_spec.rb +72 -0
  177. data/spec/integration/braintree/http_spec.rb +12 -4
  178. data/spec/integration/braintree/merchant_account_spec.rb +74 -26
  179. data/spec/integration/braintree/merchant_spec.rb +39 -13
  180. data/spec/integration/braintree/oauth_spec.rb +18 -25
  181. data/spec/integration/braintree/payment_method_nonce_spec.rb +239 -5
  182. data/spec/integration/braintree/payment_method_spec.rb +882 -300
  183. data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +416 -0
  184. data/spec/integration/braintree/paypal_account_spec.rb +32 -31
  185. data/spec/integration/braintree/plan_spec.rb +82 -0
  186. data/spec/integration/braintree/samsung_pay_card_spec.rb +144 -0
  187. data/spec/integration/braintree/sepa_direct_debit_account_spec.rb +196 -0
  188. data/spec/integration/braintree/settlement_batch_summary_spec.rb +8 -8
  189. data/spec/integration/braintree/subscription_spec.rb +274 -180
  190. data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
  191. data/spec/integration/braintree/test_transaction_spec.rb +18 -18
  192. data/spec/integration/braintree/transaction_line_item_spec.rb +38 -0
  193. data/spec/integration/braintree/transaction_search_spec.rb +280 -152
  194. data/spec/integration/braintree/transaction_spec.rb +3709 -1175
  195. data/spec/integration/braintree/transaction_us_bank_account_spec.rb +438 -0
  196. data/spec/integration/braintree/us_bank_account_spec.rb +38 -17
  197. data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +178 -0
  198. data/spec/integration/braintree/us_bank_account_verification_spec.rb +240 -0
  199. data/spec/integration/braintree/visa_checkout_card_spec.rb +5 -5
  200. data/spec/integration/spec_helper.rb +27 -6
  201. data/spec/oauth_test_helper.rb +1 -1
  202. data/spec/script/httpsd.rb +6 -6
  203. data/spec/spec_helper.rb +26 -23
  204. data/spec/unit/braintree/address_spec.rb +1 -9
  205. data/spec/unit/braintree/apple_pay_card_spec.rb +104 -4
  206. data/spec/unit/braintree/client_token_spec.rb +2 -2
  207. data/spec/unit/braintree/configuration_spec.rb +108 -33
  208. data/spec/unit/braintree/credit_card_spec.rb +62 -33
  209. data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +51 -0
  210. data/spec/unit/braintree/credit_card_verification_search_spec.rb +1 -1
  211. data/spec/unit/braintree/credit_card_verification_spec.rb +39 -6
  212. data/spec/unit/braintree/customer_spec.rb +107 -27
  213. data/spec/unit/braintree/disbursement_spec.rb +59 -7
  214. data/spec/unit/braintree/dispute_search_spec.rb +66 -0
  215. data/spec/unit/braintree/dispute_spec.rb +472 -8
  216. data/spec/unit/braintree/document_upload_spec.rb +35 -0
  217. data/spec/unit/braintree/enriched_customer_data_spec.rb +32 -0
  218. data/spec/unit/braintree/error_result_spec.rb +5 -5
  219. data/spec/unit/braintree/errors_spec.rb +8 -8
  220. data/spec/unit/braintree/exchange_rate_quote_input_spec.rb +42 -0
  221. data/spec/unit/braintree/exchange_rate_quote_request_spec.rb +82 -0
  222. data/spec/unit/braintree/exchange_rate_quote_response_spec.rb +52 -0
  223. data/spec/unit/braintree/exchange_rate_quote_spec.rb +42 -0
  224. data/spec/unit/braintree/exchange_rate_spec.rb +23 -0
  225. data/spec/unit/braintree/http_spec.rb +93 -5
  226. data/spec/unit/braintree/local_payment_completed_spec.rb +50 -0
  227. data/spec/unit/braintree/local_payment_expired_spec.rb +24 -0
  228. data/spec/unit/braintree/local_payment_funded_spec.rb +34 -0
  229. data/spec/unit/braintree/merchant_account_spec.rb +1 -1
  230. data/spec/unit/braintree/modification_spec.rb +1 -1
  231. data/spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb +45 -0
  232. data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +31 -0
  233. data/spec/unit/braintree/payment_method_nonce_details_spec.rb +51 -0
  234. data/spec/unit/braintree/payment_method_nonce_spec.rb +40 -0
  235. data/spec/unit/braintree/payment_method_spec.rb +1 -1
  236. data/spec/unit/braintree/paypal_account_spec.rb +2 -2
  237. data/spec/unit/braintree/resource_collection_spec.rb +30 -1
  238. data/spec/unit/braintree/risk_data/liability_shift.rb +26 -0
  239. data/spec/unit/braintree/risk_data_spec.rb +40 -6
  240. data/spec/unit/braintree/sepa_debit_account_nonce_details_spec.rb +29 -0
  241. data/spec/unit/braintree/sepa_debit_account_spec.rb +86 -0
  242. data/spec/unit/braintree/subscription_search_spec.rb +1 -1
  243. data/spec/unit/braintree/subscription_spec.rb +2 -2
  244. data/spec/unit/braintree/successful_result_spec.rb +1 -1
  245. data/spec/unit/braintree/three_d_secure_info_spec.rb +34 -6
  246. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +19 -3
  247. data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
  248. data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
  249. data/spec/unit/braintree/transaction/installment_spec.rb +25 -0
  250. data/spec/unit/braintree/transaction/paypal_details_spec.rb +63 -0
  251. data/spec/unit/braintree/transaction/sepa_direct_debit_account_details_spec.rb +33 -0
  252. data/spec/unit/braintree/transaction_gateway_spec.rb +111 -0
  253. data/spec/unit/braintree/transaction_search_spec.rb +12 -12
  254. data/spec/unit/braintree/transaction_spec.rb +171 -55
  255. data/spec/unit/braintree/us_bank_account_verification_search_spec.rb +60 -0
  256. data/spec/unit/braintree/us_bank_account_verification_spec.rb +93 -0
  257. data/spec/unit/braintree/util_spec.rb +162 -19
  258. data/spec/unit/braintree/validation_error_collection_spec.rb +336 -133
  259. data/spec/unit/braintree/venmo_profile_data_spec.rb +32 -0
  260. data/spec/unit/braintree/webhook_notification_spec.rb +546 -114
  261. data/spec/unit/braintree/xml/parser_spec.rb +21 -16
  262. data/spec/unit/braintree/xml_spec.rb +31 -24
  263. data/spec/unit/braintree_spec.rb +1 -0
  264. metadata +290 -198
  265. data/README.rdoc +0 -93
  266. data/lib/braintree/amex_express_checkout_card.rb +0 -26
  267. data/lib/braintree/android_pay_card.rb +0 -35
  268. data/lib/braintree/coinbase_account.rb +0 -25
  269. data/lib/braintree/europe_bank_account.rb +0 -34
  270. data/lib/braintree/europe_bank_account_gateway.rb +0 -17
  271. data/lib/braintree/ideal_payment.rb +0 -46
  272. data/lib/braintree/ideal_payment_gateway.rb +0 -18
  273. data/lib/braintree/masterpass_card.rb +0 -66
  274. data/lib/braintree/settlement_batch.rb +0 -0
  275. data/lib/braintree/transaction/amex_express_checkout_details.rb +0 -14
  276. data/lib/braintree/transaction/android_pay_details.rb +0 -17
  277. data/lib/braintree/transaction/ideal_payment_details.rb +0 -13
  278. data/lib/braintree/transparent_redirect.rb +0 -40
  279. data/lib/braintree/transparent_redirect_gateway.rb +0 -105
  280. data/spec/hacks/tcp_socket.rb +0 -18
  281. data/spec/httpsd.pid +0 -1
  282. data/spec/integration/braintree/coinbase_spec.rb +0 -31
  283. data/spec/integration/braintree/ideal_payment_spec.rb +0 -87
  284. data/spec/integration/braintree/masterpass_card_spec.rb +0 -97
  285. data/spec/integration/braintree/transparent_redirect_spec.rb +0 -268
  286. data/spec/unit/braintree/transparent_redirect_spec.rb +0 -223
@@ -14,8 +14,9 @@ describe Braintree::Address do
14
14
  :extended_address => "Suite 200",
15
15
  :locality => "Chicago",
16
16
  :region => "Illinois",
17
+ :phone_number => "5551231234",
17
18
  :postal_code => "60622",
18
- :country_name => "United States of America"
19
+ :country_name => "United States of America",
19
20
  )
20
21
  result.success?.should == true
21
22
  result.address.customer_id.should == customer.id
@@ -26,6 +27,7 @@ describe Braintree::Address do
26
27
  result.address.extended_address.should == "Suite 200"
27
28
  result.address.locality.should == "Chicago"
28
29
  result.address.region.should == "Illinois"
30
+ result.address.phone_number.should == "5551231234"
29
31
  result.address.postal_code.should == "60622"
30
32
  result.address.country_name.should == "United States of America"
31
33
  result.address.country_code_alpha2.should == "US"
@@ -39,7 +41,7 @@ describe Braintree::Address do
39
41
  :customer_id => customer.id,
40
42
  :country_code_alpha2 => "AS",
41
43
  :country_code_alpha3 => "ASM",
42
- :country_code_numeric => "16"
44
+ :country_code_numeric => "16",
43
45
  )
44
46
  result.success?.should == true
45
47
  result.address.country_name.should == "American Samoa"
@@ -52,7 +54,7 @@ describe Braintree::Address do
52
54
  customer = Braintree::Customer.create!
53
55
  result = Braintree::Address.create(
54
56
  :customer_id => customer.id,
55
- :country_name => "Åland"
57
+ :country_name => "Åland",
56
58
  )
57
59
  result.success?.should == true
58
60
  result.address.country_name.should == "Åland"
@@ -63,47 +65,47 @@ describe Braintree::Address do
63
65
  result = Braintree::Address.create(
64
66
  :customer_id => customer.id,
65
67
  :country_code_alpha2 => "AS",
66
- :country_code_alpha3 => "USA"
68
+ :country_code_alpha3 => "USA",
67
69
  )
68
70
  result.success?.should == false
69
- result.errors.for(:address).on(:base).map {|e| e.code}.should include(Braintree::ErrorCodes::Address::InconsistentCountry)
71
+ result.errors.for(:address).on(:base).map { |e| e.code }.should include(Braintree::ErrorCodes::Address::InconsistentCountry)
70
72
  end
71
73
 
72
74
  it "returns an error response given an invalid country_code_alpha2" do
73
75
  customer = Braintree::Customer.create!
74
76
  result = Braintree::Address.create(
75
77
  :customer_id => customer.id,
76
- :country_code_alpha2 => "zz"
78
+ :country_code_alpha2 => "zz",
77
79
  )
78
80
  result.success?.should == false
79
- result.errors.for(:address).on(:country_code_alpha2).map {|e| e.code}.should include(Braintree::ErrorCodes::Address::CountryCodeAlpha2IsNotAccepted)
81
+ result.errors.for(:address).on(:country_code_alpha2).map { |e| e.code }.should include(Braintree::ErrorCodes::Address::CountryCodeAlpha2IsNotAccepted)
80
82
  end
81
83
 
82
84
  it "returns an error response given an invalid country_code_alpha3" do
83
85
  customer = Braintree::Customer.create!
84
86
  result = Braintree::Address.create(
85
87
  :customer_id => customer.id,
86
- :country_code_alpha3 => "zzz"
88
+ :country_code_alpha3 => "zzz",
87
89
  )
88
90
  result.success?.should == false
89
- result.errors.for(:address).on(:country_code_alpha3).map {|e| e.code}.should include(Braintree::ErrorCodes::Address::CountryCodeAlpha3IsNotAccepted)
91
+ result.errors.for(:address).on(:country_code_alpha3).map { |e| e.code }.should include(Braintree::ErrorCodes::Address::CountryCodeAlpha3IsNotAccepted)
90
92
  end
91
93
 
92
94
  it "returns an error response given an invalid country_code_numeric" do
93
95
  customer = Braintree::Customer.create!
94
96
  result = Braintree::Address.create(
95
97
  :customer_id => customer.id,
96
- :country_code_numeric => "zz"
98
+ :country_code_numeric => "zz",
97
99
  )
98
100
  result.success?.should == false
99
- result.errors.for(:address).on(:country_code_numeric).map {|e| e.code}.should include(Braintree::ErrorCodes::Address::CountryCodeNumericIsNotAccepted)
101
+ result.errors.for(:address).on(:country_code_numeric).map { |e| e.code }.should include(Braintree::ErrorCodes::Address::CountryCodeNumericIsNotAccepted)
100
102
  end
101
103
 
102
104
  it "returns an error response if invalid" do
103
105
  customer = Braintree::Customer.create!(:last_name => "Wilson")
104
106
  result = Braintree::Address.create(
105
107
  :customer_id => customer.id,
106
- :country_name => "United States of Invalid"
108
+ :country_name => "United States of Invalid",
107
109
  )
108
110
  result.success?.should == false
109
111
  result.errors.for(:address).on(:country_name)[0].message.should == "Country name is not an accepted country."
@@ -131,14 +133,16 @@ describe Braintree::Address do
131
133
  :extended_address => "Suite 201",
132
134
  :locality => "Bartlett",
133
135
  :region => "IL",
136
+ :phone_number => "5551231234",
134
137
  :postal_code => "60623",
135
- :country_name => "United States of America"
138
+ :country_name => "United States of America",
136
139
  )
137
140
  address.customer_id.should == customer.id
138
141
  address.street_address.should == "1812 E Main St"
139
142
  address.extended_address.should == "Suite 201"
140
143
  address.locality.should == "Bartlett"
141
144
  address.region.should == "IL"
145
+ address.phone_number.should == "5551231234"
142
146
  address.postal_code.should == "60623"
143
147
  address.country_name.should == "United States of America"
144
148
  end
@@ -148,7 +152,7 @@ describe Braintree::Address do
148
152
  expect do
149
153
  Braintree::Address.create!(
150
154
  :customer_id => customer.id,
151
- :country_name => "United States of Invalid"
155
+ :country_name => "United States of Invalid",
152
156
  )
153
157
  end.to raise_error(Braintree::ValidationsFailed)
154
158
  end
@@ -226,7 +230,7 @@ describe Braintree::Address do
226
230
  :locality => "Old Chicago",
227
231
  :region => "IL",
228
232
  :postal_code => "60620",
229
- :country_name => "United States of America"
233
+ :country_name => "United States of America",
230
234
  )
231
235
  result = Braintree::Address.update(
232
236
  customer.id,
@@ -236,7 +240,7 @@ describe Braintree::Address do
236
240
  :locality => "Chicago",
237
241
  :region => "Illinois",
238
242
  :postal_code => "60621",
239
- :country_name => "United States of America"
243
+ :country_name => "United States of America",
240
244
  )
241
245
  result.success?.should == true
242
246
  result.address.street_address.should == "123 E New St"
@@ -254,12 +258,12 @@ describe Braintree::Address do
254
258
  customer = Braintree::Customer.create!(:last_name => "Miller")
255
259
  address = Braintree::Address.create!(
256
260
  :customer_id => customer.id,
257
- :country_name => "Angola"
261
+ :country_name => "Angola",
258
262
  )
259
263
  result = Braintree::Address.update(
260
264
  customer.id,
261
265
  address.id,
262
- :country_name => "Azerbaijan"
266
+ :country_name => "Azerbaijan",
263
267
  )
264
268
 
265
269
  result.success?.should == true
@@ -273,13 +277,13 @@ describe Braintree::Address do
273
277
  customer = Braintree::Customer.create!(:last_name => "Miller")
274
278
  address = Braintree::Address.create!(
275
279
  :customer_id => customer.id,
276
- :country_name => "United States of America"
280
+ :country_name => "United States of America",
277
281
  )
278
282
  result = Braintree::Address.update(
279
283
  customer.id,
280
284
  address.id,
281
285
  :street_address => "123 E New St",
282
- :country_name => "United States of Invalid"
286
+ :country_name => "United States of Invalid",
283
287
  )
284
288
  result.success?.should == false
285
289
  result.errors.for(:address).on(:country_name)[0].message.should == "Country name is not an accepted country."
@@ -304,7 +308,7 @@ describe Braintree::Address do
304
308
  :locality => "Old Chicago",
305
309
  :region => "IL",
306
310
  :postal_code => "60620",
307
- :country_name => "United States of America"
311
+ :country_name => "United States of America",
308
312
  )
309
313
  updated_address = Braintree::Address.update!(
310
314
  customer.id,
@@ -314,7 +318,7 @@ describe Braintree::Address do
314
318
  :locality => "Chicago",
315
319
  :region => "Illinois",
316
320
  :postal_code => "60621",
317
- :country_name => "United States of America"
321
+ :country_name => "United States of America",
318
322
  )
319
323
  updated_address.should == address
320
324
  updated_address.street_address.should == "123 E New St"
@@ -329,14 +333,14 @@ describe Braintree::Address do
329
333
  customer = Braintree::Customer.create!(:last_name => "Miller")
330
334
  address = Braintree::Address.create!(
331
335
  :customer_id => customer.id,
332
- :country_name => "United States of America"
336
+ :country_name => "United States of America",
333
337
  )
334
338
  expect do
335
339
  Braintree::Address.update!(
336
340
  customer.id,
337
341
  address.id,
338
342
  :street_address => "123 E New St",
339
- :country_name => "United States of Invalid"
343
+ :country_name => "United States of Invalid",
340
344
  )
341
345
  end.to raise_error(Braintree::ValidationsFailed)
342
346
  end
@@ -347,98 +351,11 @@ describe Braintree::Address do
347
351
  it "deletes the address" do
348
352
  customer = Braintree::Customer.create!(:last_name => "Wilson")
349
353
  address = Braintree::Address.create!(:customer_id => customer.id, :street_address => "123 E Main St")
350
- address.delete.success?.should == true
354
+ result = Braintree::Address.delete(customer.id, address.id)
355
+ result.success?.should == true
351
356
  expect do
352
357
  Braintree::Address.find(customer.id, address.id)
353
358
  end.to raise_error(Braintree::NotFoundError)
354
359
  end
355
360
  end
356
-
357
- describe "update" do
358
- it "returns a success response and updates the address if valid" do
359
- customer = Braintree::Customer.create!(:last_name => "Miller")
360
- address = Braintree::Address.create!(
361
- :customer_id => customer.id,
362
- :street_address => "1812 E Old St",
363
- :extended_address => "Suite Old 201",
364
- :locality => "Old Chicago",
365
- :region => "IL",
366
- :postal_code => "60620",
367
- :country_name => "United States of America"
368
- )
369
- result = address.update(
370
- :street_address => "123 E New St",
371
- :extended_address => "New Suite 3",
372
- :locality => "Chicago",
373
- :region => "Illinois",
374
- :postal_code => "60621",
375
- :country_name => "United States of America"
376
- )
377
- result.success?.should == true
378
- result.address.should == address
379
- address.street_address.should == "123 E New St"
380
- address.extended_address.should == "New Suite 3"
381
- address.locality.should == "Chicago"
382
- address.region.should == "Illinois"
383
- address.postal_code.should == "60621"
384
- address.country_name.should == "United States of America"
385
- end
386
-
387
- it "returns an error response if invalid" do
388
- customer = Braintree::Customer.create!(:last_name => "Miller")
389
- address = Braintree::Address.create!(
390
- :customer_id => customer.id,
391
- :country_name => "United States of America"
392
- )
393
- result = address.update(
394
- :street_address => "123 E New St",
395
- :country_name => "United States of Invalid"
396
- )
397
- result.success?.should == false
398
- result.errors.for(:address).on(:country_name)[0].message.should == "Country name is not an accepted country."
399
- end
400
- end
401
-
402
- describe "update!" do
403
- it "returns true and updates the address if valid" do
404
- customer = Braintree::Customer.create!(:last_name => "Miller")
405
- address = Braintree::Address.create!(
406
- :customer_id => customer.id,
407
- :street_address => "1812 E Old St",
408
- :extended_address => "Suite Old 201",
409
- :locality => "Old Chicago",
410
- :region => "IL",
411
- :postal_code => "60620",
412
- :country_name => "United States of America"
413
- )
414
- address.update!(
415
- :street_address => "123 E New St",
416
- :extended_address => "New Suite 3",
417
- :locality => "Chicago",
418
- :region => "Illinois",
419
- :postal_code => "60621",
420
- :country_name => "United States of America"
421
- ).should == address
422
- address.street_address.should == "123 E New St"
423
- address.extended_address.should == "New Suite 3"
424
- address.locality.should == "Chicago"
425
- address.region.should == "Illinois"
426
- address.postal_code.should == "60621"
427
- address.country_name.should == "United States of America"
428
- end
429
-
430
- it "raises a ValidationsFailed invalid" do
431
- customer = Braintree::Customer.create!(:last_name => "Miller")
432
- address = Braintree::Address.create!(
433
- :customer_id => customer.id,
434
- :country_name => "United States of America"
435
- )
436
- expect do
437
- address.update!(
438
- :street_address => "123 E New St",
439
- :country_name => "United States of Invalid"
440
- )
441
- end.to raise_error(Braintree::ValidationsFailed)
442
- end
443
- end
444
361
  end
@@ -6,7 +6,7 @@ describe Braintree::AdvancedSearch do
6
6
  :credit_card => {
7
7
  :number => Braintree::Test::CreditCardNumbers::Visa,
8
8
  :expiration_date => "05/2010"
9
- }
9
+ },
10
10
  ).credit_cards[0]
11
11
  end
12
12
 
@@ -16,13 +16,13 @@ describe Braintree::AdvancedSearch do
16
16
  subscription1 = Braintree::Subscription.create(
17
17
  :payment_method_token => @credit_card.token,
18
18
  :plan_id => SpecHelper::TriallessPlan[:id],
19
- :id => "subscription1_#{id}"
19
+ :id => "subscription1_#{id}",
20
20
  ).subscription
21
21
 
22
22
  subscription2 = Braintree::Subscription.create(
23
23
  :payment_method_token => @credit_card.token,
24
24
  :plan_id => SpecHelper::TriallessPlan[:id],
25
- :id => "subscription2_#{id}"
25
+ :id => "subscription2_#{id}",
26
26
  ).subscription
27
27
 
28
28
  collection = Braintree::Subscription.search do |search|
@@ -39,14 +39,14 @@ describe Braintree::AdvancedSearch do
39
39
  :payment_method_token => @credit_card.token,
40
40
  :plan_id => SpecHelper::TriallessPlan[:id],
41
41
  :price => "11",
42
- :id => "subscription1_#{id}"
42
+ :id => "subscription1_#{id}",
43
43
  ).subscription
44
44
 
45
45
  subscription2 = Braintree::Subscription.create(
46
46
  :payment_method_token => @credit_card.token,
47
47
  :plan_id => SpecHelper::TriallessPlan[:id],
48
48
  :price => "11",
49
- :id => "subscription2_#{id}"
49
+ :id => "subscription2_#{id}",
50
50
  ).subscription
51
51
 
52
52
  collection = Braintree::Subscription.search do |search|
@@ -63,13 +63,13 @@ describe Braintree::AdvancedSearch do
63
63
  subscription1 = Braintree::Subscription.create(
64
64
  :payment_method_token => @credit_card.token,
65
65
  :plan_id => SpecHelper::TriallessPlan[:id],
66
- :id => "subscription1_#{id}"
66
+ :id => "subscription1_#{id}",
67
67
  ).subscription
68
68
 
69
69
  subscription2 = Braintree::Subscription.create(
70
70
  :payment_method_token => @credit_card.token,
71
71
  :plan_id => SpecHelper::TriallessPlan[:id],
72
- :id => "subscription2_#{id}"
72
+ :id => "subscription2_#{id}",
73
73
  ).subscription
74
74
 
75
75
  collection = Braintree::Subscription.search do |search|
@@ -85,13 +85,13 @@ describe Braintree::AdvancedSearch do
85
85
  subscription1 = Braintree::Subscription.create(
86
86
  :payment_method_token => @credit_card.token,
87
87
  :plan_id => SpecHelper::TriallessPlan[:id],
88
- :id => "subscription1_#{id}"
88
+ :id => "subscription1_#{id}",
89
89
  ).subscription
90
90
 
91
91
  subscription2 = Braintree::Subscription.create(
92
92
  :payment_method_token => @credit_card.token,
93
93
  :plan_id => SpecHelper::TriallessPlan[:id],
94
- :id => "subscription2_#{id}"
94
+ :id => "subscription2_#{id}",
95
95
  ).subscription
96
96
 
97
97
  collection = Braintree::Subscription.search do |search|
@@ -107,13 +107,13 @@ describe Braintree::AdvancedSearch do
107
107
  subscription1 = Braintree::Subscription.create(
108
108
  :payment_method_token => @credit_card.token,
109
109
  :plan_id => SpecHelper::TriallessPlan[:id],
110
- :id => "subscription1_#{id}"
110
+ :id => "subscription1_#{id}",
111
111
  ).subscription
112
112
 
113
113
  subscription2 = Braintree::Subscription.create(
114
114
  :payment_method_token => @credit_card.token,
115
115
  :plan_id => SpecHelper::TriallessPlan[:id],
116
- :id => "subscription2_#{id}"
116
+ :id => "subscription2_#{id}",
117
117
  ).subscription
118
118
 
119
119
  collection = Braintree::Subscription.search do |search|
@@ -131,13 +131,13 @@ describe Braintree::AdvancedSearch do
131
131
  subscription1 = Braintree::Subscription.create(
132
132
  :payment_method_token => @credit_card.token,
133
133
  :plan_id => SpecHelper::TriallessPlan[:id],
134
- :price => "12"
134
+ :price => "12",
135
135
  ).subscription
136
136
 
137
137
  subscription2 = Braintree::Subscription.create(
138
138
  :payment_method_token => @credit_card.token,
139
139
  :plan_id => SpecHelper::TriallessPlan[:id],
140
- :price => "12"
140
+ :price => "12",
141
141
  ).subscription
142
142
 
143
143
  Braintree::Subscription.cancel(subscription2.id)
@@ -155,13 +155,13 @@ describe Braintree::AdvancedSearch do
155
155
  subscription1 = Braintree::Subscription.create(
156
156
  :payment_method_token => @credit_card.token,
157
157
  :plan_id => SpecHelper::TriallessPlan[:id],
158
- :price => "13"
158
+ :price => "13",
159
159
  ).subscription
160
160
 
161
161
  subscription2 = Braintree::Subscription.create(
162
162
  :payment_method_token => @credit_card.token,
163
163
  :plan_id => SpecHelper::TriallessPlan[:id],
164
- :price => "13"
164
+ :price => "13",
165
165
  ).subscription
166
166
 
167
167
  Braintree::Subscription.cancel(subscription2.id)
@@ -179,13 +179,13 @@ describe Braintree::AdvancedSearch do
179
179
  subscription1 = Braintree::Subscription.create(
180
180
  :payment_method_token => @credit_card.token,
181
181
  :plan_id => SpecHelper::TriallessPlan[:id],
182
- :price => "14"
182
+ :price => "14",
183
183
  ).subscription
184
184
 
185
185
  subscription2 = Braintree::Subscription.create(
186
186
  :payment_method_token => @credit_card.token,
187
187
  :plan_id => SpecHelper::TriallessPlan[:id],
188
- :price => "14"
188
+ :price => "14",
189
189
  ).subscription
190
190
 
191
191
  Braintree::Subscription.cancel(subscription2.id)
@@ -204,13 +204,13 @@ describe Braintree::AdvancedSearch do
204
204
  subscription1 = Braintree::Subscription.create(
205
205
  :payment_method_token => @credit_card.token,
206
206
  :plan_id => SpecHelper::TriallessPlan[:id],
207
- :price => "15"
207
+ :price => "15",
208
208
  ).subscription
209
209
 
210
210
  subscription2 = Braintree::Subscription.create(
211
211
  :payment_method_token => @credit_card.token,
212
212
  :plan_id => SpecHelper::TriallessPlan[:id],
213
- :price => "15"
213
+ :price => "15",
214
214
  ).subscription
215
215
 
216
216
  Braintree::Subscription.cancel(subscription2.id)
@@ -229,13 +229,13 @@ describe Braintree::AdvancedSearch do
229
229
  subscription1 = Braintree::Subscription.create(
230
230
  :payment_method_token => @credit_card.token,
231
231
  :plan_id => SpecHelper::TriallessPlan[:id],
232
- :price => "16"
232
+ :price => "16",
233
233
  ).subscription
234
234
 
235
235
  subscription2 = Braintree::Subscription.create(
236
236
  :payment_method_token => @credit_card.token,
237
237
  :plan_id => SpecHelper::TriallessPlan[:id],
238
- :price => "16"
238
+ :price => "16",
239
239
  ).subscription
240
240
 
241
241
  Braintree::Subscription.cancel(subscription2.id)
@@ -266,19 +266,19 @@ describe Braintree::AdvancedSearch do
266
266
  subscription1 = Braintree::Subscription.create(
267
267
  :payment_method_token => @credit_card.token,
268
268
  :plan_id => SpecHelper::TriallessPlan[:id],
269
- :price => "17"
269
+ :price => "17",
270
270
  ).subscription
271
271
 
272
272
  subscription2 = Braintree::Subscription.create(
273
273
  :payment_method_token => @credit_card.token,
274
274
  :plan_id => SpecHelper::TrialPlan[:id],
275
- :price => "17"
275
+ :price => "17",
276
276
  ).subscription
277
277
 
278
278
  subscription3 = Braintree::Subscription.create(
279
279
  :payment_method_token => @credit_card.token,
280
280
  :plan_id => SpecHelper::AddOnDiscountPlan[:id],
281
- :price => "17"
281
+ :price => "17",
282
282
  ).subscription
283
283
 
284
284
  plan_ids = [SpecHelper::TriallessPlan[:id], SpecHelper::TrialPlan[:id]]
@@ -307,13 +307,13 @@ describe Braintree::AdvancedSearch do
307
307
  trialless_subscription = Braintree::Subscription.create(
308
308
  :payment_method_token => @credit_card.token,
309
309
  :plan_id => SpecHelper::TriallessPlan[:id],
310
- :price => "18"
310
+ :price => "18",
311
311
  ).subscription
312
312
 
313
313
  trial_subscription = Braintree::Subscription.create(
314
314
  :payment_method_token => @credit_card.token,
315
315
  :plan_id => SpecHelper::TrialPlan[:id],
316
- :price => "18"
316
+ :price => "18",
317
317
  ).subscription
318
318
 
319
319
  collection = Braintree::Subscription.search do |search|
@@ -331,13 +331,13 @@ describe Braintree::AdvancedSearch do
331
331
  trialless_subscription = Braintree::Subscription.create(
332
332
  :payment_method_token => @credit_card.token,
333
333
  :plan_id => SpecHelper::TriallessPlan[:id],
334
- :price => "19"
334
+ :price => "19",
335
335
  ).subscription
336
336
 
337
337
  trial_subscription = Braintree::Subscription.create(
338
338
  :payment_method_token => @credit_card.token,
339
339
  :plan_id => SpecHelper::TrialPlan[:id],
340
- :price => "19"
340
+ :price => "19",
341
341
  ).subscription
342
342
 
343
343
  collection = Braintree::Subscription.search do |search|
@@ -355,13 +355,13 @@ describe Braintree::AdvancedSearch do
355
355
  trialless_subscription = Braintree::Subscription.create(
356
356
  :payment_method_token => @credit_card.token,
357
357
  :plan_id => SpecHelper::TriallessPlan[:id],
358
- :price => "20"
358
+ :price => "20",
359
359
  ).subscription
360
360
 
361
361
  trial_subscription = Braintree::Subscription.create(
362
362
  :payment_method_token => @credit_card.token,
363
363
  :plan_id => SpecHelper::TrialPlan[:id],
364
- :price => "20"
364
+ :price => "20",
365
365
  ).subscription
366
366
 
367
367
  collection = Braintree::Subscription.search do |search|
@@ -379,13 +379,13 @@ describe Braintree::AdvancedSearch do
379
379
  trialless_subscription = Braintree::Subscription.create(
380
380
  :payment_method_token => @credit_card.token,
381
381
  :plan_id => SpecHelper::TriallessPlan[:id],
382
- :price => "21"
382
+ :price => "21",
383
383
  ).subscription
384
384
 
385
385
  trial_subscription = Braintree::Subscription.create(
386
386
  :payment_method_token => @credit_card.token,
387
387
  :plan_id => SpecHelper::TrialPlan[:id],
388
- :price => "21"
388
+ :price => "21",
389
389
  ).subscription
390
390
 
391
391
  collection = Braintree::Subscription.search do |search|
@@ -403,13 +403,13 @@ describe Braintree::AdvancedSearch do
403
403
  trialless_subscription = Braintree::Subscription.create(
404
404
  :payment_method_token => @credit_card.token,
405
405
  :plan_id => SpecHelper::TriallessPlan[:id],
406
- :price => "22"
406
+ :price => "22",
407
407
  ).subscription
408
408
 
409
409
  trial_subscription = Braintree::Subscription.create(
410
410
  :payment_method_token => @credit_card.token,
411
411
  :plan_id => SpecHelper::TrialPlan[:id],
412
- :price => "22"
412
+ :price => "22",
413
413
  ).subscription
414
414
 
415
415
  collection = Braintree::Subscription.search do |search|
@@ -428,13 +428,13 @@ describe Braintree::AdvancedSearch do
428
428
  subscription_500 = Braintree::Subscription.create(
429
429
  :payment_method_token => @credit_card.token,
430
430
  :plan_id => SpecHelper::TriallessPlan[:id],
431
- :price => "5.00"
431
+ :price => "5.00",
432
432
  ).subscription
433
433
 
434
434
  subscription_501 = Braintree::Subscription.create(
435
435
  :payment_method_token => @credit_card.token,
436
436
  :plan_id => SpecHelper::TrialPlan[:id],
437
- :price => "5.01"
437
+ :price => "5.01",
438
438
  ).subscription
439
439
 
440
440
  collection = Braintree::Subscription.search do |search|
@@ -449,19 +449,19 @@ describe Braintree::AdvancedSearch do
449
449
  subscription_499 = Braintree::Subscription.create(
450
450
  :payment_method_token => @credit_card.token,
451
451
  :plan_id => SpecHelper::TrialPlan[:id],
452
- :price => "4.99"
452
+ :price => "4.99",
453
453
  ).subscription
454
454
 
455
455
  subscription_500 = Braintree::Subscription.create(
456
456
  :payment_method_token => @credit_card.token,
457
457
  :plan_id => SpecHelper::TriallessPlan[:id],
458
- :price => "5.00"
458
+ :price => "5.00",
459
459
  ).subscription
460
460
 
461
461
  subscription_501 = Braintree::Subscription.create(
462
462
  :payment_method_token => @credit_card.token,
463
463
  :plan_id => SpecHelper::TrialPlan[:id],
464
- :price => "5.01"
464
+ :price => "5.01",
465
465
  ).subscription
466
466
 
467
467
  collection = Braintree::Subscription.search do |search|
@@ -477,19 +477,19 @@ describe Braintree::AdvancedSearch do
477
477
  subscription_499 = Braintree::Subscription.create(
478
478
  :payment_method_token => @credit_card.token,
479
479
  :plan_id => SpecHelper::TrialPlan[:id],
480
- :price => "999.99"
480
+ :price => "999.99",
481
481
  ).subscription
482
482
 
483
483
  subscription_500 = Braintree::Subscription.create(
484
484
  :payment_method_token => @credit_card.token,
485
485
  :plan_id => SpecHelper::TriallessPlan[:id],
486
- :price => "1000.00"
486
+ :price => "1000.00",
487
487
  ).subscription
488
488
 
489
489
  subscription_501 = Braintree::Subscription.create(
490
490
  :payment_method_token => @credit_card.token,
491
491
  :plan_id => SpecHelper::TrialPlan[:id],
492
- :price => "1000.01"
492
+ :price => "1000.01",
493
493
  ).subscription
494
494
 
495
495
  collection = Braintree::Subscription.search do |search|
@@ -505,19 +505,19 @@ describe Braintree::AdvancedSearch do
505
505
  subscription_499 = Braintree::Subscription.create(
506
506
  :payment_method_token => @credit_card.token,
507
507
  :plan_id => SpecHelper::TrialPlan[:id],
508
- :price => "4.99"
508
+ :price => "4.99",
509
509
  ).subscription
510
510
 
511
511
  subscription_500 = Braintree::Subscription.create(
512
512
  :payment_method_token => @credit_card.token,
513
513
  :plan_id => SpecHelper::TriallessPlan[:id],
514
- :price => "5.00"
514
+ :price => "5.00",
515
515
  ).subscription
516
516
 
517
517
  subscription_502 = Braintree::Subscription.create(
518
518
  :payment_method_token => @credit_card.token,
519
519
  :plan_id => SpecHelper::TrialPlan[:id],
520
- :price => "5.02"
520
+ :price => "5.02",
521
521
  ).subscription
522
522
 
523
523
  collection = Braintree::Subscription.search do |search|