braintree 4.14.0 → 4.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (247) hide show
  1. checksums.yaml +4 -4
  2. data/lib/braintree/account_updater_daily_report.rb +3 -3
  3. data/lib/braintree/ach_mandate.rb +1 -1
  4. data/lib/braintree/add_on_gateway.rb +1 -1
  5. data/lib/braintree/address.rb +4 -4
  6. data/lib/braintree/address_gateway.rb +5 -5
  7. data/lib/braintree/advanced_search.rb +10 -10
  8. data/lib/braintree/apple_pay.rb +3 -3
  9. data/lib/braintree/apple_pay_card.rb +3 -3
  10. data/lib/braintree/apple_pay_options.rb +3 -3
  11. data/lib/braintree/authorization_adjustment.rb +3 -3
  12. data/lib/braintree/base_module.rb +1 -1
  13. data/lib/braintree/bin_data.rb +2 -2
  14. data/lib/braintree/client_token_gateway.rb +1 -1
  15. data/lib/braintree/configuration.rb +22 -22
  16. data/lib/braintree/connected_merchant_paypal_status_changed.rb +1 -1
  17. data/lib/braintree/connected_merchant_status_transitioned.rb +1 -1
  18. data/lib/braintree/credit_card.rb +22 -9
  19. data/lib/braintree/credit_card_gateway.rb +23 -11
  20. data/lib/braintree/credit_card_verification.rb +3 -3
  21. data/lib/braintree/credit_card_verification_gateway.rb +28 -11
  22. data/lib/braintree/credit_card_verification_search.rb +1 -1
  23. data/lib/braintree/customer.rb +5 -9
  24. data/lib/braintree/customer_gateway.rb +7 -7
  25. data/lib/braintree/customer_search.rb +1 -1
  26. data/lib/braintree/descriptor.rb +1 -1
  27. data/lib/braintree/digest.rb +1 -1
  28. data/lib/braintree/disbursement.rb +5 -5
  29. data/lib/braintree/discount_gateway.rb +1 -1
  30. data/lib/braintree/dispute/evidence.rb +1 -1
  31. data/lib/braintree/dispute/paypal_message.rb +1 -1
  32. data/lib/braintree/dispute/status_history.rb +1 -1
  33. data/lib/braintree/dispute/transaction.rb +1 -1
  34. data/lib/braintree/dispute/transaction_details.rb +1 -1
  35. data/lib/braintree/dispute.rb +3 -3
  36. data/lib/braintree/dispute_gateway.rb +1 -1
  37. data/lib/braintree/dispute_search.rb +1 -1
  38. data/lib/braintree/document_upload.rb +2 -2
  39. data/lib/braintree/document_upload_gateway.rb +3 -3
  40. data/lib/braintree/enriched_customer_data.rb +2 -2
  41. data/lib/braintree/error_codes.rb +4 -0
  42. data/lib/braintree/error_result.rb +2 -3
  43. data/lib/braintree/errors.rb +3 -3
  44. data/lib/braintree/exceptions.rb +1 -2
  45. data/lib/braintree/exchange_rate.rb +2 -2
  46. data/lib/braintree/exchange_rate_quote.rb +3 -3
  47. data/lib/braintree/exchange_rate_quote_gateway.rb +1 -1
  48. data/lib/braintree/exchange_rate_quote_input.rb +3 -3
  49. data/lib/braintree/exchange_rate_quote_request.rb +3 -3
  50. data/lib/braintree/exchange_rate_quote_response.rb +3 -3
  51. data/lib/braintree/facilitated_details.rb +1 -1
  52. data/lib/braintree/facilitator_details.rb +1 -1
  53. data/lib/braintree/google_pay_card.rb +3 -3
  54. data/lib/braintree/granted_payment_instrument_update.rb +1 -1
  55. data/lib/braintree/graphql_client.rb +1 -1
  56. data/lib/braintree/http.rb +5 -5
  57. data/lib/braintree/local_payment_completed.rb +2 -2
  58. data/lib/braintree/local_payment_expired.rb +2 -2
  59. data/lib/braintree/local_payment_funded.rb +2 -2
  60. data/lib/braintree/local_payment_reversed.rb +2 -2
  61. data/lib/braintree/merchant.rb +3 -3
  62. data/lib/braintree/merchant_account.rb +2 -2
  63. data/lib/braintree/merchant_account_gateway.rb +9 -9
  64. data/lib/braintree/meta_checkout_card.rb +89 -0
  65. data/lib/braintree/meta_checkout_token.rb +88 -0
  66. data/lib/braintree/modification.rb +3 -3
  67. data/lib/braintree/oauth_credentials.rb +3 -3
  68. data/lib/braintree/paginated_collection.rb +2 -2
  69. data/lib/braintree/paginated_result.rb +1 -1
  70. data/lib/braintree/payment_instrument_type.rb +2 -0
  71. data/lib/braintree/payment_method_customer_data_updated_metadata.rb +2 -2
  72. data/lib/braintree/payment_method_gateway.rb +23 -10
  73. data/lib/braintree/payment_method_nonce.rb +4 -4
  74. data/lib/braintree/payment_method_nonce_details.rb +1 -1
  75. data/lib/braintree/payment_method_nonce_details_payer_info.rb +1 -1
  76. data/lib/braintree/payment_method_nonce_gateway.rb +1 -1
  77. data/lib/braintree/paypal_account.rb +1 -2
  78. data/lib/braintree/paypal_account_gateway.rb +5 -5
  79. data/lib/braintree/plan.rb +1 -1
  80. data/lib/braintree/plan_gateway.rb +2 -2
  81. data/lib/braintree/resource_collection.rb +2 -2
  82. data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
  83. data/lib/braintree/risk_data.rb +1 -1
  84. data/lib/braintree/samsung_pay_card.rb +5 -5
  85. data/lib/braintree/sepa_direct_debit_account.rb +2 -2
  86. data/lib/braintree/sepa_direct_debit_account_nonce_details.rb +1 -1
  87. data/lib/braintree/settlement_batch_summary_gateway.rb +1 -1
  88. data/lib/braintree/sha256_digest.rb +1 -1
  89. data/lib/braintree/subscription/status_details.rb +1 -1
  90. data/lib/braintree/subscription.rb +2 -2
  91. data/lib/braintree/subscription_gateway.rb +6 -6
  92. data/lib/braintree/subscription_search.rb +1 -1
  93. data/lib/braintree/successful_result.rb +2 -2
  94. data/lib/braintree/test/credit_card.rb +7 -10
  95. data/lib/braintree/test/merchant_account.rb +1 -1
  96. data/lib/braintree/test/nonce.rb +4 -0
  97. data/lib/braintree/test/transaction_amounts.rb +2 -3
  98. data/lib/braintree/test/venmo_sdk.rb +2 -0
  99. data/lib/braintree/testing_gateway.rb +1 -1
  100. data/lib/braintree/three_d_secure_info.rb +1 -1
  101. data/lib/braintree/transaction/address_details.rb +2 -1
  102. data/lib/braintree/transaction/credit_card_details.rb +4 -1
  103. data/lib/braintree/transaction/customer_details.rb +1 -1
  104. data/lib/braintree/transaction/disbursement_details.rb +1 -1
  105. data/lib/braintree/transaction/local_payment_details.rb +2 -0
  106. data/lib/braintree/transaction/meta_checkout_card_details.rb +52 -0
  107. data/lib/braintree/transaction/meta_checkout_token_details.rb +54 -0
  108. data/lib/braintree/transaction/package_details.rb +16 -0
  109. data/lib/braintree/transaction/samsung_pay_card_details.rb +1 -1
  110. data/lib/braintree/transaction/sepa_direct_debit_account_details.rb +1 -1
  111. data/lib/braintree/transaction/status_details.rb +1 -1
  112. data/lib/braintree/transaction/subscription_details.rb +1 -1
  113. data/lib/braintree/transaction/us_bank_account_details.rb +1 -1
  114. data/lib/braintree/transaction/visa_checkout_card_details.rb +1 -1
  115. data/lib/braintree/transaction.rb +37 -20
  116. data/lib/braintree/transaction_gateway.rb +44 -15
  117. data/lib/braintree/transaction_line_item.rb +13 -10
  118. data/lib/braintree/transaction_line_item_gateway.rb +1 -1
  119. data/lib/braintree/transaction_review.rb +1 -1
  120. data/lib/braintree/transaction_search.rb +7 -6
  121. data/lib/braintree/unknown_payment_method.rb +1 -1
  122. data/lib/braintree/us_bank_account.rb +2 -2
  123. data/lib/braintree/us_bank_account_verification.rb +23 -15
  124. data/lib/braintree/us_bank_account_verification_search.rb +1 -1
  125. data/lib/braintree/util.rb +3 -3
  126. data/lib/braintree/validation_error.rb +1 -1
  127. data/lib/braintree/validation_error_collection.rb +3 -3
  128. data/lib/braintree/venmo_account.rb +3 -3
  129. data/lib/braintree/venmo_profile_data.rb +6 -4
  130. data/lib/braintree/version.rb +1 -1
  131. data/lib/braintree/visa_checkout_card.rb +7 -7
  132. data/lib/braintree/webhook_notification.rb +3 -2
  133. data/lib/braintree/webhook_notification_gateway.rb +4 -4
  134. data/lib/braintree/webhook_testing.rb +1 -1
  135. data/lib/braintree/webhook_testing_gateway.rb +18 -1
  136. data/lib/braintree/xml/generator.rb +1 -1
  137. data/lib/braintree/xml/libxml.rb +1 -1
  138. data/lib/braintree/xml/parser.rb +3 -3
  139. data/lib/braintree/xml/rexml.rb +2 -2
  140. data/lib/braintree/xml.rb +1 -1
  141. data/lib/braintree.rb +5 -1
  142. data/spec/integration/braintree/add_on_spec.rb +9 -9
  143. data/spec/integration/braintree/address_spec.rb +69 -69
  144. data/spec/integration/braintree/advanced_search_spec.rb +45 -45
  145. data/spec/integration/braintree/apple_pay_spec.rb +8 -8
  146. data/spec/integration/braintree/client_api/client_token_spec.rb +15 -15
  147. data/spec/integration/braintree/client_api/spec_helper.rb +2 -2
  148. data/spec/integration/braintree/credit_card_spec.rb +227 -228
  149. data/spec/integration/braintree/credit_card_verification_search_spec.rb +16 -16
  150. data/spec/integration/braintree/credit_card_verification_spec.rb +98 -53
  151. data/spec/integration/braintree/customer_search_spec.rb +20 -20
  152. data/spec/integration/braintree/customer_spec.rb +317 -317
  153. data/spec/integration/braintree/disbursement_spec.rb +2 -2
  154. data/spec/integration/braintree/discount_spec.rb +9 -9
  155. data/spec/integration/braintree/dispute_search_spec.rb +0 -1
  156. data/spec/integration/braintree/dispute_spec.rb +87 -87
  157. data/spec/integration/braintree/document_upload_spec.rb +17 -17
  158. data/spec/integration/braintree/error_codes_spec.rb +2 -2
  159. data/spec/integration/braintree/http_spec.rb +28 -28
  160. data/spec/integration/braintree/merchant_account_spec.rb +127 -127
  161. data/spec/integration/braintree/merchant_spec.rb +103 -103
  162. data/spec/integration/braintree/oauth_spec.rb +61 -61
  163. data/spec/integration/braintree/package_tracking_spec.rb +111 -0
  164. data/spec/integration/braintree/payment_method_nonce_spec.rb +89 -69
  165. data/spec/integration/braintree/payment_method_spec.rb +391 -391
  166. data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +150 -78
  167. data/spec/integration/braintree/paypal_account_spec.rb +38 -38
  168. data/spec/integration/braintree/plan_spec.rb +15 -15
  169. data/spec/integration/braintree/samsung_pay_card_spec.rb +65 -65
  170. data/spec/integration/braintree/sepa_direct_debit_account_spec.rb +51 -51
  171. data/spec/integration/braintree/settlement_batch_summary_spec.rb +11 -11
  172. data/spec/integration/braintree/subscription_spec.rb +364 -364
  173. data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
  174. data/spec/integration/braintree/test_transaction_spec.rb +19 -19
  175. data/spec/integration/braintree/transaction_line_item_spec.rb +12 -6
  176. data/spec/integration/braintree/transaction_search_spec.rb +225 -165
  177. data/spec/integration/braintree/transaction_spec.rb +1606 -1230
  178. data/spec/integration/braintree/transaction_us_bank_account_spec.rb +32 -32
  179. data/spec/integration/braintree/us_bank_account_spec.rb +30 -30
  180. data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +18 -18
  181. data/spec/integration/braintree/us_bank_account_verification_spec.rb +33 -33
  182. data/spec/integration/braintree/visa_checkout_card_spec.rb +57 -57
  183. data/spec/spec_helper.rb +9 -8
  184. data/spec/unit/braintree/address_spec.rb +8 -8
  185. data/spec/unit/braintree/base_module_spec.rb +4 -4
  186. data/spec/unit/braintree/client_token_spec.rb +2 -2
  187. data/spec/unit/braintree/configuration_spec.rb +57 -57
  188. data/spec/unit/braintree/credentials_parser_spec.rb +6 -6
  189. data/spec/unit/braintree/credit_card_spec.rb +31 -29
  190. data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +33 -28
  191. data/spec/unit/braintree/credit_card_verification_search_spec.rb +9 -9
  192. data/spec/unit/braintree/credit_card_verification_spec.rb +17 -17
  193. data/spec/unit/braintree/customer_spec.rb +41 -40
  194. data/spec/unit/braintree/digest_spec.rb +5 -5
  195. data/spec/unit/braintree/disbursement_spec.rb +11 -11
  196. data/spec/unit/braintree/dispute_search_spec.rb +2 -2
  197. data/spec/unit/braintree/dispute_spec.rb +56 -56
  198. data/spec/unit/braintree/document_upload_spec.rb +8 -8
  199. data/spec/unit/braintree/enriched_customer_data_spec.rb +11 -2
  200. data/spec/unit/braintree/error_result_spec.rb +5 -5
  201. data/spec/unit/braintree/errors_spec.rb +9 -9
  202. data/spec/unit/braintree/http_spec.rb +9 -9
  203. data/spec/unit/braintree/local_payment_completed_spec.rb +11 -11
  204. data/spec/unit/braintree/local_payment_expired_spec.rb +2 -2
  205. data/spec/unit/braintree/local_payment_funded_spec.rb +6 -6
  206. data/spec/unit/braintree/merchant_account_spec.rb +4 -4
  207. data/spec/unit/braintree/meta_checkout_card_details_spec.rb +60 -0
  208. data/spec/unit/braintree/meta_checkout_card_spec.rb +60 -0
  209. data/spec/unit/braintree/meta_checkout_token_details_spec.rb +63 -0
  210. data/spec/unit/braintree/meta_checkout_token_spec.rb +63 -0
  211. data/spec/unit/braintree/modification_spec.rb +1 -1
  212. data/spec/unit/braintree/package_tracking_spec.rb +74 -0
  213. data/spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb +6 -6
  214. data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +7 -7
  215. data/spec/unit/braintree/payment_method_nonce_details_spec.rb +14 -14
  216. data/spec/unit/braintree/payment_method_spec.rb +19 -19
  217. data/spec/unit/braintree/paypal_account_spec.rb +4 -4
  218. data/spec/unit/braintree/resource_collection_spec.rb +7 -7
  219. data/spec/unit/braintree/sepa_debit_account_nonce_details_spec.rb +1 -1
  220. data/spec/unit/braintree/sha256_digest_spec.rb +1 -1
  221. data/spec/unit/braintree/signature_service_spec.rb +2 -2
  222. data/spec/unit/braintree/subscription_search_spec.rb +17 -17
  223. data/spec/unit/braintree/subscription_spec.rb +8 -8
  224. data/spec/unit/braintree/successful_result_spec.rb +5 -5
  225. data/spec/unit/braintree/three_d_secure_info_spec.rb +20 -20
  226. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +5 -5
  227. data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
  228. data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
  229. data/spec/unit/braintree/transaction/local_payment_details_spec.rb +30 -0
  230. data/spec/unit/braintree/transaction_gateway_spec.rb +41 -9
  231. data/spec/unit/braintree/transaction_search_spec.rb +2 -2
  232. data/spec/unit/braintree/transaction_spec.rb +101 -93
  233. data/spec/unit/braintree/unknown_payment_method_spec.rb +4 -4
  234. data/spec/unit/braintree/us_bank_account_spec.rb +2 -2
  235. data/spec/unit/braintree/us_bank_account_verification_search_spec.rb +7 -7
  236. data/spec/unit/braintree/us_bank_account_verification_spec.rb +12 -7
  237. data/spec/unit/braintree/util_spec.rb +27 -27
  238. data/spec/unit/braintree/validation_error_collection_spec.rb +34 -34
  239. data/spec/unit/braintree/validation_error_spec.rb +4 -4
  240. data/spec/unit/braintree/venmo_profile_data_spec.rb +16 -5
  241. data/spec/unit/braintree/webhook_notification_spec.rb +206 -191
  242. data/spec/unit/braintree/xml/libxml_spec.rb +5 -5
  243. data/spec/unit/braintree/xml/parser_spec.rb +8 -8
  244. data/spec/unit/braintree/xml/rexml_spec.rb +5 -5
  245. data/spec/unit/braintree/xml_spec.rb +17 -17
  246. data/spec/unit/braintree_spec.rb +2 -2
  247. metadata +14 -2
@@ -6,7 +6,7 @@ describe Braintree::CreditCardVerification, "search" do
6
6
  search.credit_card_cardholder_name.is "thisnameisnotreal"
7
7
  end
8
8
 
9
- collection.maximum_size.should == 0
9
+ expect(collection.maximum_size).to eq(0)
10
10
  end
11
11
 
12
12
  it "can search on text fields" do
@@ -33,14 +33,14 @@ describe Braintree::CreditCardVerification, "search" do
33
33
  search.id.is verification.id
34
34
  search.send(criterion).is value
35
35
  end
36
- collection.maximum_size.should == 1
37
- collection.first.id.should == verification.id
36
+ expect(collection.maximum_size).to eq(1)
37
+ expect(collection.first.id).to eq(verification.id)
38
38
 
39
39
  collection = Braintree::CreditCardVerification.search do |search|
40
40
  search.id.is verification.id
41
41
  search.send(criterion).is("invalid_attribute")
42
42
  end
43
- collection.should be_empty
43
+ expect(collection).to be_empty
44
44
  end
45
45
 
46
46
  collection = Braintree::CreditCardVerification.search do |search|
@@ -50,8 +50,8 @@ describe Braintree::CreditCardVerification, "search" do
50
50
  end
51
51
  end
52
52
 
53
- collection.maximum_size.should == 1
54
- collection.first.id.should == verification.id
53
+ expect(collection.maximum_size).to eq(1)
54
+ expect(collection.first.id).to eq(verification.id)
55
55
  end
56
56
 
57
57
  describe "multiple value fields" do
@@ -84,7 +84,7 @@ describe Braintree::CreditCardVerification, "search" do
84
84
  search.ids.in verification_id1, verification_id2
85
85
  end
86
86
 
87
- collection.maximum_size.should == 2
87
+ expect(collection.maximum_size).to eq(2)
88
88
  end
89
89
  end
90
90
 
@@ -112,24 +112,24 @@ describe Braintree::CreditCardVerification, "search" do
112
112
  )
113
113
  end
114
114
 
115
- collection.maximum_size.should == 1
116
- collection.first.id.should == verification.id
115
+ expect(collection.maximum_size).to eq(1)
116
+ expect(collection.first.id).to eq(verification.id)
117
117
 
118
118
  collection = Braintree::CreditCardVerification.search do |search|
119
119
  search.id.is verification.id
120
120
  search.created_at >= created_at - 1
121
121
  end
122
122
 
123
- collection.maximum_size.should == 1
124
- collection.first.id.should == verification.id
123
+ expect(collection.maximum_size).to eq(1)
124
+ expect(collection.first.id).to eq(verification.id)
125
125
 
126
126
  collection = Braintree::CreditCardVerification.search do |search|
127
127
  search.id.is verification.id
128
128
  search.created_at <= created_at + 1
129
129
  end
130
130
 
131
- collection.maximum_size.should == 1
132
- collection.first.id.should == verification.id
131
+ expect(collection.maximum_size).to eq(1)
132
+ expect(collection.first.id).to eq(verification.id)
133
133
 
134
134
  collection = Braintree::CreditCardVerification.search do |search|
135
135
  search.id.is verification.id
@@ -139,15 +139,15 @@ describe Braintree::CreditCardVerification, "search" do
139
139
  )
140
140
  end
141
141
 
142
- collection.maximum_size.should == 0
142
+ expect(collection.maximum_size).to eq(0)
143
143
 
144
144
  collection = Braintree::CreditCardVerification.search do |search|
145
145
  search.id.is verification.id
146
146
  search.created_at.is created_at
147
147
  end
148
148
 
149
- collection.maximum_size.should == 1
150
- collection.first.id.should == verification.id
149
+ expect(collection.maximum_size).to eq(1)
150
+ expect(collection.first.id).to eq(verification.id)
151
151
  end
152
152
  end
153
153
 
@@ -17,12 +17,12 @@ describe Braintree::CreditCardVerification, "search" do
17
17
 
18
18
  result = Braintree::CreditCardVerification.create(verification_params)
19
19
 
20
- result.should be_success
21
- result.credit_card_verification.id.should =~ /^\w{6,}$/
22
- result.credit_card_verification.status.should == Braintree::CreditCardVerification::Status::Verified
23
- result.credit_card_verification.processor_response_code.should == "1000"
24
- result.credit_card_verification.processor_response_text.should == "Approved"
25
- result.credit_card_verification.processor_response_type.should == Braintree::ProcessorResponseTypes::Approved
20
+ expect(result).to be_success
21
+ expect(result.credit_card_verification.id).to match(/^\w{6,}$/)
22
+ expect(result.credit_card_verification.status).to eq(Braintree::CreditCardVerification::Status::Verified)
23
+ expect(result.credit_card_verification.processor_response_code).to eq("1000")
24
+ expect(result.credit_card_verification.processor_response_text).to eq("Approved")
25
+ expect(result.credit_card_verification.processor_response_type).to eq(Braintree::ProcessorResponseTypes::Approved)
26
26
  expect(result.credit_card_verification.network_transaction_id).not_to be_nil
27
27
  end
28
28
 
@@ -48,6 +48,51 @@ describe Braintree::CreditCardVerification, "search" do
48
48
  expect(result.credit_card_verification.processor_response_type).to eq(Braintree::ProcessorResponseTypes::Approved)
49
49
  end
50
50
 
51
+ it "creates a new verification from external vault param" do
52
+ verification_params = {
53
+ :credit_card => {
54
+ :expiration_date => "05/2029",
55
+ :number => Braintree::Test::CreditCardNumbers::Visa,
56
+ },
57
+ :external_vault => {
58
+ :status => "will_vault"
59
+ }
60
+ }
61
+
62
+ result = Braintree::CreditCardVerification.create(verification_params)
63
+
64
+ expect(result).to be_success
65
+ expect(result.credit_card_verification.id).to match(/^\w{6,}$/)
66
+ expect(result.credit_card_verification.status).to eq(Braintree::CreditCardVerification::Status::Verified)
67
+ expect(result.credit_card_verification.processor_response_code).to eq("1000")
68
+ expect(result.credit_card_verification.processor_response_text).to eq("Approved")
69
+ expect(result.credit_card_verification.processor_response_type).to eq(Braintree::ProcessorResponseTypes::Approved)
70
+ expect(result.credit_card_verification.network_transaction_id).not_to be_nil
71
+ end
72
+
73
+ it "creates a new verification from risk data param" do
74
+ verification_params = {
75
+ :credit_card => {
76
+ :expiration_date => "05/2029",
77
+ :number => Braintree::Test::CreditCardNumbers::Visa,
78
+ },
79
+ :risk_data => {
80
+ :customer_browser => "IE7",
81
+ :customer_ip => "192.168.0.1"
82
+ }
83
+ }
84
+
85
+ result = Braintree::CreditCardVerification.create(verification_params)
86
+
87
+ expect(result).to be_success
88
+ expect(result.credit_card_verification.id).to match(/^\w{6,}$/)
89
+ expect(result.credit_card_verification.status).to eq(Braintree::CreditCardVerification::Status::Verified)
90
+ expect(result.credit_card_verification.processor_response_code).to eq("1000")
91
+ expect(result.credit_card_verification.processor_response_text).to eq("Approved")
92
+ expect(result.credit_card_verification.processor_response_type).to eq(Braintree::ProcessorResponseTypes::Approved)
93
+ expect(result.credit_card_verification.network_transaction_id).not_to be_nil
94
+ end
95
+
51
96
  it "returns processor response code and text as well as the additional processor response if declined" do
52
97
  verification_params = {
53
98
  :credit_card => {
@@ -61,12 +106,12 @@ describe Braintree::CreditCardVerification, "search" do
61
106
 
62
107
  result = Braintree::CreditCardVerification.create(verification_params)
63
108
 
64
- result.success?.should == false
65
- result.credit_card_verification.id.should =~ /^\w{6,}$/
66
- result.credit_card_verification.status.should == Braintree::CreditCardVerification::Status::ProcessorDeclined
67
- result.credit_card_verification.processor_response_code.should == "2000"
68
- result.credit_card_verification.processor_response_text.should == "Do Not Honor"
69
- result.credit_card_verification.processor_response_type.should == Braintree::ProcessorResponseTypes::SoftDeclined
109
+ expect(result.success?).to eq(false)
110
+ expect(result.credit_card_verification.id).to match(/^\w{6,}$/)
111
+ expect(result.credit_card_verification.status).to eq(Braintree::CreditCardVerification::Status::ProcessorDeclined)
112
+ expect(result.credit_card_verification.processor_response_code).to eq("2000")
113
+ expect(result.credit_card_verification.processor_response_text).to eq("Do Not Honor")
114
+ expect(result.credit_card_verification.processor_response_type).to eq(Braintree::ProcessorResponseTypes::SoftDeclined)
70
115
  end
71
116
 
72
117
  it "returns validation errors" do
@@ -82,8 +127,8 @@ describe Braintree::CreditCardVerification, "search" do
82
127
 
83
128
  result = Braintree::CreditCardVerification.create(verification_params)
84
129
 
85
- result.success?.should == false
86
- result.errors.for(:verification).for(:options).first.code.should == Braintree::ErrorCodes::Verification::Options::AmountCannotBeNegative
130
+ expect(result.success?).to eq(false)
131
+ expect(result.errors.for(:verification).for(:options).first.code).to eq(Braintree::ErrorCodes::Verification::Options::AmountCannotBeNegative)
87
132
  end
88
133
 
89
134
  it "returns account type with debit" do
@@ -98,8 +143,8 @@ describe Braintree::CreditCardVerification, "search" do
98
143
  },
99
144
  )
100
145
 
101
- result.success?.should == true
102
- result.credit_card_verification.credit_card[:account_type].should == "debit"
146
+ expect(result.success?).to eq(true)
147
+ expect(result.credit_card_verification.credit_card[:account_type]).to eq("debit")
103
148
  end
104
149
 
105
150
  it "returns account type with credit" do
@@ -114,8 +159,8 @@ describe Braintree::CreditCardVerification, "search" do
114
159
  },
115
160
  )
116
161
 
117
- result.success?.should == true
118
- result.credit_card_verification.credit_card[:account_type].should == "credit"
162
+ expect(result.success?).to eq(true)
163
+ expect(result.credit_card_verification.credit_card[:account_type]).to eq("credit")
119
164
  end
120
165
 
121
166
  it "errors with unsupported account type" do
@@ -129,8 +174,8 @@ describe Braintree::CreditCardVerification, "search" do
129
174
  },
130
175
  )
131
176
 
132
- result.success?.should == false
133
- result.errors.for(:verification).for(:options).on(:account_type)[0].code.should == Braintree::ErrorCodes::Verification::Options::AccountTypeNotSupported
177
+ expect(result.success?).to eq(false)
178
+ expect(result.errors.for(:verification).for(:options).on(:account_type)[0].code).to eq(Braintree::ErrorCodes::Verification::Options::AccountTypeNotSupported)
134
179
  end
135
180
 
136
181
  it "errors with invalid account type" do
@@ -145,8 +190,8 @@ describe Braintree::CreditCardVerification, "search" do
145
190
  },
146
191
  )
147
192
 
148
- result.success?.should == false
149
- result.errors.for(:verification).for(:options).on(:account_type)[0].code.should == Braintree::ErrorCodes::Verification::Options::AccountTypeIsInvalid
193
+ expect(result.success?).to eq(false)
194
+ expect(result.errors.for(:verification).for(:options).on(:account_type)[0].code).to eq(Braintree::ErrorCodes::Verification::Options::AccountTypeIsInvalid)
150
195
  end
151
196
  end
152
197
 
@@ -162,8 +207,8 @@ describe Braintree::CreditCardVerification, "search" do
162
207
  credit_card_verification = Braintree::Customer.create(:credit_card => credit_card_params).credit_card_verification
163
208
  found_verification = Braintree::CreditCardVerification.find(credit_card_verification.id)
164
209
 
165
- found_verification.should == credit_card_verification
166
- found_verification.graphql_id.should_not be_nil
210
+ expect(found_verification).to eq(credit_card_verification)
211
+ expect(found_verification.graphql_id).not_to be_nil
167
212
  end
168
213
 
169
214
  it "raises a NotFoundError exception if verification cannot be found" do
@@ -215,7 +260,7 @@ describe Braintree::CreditCardVerification, "search" do
215
260
  search.status.in credit_card_verification.status
216
261
  end
217
262
 
218
- found_verifications.should include(credit_card_verification)
263
+ expect(found_verifications).to include(credit_card_verification)
219
264
  end
220
265
 
221
266
  it "searches and finds verifications using customer fields" do
@@ -231,7 +276,7 @@ describe Braintree::CreditCardVerification, "search" do
231
276
  search.payment_method_token.is credit_card.token
232
277
  end
233
278
 
234
- found_verifications.count.should eq(1)
279
+ expect(found_verifications.count).to eq(1)
235
280
  end
236
281
 
237
282
  describe "card type indicators" do
@@ -256,7 +301,7 @@ describe Braintree::CreditCardVerification, "search" do
256
301
  verification_id = search_results.first.id
257
302
 
258
303
  found_verification = Braintree::CreditCardVerification.find(verification_id)
259
- found_verification.credit_card[:prepaid].should == Braintree::CreditCard::Prepaid::Yes
304
+ expect(found_verification.credit_card[:prepaid]).to eq(Braintree::CreditCard::Prepaid::Yes)
260
305
  end
261
306
  end
262
307
  end
@@ -276,12 +321,12 @@ describe Braintree::CreditCardVerification, "search" do
276
321
 
277
322
  result = Braintree::CreditCardVerification.create(verification_params)
278
323
 
279
- result.should be_success
280
- result.credit_card_verification.id.should =~ /^\w{6,}$/
281
- result.credit_card_verification.status.should == Braintree::CreditCardVerification::Status::Verified
282
- result.credit_card_verification.processor_response_code.should == "1000"
283
- result.credit_card_verification.processor_response_text.should == "Approved"
284
- result.credit_card_verification.processor_response_type.should == Braintree::ProcessorResponseTypes::Approved
324
+ expect(result).to be_success
325
+ expect(result.credit_card_verification.id).to match(/^\w{6,}$/)
326
+ expect(result.credit_card_verification.status).to eq(Braintree::CreditCardVerification::Status::Verified)
327
+ expect(result.credit_card_verification.processor_response_code).to eq("1000")
328
+ expect(result.credit_card_verification.processor_response_text).to eq("Approved")
329
+ expect(result.credit_card_verification.processor_response_type).to eq(Braintree::ProcessorResponseTypes::Approved)
285
330
  expect(result.credit_card_verification.network_transaction_id).not_to be_nil
286
331
  end
287
332
  end
@@ -309,12 +354,12 @@ describe Braintree::CreditCardVerification, "search" do
309
354
 
310
355
  result = Braintree::CreditCardVerification.create(verification_params)
311
356
 
312
- result.should be_success
313
- result.credit_card_verification.id.should =~ /^\w{6,}$/
314
- result.credit_card_verification.status.should == Braintree::CreditCardVerification::Status::Verified
315
- result.credit_card_verification.processor_response_code.should == "1000"
316
- result.credit_card_verification.processor_response_text.should == "Approved"
317
- result.credit_card_verification.processor_response_type.should == Braintree::ProcessorResponseTypes::Approved
357
+ expect(result).to be_success
358
+ expect(result.credit_card_verification.id).to match(/^\w{6,}$/)
359
+ expect(result.credit_card_verification.status).to eq(Braintree::CreditCardVerification::Status::Verified)
360
+ expect(result.credit_card_verification.processor_response_code).to eq("1000")
361
+ expect(result.credit_card_verification.processor_response_text).to eq("Approved")
362
+ expect(result.credit_card_verification.processor_response_type).to eq(Braintree::ProcessorResponseTypes::Approved)
318
363
  expect(result.credit_card_verification.network_transaction_id).not_to be_nil
319
364
  end
320
365
 
@@ -326,7 +371,7 @@ describe Braintree::CreditCardVerification, "search" do
326
371
  :expiration_year => "2099",
327
372
  },
328
373
  )
329
- nonce.should_not be_nil
374
+ expect(nonce).not_to be_nil
330
375
 
331
376
  verification_params = {
332
377
  :credit_card => {
@@ -341,12 +386,12 @@ describe Braintree::CreditCardVerification, "search" do
341
386
 
342
387
  result = Braintree::CreditCardVerification.create(verification_params)
343
388
 
344
- result.should be_success
345
- result.credit_card_verification.id.should =~ /^\w{6,}$/
346
- result.credit_card_verification.status.should == Braintree::CreditCardVerification::Status::Verified
347
- result.credit_card_verification.processor_response_code.should == "1000"
348
- result.credit_card_verification.processor_response_text.should == "Approved"
349
- result.credit_card_verification.processor_response_type.should == Braintree::ProcessorResponseTypes::Approved
389
+ expect(result).to be_success
390
+ expect(result.credit_card_verification.id).to match(/^\w{6,}$/)
391
+ expect(result.credit_card_verification.status).to eq(Braintree::CreditCardVerification::Status::Verified)
392
+ expect(result.credit_card_verification.processor_response_code).to eq("1000")
393
+ expect(result.credit_card_verification.processor_response_text).to eq("Approved")
394
+ expect(result.credit_card_verification.processor_response_type).to eq(Braintree::ProcessorResponseTypes::Approved)
350
395
  expect(result.credit_card_verification.network_transaction_id).not_to be_nil
351
396
  end
352
397
 
@@ -360,7 +405,7 @@ describe Braintree::CreditCardVerification, "search" do
360
405
  :amount => "10.00",
361
406
  },
362
407
  :three_d_secure_pass_thru => {
363
- :eci_flag => "02",
408
+ :eci_flag => "05",
364
409
  :cavv => "some_cavv",
365
410
  :xid => "some_xid",
366
411
  :three_d_secure_version => "1.0.2",
@@ -373,12 +418,12 @@ describe Braintree::CreditCardVerification, "search" do
373
418
 
374
419
  result = Braintree::CreditCardVerification.create(verification_params)
375
420
 
376
- result.should be_success
377
- result.credit_card_verification.id.should =~ /^\w{6,}$/
378
- result.credit_card_verification.status.should == Braintree::CreditCardVerification::Status::Verified
379
- result.credit_card_verification.processor_response_code.should == "1000"
380
- result.credit_card_verification.processor_response_text.should == "Approved"
381
- result.credit_card_verification.processor_response_type.should == Braintree::ProcessorResponseTypes::Approved
421
+ expect(result).to be_success
422
+ expect(result.credit_card_verification.id).to match(/^\w{6,}$/)
423
+ expect(result.credit_card_verification.status).to eq(Braintree::CreditCardVerification::Status::Verified)
424
+ expect(result.credit_card_verification.processor_response_code).to eq("1000")
425
+ expect(result.credit_card_verification.processor_response_text).to eq("Approved")
426
+ expect(result.credit_card_verification.processor_response_type).to eq(Braintree::ProcessorResponseTypes::Approved)
382
427
  expect(result.credit_card_verification.network_transaction_id).not_to be_nil
383
428
  end
384
429
  end
@@ -8,7 +8,7 @@ describe Braintree::Transaction, "search" do
8
8
  search.first_name.is "thisnameisnotreal"
9
9
  end
10
10
 
11
- collection.maximum_size.should == 0
11
+ expect(collection.maximum_size).to eq(0)
12
12
  end
13
13
 
14
14
  it "can search on text fields" do
@@ -69,14 +69,14 @@ describe Braintree::Transaction, "search" do
69
69
  search.send(criterion).is value
70
70
  end
71
71
 
72
- collection.maximum_size.should == 1
73
- collection.first.id.should == customer.id
72
+ expect(collection.maximum_size).to eq(1)
73
+ expect(collection.first.id).to eq(customer.id)
74
74
 
75
75
  collection = Braintree::Customer.search do |search|
76
76
  search.id.is customer.id
77
77
  search.send(criterion).is("invalid_attribute")
78
78
  end
79
- collection.should be_empty
79
+ expect(collection).to be_empty
80
80
  end
81
81
 
82
82
  collection = Braintree::Customer.search do |search|
@@ -86,8 +86,8 @@ describe Braintree::Transaction, "search" do
86
86
  end
87
87
  end
88
88
 
89
- collection.maximum_size.should == 1
90
- collection.first.id.should == customer.id
89
+ expect(collection.maximum_size).to eq(1)
90
+ expect(collection.first.id).to eq(customer.id)
91
91
  end
92
92
 
93
93
  it "can find duplicate credit cards for a give payment method token " do
@@ -111,8 +111,8 @@ describe Braintree::Transaction, "search" do
111
111
  search.payment_method_token_with_duplicates.is jim.credit_cards.first.token
112
112
  end
113
113
 
114
- collection.should include(jim)
115
- collection.should include(joe)
114
+ expect(collection).to include(jim)
115
+ expect(collection).to include(joe)
116
116
  end
117
117
 
118
118
  it "can search by created_at" do
@@ -122,7 +122,7 @@ describe Braintree::Transaction, "search" do
122
122
  )
123
123
 
124
124
  created_at = customer.created_at
125
- created_at.should be_utc
125
+ expect(created_at).to be_utc
126
126
 
127
127
  collection = Braintree::Customer.search do |search|
128
128
  search.company.is company
@@ -132,24 +132,24 @@ describe Braintree::Transaction, "search" do
132
132
  )
133
133
  end
134
134
 
135
- collection.maximum_size.should == 1
136
- collection.first.id.should == customer.id
135
+ expect(collection.maximum_size).to eq(1)
136
+ expect(collection.first.id).to eq(customer.id)
137
137
 
138
138
  collection = Braintree::Customer.search do |search|
139
139
  search.company.is customer.company
140
140
  search.created_at >= created_at - 1
141
141
  end
142
142
 
143
- collection.maximum_size.should == 1
144
- collection.first.company.should == customer.company
143
+ expect(collection.maximum_size).to eq(1)
144
+ expect(collection.first.company).to eq(customer.company)
145
145
 
146
146
  collection = Braintree::Customer.search do |search|
147
147
  search.company.is customer.company
148
148
  search.created_at <= created_at + 1
149
149
  end
150
150
 
151
- collection.maximum_size.should == 1
152
- collection.first.company.should == customer.company
151
+ expect(collection.maximum_size).to eq(1)
152
+ expect(collection.first.company).to eq(customer.company)
153
153
 
154
154
  collection = Braintree::Customer.search do |search|
155
155
  search.company.is customer.company
@@ -159,15 +159,15 @@ describe Braintree::Transaction, "search" do
159
159
  )
160
160
  end
161
161
 
162
- collection.maximum_size.should == 0
162
+ expect(collection.maximum_size).to eq(0)
163
163
 
164
164
  collection = Braintree::Customer.search do |search|
165
165
  search.company.is customer.company
166
166
  search.created_at.is created_at
167
167
  end
168
168
 
169
- collection.maximum_size.should == 1
170
- collection.first.company.should == customer.company
169
+ expect(collection.maximum_size).to eq(1)
170
+ expect(collection.first.company).to eq(customer.company)
171
171
  end
172
172
  end
173
173
 
@@ -189,7 +189,7 @@ describe Braintree::Transaction, "search" do
189
189
  search.id.is customer_id
190
190
  end
191
191
 
192
- collection.maximum_size.should == 1
193
- collection.first.should == customer
192
+ expect(collection.maximum_size).to eq(1)
193
+ expect(collection.first).to eq(customer)
194
194
  end
195
195
  end