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
@@ -23,9 +23,9 @@ describe Braintree::Disbursement do
23
23
  }
24
24
 
25
25
  disbursement = Braintree::Disbursement._new(Braintree::Configuration.gateway, attributes)
26
- disbursement.transactions.maximum_size.should == 1
26
+ expect(disbursement.transactions.maximum_size).to eq(1)
27
27
  transaction = disbursement.transactions.first
28
- transaction.id.should == "sub_merchant_transaction"
28
+ expect(transaction.id).to eq("sub_merchant_transaction")
29
29
  end
30
30
  end
31
31
  end
@@ -20,15 +20,15 @@ describe Braintree::Discount do
20
20
  discounts = Braintree::Discount.all
21
21
  discount = discounts.select { |discount| discount.id == id }.first
22
22
 
23
- discount.should_not be_nil
24
- discount.amount.should == BigDecimal(expected[:amount])
25
- discount.created_at.should_not be_nil
26
- discount.description.should == expected[:description]
27
- discount.kind.should == expected[:kind]
28
- discount.name.should == expected[:name]
29
- discount.never_expires.should == expected[:never_expires]
30
- discount.number_of_billing_cycles.should == expected[:number_of_billing_cycles]
31
- discount.updated_at.should_not be_nil
23
+ expect(discount).not_to be_nil
24
+ expect(discount.amount).to eq(BigDecimal(expected[:amount]))
25
+ expect(discount.created_at).not_to be_nil
26
+ expect(discount.description).to eq(expected[:description])
27
+ expect(discount.kind).to eq(expected[:kind])
28
+ expect(discount.name).to eq(expected[:name])
29
+ expect(discount.never_expires).to eq(expected[:never_expires])
30
+ expect(discount.number_of_billing_cycles).to eq(expected[:number_of_billing_cycles])
31
+ expect(discount.updated_at).not_to be_nil
32
32
  end
33
33
  end
34
34
  end
@@ -24,7 +24,6 @@ describe Braintree::Dispute, "search" do
24
24
  :number => Braintree::Test::CreditCardNumbers::Disputes::Chargeback,
25
25
  },
26
26
  :customer_id => customer.id,
27
- :merchant_account_id => "14LaddersLLC_instant",
28
27
  :options => {
29
28
  :submit_for_settlement => true,
30
29
  },
@@ -30,21 +30,21 @@ describe Braintree::Dispute do
30
30
  it "changes the dispute status to accepted" do
31
31
  result = Braintree::Dispute.accept(dispute.id)
32
32
 
33
- result.success?.should == true
33
+ expect(result.success?).to eq(true)
34
34
 
35
35
  refreshed_dispute = Braintree::Dispute.find(dispute.id)
36
- refreshed_dispute.status.should == Braintree::Dispute::Status::Accepted
36
+ expect(refreshed_dispute.status).to eq(Braintree::Dispute::Status::Accepted)
37
37
 
38
38
  dispute_from_transaction = Braintree::Transaction.find(dispute.transaction.id).disputes[0]
39
- dispute_from_transaction.status.should == Braintree::Dispute::Status::Accepted
39
+ expect(dispute_from_transaction.status).to eq(Braintree::Dispute::Status::Accepted)
40
40
  end
41
41
 
42
42
  it "returns an error response if the dispute is not in open status" do
43
43
  result = Braintree::Dispute.accept("wells_dispute")
44
44
 
45
- result.success?.should == false
46
- result.errors.for(:dispute)[0].code.should == Braintree::ErrorCodes::Dispute::CanOnlyAcceptOpenDispute
47
- result.errors.for(:dispute)[0].message.should == "Disputes can only be accepted when they are in an Open state"
45
+ expect(result.success?).to eq(false)
46
+ expect(result.errors.for(:dispute)[0].code).to eq(Braintree::ErrorCodes::Dispute::CanOnlyAcceptOpenDispute)
47
+ expect(result.errors.for(:dispute)[0].message).to eq("Disputes can only be accepted when they are in an Open state")
48
48
  end
49
49
 
50
50
  it "raises a NotFound exception if the dispute cannot be found" do
@@ -58,13 +58,13 @@ describe Braintree::Dispute do
58
58
  it "creates file evidence for the dispute" do
59
59
  result = Braintree::Dispute.add_file_evidence(dispute.id, document_upload.id)
60
60
 
61
- result.success?.should == true
62
- result.evidence.category.should be_nil
63
- result.evidence.comment.should be_nil
64
- result.evidence.created_at.between?(Time.now - 10, Time.now).should == true
65
- result.evidence.id.should =~ /^\w{16,}$/
66
- result.evidence.sent_to_processor_at.should == nil
67
- result.evidence.url.should include("bt_logo.png")
61
+ expect(result.success?).to eq(true)
62
+ expect(result.evidence.category).to be_nil
63
+ expect(result.evidence.comment).to be_nil
64
+ expect(result.evidence.created_at.between?(Time.now - 10, Time.now)).to eq(true)
65
+ expect(result.evidence.id).to match(/^\w{16,}$/)
66
+ expect(result.evidence.sent_to_processor_at).to eq(nil)
67
+ expect(result.evidence.url).to include("bt_logo.png")
68
68
  end
69
69
 
70
70
  it "returns a NotFoundError if the dispute doesn't exist" do
@@ -77,9 +77,9 @@ describe Braintree::Dispute do
77
77
  Braintree::Dispute.accept(dispute.id)
78
78
 
79
79
  result = Braintree::Dispute.add_file_evidence(dispute.id, document_upload.id)
80
- result.success?.should == false
81
- result.errors.for(:dispute)[0].code.should == Braintree::ErrorCodes::Dispute::CanOnlyAddEvidenceToOpenDispute
82
- result.errors.for(:dispute)[0].message.should == "Evidence can only be attached to disputes that are in an Open state"
80
+ expect(result.success?).to eq(false)
81
+ expect(result.errors.for(:dispute)[0].code).to eq(Braintree::ErrorCodes::Dispute::CanOnlyAddEvidenceToOpenDispute)
82
+ expect(result.errors.for(:dispute)[0].message).to eq("Evidence can only be attached to disputes that are in an Open state")
83
83
  end
84
84
 
85
85
  it "returns the new evidence record in subsequent dispute finds" do
@@ -87,17 +87,17 @@ describe Braintree::Dispute do
87
87
  refreshed_dispute = Braintree::Dispute.find(dispute.id)
88
88
 
89
89
  expected_evidence = refreshed_dispute.evidence.find { |e| e.id == result.evidence.id }
90
- expected_evidence.should_not == nil
91
- expected_evidence.comment.should be_nil
92
- expected_evidence.url.should include("bt_logo.png")
90
+ expect(expected_evidence).not_to eq(nil)
91
+ expect(expected_evidence.comment).to be_nil
92
+ expect(expected_evidence.url).to include("bt_logo.png")
93
93
  end
94
94
 
95
95
  it "creates file evidence with a category when provided" do
96
96
  result = Braintree::Dispute.add_file_evidence(dispute.id, {category: "GENERAL", document_id: document_upload.id})
97
97
 
98
- result.success?.should == true
99
- result.evidence.category.should == "GENERAL"
100
- result.evidence.url.should include("bt_logo.png")
98
+ expect(result.success?).to eq(true)
99
+ expect(result.evidence.category).to eq("GENERAL")
100
+ expect(result.evidence.url).to include("bt_logo.png")
101
101
  end
102
102
  end
103
103
 
@@ -105,15 +105,15 @@ describe Braintree::Dispute do
105
105
  it "creates text evidence for the dispute" do
106
106
  result = Braintree::Dispute.add_text_evidence(dispute.id, "text evidence")
107
107
 
108
- result.success?.should == true
109
- result.evidence.category.should == nil
110
- result.evidence.comment.should == "text evidence"
111
- result.evidence.created_at.between?(Time.now - 10, Time.now).should == true
112
- result.evidence.id.should =~ /^\w{16,}$/
113
- result.evidence.sent_to_processor_at.should == nil
114
- result.evidence.url.should == nil
115
- result.evidence.tag.should == nil
116
- result.evidence.sequence_number.should == nil
108
+ expect(result.success?).to eq(true)
109
+ expect(result.evidence.category).to eq(nil)
110
+ expect(result.evidence.comment).to eq("text evidence")
111
+ expect(result.evidence.created_at.between?(Time.now - 10, Time.now)).to eq(true)
112
+ expect(result.evidence.id).to match(/^\w{16,}$/)
113
+ expect(result.evidence.sent_to_processor_at).to eq(nil)
114
+ expect(result.evidence.url).to eq(nil)
115
+ expect(result.evidence.tag).to eq(nil)
116
+ expect(result.evidence.sequence_number).to eq(nil)
117
117
  end
118
118
 
119
119
  it "returns a NotFoundError if the dispute doesn't exist" do
@@ -126,9 +126,9 @@ describe Braintree::Dispute do
126
126
  Braintree::Dispute.accept(dispute.id)
127
127
 
128
128
  result = Braintree::Dispute.add_text_evidence(dispute.id, "text evidence")
129
- result.success?.should == false
130
- result.errors.for(:dispute)[0].code.should == Braintree::ErrorCodes::Dispute::CanOnlyAddEvidenceToOpenDispute
131
- result.errors.for(:dispute)[0].message.should == "Evidence can only be attached to disputes that are in an Open state"
129
+ expect(result.success?).to eq(false)
130
+ expect(result.errors.for(:dispute)[0].code).to eq(Braintree::ErrorCodes::Dispute::CanOnlyAddEvidenceToOpenDispute)
131
+ expect(result.errors.for(:dispute)[0].message).to eq("Evidence can only be attached to disputes that are in an Open state")
132
132
  end
133
133
 
134
134
  it "returns the new evidence record in subsequent dispute finds" do
@@ -136,47 +136,47 @@ describe Braintree::Dispute do
136
136
  refreshed_dispute = Braintree::Dispute.find(dispute.id)
137
137
 
138
138
  expected_evidence = refreshed_dispute.evidence.find { |e| e.id == result.evidence.id }
139
- expected_evidence.should_not == nil
140
- expected_evidence.comment.should == "text evidence"
139
+ expect(expected_evidence).not_to eq(nil)
140
+ expect(expected_evidence.comment).to eq("text evidence")
141
141
  end
142
142
 
143
143
  it "creates text evidence for the dispute with optional parameters" do
144
144
  result = Braintree::Dispute.add_text_evidence(dispute.id, {content: "123456789", category: "REFUND_ID", sequence_number: 7})
145
145
 
146
- result.success?.should == true
147
- result.evidence.category.should == "REFUND_ID"
148
- result.evidence.comment.should == "123456789"
149
- result.evidence.created_at.between?(Time.now - 10, Time.now).should == true
150
- result.evidence.id.should =~ /^\w{16,}$/
151
- result.evidence.sent_to_processor_at.should == nil
152
- result.evidence.sequence_number.should == 7
146
+ expect(result.success?).to eq(true)
147
+ expect(result.evidence.category).to eq("REFUND_ID")
148
+ expect(result.evidence.comment).to eq("123456789")
149
+ expect(result.evidence.created_at.between?(Time.now - 10, Time.now)).to eq(true)
150
+ expect(result.evidence.id).to match(/^\w{16,}$/)
151
+ expect(result.evidence.sent_to_processor_at).to eq(nil)
152
+ expect(result.evidence.sequence_number).to eq(7)
153
153
  end
154
154
 
155
155
  it "creates text evidence for the dispute with CARRIER_NAME shipping tracking" do
156
156
  result = Braintree::Dispute.add_text_evidence(dispute.id, {content: "UPS", category: "CARRIER_NAME", sequence_number: 0})
157
157
 
158
- result.success?.should == true
159
- result.evidence.category.should == "CARRIER_NAME"
160
- result.evidence.comment.should == "UPS"
161
- result.evidence.sequence_number.should == 0
158
+ expect(result.success?).to eq(true)
159
+ expect(result.evidence.category).to eq("CARRIER_NAME")
160
+ expect(result.evidence.comment).to eq("UPS")
161
+ expect(result.evidence.sequence_number).to eq(0)
162
162
  end
163
163
 
164
164
  it "creates text evidence for the dispute with TRACKING_NUMBER shipping tracking" do
165
165
  result = Braintree::Dispute.add_text_evidence(dispute.id, {content: "3", category: "TRACKING_NUMBER", sequence_number: 0})
166
166
 
167
- result.success?.should == true
168
- result.evidence.category.should == "TRACKING_NUMBER"
169
- result.evidence.comment.should == "3"
170
- result.evidence.sequence_number.should == 0
167
+ expect(result.success?).to eq(true)
168
+ expect(result.evidence.category).to eq("TRACKING_NUMBER")
169
+ expect(result.evidence.comment).to eq("3")
170
+ expect(result.evidence.sequence_number).to eq(0)
171
171
  end
172
172
 
173
173
  it "creates text evidence for the dispute with TRACKING_URL shipping tracking" do
174
174
  result = Braintree::Dispute.add_text_evidence(dispute.id, {content: "https://example.com/tracking-number/abc12345", category: "TRACKING_URL", sequence_number: 1})
175
175
 
176
- result.success?.should == true
177
- result.evidence.category.should == "TRACKING_URL"
178
- result.evidence.comment.should == "https://example.com/tracking-number/abc12345"
179
- result.evidence.sequence_number.should == 1
176
+ expect(result.success?).to eq(true)
177
+ expect(result.evidence.category).to eq("TRACKING_URL")
178
+ expect(result.evidence.comment).to eq("https://example.com/tracking-number/abc12345")
179
+ expect(result.evidence.sequence_number).to eq(1)
180
180
  end
181
181
  end
182
182
 
@@ -184,18 +184,18 @@ describe Braintree::Dispute do
184
184
  it "changes the dispute status to disputed" do
185
185
  result = Braintree::Dispute.finalize(dispute.id)
186
186
 
187
- result.success?.should == true
187
+ expect(result.success?).to eq(true)
188
188
 
189
189
  refreshed_dispute = Braintree::Dispute.find(dispute.id)
190
- refreshed_dispute.status.should == Braintree::Dispute::Status::Disputed
190
+ expect(refreshed_dispute.status).to eq(Braintree::Dispute::Status::Disputed)
191
191
  end
192
192
 
193
193
  it "returns an error response if the dispute is not in open status" do
194
194
  result = Braintree::Dispute.finalize("wells_dispute")
195
195
 
196
- result.success?.should == false
197
- result.errors.for(:dispute)[0].code.should == Braintree::ErrorCodes::Dispute::CanOnlyFinalizeOpenDispute
198
- result.errors.for(:dispute)[0].message.should == "Disputes can only be finalized when they are in an Open state"
196
+ expect(result.success?).to eq(false)
197
+ expect(result.errors.for(:dispute)[0].code).to eq(Braintree::ErrorCodes::Dispute::CanOnlyFinalizeOpenDispute)
198
+ expect(result.errors.for(:dispute)[0].message).to eq("Disputes can only be finalized when they are in an Open state")
199
199
  end
200
200
 
201
201
  it "raises a NotFound exception if the dispute cannot be found" do
@@ -209,13 +209,13 @@ describe Braintree::Dispute do
209
209
  it "finds the dispute with the given id" do
210
210
  dispute = Braintree::Dispute.find("open_dispute")
211
211
 
212
- dispute.amount_disputed.should == 31.0
213
- dispute.amount_won.should == 0.0
214
- dispute.id.should == "open_dispute"
215
- dispute.graphql_id.should_not be_nil
216
- dispute.status.should == Braintree::Dispute::Status::Open
217
- dispute.transaction.amount.should == 31.0
218
- dispute.transaction.id.should == "open_disputed_transaction"
212
+ expect(dispute.amount_disputed).to eq(31.0)
213
+ expect(dispute.amount_won).to eq(0.0)
214
+ expect(dispute.id).to eq("open_dispute")
215
+ expect(dispute.graphql_id).not_to be_nil
216
+ expect(dispute.status).to eq(Braintree::Dispute::Status::Open)
217
+ expect(dispute.transaction.amount).to eq(31.0)
218
+ expect(dispute.transaction.id).to eq("open_disputed_transaction")
219
219
  end
220
220
 
221
221
  it "raises an ArgumentError if dispute_id is not a string" do
@@ -243,7 +243,7 @@ describe Braintree::Dispute do
243
243
  it "removes evidence from the dispute" do
244
244
  result = Braintree::Dispute.remove_evidence(dispute.id, evidence.id)
245
245
 
246
- result.success?.should == true
246
+ expect(result.success?).to eq(true)
247
247
  end
248
248
 
249
249
  it "returns a NotFoundError if the dispute doesn't exist" do
@@ -263,9 +263,9 @@ describe Braintree::Dispute do
263
263
  Braintree::Dispute.accept(dispute.id)
264
264
 
265
265
  result = Braintree::Dispute.remove_evidence(dispute.id, evidence.id)
266
- result.success?.should == false
267
- result.errors.for(:dispute)[0].code.should == Braintree::ErrorCodes::Dispute::CanOnlyRemoveEvidenceFromOpenDispute
268
- result.errors.for(:dispute)[0].message.should == "Evidence can only be removed from disputes that are in an Open state"
266
+ expect(result.success?).to eq(false)
267
+ expect(result.errors.for(:dispute)[0].code).to eq(Braintree::ErrorCodes::Dispute::CanOnlyRemoveEvidenceFromOpenDispute)
268
+ expect(result.errors.for(:dispute)[0].message).to eq("Evidence can only be removed from disputes that are in an Open state")
269
269
  end
270
270
  end
271
271
 
@@ -273,61 +273,61 @@ describe Braintree::Dispute do
273
273
  it "fails to create file evidence for an unsupported category" do
274
274
  result = Braintree::Dispute.add_file_evidence(dispute.id, {category: "NOTREALCATEGORY", document_id: document_upload.id})
275
275
 
276
- result.success?.should == false
277
- result.errors.for(:dispute)[0].code.should == Braintree::ErrorCodes::Dispute::CanOnlyCreateEvidenceWithValidCategory
276
+ expect(result.success?).to eq(false)
277
+ expect(result.errors.for(:dispute)[0].code).to eq(Braintree::ErrorCodes::Dispute::CanOnlyCreateEvidenceWithValidCategory)
278
278
  end
279
279
 
280
280
  it "fails to create text evidence for an unsupported category" do
281
281
  result = Braintree::Dispute.add_text_evidence(dispute.id, {category: "NOTREALCATEGORY", content: "evidence"})
282
282
 
283
- result.success?.should == false
284
- result.errors.for(:dispute)[0].code.should == Braintree::ErrorCodes::Dispute::CanOnlyCreateEvidenceWithValidCategory
283
+ expect(result.success?).to eq(false)
284
+ expect(result.errors.for(:dispute)[0].code).to eq(Braintree::ErrorCodes::Dispute::CanOnlyCreateEvidenceWithValidCategory)
285
285
  end
286
286
 
287
287
  it "fails to create text evidence for a file only category MERCHANT_WEBSITE_OR_APP_ACCESS" do
288
288
  result = Braintree::Dispute.add_text_evidence(dispute.id, {category: "MERCHANT_WEBSITE_OR_APP_ACCESS", content: "evidence"})
289
289
 
290
- result.success?.should == false
291
- result.errors.for(:dispute)[0].code.should == Braintree::ErrorCodes::Dispute::EvidenceCategoryDocumentOnly
290
+ expect(result.success?).to eq(false)
291
+ expect(result.errors.for(:dispute)[0].code).to eq(Braintree::ErrorCodes::Dispute::EvidenceCategoryDocumentOnly)
292
292
  end
293
293
 
294
294
  it "fails to create file evidence for a text only category DEVICE_ID" do
295
295
  result = Braintree::Dispute.add_file_evidence(dispute.id, {category: "DEVICE_ID", document_id: document_upload.id})
296
296
 
297
- result.success?.should == false
298
- result.errors.for(:dispute)[0].code.should == Braintree::ErrorCodes::Dispute::EvidenceCategoryTextOnly
297
+ expect(result.success?).to eq(false)
298
+ expect(result.errors.for(:dispute)[0].code).to eq(Braintree::ErrorCodes::Dispute::EvidenceCategoryTextOnly)
299
299
  end
300
300
 
301
301
  it "fails to create evidence with an invalid date time format" do
302
302
  result = Braintree::Dispute.add_text_evidence(dispute.id, {category: "DOWNLOAD_DATE_TIME", content: "baddate"})
303
303
 
304
- result.success?.should == false
305
- result.errors.for(:dispute)[0].code.should == Braintree::ErrorCodes::Dispute::EvidenceContentDateInvalid
304
+ expect(result.success?).to eq(false)
305
+ expect(result.errors.for(:dispute)[0].code).to eq(Braintree::ErrorCodes::Dispute::EvidenceContentDateInvalid)
306
306
  end
307
307
 
308
308
  it "successfully creates text evidence with an valid date time format" do
309
309
  result = Braintree::Dispute.add_text_evidence(dispute.id, {category: "DOWNLOAD_DATE_TIME", content: "2018-10-20T18:00:00-0500"})
310
310
 
311
- result.success?.should == true
311
+ expect(result.success?).to eq(true)
312
312
  end
313
313
 
314
314
  it "fails to finalize a dispute with digital goods missing" do
315
315
  Braintree::Dispute.add_text_evidence(dispute.id, {category: "DEVICE_ID", content: "iphone_id"})
316
316
  result = Braintree::Dispute.finalize(dispute.id)
317
317
 
318
- result.success?.should == false
318
+ expect(result.success?).to eq(false)
319
319
  error_codes = result.errors.for(:dispute).map(&:code)
320
320
 
321
- error_codes.should include(Braintree::ErrorCodes::Dispute::DigitalGoodsMissingDownloadDate)
322
- error_codes.should include(Braintree::ErrorCodes::Dispute::DigitalGoodsMissingEvidence)
321
+ expect(error_codes).to include(Braintree::ErrorCodes::Dispute::DigitalGoodsMissingDownloadDate)
322
+ expect(error_codes).to include(Braintree::ErrorCodes::Dispute::DigitalGoodsMissingEvidence)
323
323
  end
324
324
 
325
325
  it "fails to finalize a dispute with partial non-disputed transaction information provided" do
326
326
  Braintree::Dispute.add_text_evidence(dispute.id, {category: "PRIOR_NON_DISPUTED_TRANSACTION_ARN", content: "123"})
327
327
  result = Braintree::Dispute.finalize(dispute.id)
328
328
 
329
- result.success?.should == false
330
- result.errors.for(:dispute)[0].code.should == Braintree::ErrorCodes::Dispute::NonDisputedPriorTransactionEvidenceMissingDate
329
+ expect(result.success?).to eq(false)
330
+ expect(result.errors.for(:dispute)[0].code).to eq(Braintree::ErrorCodes::Dispute::NonDisputedPriorTransactionEvidenceMissingDate)
331
331
  end
332
332
  end
333
333
  end
@@ -7,30 +7,30 @@ describe Braintree::DocumentUploadGateway do
7
7
  response = Braintree::DocumentUpload.create({:kind => Braintree::DocumentUpload::Kind::EvidenceDocument, :file => file})
8
8
  document_upload = response.document_upload
9
9
 
10
- response.success?.should == true
11
- document_upload.id.should_not be_nil
12
- document_upload.content_type.should == "image/png"
13
- document_upload.kind.should == Braintree::DocumentUpload::Kind::EvidenceDocument
14
- document_upload.name.should == "bt_logo.png"
15
- document_upload.size.should == 2443
10
+ expect(response.success?).to eq(true)
11
+ expect(document_upload.id).not_to be_nil
12
+ expect(document_upload.content_type).to eq("image/png")
13
+ expect(document_upload.kind).to eq(Braintree::DocumentUpload::Kind::EvidenceDocument)
14
+ expect(document_upload.name).to eq("bt_logo.png")
15
+ expect(document_upload.size).to eq(2443)
16
16
  end
17
17
 
18
18
  it "returns file type error with unsupported file type" do
19
19
  file = File.new("#{File.dirname(__FILE__)}/../../fixtures/files/gif_extension_bt_logo.gif", "r")
20
20
  response = Braintree::DocumentUpload.create({:kind => Braintree::DocumentUpload::Kind::EvidenceDocument, :file => file})
21
- response.errors.for(:document_upload).first.code.should == Braintree::ErrorCodes::DocumentUpload::FileTypeIsInvalid
21
+ expect(response.errors.for(:document_upload).first.code).to eq(Braintree::ErrorCodes::DocumentUpload::FileTypeIsInvalid)
22
22
  end
23
23
 
24
24
  it "returns malformed error with malformed file" do
25
25
  file = File.new("#{File.dirname(__FILE__)}/../../fixtures/files/malformed_pdf.pdf", "r")
26
26
  response = Braintree::DocumentUpload.create({:kind => Braintree::DocumentUpload::Kind::EvidenceDocument, :file => file})
27
- response.errors.for(:document_upload).first.code.should == Braintree::ErrorCodes::DocumentUpload::FileIsMalformedOrEncrypted
27
+ expect(response.errors.for(:document_upload).first.code).to eq(Braintree::ErrorCodes::DocumentUpload::FileIsMalformedOrEncrypted)
28
28
  end
29
29
 
30
30
  it "returns invalid kind error with invalid kind" do
31
31
  file = File.new("#{File.dirname(__FILE__)}/../../fixtures/files/bt_logo.png", "r")
32
32
  response = Braintree::DocumentUpload.create({:kind => "invalid_kind", :file => file})
33
- response.errors.for(:document_upload).first.code.should == Braintree::ErrorCodes::DocumentUpload::KindIsInvalid
33
+ expect(response.errors.for(:document_upload).first.code).to eq(Braintree::ErrorCodes::DocumentUpload::KindIsInvalid)
34
34
  end
35
35
 
36
36
  it "returns file too large error with file over 4mb" do
@@ -40,7 +40,7 @@ describe Braintree::DocumentUploadGateway do
40
40
  File.open(filename, "w+") { |f| write_times.times { f.write "a" } }
41
41
  file = File.new(filename, "r")
42
42
  response = Braintree::DocumentUpload.create({:kind => Braintree::DocumentUpload::Kind::EvidenceDocument, :file => file})
43
- response.errors.for(:document_upload).first.code.should == Braintree::ErrorCodes::DocumentUpload::FileIsTooLarge
43
+ expect(response.errors.for(:document_upload).first.code).to eq(Braintree::ErrorCodes::DocumentUpload::FileIsTooLarge)
44
44
  ensure
45
45
  File.delete(filename)
46
46
  end
@@ -52,7 +52,7 @@ describe Braintree::DocumentUploadGateway do
52
52
  File.open(filename, "w+") {}
53
53
  file = File.new(filename, "r")
54
54
  response = Braintree::DocumentUpload.create({:kind => Braintree::DocumentUpload::Kind::EvidenceDocument, :file => file})
55
- response.errors.for(:document_upload).first.code.should == Braintree::ErrorCodes::DocumentUpload::FileIsEmpty
55
+ expect(response.errors.for(:document_upload).first.code).to eq(Braintree::ErrorCodes::DocumentUpload::FileIsEmpty)
56
56
  ensure
57
57
  File.delete(filename)
58
58
  end
@@ -62,7 +62,7 @@ describe Braintree::DocumentUploadGateway do
62
62
  filename = "#{File.dirname(__FILE__)}/../../fixtures/files/too_long.pdf"
63
63
  file = File.new(filename, "r")
64
64
  response = Braintree::DocumentUpload.create({:kind => Braintree::DocumentUpload::Kind::EvidenceDocument, :file => file})
65
- response.errors.for(:document_upload).first.code.should == Braintree::ErrorCodes::DocumentUpload::FileIsTooLong
65
+ expect(response.errors.for(:document_upload).first.code).to eq(Braintree::ErrorCodes::DocumentUpload::FileIsTooLong)
66
66
  end
67
67
 
68
68
  it "returns invalid keys error if signature is invalid" do
@@ -77,11 +77,11 @@ describe Braintree::DocumentUploadGateway do
77
77
  file = File.new("#{File.dirname(__FILE__)}/../../fixtures/files/bt_logo.png", "r")
78
78
  document_upload = Braintree::DocumentUpload.create!({:kind => Braintree::DocumentUpload::Kind::EvidenceDocument, :file => file})
79
79
 
80
- document_upload.id.should_not be_nil
81
- document_upload.content_type.should == "image/png"
82
- document_upload.kind.should == Braintree::DocumentUpload::Kind::EvidenceDocument
83
- document_upload.name.should == "bt_logo.png"
84
- document_upload.size.should == 2443
80
+ expect(document_upload.id).not_to be_nil
81
+ expect(document_upload.content_type).to eq("image/png")
82
+ expect(document_upload.kind).to eq(Braintree::DocumentUpload::Kind::EvidenceDocument)
83
+ expect(document_upload.name).to eq("bt_logo.png")
84
+ expect(document_upload.size).to eq(2443)
85
85
  end
86
86
  end
87
87
  end
@@ -8,8 +8,8 @@ describe Braintree::ErrorCodes do
8
8
  :cardholder_name => "x" * 256
9
9
  },
10
10
  )
11
- result.success?.should == false
12
- result.errors.for(:customer).for(:credit_card).map { |e| e.code }.should \
11
+ expect(result.success?).to eq(false)
12
+ expect(result.errors.for(:customer).for(:credit_card).map { |e| e.code }).to \
13
13
  include(Braintree::ErrorCodes::CreditCard::CardholderNameIsTooLong)
14
14
  end
15
15
  end