braintree 3.3.0 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +4 -4
  2. data/braintree.gemspec +1 -1
  3. data/lib/braintree.rb +2 -1
  4. data/lib/braintree/account_updater_daily_report.rb +1 -1
  5. data/lib/braintree/address.rb +1 -1
  6. data/lib/braintree/apple_pay.rb +1 -1
  7. data/lib/braintree/apple_pay_card.rb +1 -1
  8. data/lib/braintree/apple_pay_options.rb +1 -1
  9. data/lib/braintree/authorization_adjustment.rb +1 -1
  10. data/lib/braintree/client_token.rb +1 -1
  11. data/lib/braintree/configuration.rb +11 -11
  12. data/lib/braintree/connected_merchant_paypal_status_changed.rb +1 -1
  13. data/lib/braintree/connected_merchant_status_transitioned.rb +1 -1
  14. data/lib/braintree/credit_card.rb +2 -2
  15. data/lib/braintree/credit_card_gateway.rb +3 -3
  16. data/lib/braintree/credit_card_verification.rb +5 -5
  17. data/lib/braintree/credit_card_verification_search.rb +1 -1
  18. data/lib/braintree/customer.rb +2 -2
  19. data/lib/braintree/customer_search.rb +1 -1
  20. data/lib/braintree/disbursement.rb +1 -1
  21. data/lib/braintree/dispute.rb +1 -1
  22. data/lib/braintree/dispute_gateway.rb +2 -2
  23. data/lib/braintree/dispute_search.rb +2 -2
  24. data/lib/braintree/document_upload.rb +1 -1
  25. data/lib/braintree/error_codes.rb +7 -0
  26. data/lib/braintree/google_pay_card.rb +1 -1
  27. data/lib/braintree/granted_payment_instrument_update.rb +1 -1
  28. data/lib/braintree/graphql_client.rb +7 -7
  29. data/lib/braintree/http.rb +3 -3
  30. data/lib/braintree/local_payment_completed.rb +1 -1
  31. data/lib/braintree/local_payment_reversed.rb +19 -0
  32. data/lib/braintree/merchant.rb +1 -1
  33. data/lib/braintree/merchant_account.rb +1 -1
  34. data/lib/braintree/merchant_account_gateway.rb +1 -1
  35. data/lib/braintree/merchant_gateway.rb +1 -1
  36. data/lib/braintree/modification.rb +1 -1
  37. data/lib/braintree/oauth_credentials.rb +1 -1
  38. data/lib/braintree/oauth_gateway.rb +5 -5
  39. data/lib/braintree/payment_instrument_type.rb +10 -10
  40. data/lib/braintree/payment_method_gateway.rb +3 -3
  41. data/lib/braintree/payment_method_nonce_gateway.rb +1 -1
  42. data/lib/braintree/plan.rb +1 -1
  43. data/lib/braintree/processor_response_types.rb +3 -3
  44. data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
  45. data/lib/braintree/samsung_pay_card.rb +1 -1
  46. data/lib/braintree/settlement_batch_summary.rb +2 -2
  47. data/lib/braintree/subscription.rb +6 -6
  48. data/lib/braintree/transaction.rb +32 -24
  49. data/lib/braintree/transaction_gateway.rb +23 -4
  50. data/lib/braintree/transaction_line_item.rb +1 -1
  51. data/lib/braintree/transaction_search.rb +3 -1
  52. data/lib/braintree/unknown_payment_method.rb +1 -1
  53. data/lib/braintree/us_bank_account.rb +3 -3
  54. data/lib/braintree/us_bank_account_verification.rb +1 -1
  55. data/lib/braintree/us_bank_account_verification_gateway.rb +1 -1
  56. data/lib/braintree/util.rb +4 -4
  57. data/lib/braintree/venmo_account.rb +1 -1
  58. data/lib/braintree/version.rb +1 -1
  59. data/lib/braintree/visa_checkout_card.rb +2 -2
  60. data/lib/braintree/webhook_notification.rb +28 -19
  61. data/lib/braintree/webhook_notification_gateway.rb +5 -5
  62. data/lib/braintree/webhook_testing_gateway.rb +10 -0
  63. data/lib/braintree/xml/generator.rb +5 -4
  64. data/lib/braintree/xml/libxml.rb +1 -1
  65. data/lib/braintree/xml/parser.rb +10 -10
  66. data/spec/integration/braintree/add_on_spec.rb +1 -1
  67. data/spec/integration/braintree/address_spec.rb +24 -24
  68. data/spec/integration/braintree/advanced_search_spec.rb +45 -45
  69. data/spec/integration/braintree/apple_pay_spec.rb +3 -3
  70. data/spec/integration/braintree/braintree_gateway_spec.rb +2 -1
  71. data/spec/integration/braintree/client_api/client_token_spec.rb +14 -14
  72. data/spec/integration/braintree/client_api/spec_helper.rb +5 -5
  73. data/spec/integration/braintree/credit_card_spec.rb +119 -119
  74. data/spec/integration/braintree/credit_card_verification_search_spec.rb +2 -2
  75. data/spec/integration/braintree/credit_card_verification_spec.rb +1 -1
  76. data/spec/integration/braintree/customer_search_spec.rb +8 -8
  77. data/spec/integration/braintree/customer_spec.rb +165 -165
  78. data/spec/integration/braintree/dispute_search_spec.rb +3 -3
  79. data/spec/integration/braintree/dispute_spec.rb +6 -6
  80. data/spec/integration/braintree/error_codes_spec.rb +1 -1
  81. data/spec/integration/braintree/http_spec.rb +2 -2
  82. data/spec/integration/braintree/merchant_account_spec.rb +25 -26
  83. data/spec/integration/braintree/merchant_spec.rb +12 -12
  84. data/spec/integration/braintree/oauth_spec.rb +11 -11
  85. data/spec/integration/braintree/payment_method_nonce_spec.rb +12 -12
  86. data/spec/integration/braintree/payment_method_spec.rb +165 -165
  87. data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +9 -9
  88. data/spec/integration/braintree/paypal_account_spec.rb +28 -28
  89. data/spec/integration/braintree/samsung_pay_card_spec.rb +9 -9
  90. data/spec/integration/braintree/settlement_batch_summary_spec.rb +8 -8
  91. data/spec/integration/braintree/subscription_spec.rb +133 -133
  92. data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
  93. data/spec/integration/braintree/test_transaction_spec.rb +10 -10
  94. data/spec/integration/braintree/transaction_search_spec.rb +93 -67
  95. data/spec/integration/braintree/transaction_spec.rb +498 -344
  96. data/spec/integration/braintree/transaction_us_bank_account_spec.rb +20 -20
  97. data/spec/integration/braintree/us_bank_account_spec.rb +6 -6
  98. data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +7 -7
  99. data/spec/integration/braintree/us_bank_account_verification_spec.rb +8 -8
  100. data/spec/integration/braintree/visa_checkout_card_spec.rb +5 -5
  101. data/spec/integration/spec_helper.rb +2 -2
  102. data/spec/oauth_test_helper.rb +1 -1
  103. data/spec/script/httpsd.rb +6 -6
  104. data/spec/spec_helper.rb +4 -3
  105. data/spec/unit/braintree/address_spec.rb +1 -1
  106. data/spec/unit/braintree/apple_pay_card_spec.rb +1 -1
  107. data/spec/unit/braintree/client_token_spec.rb +2 -2
  108. data/spec/unit/braintree/configuration_spec.rb +42 -42
  109. data/spec/unit/braintree/credit_card_spec.rb +7 -7
  110. data/spec/unit/braintree/credit_card_verification_search_spec.rb +1 -1
  111. data/spec/unit/braintree/credit_card_verification_spec.rb +2 -2
  112. data/spec/unit/braintree/customer_spec.rb +3 -3
  113. data/spec/unit/braintree/disbursement_spec.rb +7 -7
  114. data/spec/unit/braintree/dispute_spec.rb +8 -8
  115. data/spec/unit/braintree/error_result_spec.rb +5 -5
  116. data/spec/unit/braintree/errors_spec.rb +8 -8
  117. data/spec/unit/braintree/http_spec.rb +5 -5
  118. data/spec/unit/braintree/merchant_account_spec.rb +1 -1
  119. data/spec/unit/braintree/payment_method_spec.rb +1 -1
  120. data/spec/unit/braintree/paypal_account_spec.rb +2 -2
  121. data/spec/unit/braintree/resource_collection_spec.rb +9 -9
  122. data/spec/unit/braintree/subscription_search_spec.rb +1 -1
  123. data/spec/unit/braintree/successful_result_spec.rb +1 -1
  124. data/spec/unit/braintree/three_d_secure_info_spec.rb +1 -1
  125. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +3 -3
  126. data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
  127. data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
  128. data/spec/unit/braintree/transaction/paypal_details_spec.rb +1 -1
  129. data/spec/unit/braintree/transaction_search_spec.rb +12 -12
  130. data/spec/unit/braintree/transaction_spec.rb +25 -17
  131. data/spec/unit/braintree/util_spec.rb +18 -18
  132. data/spec/unit/braintree/validation_error_collection_spec.rb +36 -36
  133. data/spec/unit/braintree/webhook_notification_spec.rb +72 -56
  134. data/spec/unit/braintree/xml_spec.rb +31 -31
  135. metadata +3 -3
  136. data/lib/braintree/settlement_batch.rb +0 -0
@@ -75,7 +75,7 @@ module Braintree
75
75
  @config.proxy_address,
76
76
  @config.proxy_port,
77
77
  @config.proxy_user,
78
- @config.proxy_pass
78
+ @config.proxy_pass,
79
79
  )
80
80
  else
81
81
  connection = Net::HTTP.new(server, port)
@@ -127,7 +127,7 @@ module Braintree
127
127
  form_params.push(_add_form_field(k, v))
128
128
  end
129
129
  form_params.push(_add_file_part("file", file))
130
- request.body = form_params.collect {|p| "--" + boundary + "#{LINE_FEED}" + p}.join("") + "--" + boundary + "--"
130
+ request.body = form_params.collect { |p| "--" + boundary + "#{LINE_FEED}" + p }.join("") + "--" + boundary + "--"
131
131
  @config.logger.debug _format_and_sanitize_body_for_log(_build_xml(body))
132
132
  else
133
133
  request.body = body
@@ -187,7 +187,7 @@ module Braintree
187
187
  def _format_and_sanitize_body_for_log(input_xml)
188
188
  formatted_xml = input_xml.gsub(/^/, "[Braintree] ")
189
189
  formatted_xml = formatted_xml.gsub(/<number>(.{6}).+?(.{4})<\/number>/m, '<number>\1******\2</number>')
190
- formatted_xml = formatted_xml.gsub(/<cvv>.+?<\/cvv>/m, '<cvv>***</cvv>')
190
+ formatted_xml = formatted_xml.gsub(/<cvv>.+?<\/cvv>/m, "<cvv>***</cvv>")
191
191
  formatted_xml
192
192
  end
193
193
 
@@ -17,7 +17,7 @@ module Braintree
17
17
  end
18
18
 
19
19
  def self._new(*args) # :nodoc:
20
- self.new *args
20
+ self.new(*args)
21
21
  end
22
22
  end
23
23
  end
@@ -0,0 +1,19 @@
1
+ module Braintree
2
+ class LocalPaymentReversed
3
+ include BaseModule
4
+
5
+ attr_reader :payment_id
6
+
7
+ def initialize(attributes) # :nodoc:
8
+ set_instance_variables_from_hash(attributes)
9
+ end
10
+
11
+ class << self
12
+ protected :new
13
+ end
14
+
15
+ def self._new(*args) # :nodoc:
16
+ self.new(*args)
17
+ end
18
+ end
19
+ end
@@ -24,7 +24,7 @@ module Braintree
24
24
  end
25
25
 
26
26
  def self._new(*args) # :nodoc:
27
- self.new *args
27
+ self.new(*args)
28
28
  end
29
29
 
30
30
  def self.provision_raw_apple_pay
@@ -61,7 +61,7 @@ module Braintree
61
61
  class << self
62
62
  protected :new
63
63
  def _new(*args) # :nodoc:
64
- self.new *args
64
+ self.new(*args)
65
65
  end
66
66
  end
67
67
 
@@ -74,7 +74,7 @@ module Braintree
74
74
 
75
75
  if response.has_key?(:response) && response[:response][:merchant_account]
76
76
  Braintree::SuccessfulResult.new(
77
- :merchant_account => MerchantAccount._new(@gateway, response[:response][:merchant_account])
77
+ :merchant_account => MerchantAccount._new(@gateway, response[:response][:merchant_account]),
78
78
  )
79
79
  elsif response[:api_error_response]
80
80
  ErrorResult.new(@gateway, response[:api_error_response])
@@ -26,7 +26,7 @@ module Braintree
26
26
  if response.has_key?(:response) && response[:response][:merchant]
27
27
  Braintree::SuccessfulResult.new(
28
28
  :merchant => Merchant._new(@gateway, response[:response][:merchant]),
29
- :credentials => OAuthCredentials._new(response[:response][:credentials])
29
+ :credentials => OAuthCredentials._new(response[:response][:credentials]),
30
30
  )
31
31
  elsif response[:api_error_response]
32
32
  ErrorResult.new(@gateway, response[:api_error_response])
@@ -18,7 +18,7 @@ module Braintree
18
18
  class << self
19
19
  protected :new
20
20
  def _new(*args) # :nodoc:
21
- self.new *args
21
+ self.new(*args)
22
22
  end
23
23
  end
24
24
 
@@ -16,7 +16,7 @@ module Braintree
16
16
  end
17
17
 
18
18
  def self._new(*args) # :nodoc:
19
- self.new *args
19
+ self.new(*args)
20
20
  end
21
21
  end
22
22
  end
@@ -22,7 +22,7 @@ module Braintree
22
22
  })
23
23
  if response[:credentials]
24
24
  Braintree::SuccessfulResult.new(
25
- :credentials => OAuthCredentials._new(response[:credentials])
25
+ :credentials => OAuthCredentials._new(response[:credentials]),
26
26
  )
27
27
  elsif response[:api_error_response]
28
28
  ErrorResult.new(@gateway, response[:api_error_response])
@@ -47,10 +47,10 @@ module Braintree
47
47
  user_params = _sub_query(params, :user)
48
48
  business_params = _sub_query(params, :business)
49
49
  payment_methods = _sub_array_query(params, :payment_methods)
50
- query = params.to_a.
51
- concat(user_params).
52
- concat(business_params).
53
- concat(payment_methods)
50
+ query = params.to_a
51
+ .concat(user_params)
52
+ .concat(business_params)
53
+ .concat(payment_methods)
54
54
 
55
55
  query_string = query.map { |k, v| "#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}" }.join("&")
56
56
  "#{@config.base_url}/oauth/connect?#{query_string}"
@@ -1,14 +1,14 @@
1
1
  module Braintree
2
2
  module PaymentInstrumentType
3
- PayPalAccount = 'paypal_account'
4
- CreditCard = 'credit_card'
5
- ApplePayCard = 'apple_pay_card'
6
- GooglePayCard = 'android_pay_card'
7
- VenmoAccount = 'venmo_account'
8
- UsBankAccount = 'us_bank_account'
9
- VisaCheckoutCard = 'visa_checkout_card'
10
- SamsungPayCard = 'samsung_pay_card'
11
- LocalPayment = 'local_payment'
12
- PayPalHere = 'paypal_here'
3
+ PayPalAccount = "paypal_account"
4
+ CreditCard = "credit_card"
5
+ ApplePayCard = "apple_pay_card"
6
+ GooglePayCard = "android_pay_card"
7
+ VenmoAccount = "venmo_account"
8
+ UsBankAccount = "us_bank_account"
9
+ VisaCheckoutCard = "visa_checkout_card"
10
+ SamsungPayCard = "samsung_pay_card"
11
+ LocalPayment = "local_payment"
12
+ PayPalHere = "paypal_here"
13
13
  end
14
14
  end
@@ -82,7 +82,7 @@ module Braintree
82
82
  if options.class == Hash
83
83
  grant_options = options
84
84
  elsif [true, false].include?(options)
85
- grant_options = { :allow_vaulting => options }
85
+ grant_options = {:allow_vaulting => options}
86
86
  else
87
87
  raise ArgumentError
88
88
  end
@@ -91,7 +91,7 @@ module Braintree
91
91
  "/payment_methods/grant",
92
92
  :payment_method => {
93
93
  :shared_payment_method_token => token,
94
- }.merge(grant_options)
94
+ }.merge(grant_options),
95
95
  )
96
96
  rescue NotFoundError
97
97
  raise NotFoundError, "payment method with token #{token.inspect} not found"
@@ -115,7 +115,7 @@ module Braintree
115
115
  "/payment_methods/revoke",
116
116
  :payment_method => {
117
117
  :shared_payment_method_token => token
118
- }
118
+ },
119
119
  )
120
120
  rescue NotFoundError
121
121
  raise NotFoundError, "payment method with token #{token.inspect} not found"
@@ -8,7 +8,7 @@ module Braintree
8
8
  @config.assert_has_access_token_or_keys
9
9
  end
10
10
 
11
- def create(payment_method_token, args = { payment_method_nonce: {} })
11
+ def create(payment_method_token, args = {payment_method_nonce: {}})
12
12
  Util.verify_keys(PaymentMethodNonceGateway._create_signature, args)
13
13
 
14
14
  response = @config.http.post("#{@config.base_merchant_path}/payment_methods/#{payment_method_token}/nonces", args)
@@ -36,7 +36,7 @@ module Braintree
36
36
  end
37
37
 
38
38
  def self._new(*args)
39
- self.new *args
39
+ self.new(*args)
40
40
  end
41
41
  end
42
42
  end
@@ -1,7 +1,7 @@
1
1
  module Braintree
2
2
  module ProcessorResponseTypes
3
- Approved = 'approved'
4
- SoftDeclined = 'soft_declined'
5
- HardDeclined = 'hard_declined'
3
+ Approved = "approved"
4
+ SoftDeclined = "soft_declined"
5
+ HardDeclined = "hard_declined"
6
6
  end
7
7
  end
@@ -15,7 +15,7 @@ module Braintree
15
15
  class << self
16
16
  protected :new
17
17
  def _new(*args) # :nodoc:
18
- self.new *args
18
+ self.new(*args)
19
19
  end
20
20
  end
21
21
  end
@@ -77,7 +77,7 @@ module Braintree
77
77
  end
78
78
 
79
79
  def self._new(*args) # :nodoc:
80
- self.new *args
80
+ self.new(*args)
81
81
  end
82
82
  end
83
83
  end
@@ -1,11 +1,11 @@
1
1
  module Braintree
2
2
  class SettlementBatchSummary
3
3
  include BaseModule
4
-
4
+
5
5
  attr_reader :records
6
6
 
7
7
  def self.generate(settlement_date, group_by_custom_field = nil)
8
- criteria = { :settlement_date => settlement_date }
8
+ criteria = {:settlement_date => settlement_date}
9
9
  criteria.merge!({:group_by_custom_field => group_by_custom_field}) if group_by_custom_field
10
10
  Configuration.gateway.settlement_batch_summary.generate(criteria)
11
11
  end
@@ -11,11 +11,11 @@ module Braintree
11
11
  end
12
12
 
13
13
  module Status
14
- Active = 'Active'
15
- Canceled = 'Canceled'
16
- Expired = 'Expired'
17
- PastDue = 'Past Due'
18
- Pending = 'Pending'
14
+ Active = "Active"
15
+ Canceled = "Canceled"
16
+ Expired = "Expired"
17
+ PastDue = "Past Due"
18
+ Pending = "Pending"
19
19
 
20
20
  All = constants.map { |c| const_get(c) }
21
21
  end
@@ -115,7 +115,7 @@ module Braintree
115
115
  class << self
116
116
  protected :new
117
117
  def _new(*args) # :nodoc:
118
- self.new *args
118
+ self.new(*args)
119
119
  end
120
120
  end
121
121
  end
@@ -4,18 +4,18 @@ module Braintree
4
4
  include Braintree::Util::IdEquality
5
5
 
6
6
  module CreatedUsing
7
- FullInformation = 'full_information'
8
- Token = 'token'
9
- Unrecognized = 'unrecognized'
7
+ FullInformation = "full_information"
8
+ Token = "token"
9
+ Unrecognized = "unrecognized"
10
10
  end
11
11
 
12
12
  module EscrowStatus
13
- HoldPending = 'hold_pending'
14
- Held = 'held'
15
- ReleasePending = 'release_pending'
16
- Released = 'released'
17
- Refunded = 'refunded'
18
- Unrecognized = 'unrecognized'
13
+ HoldPending = "hold_pending"
14
+ Held = "held"
15
+ ReleasePending = "release_pending"
16
+ Released = "released"
17
+ Refunded = "refunded"
18
+ Unrecognized = "unrecognized"
19
19
  end
20
20
 
21
21
  module GatewayRejectionReason
@@ -32,20 +32,20 @@ module Braintree
32
32
  end
33
33
 
34
34
  module Status
35
- AuthorizationExpired = 'authorization_expired'
36
- Authorizing = 'authorizing'
37
- Authorized = 'authorized'
38
- GatewayRejected = 'gateway_rejected'
39
- Failed = 'failed'
40
- ProcessorDeclined = 'processor_declined'
41
- Settled = 'settled'
42
- SettlementConfirmed = 'settlement_confirmed'
43
- SettlementDeclined = 'settlement_declined'
44
- SettlementPending = 'settlement_pending'
45
- Settling = 'settling'
46
- SubmittedForSettlement = 'submitted_for_settlement'
47
- Voided = 'voided'
48
- Unrecognized = 'unrecognized'
35
+ AuthorizationExpired = "authorization_expired"
36
+ Authorizing = "authorizing"
37
+ Authorized = "authorized"
38
+ GatewayRejected = "gateway_rejected"
39
+ Failed = "failed"
40
+ ProcessorDeclined = "processor_declined"
41
+ Settled = "settled"
42
+ SettlementConfirmed = "settlement_confirmed"
43
+ SettlementDeclined = "settlement_declined"
44
+ SettlementPending = "settlement_pending"
45
+ Settling = "settling"
46
+ SubmittedForSettlement = "submitted_for_settlement"
47
+ Voided = "voided"
48
+ Unrecognized = "unrecognized"
49
49
 
50
50
  All = constants.map { |c| const_get(c) }
51
51
  end
@@ -169,6 +169,14 @@ module Braintree
169
169
  attr_reader :visa_checkout_card_details
170
170
  attr_reader :voice_referral_number
171
171
 
172
+ def self.adjust_authorization(*args)
173
+ Configuration.gateway.transaction.adjust_authorization(*args)
174
+ end
175
+
176
+ def self.adjust_authorization!(*args)
177
+ Configuration.gateway.transaction.adjust_authorization!(*args)
178
+ end
179
+
172
180
  def self.create(*args)
173
181
  Configuration.gateway.transaction.create(*args)
174
182
  end
@@ -386,7 +394,7 @@ module Braintree
386
394
  class << self
387
395
  protected :new
388
396
  def _new(*args) # :nodoc:
389
- self.new *args
397
+ self.new(*args)
390
398
  end
391
399
  end
392
400
 
@@ -53,7 +53,7 @@ module Braintree
53
53
  end
54
54
 
55
55
  def credit(attributes)
56
- create(attributes.merge(:type => 'credit'))
56
+ create(attributes.merge(:type => "credit"))
57
57
  end
58
58
 
59
59
  def credit!(*args)
@@ -72,7 +72,7 @@ module Braintree
72
72
  options = if amount_or_options.is_a?(Hash)
73
73
  amount_or_options
74
74
  else
75
- { :amount => amount_or_options }
75
+ {:amount => amount_or_options}
76
76
  end
77
77
 
78
78
  Util.verify_keys(TransactionGateway._refund_signature, options)
@@ -97,7 +97,7 @@ module Braintree
97
97
  end
98
98
 
99
99
  def sale(attributes)
100
- create(attributes.merge(:type => 'sale'))
100
+ create(attributes.merge(:type => "sale"))
101
101
  end
102
102
 
103
103
  def sale!(*args)
@@ -139,6 +139,18 @@ module Braintree
139
139
  return_object_or_raise(:transaction) { submit_for_settlement(*args) }
140
140
  end
141
141
 
142
+ def adjust_authorization(transaction_id, amount)
143
+ raise ArgumentError, "transaction_id is invalid" unless transaction_id =~ /\A[0-9a-z]+\z/
144
+ Util.verify_keys(TransactionGateway._adjust_authorization_signature, {})
145
+ transaction_params = {:amount => amount}
146
+ response = @config.http.put("#{@config.base_merchant_path}/transactions/#{transaction_id}/adjust_authorization", :transaction => transaction_params)
147
+ _handle_transaction_response(response)
148
+ end
149
+
150
+ def adjust_authorization!(*args)
151
+ return_object_or_raise(:transaction) { adjust_authorization(*args) }
152
+ end
153
+
142
154
  def update_details(transaction_id, options = {})
143
155
  raise ArgumentError, "transaction_id is invalid" unless transaction_id =~ /\A[0-9a-z]+\z/
144
156
  Util.verify_keys(TransactionGateway._update_details_signature, options)
@@ -265,6 +277,12 @@ module Braintree
265
277
  ]
266
278
  end
267
279
 
280
+ def self._adjust_authorization_signature
281
+ [
282
+ :amount
283
+ ]
284
+ end
285
+
268
286
  def self._update_details_signature # :nodoc:
269
287
  [
270
288
  :amount,
@@ -276,7 +294,8 @@ module Braintree
276
294
  def self._refund_signature
277
295
  [
278
296
  :amount,
279
- :order_id
297
+ :merchant_account_id,
298
+ :order_id,
280
299
  ]
281
300
  end
282
301
 
@@ -29,7 +29,7 @@ module Braintree
29
29
  class << self
30
30
  protected :new
31
31
  def _new(*args) # :nodoc:
32
- self.new *args
32
+ self.new(*args)
33
33
  end
34
34
  end
35
35