braintree 2.104.0 → 4.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/braintree.gemspec +7 -4
- data/lib/braintree/account_updater_daily_report.rb +1 -1
- data/lib/braintree/address.rb +2 -23
- data/lib/braintree/apple_pay.rb +1 -1
- data/lib/braintree/apple_pay_card.rb +11 -1
- data/lib/braintree/apple_pay_options.rb +1 -1
- data/lib/braintree/authorization_adjustment.rb +1 -1
- data/lib/braintree/base_module.rb +6 -0
- data/lib/braintree/bin_data.rb +9 -2
- data/lib/braintree/client_token.rb +1 -1
- data/lib/braintree/configuration.rb +12 -12
- 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 -77
- data/lib/braintree/credit_card_gateway.rb +17 -36
- data/lib/braintree/credit_card_verification.rb +18 -5
- data/lib/braintree/credit_card_verification_search.rb +1 -1
- data/lib/braintree/customer.rb +9 -78
- data/lib/braintree/customer_gateway.rb +2 -23
- data/lib/braintree/customer_search.rb +1 -1
- data/lib/braintree/disbursement.rb +1 -1
- data/lib/braintree/{transaction/coinbase_details.rb → dispute/paypal_message.rb} +5 -6
- data/lib/braintree/dispute/{history_event.rb → status_history.rb} +3 -1
- data/lib/braintree/dispute.rb +32 -8
- data/lib/braintree/dispute_gateway.rb +4 -9
- data/lib/braintree/dispute_search.rb +6 -3
- data/lib/braintree/document_upload.rb +1 -1
- data/lib/braintree/enriched_customer_data.rb +21 -0
- data/lib/braintree/error_codes.rb +150 -171
- data/lib/braintree/exceptions.rb +5 -3
- data/lib/braintree/exchange_rate.rb +13 -0
- data/lib/braintree/exchange_rate_quote.rb +24 -0
- data/lib/braintree/exchange_rate_quote_gateway.rb +35 -0
- data/lib/braintree/exchange_rate_quote_input.rb +21 -0
- data/lib/braintree/exchange_rate_quote_request.rb +18 -0
- data/lib/braintree/exchange_rate_quote_response.rb +18 -0
- data/lib/braintree/gateway.rb +4 -14
- data/lib/braintree/{android_pay_card.rb → google_pay_card.rb} +11 -3
- data/lib/braintree/granted_payment_instrument_update.rb +1 -1
- data/lib/braintree/graphql_client.rb +7 -7
- data/lib/braintree/http.rb +4 -3
- data/lib/braintree/local_payment_completed.rb +2 -2
- data/lib/braintree/local_payment_expired.rb +21 -0
- data/lib/braintree/local_payment_funded.rb +22 -0
- 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 +3 -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 -14
- data/lib/braintree/payment_method_customer_data_updated_metadata.rb +24 -0
- data/lib/braintree/payment_method_gateway.rb +15 -17
- data/lib/braintree/payment_method_nonce.rb +7 -4
- data/lib/braintree/payment_method_nonce_details.rb +37 -0
- data/lib/braintree/payment_method_nonce_details_payer_info.rb +32 -0
- data/lib/braintree/payment_method_nonce_gateway.rb +1 -1
- data/lib/braintree/payment_method_parser.rb +1 -8
- data/lib/braintree/plan.rb +21 -1
- data/lib/braintree/plan_gateway.rb +100 -0
- data/lib/braintree/processor_response_types.rb +3 -3
- data/lib/braintree/resource_collection.rb +8 -3
- data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
- data/lib/braintree/risk_data/liability_shift.rb +22 -0
- data/lib/braintree/risk_data.rb +5 -1
- data/lib/braintree/samsung_pay_card.rb +1 -1
- data/lib/braintree/settlement_batch_summary.rb +2 -2
- data/lib/braintree/subscription.rb +11 -11
- data/lib/braintree/successful_result.rb +3 -2
- data/lib/braintree/test/credit_card.rb +1 -0
- data/lib/braintree/test/nonce.rb +4 -23
- data/lib/braintree/three_d_secure_info.rb +22 -12
- data/lib/braintree/transaction/disbursement_details.rb +1 -0
- data/lib/braintree/transaction/{android_pay_details.rb → google_pay_details.rb} +1 -1
- data/lib/braintree/transaction/installment/adjustment.rb +33 -0
- data/lib/braintree/transaction/installment.rb +28 -0
- data/lib/braintree/transaction/paypal_details.rb +3 -0
- data/lib/braintree/transaction/subscription_details.rb +2 -0
- data/lib/braintree/transaction.rb +65 -120
- data/lib/braintree/transaction_gateway.rb +39 -27
- data/lib/braintree/transaction_line_item.rb +1 -1
- data/lib/braintree/transaction_review.rb +18 -0
- data/lib/braintree/transaction_search.rb +5 -3
- 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 +21 -6
- data/lib/braintree/venmo_account.rb +1 -1
- data/lib/braintree/venmo_profile_data.rb +23 -0
- data/lib/braintree/version.rb +2 -2
- data/lib/braintree/visa_checkout_card.rb +2 -2
- data/lib/braintree/webhook_notification.rb +44 -30
- data/lib/braintree/webhook_notification_gateway.rb +5 -5
- data/lib/braintree/webhook_testing_gateway.rb +104 -43
- data/lib/braintree/xml/generator.rb +5 -4
- data/lib/braintree/xml/parser.rb +22 -35
- data/lib/braintree/xml/rexml.rb +4 -5
- data/lib/braintree.rb +28 -23
- data/spec/integration/braintree/add_on_spec.rb +1 -1
- data/spec/integration/braintree/address_spec.rb +30 -113
- 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 -31
- data/spec/integration/braintree/credit_card_spec.rb +219 -593
- 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 +484 -513
- data/spec/integration/braintree/dispute_search_spec.rb +35 -6
- data/spec/integration/braintree/dispute_spec.rb +6 -7
- data/spec/integration/braintree/error_codes_spec.rb +1 -1
- data/spec/integration/braintree/exchange_rate_quote_spec.rb +97 -0
- data/spec/integration/braintree/graphql_client_spec.rb +0 -2
- data/spec/integration/braintree/http_spec.rb +2 -2
- data/spec/integration/braintree/merchant_account_spec.rb +28 -29
- data/spec/integration/braintree/merchant_spec.rb +14 -14
- data/spec/integration/braintree/oauth_spec.rb +11 -11
- data/spec/integration/braintree/payment_method_nonce_spec.rb +29 -35
- data/spec/integration/braintree/payment_method_spec.rb +535 -270
- data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +17 -13
- data/spec/integration/braintree/paypal_account_spec.rb +28 -28
- data/spec/integration/braintree/plan_spec.rb +82 -0
- 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 +144 -149
- 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 +175 -70
- data/spec/integration/braintree/transaction_spec.rb +955 -894
- data/spec/integration/braintree/transaction_us_bank_account_spec.rb +32 -26
- 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 +16 -7
- data/spec/oauth_test_helper.rb +1 -1
- data/spec/script/httpsd.rb +6 -6
- data/spec/spec_helper.rb +8 -14
- data/spec/unit/braintree/address_spec.rb +1 -9
- data/spec/unit/braintree/apple_pay_card_spec.rb +7 -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 +13 -32
- data/spec/unit/braintree/credit_card_verification_search_spec.rb +1 -1
- data/spec/unit/braintree/credit_card_verification_spec.rb +8 -4
- data/spec/unit/braintree/customer_spec.rb +21 -22
- data/spec/unit/braintree/disbursement_spec.rb +7 -7
- data/spec/unit/braintree/dispute_search_spec.rb +3 -0
- data/spec/unit/braintree/dispute_spec.rb +75 -21
- data/spec/unit/braintree/enriched_customer_data_spec.rb +32 -0
- data/spec/unit/braintree/error_result_spec.rb +5 -5
- data/spec/unit/braintree/errors_spec.rb +8 -8
- data/spec/unit/braintree/exchange_rate_quote_input_spec.rb +42 -0
- data/spec/unit/braintree/exchange_rate_quote_request_spec.rb +82 -0
- data/spec/unit/braintree/exchange_rate_quote_response_spec.rb +52 -0
- data/spec/unit/braintree/exchange_rate_quote_spec.rb +42 -0
- data/spec/unit/braintree/exchange_rate_spec.rb +23 -0
- data/spec/unit/braintree/http_spec.rb +10 -8
- data/spec/unit/braintree/local_payment_completed_spec.rb +14 -0
- data/spec/unit/braintree/local_payment_expired_spec.rb +24 -0
- data/spec/unit/braintree/local_payment_funded_spec.rb +34 -0
- data/spec/unit/braintree/merchant_account_spec.rb +1 -1
- data/spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb +45 -0
- data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +31 -0
- data/spec/unit/braintree/payment_method_nonce_details_spec.rb +43 -0
- data/spec/unit/braintree/payment_method_nonce_spec.rb +40 -0
- 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 +30 -1
- data/spec/unit/braintree/risk_data/liability_shift.rb +26 -0
- data/spec/unit/braintree/risk_data_spec.rb +38 -8
- 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 +32 -14
- 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/installment_spec.rb +25 -0
- data/spec/unit/braintree/transaction/paypal_details_spec.rb +7 -1
- data/spec/unit/braintree/transaction_search_spec.rb +12 -12
- data/spec/unit/braintree/transaction_spec.rb +36 -54
- data/spec/unit/braintree/util_spec.rb +55 -21
- data/spec/unit/braintree/validation_error_collection_spec.rb +36 -36
- data/spec/unit/braintree/venmo_profile_data_spec.rb +32 -0
- data/spec/unit/braintree/webhook_notification_spec.rb +166 -57
- data/spec/unit/braintree/xml/parser_spec.rb +21 -16
- data/spec/unit/braintree/xml_spec.rb +31 -31
- metadata +62 -30
- data/lib/braintree/amex_express_checkout_card.rb +0 -40
- data/lib/braintree/coinbase_account.rb +0 -34
- data/lib/braintree/europe_bank_account.rb +0 -36
- data/lib/braintree/europe_bank_account_gateway.rb +0 -17
- data/lib/braintree/ideal_payment.rb +0 -61
- data/lib/braintree/ideal_payment_gateway.rb +0 -19
- data/lib/braintree/masterpass_card.rb +0 -83
- data/lib/braintree/settlement_batch.rb +0 -0
- data/lib/braintree/transaction/amex_express_checkout_details.rb +0 -21
- data/lib/braintree/transaction/ideal_payment_details.rb +0 -19
- data/lib/braintree/transaction/masterpass_card_details.rb +0 -49
- data/lib/braintree/transparent_redirect.rb +0 -40
- data/lib/braintree/transparent_redirect_gateway.rb +0 -105
- data/spec/hacks/tcp_socket.rb +0 -18
- data/spec/integration/braintree/coinbase_spec.rb +0 -34
- data/spec/integration/braintree/masterpass_card_spec.rb +0 -97
- data/spec/integration/braintree/transparent_redirect_spec.rb +0 -268
- data/spec/unit/braintree/transparent_redirect_spec.rb +0 -223
@@ -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
|
@@ -90,14 +90,11 @@ module Braintree
|
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
|
+
attr_reader :acquirer_reference_number
|
94
|
+
attr_reader :ach_return_code
|
93
95
|
attr_reader :add_ons
|
94
96
|
attr_reader :additional_processor_response # The raw response from the processor.
|
95
|
-
# NEXT_MAJOR_VERSION Remove this class.
|
96
|
-
# DEPRECATED The American Express Checkout payment method is deprecated.
|
97
|
-
attr_reader :amex_express_checkout_details
|
98
97
|
attr_reader :amount
|
99
|
-
# NEXT_MAJOR_VERSION rename Android Pay to Google Pay
|
100
|
-
attr_reader :android_pay_details
|
101
98
|
attr_reader :apple_pay_details
|
102
99
|
attr_reader :authorization_adjustments
|
103
100
|
attr_reader :authorization_expires_at
|
@@ -107,7 +104,6 @@ module Braintree
|
|
107
104
|
attr_reader :avs_street_address_response_code
|
108
105
|
attr_reader :billing_details
|
109
106
|
attr_reader :channel
|
110
|
-
attr_reader :coinbase_details
|
111
107
|
attr_reader :created_at
|
112
108
|
attr_reader :credit_card_details
|
113
109
|
attr_reader :currency_iso_code
|
@@ -123,15 +119,12 @@ module Braintree
|
|
123
119
|
attr_reader :facilitated_details
|
124
120
|
attr_reader :facilitator_details
|
125
121
|
attr_reader :gateway_rejection_reason
|
122
|
+
attr_reader :google_pay_details
|
126
123
|
attr_reader :graphql_id
|
127
124
|
attr_reader :id
|
128
|
-
|
129
|
-
|
130
|
-
attr_reader :ideal_payment_details
|
125
|
+
attr_reader :installment_count
|
126
|
+
attr_reader :installments
|
131
127
|
attr_reader :local_payment_details
|
132
|
-
# NEXT_MAJOR_VERSION Remove this class.
|
133
|
-
# DEPRECATED The Masterpass Card payment method is deprecated.
|
134
|
-
attr_reader :masterpass_card_details
|
135
128
|
attr_reader :merchant_account_id
|
136
129
|
attr_reader :network_response_code # Response code from the card network
|
137
130
|
attr_reader :network_response_text # Response text from the card network
|
@@ -153,8 +146,12 @@ module Braintree
|
|
153
146
|
attr_reader :recurring
|
154
147
|
attr_reader :refund_ids
|
155
148
|
attr_reader :refunded_transaction_id
|
149
|
+
attr_reader :refunded_installments
|
150
|
+
attr_reader :retried
|
151
|
+
attr_reader :retrieval_reference_number
|
156
152
|
attr_reader :risk_data
|
157
153
|
attr_reader :samsung_pay_card_details
|
154
|
+
attr_reader :sca_exemption_requested
|
158
155
|
attr_reader :service_fee_amount
|
159
156
|
attr_reader :settlement_batch_id
|
160
157
|
attr_reader :shipping_amount
|
@@ -173,7 +170,15 @@ module Braintree
|
|
173
170
|
attr_reader :venmo_account_details
|
174
171
|
attr_reader :visa_checkout_card_details
|
175
172
|
attr_reader :voice_referral_number
|
176
|
-
attr_reader :
|
173
|
+
attr_reader :ach_return_responses
|
174
|
+
|
175
|
+
def self.adjust_authorization(*args)
|
176
|
+
Configuration.gateway.transaction.adjust_authorization(*args)
|
177
|
+
end
|
178
|
+
|
179
|
+
def self.adjust_authorization!(*args)
|
180
|
+
Configuration.gateway.transaction.adjust_authorization!(*args)
|
181
|
+
end
|
177
182
|
|
178
183
|
def self.create(*args)
|
179
184
|
Configuration.gateway.transaction.create(*args)
|
@@ -199,18 +204,6 @@ module Braintree
|
|
199
204
|
Configuration.gateway.transaction.clone_transaction!(*args)
|
200
205
|
end
|
201
206
|
|
202
|
-
# Deprecated. Use Braintree::TransparentRedirect.confirm
|
203
|
-
def self.create_from_transparent_redirect(*args)
|
204
|
-
warn "[DEPRECATED] Transaction.create_from_transparent_redirect is deprecated. Please use TransparentRedirect.confirm"
|
205
|
-
Configuration.gateway.transaction.create_from_transparent_redirect(*args)
|
206
|
-
end
|
207
|
-
|
208
|
-
# Deprecated. Use Braintree::TransparentRedirect.url
|
209
|
-
def self.create_transaction_url
|
210
|
-
warn "[DEPRECATED] Transaction.create_transaction_url is deprecated. Please use TransparentRedirect.url"
|
211
|
-
Configuration.gateway.transaction.create_transaction_url
|
212
|
-
end
|
213
|
-
|
214
207
|
def self.credit(*args)
|
215
208
|
Configuration.gateway.transaction.credit(*args)
|
216
209
|
end
|
@@ -298,41 +291,42 @@ module Braintree
|
|
298
291
|
def initialize(gateway, attributes) # :nodoc:
|
299
292
|
@gateway = gateway
|
300
293
|
set_instance_variables_from_hash(attributes)
|
294
|
+
|
301
295
|
@amount = Util.to_big_decimal(amount)
|
296
|
+
@apple_pay_details = ApplePayDetails.new(@apple_pay)
|
297
|
+
@billing_details = AddressDetails.new(@billing)
|
302
298
|
@credit_card_details = CreditCardDetails.new(@credit_card)
|
303
|
-
@
|
304
|
-
@subscription_details = SubscriptionDetails.new(@subscription)
|
299
|
+
@custom_fields = attributes[:custom_fields].is_a?(Hash) ? attributes[:custom_fields] : {}
|
305
300
|
@customer_details = CustomerDetails.new(@customer)
|
306
|
-
@billing_details = AddressDetails.new(@billing)
|
307
|
-
@disbursement_details = DisbursementDetails.new(@disbursement_details)
|
308
|
-
@shipping_details = AddressDetails.new(@shipping)
|
309
|
-
@status_history = attributes[:status_history] ? attributes[:status_history].map { |s| StatusDetails.new(s) } : []
|
310
|
-
@tax_amount = Util.to_big_decimal(tax_amount)
|
311
301
|
@descriptor = Descriptor.new(@descriptor)
|
302
|
+
@disbursement_details = DisbursementDetails.new(@disbursement_details)
|
303
|
+
@google_pay_details = GooglePayDetails.new(@google_pay_card)
|
312
304
|
@local_payment_details = LocalPaymentDetails.new(@local_payment)
|
305
|
+
@payment_instrument_type = attributes[:payment_instrument_type]
|
313
306
|
@paypal_details = PayPalDetails.new(@paypal)
|
314
307
|
@paypal_here_details = PayPalHereDetails.new(@paypal_here)
|
315
|
-
@
|
316
|
-
|
317
|
-
@
|
318
|
-
@
|
308
|
+
@samsung_pay_card_details = SamsungPayCardDetails.new(attributes[:samsung_pay_card])
|
309
|
+
@sca_exemption_requested = attributes[:sca_exemption_requested]
|
310
|
+
@service_fee_amount = Util.to_big_decimal(service_fee_amount)
|
311
|
+
@shipping_details = AddressDetails.new(@shipping)
|
312
|
+
@status_history = attributes[:status_history] ? attributes[:status_history].map { |s| StatusDetails.new(s) } : []
|
313
|
+
@subscription_details = SubscriptionDetails.new(@subscription)
|
314
|
+
@tax_amount = Util.to_big_decimal(tax_amount)
|
319
315
|
@venmo_account_details = VenmoAccountDetails.new(@venmo_account)
|
320
|
-
@
|
321
|
-
|
322
|
-
@custom_fields = attributes[:custom_fields].is_a?(Hash) ? attributes[:custom_fields] : {}
|
323
|
-
add_ons.map! { |attrs| AddOn._new(attrs) } if add_ons
|
324
|
-
discounts.map! { |attrs| Discount._new(attrs) } if discounts
|
325
|
-
@payment_instrument_type = attributes[:payment_instrument_type]
|
326
|
-
@risk_data = RiskData.new(attributes[:risk_data]) if attributes[:risk_data]
|
316
|
+
@visa_checkout_card_details = VisaCheckoutCardDetails.new(attributes[:visa_checkout_card])
|
317
|
+
|
327
318
|
@facilitated_details = FacilitatedDetails.new(attributes[:facilitated_details]) if attributes[:facilitated_details]
|
328
319
|
@facilitator_details = FacilitatorDetails.new(attributes[:facilitator_details]) if attributes[:facilitator_details]
|
320
|
+
@risk_data = RiskData.new(attributes[:risk_data]) if attributes[:risk_data]
|
329
321
|
@three_d_secure_info = ThreeDSecureInfo.new(attributes[:three_d_secure_info]) if attributes[:three_d_secure_info]
|
330
322
|
@us_bank_account_details = UsBankAccountDetails.new(attributes[:us_bank_account]) if attributes[:us_bank_account]
|
331
|
-
|
332
|
-
|
333
|
-
@masterpass_card_details = MasterpassCardDetails.new(attributes[:masterpass_card])
|
334
|
-
@samsung_pay_card_details = SamsungPayCardDetails.new(attributes[:samsung_pay_card])
|
323
|
+
|
324
|
+
add_ons.map! { |attrs| AddOn._new(attrs) } if add_ons
|
335
325
|
authorization_adjustments.map! { |attrs| AuthorizationAdjustment._new(attrs) } if authorization_adjustments
|
326
|
+
discounts.map! { |attrs| Discount._new(attrs) } if discounts
|
327
|
+
disputes.map! { |attrs| Dispute._new(attrs) } if disputes
|
328
|
+
installments.map! { |attrs| Installment.new(attrs) } if installments
|
329
|
+
refunded_installments.map! { |attrs| Installment.new(attrs) } if refunded_installments
|
336
330
|
end
|
337
331
|
|
338
332
|
def inspect # :nodoc:
|
@@ -352,18 +346,6 @@ module Braintree
|
|
352
346
|
@gateway.transaction_line_item.find_all(id)
|
353
347
|
end
|
354
348
|
|
355
|
-
# Deprecated. Use Braintree::Transaction.refund
|
356
|
-
def refund(amount = nil)
|
357
|
-
warn "[DEPRECATED] refund as an instance method is deprecated. Please use Transaction.refund"
|
358
|
-
result = @gateway.transaction.refund(id, amount)
|
359
|
-
|
360
|
-
if result.success?
|
361
|
-
SuccessfulResult.new(:new_transaction => result.transaction)
|
362
|
-
else
|
363
|
-
result
|
364
|
-
end
|
365
|
-
end
|
366
|
-
|
367
349
|
# Returns true if the transaction has been refunded. False otherwise.
|
368
350
|
def refunded?
|
369
351
|
!@refund_id.nil?
|
@@ -374,27 +356,6 @@ module Braintree
|
|
374
356
|
@disbursement_details.valid?
|
375
357
|
end
|
376
358
|
|
377
|
-
def refund_id
|
378
|
-
warn "[DEPRECATED] Transaction.refund_id is deprecated. Please use Transaction.refund_ids"
|
379
|
-
@refund_id
|
380
|
-
end
|
381
|
-
|
382
|
-
# Deprecated. Use Braintree::Transaction.submit_for_settlement
|
383
|
-
def submit_for_settlement(amount = nil)
|
384
|
-
warn "[DEPRECATED] submit_for_settlement as an instance method is deprecated. Please use Transaction.submit_for_settlement"
|
385
|
-
result = @gateway.transaction.submit_for_settlement(id, amount)
|
386
|
-
if result.success?
|
387
|
-
copy_instance_variables_from_object result.transaction
|
388
|
-
end
|
389
|
-
result
|
390
|
-
end
|
391
|
-
|
392
|
-
# Deprecated. Use Braintree::Transaction.submit_for_settlement!
|
393
|
-
def submit_for_settlement!(amount = nil)
|
394
|
-
warn "[DEPRECATED] submit_for_settlement! as an instance method is deprecated. Please use Transaction.submit_for_settlement!"
|
395
|
-
return_object_or_raise(:transaction) { submit_for_settlement(amount) }
|
396
|
-
end
|
397
|
-
|
398
359
|
# If this transaction was stored in the vault, or created from vault records,
|
399
360
|
# vault_billing_address will return the associated Braintree::Address. Because the
|
400
361
|
# vault billing address can be updated after the transaction was created, the attributes
|
@@ -431,22 +392,6 @@ module Braintree
|
|
431
392
|
@gateway.address.find(customer_details.id, shipping_details.id)
|
432
393
|
end
|
433
394
|
|
434
|
-
# Deprecated. Use Braintree::Transaction.void
|
435
|
-
def void
|
436
|
-
warn "[DEPRECATED] void as an instance method is deprecated. Please use Transaction.void"
|
437
|
-
result = @gateway.transaction.void(id)
|
438
|
-
if result.success?
|
439
|
-
copy_instance_variables_from_object result.transaction
|
440
|
-
end
|
441
|
-
result
|
442
|
-
end
|
443
|
-
|
444
|
-
# Deprecated. Use Braintree::Transaction.void!
|
445
|
-
def void!
|
446
|
-
warn "[DEPRECATED] void! as an instance method is deprecated. Please use Transaction.void!"
|
447
|
-
return_object_or_raise(:transaction) { void }
|
448
|
-
end
|
449
|
-
|
450
395
|
def processed_with_network_token?
|
451
396
|
@processed_with_network_token
|
452
397
|
end
|
@@ -454,7 +399,7 @@ module Braintree
|
|
454
399
|
class << self
|
455
400
|
protected :new
|
456
401
|
def _new(*args) # :nodoc:
|
457
|
-
self.new
|
402
|
+
self.new(*args)
|
458
403
|
end
|
459
404
|
end
|
460
405
|
|
@@ -52,19 +52,8 @@ 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
|
-
create(attributes.merge(:type =>
|
56
|
+
create(attributes.merge(:type => "credit"))
|
68
57
|
end
|
69
58
|
|
70
59
|
def credit!(*args)
|
@@ -72,7 +61,7 @@ module Braintree
|
|
72
61
|
end
|
73
62
|
|
74
63
|
def find(id)
|
75
|
-
raise ArgumentError if id.nil? || id.strip.to_s == ""
|
64
|
+
raise ArgumentError, "id can not be empty" if id.nil? || id.strip.to_s == ""
|
76
65
|
response = @config.http.get("#{@config.base_merchant_path}/transactions/#{id}")
|
77
66
|
Transaction._new(@gateway, response[:transaction])
|
78
67
|
rescue NotFoundError
|
@@ -83,7 +72,7 @@ module Braintree
|
|
83
72
|
options = if amount_or_options.is_a?(Hash)
|
84
73
|
amount_or_options
|
85
74
|
else
|
86
|
-
{
|
75
|
+
{:amount => amount_or_options}
|
87
76
|
end
|
88
77
|
|
89
78
|
Util.verify_keys(TransactionGateway._refund_signature, options)
|
@@ -108,7 +97,7 @@ module Braintree
|
|
108
97
|
end
|
109
98
|
|
110
99
|
def sale(attributes)
|
111
|
-
create(attributes.merge(:type =>
|
100
|
+
create(attributes.merge(:type => "sale"))
|
112
101
|
end
|
113
102
|
|
114
103
|
def sale!(*args)
|
@@ -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
|
116
|
+
raise UnexpectedError, "expected :search_results"
|
128
117
|
end
|
129
118
|
end
|
130
119
|
|
@@ -150,6 +139,18 @@ module Braintree
|
|
150
139
|
return_object_or_raise(:transaction) { submit_for_settlement(*args) }
|
151
140
|
end
|
152
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
|
+
|
153
154
|
def update_details(transaction_id, options = {})
|
154
155
|
raise ArgumentError, "transaction_id is invalid" unless transaction_id =~ /\A[0-9a-z]+\z/
|
155
156
|
Util.verify_keys(TransactionGateway._update_details_signature, options)
|
@@ -184,16 +185,17 @@ module Braintree
|
|
184
185
|
|
185
186
|
def self._create_signature # :nodoc:
|
186
187
|
[
|
187
|
-
:amount, :
|
188
|
-
:
|
189
|
-
:
|
190
|
-
:
|
191
|
-
:
|
192
|
-
:
|
193
|
-
:
|
188
|
+
:amount, :billing_address_id, :channel, :customer_id, :device_data, :discount_amount,
|
189
|
+
:merchant_account_id, :order_id, :payment_method_nonce, :payment_method_token,
|
190
|
+
:product_sku, :purchase_order_number, :service_fee_amount, :shared_billing_address_id,
|
191
|
+
:shared_customer_id, :shared_payment_method_nonce, :shared_payment_method_token,
|
192
|
+
:shared_shipping_address_id, :shipping_address_id, :shipping_amount,
|
193
|
+
:ships_from_postal_code, :tax_amount, :tax_exempt, :three_d_secure_authentication_id,
|
194
|
+
:three_d_secure_token, :transaction_source, :type, :venmo_sdk_payment_method_code,
|
195
|
+
:sca_exemption, :currency_iso_code, :exchange_rate_quote_id,
|
194
196
|
{: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]},
|
195
197
|
{:risk_data => [:customer_browser, :customer_device_id, :customer_ip, :customer_location_zip, :customer_tenure]},
|
196
|
-
{:credit_card => [:token, :cardholder_name, :cvv, :expiration_date, :expiration_month, :expiration_year, :number]},
|
198
|
+
{:credit_card => [:token, :cardholder_name, :cvv, :expiration_date, :expiration_month, :expiration_year, :number, {:payment_reader_card_details => [:encrypted_card_data, :key_serial_number]}]},
|
197
199
|
{:customer => [:id, :company, :email, :fax, :first_name, :last_name, :phone, :website]},
|
198
200
|
{
|
199
201
|
:billing => AddressGateway._shared_signature
|
@@ -256,8 +258,8 @@ module Braintree
|
|
256
258
|
]},
|
257
259
|
]},
|
258
260
|
{:apple_pay_card => [:number, :cardholder_name, :cryptogram, :expiration_month, :expiration_year, :eci_indicator]},
|
259
|
-
|
260
|
-
{:
|
261
|
+
{:google_pay_card => [:number, :cryptogram, :google_transaction_id, :expiration_month, :expiration_year, :source_card_type, :source_card_last_four, :eci_indicator]},
|
262
|
+
{:installments => [:count]},
|
261
263
|
]
|
262
264
|
end
|
263
265
|
|
@@ -275,6 +277,12 @@ module Braintree
|
|
275
277
|
]
|
276
278
|
end
|
277
279
|
|
280
|
+
def self._adjust_authorization_signature
|
281
|
+
[
|
282
|
+
:amount
|
283
|
+
]
|
284
|
+
end
|
285
|
+
|
278
286
|
def self._update_details_signature # :nodoc:
|
279
287
|
[
|
280
288
|
:amount,
|
@@ -286,11 +294,15 @@ module Braintree
|
|
286
294
|
def self._refund_signature
|
287
295
|
[
|
288
296
|
:amount,
|
289
|
-
:
|
297
|
+
:merchant_account_id,
|
298
|
+
:order_id,
|
290
299
|
]
|
291
300
|
end
|
292
301
|
|
293
302
|
def _do_create(path, params=nil) # :nodoc:
|
303
|
+
if !params.nil?
|
304
|
+
params = Util.replace_key(params, :google_pay_card, :android_pay_card)
|
305
|
+
end
|
294
306
|
response = @config.http.post("#{@config.base_merchant_path}#{path}", params)
|
295
307
|
_handle_transaction_response(response)
|
296
308
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Braintree
|
2
|
+
class TransactionReview
|
3
|
+
include BaseModule
|
4
|
+
|
5
|
+
attr_reader :transaction_id, :decision, :reviewer_email, :reviewer_note, :reviewer_time
|
6
|
+
|
7
|
+
def initialize(attributes)
|
8
|
+
set_instance_variables_from_hash(attributes)
|
9
|
+
end
|
10
|
+
|
11
|
+
class << self
|
12
|
+
protected :new
|
13
|
+
def _new(*args) # :nodoc:
|
14
|
+
self.new(*args)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
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,
|
@@ -38,7 +37,8 @@ module Braintree
|
|
38
37
|
:shipping_locality,
|
39
38
|
:shipping_postal_code,
|
40
39
|
:shipping_region,
|
41
|
-
:shipping_street_address
|
40
|
+
:shipping_street_address,
|
41
|
+
:store_id,
|
42
42
|
)
|
43
43
|
|
44
44
|
equality_fields :credit_card_expiration_date
|
@@ -60,12 +60,14 @@ module Braintree
|
|
60
60
|
multiple_value_field :status, :allows => Transaction::Status::All
|
61
61
|
multiple_value_field :source
|
62
62
|
multiple_value_field :type, :allows => Transaction::Type::All
|
63
|
+
multiple_value_field :store_ids
|
64
|
+
multiple_value_field :reason_code
|
63
65
|
|
64
66
|
key_value_fields :refund
|
65
67
|
|
66
68
|
range_fields :amount, :created_at, :authorization_expired_at, :authorized_at,
|
67
69
|
:failed_at, :gateway_rejected_at, :processor_declined_at,
|
68
70
|
:settled_at, :submitted_for_settlement_at, :voided_at,
|
69
|
-
:disbursement_date, :dispute_date
|
71
|
+
:disbursement_date, :dispute_date, :ach_return_responses_created_at
|
70
72
|
end
|
71
73
|
end
|
@@ -35,7 +35,7 @@ module Braintree
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def self._new(*args) # :nodoc:
|
38
|
-
self.new
|
38
|
+
self.new(*args)
|
39
39
|
end
|
40
40
|
|
41
41
|
def self.find(*args)
|
@@ -45,8 +45,8 @@ module Braintree
|
|
45
45
|
def self.sale(token, transaction_attributes)
|
46
46
|
Configuration.gateway.transaction.sale(transaction_attributes.merge(
|
47
47
|
:payment_method_token => token,
|
48
|
-
:options => {
|
49
|
-
)
|
48
|
+
:options => {:submit_for_settlement => true},
|
49
|
+
),
|
50
50
|
)
|
51
51
|
end
|
52
52
|
|
@@ -18,7 +18,7 @@ module Braintree
|
|
18
18
|
ErrorResult.new(@gateway, response[:api_error_response])
|
19
19
|
else
|
20
20
|
SuccessfulResult.new(
|
21
|
-
:us_bank_account_verification => UsBankAccountVerification._new(response[:us_bank_account_verification])
|
21
|
+
:us_bank_account_verification => UsBankAccountVerification._new(response[:us_bank_account_verification]),
|
22
22
|
)
|
23
23
|
end
|
24
24
|
rescue NotFoundError
|
data/lib/braintree/util.rb
CHANGED
@@ -14,13 +14,13 @@ module Braintree
|
|
14
14
|
else
|
15
15
|
url_encode(full_key) + "=" + url_encode(value)
|
16
16
|
end
|
17
|
-
end.sort *
|
17
|
+
end.sort * "&"
|
18
18
|
end
|
19
19
|
|
20
20
|
def self.parse_query_string(qs)
|
21
|
-
qs.split(
|
22
|
-
pair = couplet.split(
|
23
|
-
result[CGI.unescape(pair[0]).to_sym] = CGI.unescape(pair[1] ||
|
21
|
+
qs.split("&").inject({}) do |result, couplet|
|
22
|
+
pair = couplet.split("=")
|
23
|
+
result[CGI.unescape(pair[0]).to_sym] = CGI.unescape(pair[1] || "")
|
24
24
|
result
|
25
25
|
end
|
26
26
|
end
|
@@ -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
|
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
|
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)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Braintree
|
2
|
+
class VenmoProfileData
|
3
|
+
include BaseModule
|
4
|
+
|
5
|
+
attr_reader :username
|
6
|
+
attr_reader :first_name
|
7
|
+
attr_reader :last_name
|
8
|
+
attr_reader :phone_number
|
9
|
+
attr_reader :email
|
10
|
+
|
11
|
+
def initialize(attributes) # :nodoc:
|
12
|
+
set_instance_variables_from_hash(attributes)
|
13
|
+
end
|
14
|
+
|
15
|
+
class << self
|
16
|
+
protected :new
|
17
|
+
end
|
18
|
+
|
19
|
+
def self._new(*args) # :nodoc:
|
20
|
+
self.new(*args)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|