braintree 3.3.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/braintree.gemspec +1 -1
- data/lib/braintree.rb +2 -1
- data/lib/braintree/account_updater_daily_report.rb +1 -1
- data/lib/braintree/address.rb +1 -1
- data/lib/braintree/apple_pay.rb +1 -1
- data/lib/braintree/apple_pay_card.rb +1 -1
- data/lib/braintree/apple_pay_options.rb +1 -1
- data/lib/braintree/authorization_adjustment.rb +1 -1
- data/lib/braintree/client_token.rb +1 -1
- data/lib/braintree/configuration.rb +11 -11
- data/lib/braintree/connected_merchant_paypal_status_changed.rb +1 -1
- data/lib/braintree/connected_merchant_status_transitioned.rb +1 -1
- data/lib/braintree/credit_card.rb +2 -2
- data/lib/braintree/credit_card_gateway.rb +3 -3
- data/lib/braintree/credit_card_verification.rb +5 -5
- data/lib/braintree/credit_card_verification_search.rb +1 -1
- data/lib/braintree/customer.rb +2 -2
- data/lib/braintree/customer_search.rb +1 -1
- data/lib/braintree/disbursement.rb +1 -1
- data/lib/braintree/dispute.rb +1 -1
- data/lib/braintree/dispute_gateway.rb +2 -2
- data/lib/braintree/dispute_search.rb +2 -2
- data/lib/braintree/document_upload.rb +1 -1
- data/lib/braintree/error_codes.rb +7 -0
- data/lib/braintree/google_pay_card.rb +1 -1
- data/lib/braintree/granted_payment_instrument_update.rb +1 -1
- data/lib/braintree/graphql_client.rb +7 -7
- data/lib/braintree/http.rb +3 -3
- data/lib/braintree/local_payment_completed.rb +1 -1
- data/lib/braintree/local_payment_reversed.rb +19 -0
- data/lib/braintree/merchant.rb +1 -1
- data/lib/braintree/merchant_account.rb +1 -1
- data/lib/braintree/merchant_account_gateway.rb +1 -1
- data/lib/braintree/merchant_gateway.rb +1 -1
- data/lib/braintree/modification.rb +1 -1
- data/lib/braintree/oauth_credentials.rb +1 -1
- data/lib/braintree/oauth_gateway.rb +5 -5
- data/lib/braintree/payment_instrument_type.rb +10 -10
- data/lib/braintree/payment_method_gateway.rb +3 -3
- data/lib/braintree/payment_method_nonce_gateway.rb +1 -1
- data/lib/braintree/plan.rb +1 -1
- data/lib/braintree/processor_response_types.rb +3 -3
- data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
- data/lib/braintree/samsung_pay_card.rb +1 -1
- data/lib/braintree/settlement_batch_summary.rb +2 -2
- data/lib/braintree/subscription.rb +6 -6
- data/lib/braintree/transaction.rb +32 -24
- data/lib/braintree/transaction_gateway.rb +23 -4
- data/lib/braintree/transaction_line_item.rb +1 -1
- data/lib/braintree/transaction_search.rb +3 -1
- data/lib/braintree/unknown_payment_method.rb +1 -1
- data/lib/braintree/us_bank_account.rb +3 -3
- data/lib/braintree/us_bank_account_verification.rb +1 -1
- data/lib/braintree/us_bank_account_verification_gateway.rb +1 -1
- data/lib/braintree/util.rb +4 -4
- data/lib/braintree/venmo_account.rb +1 -1
- data/lib/braintree/version.rb +1 -1
- data/lib/braintree/visa_checkout_card.rb +2 -2
- data/lib/braintree/webhook_notification.rb +28 -19
- data/lib/braintree/webhook_notification_gateway.rb +5 -5
- data/lib/braintree/webhook_testing_gateway.rb +10 -0
- data/lib/braintree/xml/generator.rb +5 -4
- data/lib/braintree/xml/libxml.rb +1 -1
- data/lib/braintree/xml/parser.rb +10 -10
- data/spec/integration/braintree/add_on_spec.rb +1 -1
- data/spec/integration/braintree/address_spec.rb +24 -24
- data/spec/integration/braintree/advanced_search_spec.rb +45 -45
- data/spec/integration/braintree/apple_pay_spec.rb +3 -3
- data/spec/integration/braintree/braintree_gateway_spec.rb +2 -1
- data/spec/integration/braintree/client_api/client_token_spec.rb +14 -14
- data/spec/integration/braintree/client_api/spec_helper.rb +5 -5
- data/spec/integration/braintree/credit_card_spec.rb +119 -119
- data/spec/integration/braintree/credit_card_verification_search_spec.rb +2 -2
- data/spec/integration/braintree/credit_card_verification_spec.rb +1 -1
- data/spec/integration/braintree/customer_search_spec.rb +8 -8
- data/spec/integration/braintree/customer_spec.rb +165 -165
- data/spec/integration/braintree/dispute_search_spec.rb +3 -3
- data/spec/integration/braintree/dispute_spec.rb +6 -6
- data/spec/integration/braintree/error_codes_spec.rb +1 -1
- data/spec/integration/braintree/http_spec.rb +2 -2
- data/spec/integration/braintree/merchant_account_spec.rb +25 -26
- data/spec/integration/braintree/merchant_spec.rb +12 -12
- data/spec/integration/braintree/oauth_spec.rb +11 -11
- data/spec/integration/braintree/payment_method_nonce_spec.rb +12 -12
- data/spec/integration/braintree/payment_method_spec.rb +165 -165
- data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +9 -9
- data/spec/integration/braintree/paypal_account_spec.rb +28 -28
- data/spec/integration/braintree/samsung_pay_card_spec.rb +9 -9
- data/spec/integration/braintree/settlement_batch_summary_spec.rb +8 -8
- data/spec/integration/braintree/subscription_spec.rb +133 -133
- data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
- data/spec/integration/braintree/test_transaction_spec.rb +10 -10
- data/spec/integration/braintree/transaction_search_spec.rb +93 -67
- data/spec/integration/braintree/transaction_spec.rb +498 -344
- data/spec/integration/braintree/transaction_us_bank_account_spec.rb +20 -20
- data/spec/integration/braintree/us_bank_account_spec.rb +6 -6
- data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +7 -7
- data/spec/integration/braintree/us_bank_account_verification_spec.rb +8 -8
- data/spec/integration/braintree/visa_checkout_card_spec.rb +5 -5
- data/spec/integration/spec_helper.rb +2 -2
- data/spec/oauth_test_helper.rb +1 -1
- data/spec/script/httpsd.rb +6 -6
- data/spec/spec_helper.rb +4 -3
- data/spec/unit/braintree/address_spec.rb +1 -1
- data/spec/unit/braintree/apple_pay_card_spec.rb +1 -1
- data/spec/unit/braintree/client_token_spec.rb +2 -2
- data/spec/unit/braintree/configuration_spec.rb +42 -42
- data/spec/unit/braintree/credit_card_spec.rb +7 -7
- data/spec/unit/braintree/credit_card_verification_search_spec.rb +1 -1
- data/spec/unit/braintree/credit_card_verification_spec.rb +2 -2
- data/spec/unit/braintree/customer_spec.rb +3 -3
- data/spec/unit/braintree/disbursement_spec.rb +7 -7
- data/spec/unit/braintree/dispute_spec.rb +8 -8
- data/spec/unit/braintree/error_result_spec.rb +5 -5
- data/spec/unit/braintree/errors_spec.rb +8 -8
- data/spec/unit/braintree/http_spec.rb +5 -5
- data/spec/unit/braintree/merchant_account_spec.rb +1 -1
- data/spec/unit/braintree/payment_method_spec.rb +1 -1
- data/spec/unit/braintree/paypal_account_spec.rb +2 -2
- data/spec/unit/braintree/resource_collection_spec.rb +9 -9
- data/spec/unit/braintree/subscription_search_spec.rb +1 -1
- data/spec/unit/braintree/successful_result_spec.rb +1 -1
- data/spec/unit/braintree/three_d_secure_info_spec.rb +1 -1
- data/spec/unit/braintree/transaction/credit_card_details_spec.rb +3 -3
- data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
- data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
- data/spec/unit/braintree/transaction/paypal_details_spec.rb +1 -1
- data/spec/unit/braintree/transaction_search_spec.rb +12 -12
- data/spec/unit/braintree/transaction_spec.rb +25 -17
- data/spec/unit/braintree/util_spec.rb +18 -18
- data/spec/unit/braintree/validation_error_collection_spec.rb +36 -36
- data/spec/unit/braintree/webhook_notification_spec.rb +72 -56
- data/spec/unit/braintree/xml_spec.rb +31 -31
- metadata +3 -3
- data/lib/braintree/settlement_batch.rb +0 -0
data/lib/braintree/http.rb
CHANGED
|
@@ -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,
|
|
190
|
+
formatted_xml = formatted_xml.gsub(/<cvv>.+?<\/cvv>/m, "<cvv>***</cvv>")
|
|
191
191
|
formatted_xml
|
|
192
192
|
end
|
|
193
193
|
|
|
@@ -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
|
data/lib/braintree/merchant.rb
CHANGED
|
@@ -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])
|
|
@@ -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 =
|
|
4
|
-
CreditCard =
|
|
5
|
-
ApplePayCard =
|
|
6
|
-
GooglePayCard =
|
|
7
|
-
VenmoAccount =
|
|
8
|
-
UsBankAccount =
|
|
9
|
-
VisaCheckoutCard =
|
|
10
|
-
SamsungPayCard =
|
|
11
|
-
LocalPayment =
|
|
12
|
-
PayPalHere =
|
|
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 = {
|
|
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 = {
|
|
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)
|
data/lib/braintree/plan.rb
CHANGED
|
@@ -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 = {
|
|
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 =
|
|
15
|
-
Canceled =
|
|
16
|
-
Expired =
|
|
17
|
-
PastDue =
|
|
18
|
-
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
|
|
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 =
|
|
8
|
-
Token =
|
|
9
|
-
Unrecognized =
|
|
7
|
+
FullInformation = "full_information"
|
|
8
|
+
Token = "token"
|
|
9
|
+
Unrecognized = "unrecognized"
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
module EscrowStatus
|
|
13
|
-
HoldPending =
|
|
14
|
-
Held =
|
|
15
|
-
ReleasePending =
|
|
16
|
-
Released =
|
|
17
|
-
Refunded =
|
|
18
|
-
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 =
|
|
36
|
-
Authorizing =
|
|
37
|
-
Authorized =
|
|
38
|
-
GatewayRejected =
|
|
39
|
-
Failed =
|
|
40
|
-
ProcessorDeclined =
|
|
41
|
-
Settled =
|
|
42
|
-
SettlementConfirmed =
|
|
43
|
-
SettlementDeclined =
|
|
44
|
-
SettlementPending =
|
|
45
|
-
Settling =
|
|
46
|
-
SubmittedForSettlement =
|
|
47
|
-
Voided =
|
|
48
|
-
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
|
|
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 =>
|
|
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
|
-
{
|
|
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 =>
|
|
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
|
-
:
|
|
297
|
+
:merchant_account_id,
|
|
298
|
+
:order_id,
|
|
280
299
|
]
|
|
281
300
|
end
|
|
282
301
|
|