braintree 2.101.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/braintree.gemspec +6 -3
  4. data/lib/braintree.rb +3 -17
  5. data/lib/braintree/address.rb +0 -22
  6. data/lib/braintree/address_gateway.rb +2 -2
  7. data/lib/braintree/base_module.rb +6 -0
  8. data/lib/braintree/configuration.rb +1 -1
  9. data/lib/braintree/credit_card.rb +5 -76
  10. data/lib/braintree/credit_card_gateway.rb +16 -32
  11. data/lib/braintree/credit_card_verification.rb +14 -0
  12. data/lib/braintree/customer.rb +3 -72
  13. data/lib/braintree/customer_gateway.rb +0 -23
  14. data/lib/braintree/dispute.rb +1 -7
  15. data/lib/braintree/dispute/{history_event.rb → status_history.rb} +3 -1
  16. data/lib/braintree/dispute/transaction.rb +2 -0
  17. data/lib/braintree/dispute_gateway.rb +2 -7
  18. data/lib/braintree/error_codes.rb +162 -157
  19. data/lib/braintree/exceptions.rb +5 -3
  20. data/lib/braintree/gateway.rb +0 -14
  21. data/lib/braintree/{android_pay_card.rb → google_pay_card.rb} +1 -1
  22. data/lib/braintree/local_payment_completed.rb +1 -1
  23. data/lib/braintree/merchant_account_gateway.rb +2 -0
  24. data/lib/braintree/payment_instrument_type.rb +1 -4
  25. data/lib/braintree/payment_method_gateway.rb +16 -8
  26. data/lib/braintree/payment_method_nonce.rb +2 -0
  27. data/lib/braintree/payment_method_nonce_gateway.rb +13 -2
  28. data/lib/braintree/payment_method_parser.rb +1 -7
  29. data/lib/braintree/risk_data.rb +4 -1
  30. data/lib/braintree/subscription.rb +5 -5
  31. data/lib/braintree/successful_result.rb +0 -1
  32. data/lib/braintree/test/authentication_id.rb +21 -0
  33. data/lib/braintree/test/credit_card.rb +1 -0
  34. data/lib/braintree/test/nonce.rb +19 -20
  35. data/lib/braintree/transaction.rb +8 -72
  36. data/lib/braintree/transaction/address_details.rb +11 -0
  37. data/lib/braintree/transaction/disbursement_details.rb +1 -0
  38. data/lib/braintree/transaction/{android_pay_details.rb → google_pay_details.rb} +1 -1
  39. data/lib/braintree/transaction/paypal_details.rb +2 -0
  40. data/lib/braintree/transaction/subscription_details.rb +2 -0
  41. data/lib/braintree/transaction_gateway.rb +14 -21
  42. data/lib/braintree/transaction_search.rb +0 -1
  43. data/lib/braintree/util.rb +17 -2
  44. data/lib/braintree/version.rb +3 -3
  45. data/lib/braintree/webhook_notification.rb +3 -10
  46. data/lib/braintree/webhook_testing_gateway.rb +243 -43
  47. data/lib/braintree/xml/libxml.rb +1 -0
  48. data/lib/braintree/xml/parser.rb +11 -34
  49. data/spec/integration/braintree/address_spec.rb +2 -89
  50. data/spec/integration/braintree/client_api/spec_helper.rb +100 -67
  51. data/spec/integration/braintree/credit_card_spec.rb +119 -467
  52. data/spec/integration/braintree/credit_card_verification_spec.rb +1 -0
  53. data/spec/integration/braintree/customer_spec.rb +135 -362
  54. data/spec/integration/braintree/dispute_search_spec.rb +2 -2
  55. data/spec/integration/braintree/dispute_spec.rb +1 -2
  56. data/spec/integration/braintree/document_upload_spec.rb +12 -0
  57. data/spec/integration/braintree/merchant_spec.rb +2 -2
  58. data/spec/integration/braintree/payment_method_nonce_spec.rb +77 -0
  59. data/spec/integration/braintree/payment_method_spec.rb +186 -120
  60. data/spec/integration/braintree/paypal_account_spec.rb +1 -1
  61. data/spec/integration/braintree/subscription_spec.rb +11 -16
  62. data/spec/integration/braintree/transaction_search_spec.rb +3 -3
  63. data/spec/integration/braintree/transaction_spec.rb +252 -524
  64. data/spec/integration/spec_helper.rb +1 -4
  65. data/spec/spec_helper.rb +1 -11
  66. data/spec/unit/braintree/address_spec.rb +0 -8
  67. data/spec/unit/braintree/credit_card_spec.rb +50 -23
  68. data/spec/unit/braintree/credit_card_verification_spec.rb +7 -0
  69. data/spec/unit/braintree/customer_spec.rb +26 -14
  70. data/spec/unit/braintree/dispute_spec.rb +4 -12
  71. data/spec/unit/braintree/http_spec.rb +3 -3
  72. data/spec/unit/braintree/local_payment_completed_spec.rb +14 -0
  73. data/spec/unit/braintree/transaction/paypal_details_spec.rb +57 -0
  74. data/spec/unit/braintree/transaction_spec.rb +17 -37
  75. data/spec/unit/braintree/util_spec.rb +37 -3
  76. data/spec/unit/braintree/webhook_notification_spec.rb +49 -1
  77. data/spec/unit/braintree/xml/parser_spec.rb +21 -16
  78. metadata +29 -31
  79. data/lib/braintree/amex_express_checkout_card.rb +0 -38
  80. data/lib/braintree/coinbase_account.rb +0 -34
  81. data/lib/braintree/europe_bank_account.rb +0 -36
  82. data/lib/braintree/europe_bank_account_gateway.rb +0 -17
  83. data/lib/braintree/ideal_payment.rb +0 -61
  84. data/lib/braintree/ideal_payment_gateway.rb +0 -19
  85. data/lib/braintree/masterpass_card.rb +0 -81
  86. data/lib/braintree/transaction/amex_express_checkout_details.rb +0 -21
  87. data/lib/braintree/transaction/coinbase_details.rb +0 -16
  88. data/lib/braintree/transaction/ideal_payment_details.rb +0 -19
  89. data/lib/braintree/transaction/masterpass_card_details.rb +0 -47
  90. data/lib/braintree/transparent_redirect.rb +0 -40
  91. data/lib/braintree/transparent_redirect_gateway.rb +0 -105
  92. data/lib/braintree/xml/rexml.rb +0 -71
  93. data/spec/hacks/tcp_socket.rb +0 -18
  94. data/spec/integration/braintree/coinbase_spec.rb +0 -34
  95. data/spec/integration/braintree/masterpass_card_spec.rb +0 -97
  96. data/spec/integration/braintree/transparent_redirect_spec.rb +0 -268
  97. data/spec/unit/braintree/transparent_redirect_spec.rb +0 -223
  98. data/spec/unit/braintree/xml/rexml_spec.rb +0 -51
@@ -3,6 +3,15 @@ module Braintree
3
3
  class AddressDetails # :nodoc:
4
4
  include BaseModule
5
5
 
6
+ module ShippingMethod
7
+ SameDay = "same_day"
8
+ NextDay = "next_day"
9
+ Priority = "priority"
10
+ Ground = "ground"
11
+ Electronic = "electronic"
12
+ ShipToStore = "ship_to_store"
13
+ end
14
+
6
15
  attr_reader :company
7
16
  attr_reader :country_code_alpha2
8
17
  attr_reader :country_code_alpha3
@@ -13,8 +22,10 @@ module Braintree
13
22
  attr_reader :id
14
23
  attr_reader :last_name
15
24
  attr_reader :locality
25
+ attr_reader :phone_number
16
26
  attr_reader :postal_code
17
27
  attr_reader :region
28
+ attr_reader :shipping_method
18
29
  attr_reader :street_address
19
30
 
20
31
  def initialize(attributes)
@@ -13,6 +13,7 @@ module Braintree
13
13
 
14
14
  def initialize(attributes)
15
15
  set_instance_variables_from_hash attributes unless attributes.nil?
16
+ @disbursement_date = Date.parse(disbursement_date) unless disbursement_date.nil?
16
17
  end
17
18
 
18
19
  def funds_held?
@@ -1,6 +1,6 @@
1
1
  module Braintree
2
2
  class Transaction
3
- class AndroidPayDetails
3
+ class GooglePayDetails
4
4
  include BaseModule
5
5
 
6
6
  attr_reader :bin
@@ -9,6 +9,8 @@ module Braintree
9
9
  attr_reader :debug_id
10
10
  attr_reader :description
11
11
  attr_reader :image_url
12
+ attr_reader :implicitly_vaulted_payment_method_global_id
13
+ attr_reader :implicitly_vaulted_payment_method_token
12
14
  attr_reader :payee_email
13
15
  attr_reader :payee_id
14
16
  attr_reader :payer_email
@@ -8,6 +8,8 @@ module Braintree
8
8
 
9
9
  def initialize(attributes)
10
10
  set_instance_variables_from_hash attributes unless attributes.nil?
11
+ @billing_period_start_date = Date.parse(billing_period_start_date) unless billing_period_start_date.nil?
12
+ @billing_period_end_date = Date.parse(billing_period_end_date) unless billing_period_end_date.nil?
11
13
  end
12
14
  end
13
15
  end
@@ -52,17 +52,6 @@ module Braintree
52
52
  return_object_or_raise(:transaction) { clone_transaction(*args) }
53
53
  end
54
54
 
55
- # Deprecated
56
- def create_from_transparent_redirect(query_string)
57
- params = @gateway.transparent_redirect.parse_and_validate_query_string query_string
58
- _do_create("/transactions/all/confirm_transparent_redirect_request", :id => params[:id])
59
- end
60
-
61
- def create_transaction_url
62
- warn "[DEPRECATED] Transaction.create_transaction_url is deprecated. Please use TransparentRedirect.url"
63
- "#{@config.base_merchant_url}/transactions/all/create_via_transparent_redirect_request"
64
- end
65
-
66
55
  def credit(attributes)
67
56
  create(attributes.merge(:type => 'credit'))
68
57
  end
@@ -124,7 +113,7 @@ module Braintree
124
113
  if response.has_key?(:search_results)
125
114
  ResourceCollection.new(response) { |ids| _fetch_transactions(search, ids) }
126
115
  else
127
- raise DownForMaintenanceError
116
+ raise UnexpectedError, "expected :search_results"
128
117
  end
129
118
  end
130
119
 
@@ -184,21 +173,22 @@ module Braintree
184
173
 
185
174
  def self._create_signature # :nodoc:
186
175
  [
187
- :amount, :customer_id, :merchant_account_id, :order_id, :channel, :payment_method_token,
188
- :purchase_order_number, :recurring, :transaction_source, :shipping_address_id, :type, :tax_amount, :tax_exempt,
189
- :venmo_sdk_payment_method_code, :device_session_id, :service_fee_amount, :device_data, :fraud_merchant_id,
190
- :shipping_amount, :discount_amount, :ships_from_postal_code,
191
- :billing_address_id, :payment_method_nonce, :three_d_secure_token, :three_d_secure_authentication_id,
192
- :shared_payment_method_token, :shared_billing_address_id, :shared_customer_id, :shared_shipping_address_id, :shared_payment_method_nonce,
176
+ :amount, :billing_address_id, :channel, :customer_id, :device_data, :discount_amount,
177
+ :merchant_account_id, :order_id, :payment_method_nonce, :payment_method_token,
178
+ :product_sku, :purchase_order_number, :service_fee_amount, :shared_billing_address_id,
179
+ :shared_customer_id, :shared_payment_method_nonce, :shared_payment_method_token,
180
+ :shared_shipping_address_id, :shipping_address_id, :shipping_amount,
181
+ :ships_from_postal_code, :tax_amount, :tax_exempt, :three_d_secure_authentication_id,
182
+ :three_d_secure_token, :transaction_source, :type, :venmo_sdk_payment_method_code,
193
183
  {:line_items => [:quantity, :name, :description, :kind, :unit_amount, :unit_tax_amount, :total_amount, :discount_amount, :tax_amount, :unit_of_measure, :product_code, :commodity_code, :url]},
194
- {:risk_data => [:customer_browser, :customer_ip]},
184
+ {:risk_data => [:customer_browser, :customer_device_id, :customer_ip, :customer_location_zip, :customer_tenure]},
195
185
  {:credit_card => [:token, :cardholder_name, :cvv, :expiration_date, :expiration_month, :expiration_year, :number]},
196
186
  {:customer => [:id, :company, :email, :fax, :first_name, :last_name, :phone, :website]},
197
187
  {
198
188
  :billing => AddressGateway._shared_signature
199
189
  },
200
190
  {
201
- :shipping => AddressGateway._shared_signature
191
+ :shipping => AddressGateway._shared_signature + [:shipping_method],
202
192
  },
203
193
  {
204
194
  :three_d_secure_pass_thru => [
@@ -255,7 +245,7 @@ module Braintree
255
245
  ]},
256
246
  ]},
257
247
  {:apple_pay_card => [:number, :cardholder_name, :cryptogram, :expiration_month, :expiration_year, :eci_indicator]},
258
- {:android_pay_card => [:number, :cryptogram, :google_transaction_id, :expiration_month, :expiration_year, :source_card_type, :source_card_last_four, :eci_indicator]}
248
+ {:google_pay_card => [:number, :cryptogram, :google_transaction_id, :expiration_month, :expiration_year, :source_card_type, :source_card_last_four, :eci_indicator]}
259
249
  ]
260
250
  end
261
251
 
@@ -289,6 +279,9 @@ module Braintree
289
279
  end
290
280
 
291
281
  def _do_create(path, params=nil) # :nodoc:
282
+ if !params.nil?
283
+ params = Util.replace_key(params, :google_pay_card, :android_pay_card)
284
+ end
292
285
  response = @config.http.post("#{@config.base_merchant_path}#{path}", params)
293
286
  _handle_transaction_response(response)
294
287
  end
@@ -28,7 +28,6 @@ module Braintree
28
28
  :paypal_authorization_id,
29
29
  :paypal_payer_email,
30
30
  :processor_authorization_code,
31
- :europe_bank_account_iban,
32
31
  :settlement_batch_id,
33
32
  :shipping_company,
34
33
  :shipping_country_name,
@@ -53,6 +53,8 @@ module Braintree
53
53
  raise AuthorizationError, message
54
54
  when 404
55
55
  raise NotFoundError
56
+ when 408
57
+ raise RequestTimeoutError
56
58
  when 426
57
59
  raise UpgradeRequiredError, "Please upgrade your client library."
58
60
  when 429
@@ -60,7 +62,9 @@ module Braintree
60
62
  when 500
61
63
  raise ServerError
62
64
  when 503
63
- raise DownForMaintenanceError
65
+ raise ServiceUnavailableError
66
+ when 504
67
+ raise GatewayTimeoutError
64
68
  else
65
69
  raise UnexpectedError, "Unexpected HTTP_RESPONSE #{status_code.to_i}"
66
70
  end
@@ -87,7 +91,7 @@ module Braintree
87
91
  when "INTERNAL"
88
92
  raise ServerError
89
93
  when "SERVICE_AVAILABILITY"
90
- raise DownForMaintenanceError
94
+ raise ServiceUnavailableError
91
95
  else
92
96
  raise UnexpectedError, "Unexpected Response: #{error[:message]}"
93
97
  end
@@ -126,6 +130,17 @@ module Braintree
126
130
  !invalid_keys.any?
127
131
  end
128
132
 
133
+ def self.replace_key(hash, target_key, replacement_key)
134
+ hash.inject({}) do |new_hash, (key, value)|
135
+ if value.is_a?(Hash)
136
+ value = replace_key(value, target_key, replacement_key)
137
+ end
138
+
139
+ key = replacement_key if key == target_key
140
+ new_hash.merge(key => value)
141
+ end
142
+ end
143
+
129
144
  def self._flatten_valid_keys(valid_keys, namespace = nil)
130
145
  valid_keys.inject([]) do |result, key|
131
146
  if key.is_a?(Hash)
@@ -1,8 +1,8 @@
1
1
  module Braintree
2
2
  module Version
3
- Major = 2
4
- Minor = 101
5
- Tiny = 0
3
+ Major = 3
4
+ Minor = 0
5
+ Tiny = 1
6
6
 
7
7
  String = "#{Major}.#{Minor}.#{Tiny}"
8
8
  end
@@ -13,6 +13,9 @@ module Braintree
13
13
  DisputeOpened = "dispute_opened"
14
14
  DisputeLost = "dispute_lost"
15
15
  DisputeWon = "dispute_won"
16
+ DisputeAccepted = "dispute_accepted"
17
+ DisputeDisputed = "dispute_disputed"
18
+ DisputeExpired = "dispute_expired"
16
19
 
17
20
  SubscriptionCanceled = "subscription_canceled"
18
21
  SubscriptionChargedSuccessfully = "subscription_charged_successfully"
@@ -33,18 +36,10 @@ module Braintree
33
36
 
34
37
  AccountUpdaterDailyReport = "account_updater_daily_report"
35
38
 
36
- # NEXT_MAJOR_VERSION Remove this class as legacy Ideal has been removed/disabled in the Braintree Gateway
37
- # DEPRECATED If you're looking to accept iDEAL as a payment method contact accounts@braintreepayments.com for a solution.
38
- IdealPaymentComplete = "ideal_payment_complete"
39
- IdealPaymentFailed = "ideal_payment_failed"
40
-
41
39
  OAuthAccessRevoked = "oauth_access_revoked"
42
40
  ConnectedMerchantStatusTransitioned = "connected_merchant_status_transitioned"
43
41
  ConnectedMerchantPayPalStatusChanged = "connected_merchant_paypal_status_changed"
44
42
 
45
- # NEXT_MAJOR_VERSION remove GrantedPaymentInstrumentUpdate. Kind is not sent by Braintree Gateway.
46
- # Kind will either be GrantorUpdatedGrantedPaymentMethod or RecipientUpdatedGrantedPaymentMethod.
47
- GrantedPaymentInstrumentUpdate = "granted_payment_instrument_update"
48
43
  GrantorUpdatedGrantedPaymentMethod = "grantor_updated_granted_payment_method"
49
44
  RecipientUpdatedGrantedPaymentMethod = "recipient_updated_granted_payment_method"
50
45
  GrantedPaymentInstrumentRevoked = "granted_payment_instrument_revoked"
@@ -60,7 +55,6 @@ module Braintree
60
55
  attr_reader :dispute
61
56
  attr_reader :granted_payment_instrument_update
62
57
  attr_reader :revoked_payment_method_metadata
63
- attr_reader :ideal_payment
64
58
  attr_reader :kind
65
59
  attr_reader :local_payment_completed
66
60
  attr_reader :oauth_access_revocation
@@ -90,7 +84,6 @@ module Braintree
90
84
  @disbursement = Disbursement._new(gateway, @subject[:disbursement]) if @subject.has_key?(:disbursement)
91
85
  @dispute = Dispute._new(@subject[:dispute]) if @subject.has_key?(:dispute)
92
86
  @account_updater_daily_report = AccountUpdaterDailyReport._new(@subject[:account_updater_daily_report]) if @subject.has_key?(:account_updater_daily_report)
93
- @ideal_payment = Braintree::IdealPayment._new(gateway, @subject[:ideal_payment]) if @subject.has_key?(:ideal_payment)
94
87
  @connected_merchant_status_transitioned = ConnectedMerchantStatusTransitioned._new(@subject[:connected_merchant_status_transitioned]) if @subject.has_key?(:connected_merchant_status_transitioned)
95
88
  @connected_merchant_paypal_status_changed = ConnectedMerchantPayPalStatusChanged._new(@subject[:connected_merchant_paypal_status_changed]) if @subject.has_key?(:connected_merchant_paypal_status_changed)
96
89
  @granted_payment_instrument_update = GrantedPaymentInstrumentUpdate._new(@subject[:granted_payment_instrument_update]) if @subject.has_key?(:granted_payment_instrument_update)
@@ -40,6 +40,12 @@ module Braintree
40
40
  _dispute_lost_sample_xml(id)
41
41
  when Braintree::WebhookNotification::Kind::DisputeWon
42
42
  _dispute_won_sample_xml(id)
43
+ when Braintree::WebhookNotification::Kind::DisputeAccepted
44
+ _dispute_accepted_sample_xml(id)
45
+ when Braintree::WebhookNotification::Kind::DisputeDisputed
46
+ _dispute_disputed_sample_xml(id)
47
+ when Braintree::WebhookNotification::Kind::DisputeExpired
48
+ _dispute_expired_sample_xml(id)
43
49
  when Braintree::WebhookNotification::Kind::PartnerMerchantConnected
44
50
  _partner_merchant_connected_sample_xml(id)
45
51
  when Braintree::WebhookNotification::Kind::PartnerMerchantDisconnected
@@ -72,17 +78,6 @@ module Braintree
72
78
  _auth_status_transitioned_sample_xml(id)
73
79
  when Braintree::WebhookNotification::Kind::ConnectedMerchantPayPalStatusChanged
74
80
  _auth_paypal_status_changed_sample_xml(id)
75
- # NEXT_MAJOR_VERSION Remove this class as legacy Ideal has been removed/disabled in the Braintree Gateway
76
- # DEPRECATED If you're looking to accept iDEAL as a payment method contact accounts@braintreepayments.com for a solution.
77
- when Braintree::WebhookNotification::Kind::IdealPaymentComplete
78
- _ideal_payment_complete_sample_xml(id)
79
- # NEXT_MAJOR_VERSION Remove this class as legacy Ideal has been removed/disabled in the Braintree Gateway
80
- # DEPRECATED If you're looking to accept iDEAL as a payment method contact accounts@braintreepayments.com for a solution.
81
- when Braintree::WebhookNotification::Kind::IdealPaymentFailed
82
- _ideal_payment_failed_sample_xml(id)
83
- # NEXT_MAJOR_VERSION remove GrantedPaymentInstrumentUpdate
84
- when Braintree::WebhookNotification::Kind::GrantedPaymentInstrumentUpdate
85
- _granted_payment_instrument_update_sample_xml(id)
86
81
  when Braintree::WebhookNotification::Kind::GrantorUpdatedGrantedPaymentMethod
87
82
  _granted_payment_instrument_update_sample_xml(id)
88
83
  when Braintree::WebhookNotification::Kind::RecipientUpdatedGrantedPaymentMethod
@@ -309,6 +304,30 @@ module Braintree
309
304
  end
310
305
  end
311
306
 
307
+ def _dispute_accepted_sample_xml(id)
308
+ if id == "legacy_dispute_id"
309
+ _old_dispute_accepted_sample_xml(id)
310
+ else
311
+ _new_dispute_accepted_sample_xml(id)
312
+ end
313
+ end
314
+
315
+ def _dispute_disputed_sample_xml(id)
316
+ if id == "legacy_dispute_id"
317
+ _old_dispute_disputed_sample_xml(id)
318
+ else
319
+ _new_dispute_disputed_sample_xml(id)
320
+ end
321
+ end
322
+
323
+ def _dispute_expired_sample_xml(id)
324
+ if id == "legacy_dispute_id"
325
+ _old_dispute_expired_sample_xml(id)
326
+ else
327
+ _new_dispute_expired_sample_xml(id)
328
+ end
329
+ end
330
+
312
331
  def _old_dispute_opened_sample_xml(id)
313
332
  <<-XML
314
333
  <dispute>
@@ -370,6 +389,66 @@ module Braintree
370
389
  XML
371
390
  end
372
391
 
392
+ def _old_dispute_accepted_sample_xml(id)
393
+ <<-XML
394
+ <dispute>
395
+ <amount>100.00</amount>
396
+ <currency-iso-code>USD</currency-iso-code>
397
+ <received-date type="date">2014-03-01</received-date>
398
+ <reply-by-date type="date">2014-03-21</reply-by-date>
399
+ <kind>chargeback</kind>
400
+ <status>accepted</status>
401
+ <reason>fraud</reason>
402
+ <id>#{id}</id>
403
+ <transaction>
404
+ <id>#{id}</id>
405
+ <amount>100.00</amount>
406
+ </transaction>
407
+ <date-opened type=\"date\">2014-03-21</date-opened>
408
+ </dispute>
409
+ XML
410
+ end
411
+
412
+ def _old_dispute_disputed_sample_xml(id)
413
+ <<-XML
414
+ <dispute>
415
+ <amount>100.00</amount>
416
+ <currency-iso-code>USD</currency-iso-code>
417
+ <received-date type="date">2014-03-01</received-date>
418
+ <reply-by-date type="date">2014-03-21</reply-by-date>
419
+ <kind>chargeback</kind>
420
+ <status>disputed</status>
421
+ <reason>fraud</reason>
422
+ <id>#{id}</id>
423
+ <transaction>
424
+ <id>#{id}</id>
425
+ <amount>100.00</amount>
426
+ </transaction>
427
+ <date-opened type=\"date\">2014-03-21</date-opened>
428
+ </dispute>
429
+ XML
430
+ end
431
+
432
+ def _old_dispute_expired_sample_xml(id)
433
+ <<-XML
434
+ <dispute>
435
+ <amount>100.00</amount>
436
+ <currency-iso-code>USD</currency-iso-code>
437
+ <received-date type="date">2014-03-01</received-date>
438
+ <reply-by-date type="date">2014-03-21</reply-by-date>
439
+ <kind>chargeback</kind>
440
+ <status>expired</status>
441
+ <reason>fraud</reason>
442
+ <id>#{id}</id>
443
+ <transaction>
444
+ <id>#{id}</id>
445
+ <amount>100.00</amount>
446
+ </transaction>
447
+ <date-opened type=\"date\">2014-03-21</date-opened>
448
+ </dispute>
449
+ XML
450
+ end
451
+
373
452
  def _new_dispute_opened_sample_xml(id)
374
453
  <<-XML
375
454
  <dispute>
@@ -535,6 +614,159 @@ module Braintree
535
614
  XML
536
615
  end
537
616
 
617
+ def _new_dispute_accepted_sample_xml(id)
618
+ <<-XML
619
+ <dispute>
620
+ <id>#{id}</id>
621
+ <amount>100.00</amount>
622
+ <amount-disputed>100.00</amount-disputed>
623
+ <amount-won>95.00</amount-won>
624
+ <case-number>CASE-12345</case-number>
625
+ <created-at type="datetime">2017-06-16T20:44:41Z</created-at>
626
+ <currency-iso-code>USD</currency-iso-code>
627
+ <forwarded-comments nil="true"/>
628
+ <kind>chargeback</kind>
629
+ <merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
630
+ <reason>fraud</reason>
631
+ <reason-code nil="true"/>
632
+ <reason-description nil="true"/>
633
+ <received-date type="date">2016-02-15</received-date>
634
+ <reference-number>REF-9876</reference-number>
635
+ <reply-by-date type="date">2016-02-22</reply-by-date>
636
+ <status>accepted</status>
637
+ <updated-at type="datetime">2017-06-16T20:44:41Z</updated-at>
638
+ <original-dispute-id>9qde5qgp</original-dispute-id>
639
+ <status-history type="array">
640
+ <status-history>
641
+ <status>open</status>
642
+ <timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
643
+ </status-history>
644
+ <status-history>
645
+ <status>accepted</status>
646
+ <timestamp type="datetime">2017-06-25T20:50:55Z</timestamp>
647
+ </status-history>
648
+ </status-history>
649
+ <evidence type="array"/>
650
+ <transaction>
651
+ <id>#{id}</id>
652
+ <amount>100.00</amount>
653
+ <created-at>2017-06-21T20:44:41Z</created-at>
654
+ <order-id nil="true"/>
655
+ <purchase-order-number nil="true"/>
656
+ <payment-instrument-subtype>Visa</payment-instrument-subtype>
657
+ </transaction>
658
+ <date-opened type=\"date\">2014-03-21</date-opened>
659
+ </dispute>
660
+ XML
661
+ end
662
+
663
+ def _new_dispute_disputed_sample_xml(id)
664
+ <<-XML
665
+ <dispute>
666
+ <id>#{id}</id>
667
+ <amount>100.00</amount>
668
+ <amount-disputed>100.00</amount-disputed>
669
+ <amount-won>95.00</amount-won>
670
+ <case-number>CASE-12345</case-number>
671
+ <created-at type="datetime">2017-06-16T20:44:41Z</created-at>
672
+ <currency-iso-code>USD</currency-iso-code>
673
+ <forwarded-comments nil="true"/>
674
+ <kind>chargeback</kind>
675
+ <merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
676
+ <reason>fraud</reason>
677
+ <reason-code nil="true"/>
678
+ <reason-description nil="true"/>
679
+ <received-date type="date">2016-02-15</received-date>
680
+ <reference-number>REF-9876</reference-number>
681
+ <reply-by-date type="date">2016-02-22</reply-by-date>
682
+ <status>disputed</status>
683
+ <updated-at type="datetime">2017-06-21T20:44:41Z</updated-at>
684
+ <original-dispute-id>9qde5qgp</original-dispute-id>
685
+ <status-history type="array">
686
+ <status-history>
687
+ <status>open</status>
688
+ <timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
689
+ </status-history>
690
+ <status-history>
691
+ <status>disputed</status>
692
+ <timestamp type="datetime">2017-06-25T20:50:55Z</timestamp>
693
+ </status-history>
694
+ </status-history>
695
+ <evidence type="array">
696
+ <evidence>
697
+ <id>rxtngk9j5j93tsrq</id>
698
+ <comments nil="true"/>
699
+ <created-at type="datetime">2017-06-21T20:44:42Z</created-at>
700
+ <sent-to-processor-at nil="true"/>
701
+ <url>s3.amazonaws.com/foo.jpg</url>
702
+ </evidence>
703
+ <evidence>
704
+ <id>88cfb8dd</id>
705
+ <comments>text evidence</comments>
706
+ <created-at type="datetime">2017-06-21T20:44:42Z</created-at>
707
+ <sent-to-processor-at nil="true"/>
708
+ <url nil="true"/>
709
+ </evidence>
710
+ </evidence>
711
+ <transaction>
712
+ <id>#{id}</id>
713
+ <amount>100.00</amount>
714
+ <created-at>2017-06-21T20:44:41Z</created-at>
715
+ <order-id nil="true"/>
716
+ <purchase-order-number nil="true"/>
717
+ <payment-instrument-subtype>Visa</payment-instrument-subtype>
718
+ </transaction>
719
+ <date-opened type=\"date\">2014-03-21</date-opened>
720
+ </dispute>
721
+ XML
722
+ end
723
+
724
+ def _new_dispute_expired_sample_xml(id)
725
+ <<-XML
726
+ <dispute>
727
+ <id>#{id}</id>
728
+ <amount>100.00</amount>
729
+ <amount-disputed>100.00</amount-disputed>
730
+ <amount-won>95.00</amount-won>
731
+ <case-number>CASE-12345</case-number>
732
+ <created-at type="datetime">2017-06-16T20:44:41Z</created-at>
733
+ <currency-iso-code>USD</currency-iso-code>
734
+ <forwarded-comments nil="true"/>
735
+ <kind>chargeback</kind>
736
+ <merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
737
+ <reason>fraud</reason>
738
+ <reason-code nil="true"/>
739
+ <reason-description nil="true"/>
740
+ <received-date type="date">2016-02-15</received-date>
741
+ <reference-number>REF-9876</reference-number>
742
+ <reply-by-date type="date">2016-02-22</reply-by-date>
743
+ <status>expired</status>
744
+ <updated-at type="datetime">2017-06-16T20:44:41Z</updated-at>
745
+ <original-dispute-id>9qde5qgp</original-dispute-id>
746
+ <status-history type="array">
747
+ <status-history>
748
+ <status>open</status>
749
+ <timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
750
+ </status-history>
751
+ <status-history>
752
+ <status>expired</status>
753
+ <timestamp type="datetime">2017-06-25T20:50:55Z</timestamp>
754
+ </status-history>
755
+ </status-history>
756
+ <evidence type="array"/>
757
+ <transaction>
758
+ <id>#{id}</id>
759
+ <amount>100.00</amount>
760
+ <created-at>2017-06-21T20:44:41Z</created-at>
761
+ <order-id nil="true"/>
762
+ <purchase-order-number nil="true"/>
763
+ <payment-instrument-subtype>Visa</payment-instrument-subtype>
764
+ </transaction>
765
+ <date-opened type=\"date\">2014-03-21</date-opened>
766
+ </dispute>
767
+ XML
768
+ end
769
+
538
770
  def _disbursement_exception_sample_xml(id)
539
771
 
540
772
  <<-XML
@@ -624,38 +856,6 @@ module Braintree
624
856
  XML
625
857
  end
626
858
 
627
- def _ideal_payment_complete_sample_xml(id)
628
- <<-XML
629
- <ideal-payment>
630
- <id>#{id}</id>
631
- <status>COMPLETE</status>
632
- <issuer>ABCISSUER</issuer>
633
- <order-id>ORDERABC</order-id>
634
- <currency>EUR</currency>
635
- <amount>10.00</amount>
636
- <created-at>2016-11-29T23:27:34.547Z</created-at>
637
- <approval-url>https://example.com</approval-url>
638
- <ideal-transaction-id>1234567890</ideal-transaction-id>
639
- </ideal-payment>
640
- XML
641
- end
642
-
643
- def _ideal_payment_failed_sample_xml(id)
644
- <<-XML
645
- <ideal-payment>
646
- <id>#{id}</id>
647
- <status>FAILED</status>
648
- <issuer>ABCISSUER</issuer>
649
- <order-id>ORDERABC</order-id>
650
- <currency>EUR</currency>
651
- <amount>10.00</amount>
652
- <created-at>2016-11-29T23:27:34.547Z</created-at>
653
- <approval-url>https://example.com</approval-url>
654
- <ideal-transaction-id>1234567890</ideal-transaction-id>
655
- </ideal-payment>
656
- XML
657
- end
658
-
659
859
  def _granted_payment_instrument_update_sample_xml(id)
660
860
  <<-XML
661
861
  <granted-payment-instrument-update>