braintree 2.98.0 → 4.23.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/LICENSE +1 -1
- data/braintree.gemspec +7 -4
- data/lib/braintree/account_updater_daily_report.rb +4 -4
- data/lib/braintree/ach_mandate.rb +1 -1
- data/lib/braintree/add_on_gateway.rb +1 -1
- data/lib/braintree/address.rb +7 -27
- data/lib/braintree/address_gateway.rb +8 -7
- data/lib/braintree/advanced_search.rb +11 -12
- data/lib/braintree/apple_pay.rb +4 -4
- data/lib/braintree/apple_pay_card.rb +18 -4
- data/lib/braintree/apple_pay_options.rb +4 -4
- data/lib/braintree/authorization_adjustment.rb +4 -4
- data/lib/braintree/base_module.rb +11 -1
- data/lib/braintree/bin_data.rb +10 -3
- data/lib/braintree/client_token.rb +1 -1
- data/lib/braintree/client_token_gateway.rb +4 -3
- data/lib/braintree/configuration.rb +35 -35
- data/lib/braintree/connected_merchant_paypal_status_changed.rb +2 -2
- data/lib/braintree/connected_merchant_status_transitioned.rb +2 -2
- data/lib/braintree/credit_card.rb +40 -86
- data/lib/braintree/credit_card_gateway.rb +58 -44
- data/lib/braintree/credit_card_verification.rb +39 -20
- data/lib/braintree/credit_card_verification_gateway.rb +35 -5
- data/lib/braintree/credit_card_verification_search.rb +2 -2
- data/lib/braintree/customer.rb +23 -88
- data/lib/braintree/customer_gateway.rb +17 -32
- data/lib/braintree/customer_search.rb +2 -2
- data/lib/braintree/descriptor.rb +1 -1
- data/lib/braintree/digest.rb +1 -1
- data/lib/braintree/disbursement.rb +7 -7
- data/lib/braintree/discount_gateway.rb +1 -1
- data/lib/braintree/dispute/evidence.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/transaction.rb +3 -1
- data/lib/braintree/dispute/transaction_details.rb +1 -1
- data/lib/braintree/dispute.rb +47 -6
- data/lib/braintree/dispute_gateway.rb +5 -10
- data/lib/braintree/dispute_search.rb +8 -4
- data/lib/braintree/document_upload.rb +3 -3
- data/lib/braintree/document_upload_gateway.rb +3 -3
- data/lib/braintree/enriched_customer_data.rb +21 -0
- data/lib/braintree/error_codes.rb +217 -175
- data/lib/braintree/error_result.rb +2 -3
- data/lib/braintree/errors.rb +3 -3
- data/lib/braintree/exceptions.rb +6 -5
- 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/facilitated_details.rb +1 -1
- data/lib/braintree/facilitator_details.rb +1 -1
- data/lib/braintree/gateway.rb +6 -12
- data/lib/braintree/{android_pay_card.rb → google_pay_card.rb} +18 -5
- data/lib/braintree/granted_payment_instrument_update.rb +2 -2
- data/lib/braintree/graphql_client.rb +14 -8
- data/lib/braintree/http.rb +9 -10
- data/lib/braintree/local_payment_completed/blik_alias.rb +23 -0
- data/lib/braintree/local_payment_completed.rb +10 -5
- 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 +4 -4
- data/lib/braintree/merchant_account.rb +3 -3
- data/lib/braintree/merchant_account_gateway.rb +10 -8
- data/lib/braintree/merchant_gateway.rb +1 -1
- data/lib/braintree/meta_checkout_card.rb +89 -0
- data/lib/braintree/meta_checkout_token.rb +88 -0
- data/lib/braintree/modification.rb +4 -4
- data/lib/braintree/oauth_credentials.rb +4 -4
- data/lib/braintree/oauth_gateway.rb +5 -5
- data/lib/braintree/paginated_collection.rb +2 -2
- data/lib/braintree/paginated_result.rb +1 -1
- data/lib/braintree/payment_instrument_type.rb +14 -13
- data/lib/braintree/payment_method_customer_data_updated_metadata.rb +24 -0
- data/lib/braintree/payment_method_gateway.rb +52 -22
- data/lib/braintree/payment_method_nonce.rb +12 -7
- data/lib/braintree/payment_method_nonce_details.rb +40 -0
- data/lib/braintree/payment_method_nonce_details_payer_info.rb +32 -0
- data/lib/braintree/payment_method_nonce_gateway.rb +14 -3
- data/lib/braintree/payment_method_parser.rb +4 -7
- data/lib/braintree/paypal_account.rb +3 -2
- data/lib/braintree/paypal_account_gateway.rb +5 -5
- data/lib/braintree/plan.rb +22 -2
- data/lib/braintree/plan_gateway.rb +101 -1
- data/lib/braintree/processor_response_types.rb +3 -3
- data/lib/braintree/resource_collection.rb +10 -5
- data/lib/braintree/revoked_payment_method_metadata.rb +2 -2
- data/lib/braintree/risk_data/liability_shift.rb +22 -0
- data/lib/braintree/risk_data.rb +10 -3
- data/lib/braintree/samsung_pay_card.rb +8 -6
- data/lib/braintree/sepa_direct_debit_account.rb +60 -0
- data/lib/braintree/sepa_direct_debit_account_gateway.rb +25 -0
- data/lib/braintree/sepa_direct_debit_account_nonce_details.rb +28 -0
- data/lib/braintree/settlement_batch_summary.rb +2 -2
- data/lib/braintree/settlement_batch_summary_gateway.rb +1 -1
- data/lib/braintree/sha256_digest.rb +1 -1
- data/lib/braintree/subscription/status_details.rb +1 -1
- data/lib/braintree/subscription.rb +13 -13
- data/lib/braintree/subscription_gateway.rb +6 -6
- data/lib/braintree/subscription_search.rb +1 -1
- data/lib/braintree/successful_result.rb +5 -4
- data/lib/braintree/test/authentication_id.rb +21 -0
- data/lib/braintree/test/credit_card.rb +9 -10
- data/lib/braintree/test/merchant_account.rb +1 -1
- data/lib/braintree/test/nonce.rb +27 -20
- data/lib/braintree/test/transaction_amounts.rb +2 -3
- data/lib/braintree/test/venmo_sdk.rb +2 -0
- data/lib/braintree/testing_gateway.rb +1 -1
- data/lib/braintree/three_d_secure_info.rb +23 -11
- data/lib/braintree/transaction/address_details.rb +14 -1
- data/lib/braintree/transaction/apple_pay_details.rb +13 -10
- data/lib/braintree/transaction/credit_card_details.rb +8 -1
- data/lib/braintree/transaction/customer_details.rb +3 -2
- data/lib/braintree/transaction/disbursement_details.rb +2 -1
- data/lib/braintree/transaction/{android_pay_details.rb → google_pay_details.rb} +6 -1
- data/lib/braintree/transaction/installment/adjustment.rb +33 -0
- data/lib/braintree/transaction/installment.rb +28 -0
- data/lib/braintree/transaction/local_payment_details.rb +3 -0
- data/lib/braintree/transaction/meta_checkout_card_details.rb +52 -0
- data/lib/braintree/transaction/meta_checkout_token_details.rb +54 -0
- data/lib/braintree/transaction/package_details.rb +19 -0
- data/lib/braintree/transaction/payment_receipt/card_present_data.rb +36 -0
- data/lib/braintree/transaction/payment_receipt/merchant_address.rb +19 -0
- data/lib/braintree/transaction/payment_receipt.rb +31 -0
- data/lib/braintree/transaction/paypal_details.rb +5 -0
- data/lib/braintree/transaction/samsung_pay_card_details.rb +3 -1
- data/lib/braintree/transaction/sepa_direct_debit_account_details.rb +27 -0
- data/lib/braintree/transaction/status_details.rb +1 -1
- data/lib/braintree/transaction/subscription_details.rb +3 -1
- data/lib/braintree/transaction/us_bank_account_details.rb +2 -1
- data/lib/braintree/transaction/visa_checkout_card_details.rb +1 -1
- data/lib/braintree/transaction.rb +119 -128
- data/lib/braintree/transaction_gateway.rb +138 -64
- data/lib/braintree/transaction_line_item.rb +14 -11
- data/lib/braintree/transaction_line_item_gateway.rb +1 -1
- data/lib/braintree/transaction_review.rb +18 -0
- data/lib/braintree/transaction_search.rb +11 -7
- data/lib/braintree/unknown_payment_method.rb +2 -2
- data/lib/braintree/us_bank_account.rb +5 -5
- data/lib/braintree/us_bank_account_verification.rb +24 -16
- data/lib/braintree/us_bank_account_verification_gateway.rb +1 -1
- data/lib/braintree/us_bank_account_verification_search.rb +1 -1
- data/lib/braintree/util.rb +25 -10
- data/lib/braintree/validation_error.rb +1 -1
- data/lib/braintree/validation_error_collection.rb +3 -3
- data/lib/braintree/venmo_account.rb +4 -4
- data/lib/braintree/venmo_profile_data.rb +25 -0
- data/lib/braintree/version.rb +2 -2
- data/lib/braintree/visa_checkout_card.rb +8 -8
- data/lib/braintree/webhook_notification.rb +55 -33
- data/lib/braintree/webhook_notification_gateway.rb +9 -9
- data/lib/braintree/webhook_testing.rb +1 -1
- data/lib/braintree/webhook_testing_gateway.rb +569 -46
- data/lib/braintree/xml/generator.rb +6 -5
- data/lib/braintree/xml/libxml.rb +1 -1
- data/lib/braintree/xml/parser.rb +24 -37
- data/lib/braintree/xml/rexml.rb +6 -7
- data/lib/braintree/xml.rb +1 -1
- data/lib/braintree.rb +41 -24
- data/lib/ssl/api_braintreegateway_com.ca.crt +401 -168
- data/spec/integration/braintree/add_on_spec.rb +10 -10
- data/spec/integration/braintree/address_spec.rb +101 -178
- data/spec/integration/braintree/advanced_search_spec.rb +93 -93
- data/spec/integration/braintree/apple_pay_spec.rb +12 -12
- data/spec/integration/braintree/braintree_gateway_spec.rb +2 -1
- data/spec/integration/braintree/client_api/client_token_spec.rb +279 -62
- data/spec/integration/braintree/client_api/spec_helper.rb +99 -73
- data/spec/integration/braintree/credit_card_spec.rb +522 -821
- data/spec/integration/braintree/credit_card_verification_search_spec.rb +18 -18
- data/spec/integration/braintree/credit_card_verification_spec.rb +219 -30
- data/spec/integration/braintree/customer_search_spec.rb +28 -28
- data/spec/integration/braintree/customer_spec.rb +840 -757
- data/spec/integration/braintree/disbursement_spec.rb +2 -2
- data/spec/integration/braintree/discount_spec.rb +9 -9
- data/spec/integration/braintree/dispute_search_spec.rb +45 -9
- data/spec/integration/braintree/dispute_spec.rb +109 -82
- data/spec/integration/braintree/document_upload_spec.rb +29 -17
- data/spec/integration/braintree/error_codes_spec.rb +3 -3
- 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 +31 -33
- data/spec/integration/braintree/merchant_account_spec.rb +155 -156
- data/spec/integration/braintree/merchant_spec.rb +71 -192
- data/spec/integration/braintree/oauth_spec.rb +72 -72
- data/spec/integration/braintree/package_tracking_spec.rb +130 -0
- data/spec/integration/braintree/payment_method_nonce_spec.rb +173 -78
- data/spec/integration/braintree/payment_method_spec.rb +953 -501
- data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +147 -234
- data/spec/integration/braintree/paypal_account_spec.rb +74 -72
- data/spec/integration/braintree/plan_spec.rb +96 -15
- data/spec/integration/braintree/samsung_pay_card_spec.rb +75 -73
- data/spec/integration/braintree/sepa_direct_debit_account_spec.rb +194 -0
- data/spec/integration/braintree/settlement_batch_summary_spec.rb +18 -18
- data/spec/integration/braintree/subscription_spec.rb +507 -513
- data/spec/integration/braintree/test/transaction_amounts_spec.rb +4 -4
- data/spec/integration/braintree/test_transaction_spec.rb +29 -29
- data/spec/integration/braintree/transaction_line_item_spec.rb +12 -6
- data/spec/integration/braintree/transaction_search_spec.rb +410 -217
- data/spec/integration/braintree/transaction_spec.rb +3252 -2102
- data/spec/integration/braintree/transaction_us_bank_account_spec.rb +42 -278
- data/spec/integration/braintree/us_bank_account_spec.rb +36 -36
- data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +25 -25
- data/spec/integration/braintree/us_bank_account_verification_spec.rb +41 -41
- data/spec/integration/braintree/visa_checkout_card_spec.rb +62 -62
- data/spec/integration/spec_helper.rb +22 -7
- data/spec/oauth_test_helper.rb +1 -1
- data/spec/script/httpsd.rb +6 -6
- data/spec/spec_helper.rb +15 -20
- data/spec/unit/braintree/address_spec.rb +9 -17
- data/spec/unit/braintree/apple_pay_card_spec.rb +110 -7
- data/spec/unit/braintree/base_module_spec.rb +4 -4
- data/spec/unit/braintree/client_token_spec.rb +6 -6
- data/spec/unit/braintree/configuration_spec.rb +84 -84
- data/spec/unit/braintree/credentials_parser_spec.rb +6 -6
- data/spec/unit/braintree/credit_card_spec.rb +91 -58
- data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +56 -0
- data/spec/unit/braintree/credit_card_verification_search_spec.rb +10 -10
- data/spec/unit/braintree/credit_card_verification_spec.rb +40 -18
- data/spec/unit/braintree/customer_spec.rb +102 -57
- data/spec/unit/braintree/digest_spec.rb +5 -6
- data/spec/unit/braintree/disbursement_spec.rb +14 -14
- data/spec/unit/braintree/dispute_search_spec.rb +6 -2
- data/spec/unit/braintree/dispute_spec.rb +144 -66
- data/spec/unit/braintree/document_upload_spec.rb +8 -8
- data/spec/unit/braintree/enriched_customer_data_spec.rb +41 -0
- data/spec/unit/braintree/error_result_spec.rb +11 -11
- data/spec/unit/braintree/errors_spec.rb +17 -17
- 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 +19 -17
- data/spec/unit/braintree/local_payment_completed_spec.rb +62 -8
- 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 +5 -5
- data/spec/unit/braintree/meta_checkout_card_details_spec.rb +60 -0
- data/spec/unit/braintree/meta_checkout_card_spec.rb +60 -0
- data/spec/unit/braintree/meta_checkout_token_details_spec.rb +63 -0
- data/spec/unit/braintree/meta_checkout_token_spec.rb +63 -0
- data/spec/unit/braintree/modification_spec.rb +1 -1
- data/spec/unit/braintree/package_tracking_spec.rb +77 -0
- 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 +51 -0
- data/spec/unit/braintree/payment_method_nonce_spec.rb +40 -0
- data/spec/unit/braintree/payment_method_spec.rb +20 -20
- data/spec/unit/braintree/paypal_account_spec.rb +16 -7
- data/spec/unit/braintree/resource_collection_spec.rb +34 -5
- 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/sepa_debit_account_nonce_details_spec.rb +29 -0
- data/spec/unit/braintree/sepa_debit_account_spec.rb +86 -0
- data/spec/unit/braintree/sha256_digest_spec.rb +1 -1
- data/spec/unit/braintree/signature_service_spec.rb +2 -2
- data/spec/unit/braintree/subscription_search_spec.rb +18 -18
- data/spec/unit/braintree/subscription_spec.rb +8 -8
- data/spec/unit/braintree/successful_result_spec.rb +6 -6
- data/spec/unit/braintree/three_d_secure_info_spec.rb +37 -17
- data/spec/unit/braintree/transaction/credit_card_details_spec.rb +22 -6
- data/spec/unit/braintree/transaction/customer_details_spec.rb +3 -2
- data/spec/unit/braintree/transaction/deposit_details_spec.rb +4 -4
- data/spec/unit/braintree/transaction/installment_spec.rb +25 -0
- data/spec/unit/braintree/transaction/local_payment_details_spec.rb +36 -0
- data/spec/unit/braintree/transaction/payment_receipt_spec.rb +73 -0
- data/spec/unit/braintree/transaction/paypal_details_spec.rb +63 -0
- data/spec/unit/braintree/transaction/sepa_direct_debit_account_details_spec.rb +33 -0
- data/spec/unit/braintree/transaction_gateway_spec.rb +150 -0
- data/spec/unit/braintree/transaction_search_spec.rb +12 -12
- data/spec/unit/braintree/transaction_spec.rb +221 -124
- data/spec/unit/braintree/unknown_payment_method_spec.rb +4 -4
- data/spec/unit/braintree/us_bank_account_spec.rb +2 -2
- data/spec/unit/braintree/us_bank_account_verification_search_spec.rb +7 -7
- data/spec/unit/braintree/us_bank_account_verification_spec.rb +12 -7
- data/spec/unit/braintree/util_spec.rb +78 -44
- data/spec/unit/braintree/validation_error_collection_spec.rb +62 -62
- data/spec/unit/braintree/validation_error_spec.rb +4 -4
- data/spec/unit/braintree/venmo_profile_data_spec.rb +43 -0
- data/spec/unit/braintree/webhook_notification_spec.rb +434 -197
- data/spec/unit/braintree/xml/libxml_spec.rb +5 -5
- data/spec/unit/braintree/xml/parser_spec.rb +27 -22
- data/spec/unit/braintree/xml/rexml_spec.rb +5 -5
- data/spec/unit/braintree/xml_spec.rb +38 -38
- data/spec/unit/braintree_spec.rb +2 -2
- metadata +91 -30
- data/lib/braintree/amex_express_checkout_card.rb +0 -38
- 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 -81
- 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 -47
- 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
@@ -10,7 +10,7 @@ module Braintree
|
|
10
10
|
attr_reader :transaction
|
11
11
|
attr_reader :verification
|
12
12
|
|
13
|
-
def initialize(gateway, data)
|
13
|
+
def initialize(gateway, data)
|
14
14
|
@gateway = gateway
|
15
15
|
@params = data[:params]
|
16
16
|
@credit_card_verification = CreditCardVerification._new(data[:verification]) if data[:verification]
|
@@ -22,7 +22,7 @@ module Braintree
|
|
22
22
|
@errors = Errors.new(data[:errors])
|
23
23
|
end
|
24
24
|
|
25
|
-
def inspect
|
25
|
+
def inspect
|
26
26
|
if @credit_card_verification
|
27
27
|
verification_inspect = " credit_card_verification: #{@credit_card_verification.inspect}"
|
28
28
|
end
|
@@ -32,7 +32,6 @@ module Braintree
|
|
32
32
|
"#<#{self.class} params:{...} errors:<#{@errors._inner_inspect}>#{verification_inspect}#{transaction_inspect}>"
|
33
33
|
end
|
34
34
|
|
35
|
-
# Always returns false.
|
36
35
|
def success?
|
37
36
|
false
|
38
37
|
end
|
data/lib/braintree/errors.rb
CHANGED
@@ -2,7 +2,7 @@ module Braintree
|
|
2
2
|
class Errors
|
3
3
|
include Enumerable
|
4
4
|
|
5
|
-
def initialize(data = {})
|
5
|
+
def initialize(data = {})
|
6
6
|
@errors = ValidationErrorCollection.new(data.merge(:errors => []))
|
7
7
|
end
|
8
8
|
|
@@ -14,7 +14,7 @@ module Braintree
|
|
14
14
|
@errors.for(scope)
|
15
15
|
end
|
16
16
|
|
17
|
-
def inspect
|
17
|
+
def inspect
|
18
18
|
"#<#{self.class} #{_inner_inspect}>"
|
19
19
|
end
|
20
20
|
|
@@ -25,7 +25,7 @@ module Braintree
|
|
25
25
|
@errors.deep_size
|
26
26
|
end
|
27
27
|
|
28
|
-
def _inner_inspect
|
28
|
+
def _inner_inspect
|
29
29
|
@errors._inner_inspect
|
30
30
|
end
|
31
31
|
end
|
data/lib/braintree/exceptions.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
module Braintree
|
2
|
-
# Super class for all Braintree exceptions.
|
1
|
+
module Braintree
|
3
2
|
class BraintreeError < ::StandardError; end
|
4
3
|
|
5
4
|
class AuthenticationError < BraintreeError; end
|
@@ -8,9 +7,7 @@ module Braintree # :nodoc:
|
|
8
7
|
|
9
8
|
class ConfigurationError < BraintreeError; end
|
10
9
|
|
11
|
-
class
|
12
|
-
|
13
|
-
class ForgedQueryString < BraintreeError; end
|
10
|
+
class GatewayTimeoutError < BraintreeError; end
|
14
11
|
|
15
12
|
class InvalidSignature < BraintreeError; end
|
16
13
|
|
@@ -18,8 +15,12 @@ module Braintree # :nodoc:
|
|
18
15
|
|
19
16
|
class NotFoundError < BraintreeError; end
|
20
17
|
|
18
|
+
class RequestTimeoutError < BraintreeError; end
|
19
|
+
|
21
20
|
class ServerError < BraintreeError; end
|
22
21
|
|
22
|
+
class ServiceUnavailableError < BraintreeError; end
|
23
|
+
|
23
24
|
class SSLCertificateError < BraintreeError; end
|
24
25
|
|
25
26
|
class TooManyRequestsError < BraintreeError; end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Braintree
|
2
|
+
class ExchangeRate
|
3
|
+
include BaseModule
|
4
|
+
|
5
|
+
def initialize(gateway, attributes)
|
6
|
+
set_instance_variables_from_hash(attributes)
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.generate(exchange_rate_quote_request)
|
10
|
+
Configuration.gateway.exchange_rate_quote.generate(exchange_rate_quote_request)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Braintree
|
2
|
+
class ExchangeRateQuote
|
3
|
+
include BaseModule
|
4
|
+
|
5
|
+
attr_reader :attrs
|
6
|
+
attr_reader :base_amount
|
7
|
+
attr_reader :exchange_rate
|
8
|
+
attr_reader :expires_at
|
9
|
+
attr_reader :id
|
10
|
+
attr_reader :quote_amount
|
11
|
+
attr_reader :refreshes_at
|
12
|
+
attr_reader :trade_rate
|
13
|
+
|
14
|
+
def initialize(attributes)
|
15
|
+
@attrs = attributes.keys
|
16
|
+
set_instance_variables_from_hash(attributes)
|
17
|
+
end
|
18
|
+
|
19
|
+
def inspect
|
20
|
+
inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
|
21
|
+
"#<#{self.class} #{inspected_attributes.join(" ")}>"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Braintree
|
2
|
+
class ExchangeRateQuoteGateway
|
3
|
+
def initialize(gateway)
|
4
|
+
@gateway = gateway
|
5
|
+
end
|
6
|
+
|
7
|
+
DEFINITION = <<-GRAPHQL
|
8
|
+
mutation GenerateExchangeRateQuoteInput($input: GenerateExchangeRateQuoteInput!) {
|
9
|
+
generateExchangeRateQuote(input: $input) {
|
10
|
+
quotes {
|
11
|
+
id
|
12
|
+
baseAmount {value, currencyCode}
|
13
|
+
quoteAmount {value, currencyCode}
|
14
|
+
exchangeRate
|
15
|
+
tradeRate
|
16
|
+
expiresAt
|
17
|
+
refreshesAt
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
GRAPHQL
|
22
|
+
|
23
|
+
def generate(params)
|
24
|
+
response = @gateway.config.graphql_client.query(DEFINITION, {input: params})
|
25
|
+
|
26
|
+
if response.has_key?(:data) && response[:data][:generateExchangeRateQuote]
|
27
|
+
response[:data][:generateExchangeRateQuote]
|
28
|
+
elsif response[:errors]
|
29
|
+
ErrorResult.new(@gateway, response[:errors])
|
30
|
+
else
|
31
|
+
raise UnexpectedError, "expected :generateExchangeRateQuote or :api_error_response in GraphQL response"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Braintree
|
2
|
+
class ExchangeRateQuoteInput
|
3
|
+
include BaseModule
|
4
|
+
|
5
|
+
attr_reader :attrs
|
6
|
+
attr_reader :base_currency
|
7
|
+
attr_reader :base_amount
|
8
|
+
attr_reader :markup
|
9
|
+
attr_reader :quote_currency
|
10
|
+
|
11
|
+
def initialize(attributes)
|
12
|
+
@attrs = attributes.keys
|
13
|
+
set_instance_variables_from_hash(attributes)
|
14
|
+
end
|
15
|
+
|
16
|
+
def inspect
|
17
|
+
inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
|
18
|
+
"#<#{self.class} #{inspected_attributes.join(" ")}>"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Braintree
|
2
|
+
class ExchangeRateQuoteRequest
|
3
|
+
include BaseModule
|
4
|
+
|
5
|
+
attr_reader :quotes
|
6
|
+
|
7
|
+
def initialize(attributes)
|
8
|
+
@attrs = attributes.keys
|
9
|
+
set_instance_variables_from_hash(attributes)
|
10
|
+
@quotes = (@quotes || []).map { |quote_hash| ExchangeRateQuoteInput.new(quote_hash) }
|
11
|
+
end
|
12
|
+
|
13
|
+
def inspect
|
14
|
+
inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
|
15
|
+
"#<#{self.class} #{inspected_attributes.join(" ")}>"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Braintree
|
2
|
+
class ExchangeRateQuoteResponse
|
3
|
+
include BaseModule
|
4
|
+
|
5
|
+
attr_reader :quotes
|
6
|
+
|
7
|
+
def initialize(attributes)
|
8
|
+
@attrs = attributes.keys
|
9
|
+
set_instance_variables_from_hash(attributes)
|
10
|
+
@quotes = (@quotes || []).map { |quote_hash| ExchangeRateQuote.new(quote_hash) }
|
11
|
+
end
|
12
|
+
|
13
|
+
def inspect
|
14
|
+
inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
|
15
|
+
"#<#{self.class} #{inspected_attributes.join(" ")}>"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/braintree/gateway.rb
CHANGED
@@ -50,6 +50,10 @@ module Braintree
|
|
50
50
|
DocumentUploadGateway.new(self)
|
51
51
|
end
|
52
52
|
|
53
|
+
def exchange_rate_quote
|
54
|
+
ExchangeRateQuoteGateway.new(self)
|
55
|
+
end
|
56
|
+
|
53
57
|
def oauth
|
54
58
|
OAuthGateway.new(self)
|
55
59
|
end
|
@@ -74,10 +78,8 @@ module Braintree
|
|
74
78
|
UsBankAccountGateway.new(self)
|
75
79
|
end
|
76
80
|
|
77
|
-
|
78
|
-
|
79
|
-
def ideal_payment
|
80
|
-
IdealPaymentGateway.new(self)
|
81
|
+
def sepa_direct_debit_account
|
82
|
+
SepaDirectDebitAccountGateway.new(self)
|
81
83
|
end
|
82
84
|
|
83
85
|
def merchant
|
@@ -88,10 +90,6 @@ module Braintree
|
|
88
90
|
MerchantAccountGateway.new(self)
|
89
91
|
end
|
90
92
|
|
91
|
-
def europe_bank_account
|
92
|
-
EuropeBankAccountGateway.new(self)
|
93
|
-
end
|
94
|
-
|
95
93
|
def settlement_batch_summary
|
96
94
|
SettlementBatchSummaryGateway.new(self)
|
97
95
|
end
|
@@ -100,10 +98,6 @@ module Braintree
|
|
100
98
|
SubscriptionGateway.new(self)
|
101
99
|
end
|
102
100
|
|
103
|
-
def transparent_redirect
|
104
|
-
TransparentRedirectGateway.new(self)
|
105
|
-
end
|
106
|
-
|
107
101
|
def transaction
|
108
102
|
TransactionGateway.new(self)
|
109
103
|
end
|
@@ -1,15 +1,24 @@
|
|
1
1
|
module Braintree
|
2
|
-
class
|
3
|
-
include BaseModule
|
2
|
+
class GooglePayCard
|
3
|
+
include BaseModule
|
4
4
|
|
5
5
|
attr_reader :bin
|
6
|
+
attr_reader :commercial
|
7
|
+
attr_reader :country_of_issuance
|
6
8
|
attr_reader :created_at
|
7
9
|
attr_reader :customer_id
|
10
|
+
attr_reader :debit
|
8
11
|
attr_reader :default
|
12
|
+
attr_reader :durbin_regulated
|
9
13
|
attr_reader :expiration_month
|
10
14
|
attr_reader :expiration_year
|
11
15
|
attr_reader :google_transaction_id
|
16
|
+
attr_reader :healthcare
|
12
17
|
attr_reader :image_url
|
18
|
+
attr_reader :issuing_bank
|
19
|
+
attr_reader :payroll
|
20
|
+
attr_reader :prepaid
|
21
|
+
attr_reader :product_id
|
13
22
|
attr_reader :source_card_last_4
|
14
23
|
attr_reader :source_card_type
|
15
24
|
attr_reader :source_description
|
@@ -19,7 +28,7 @@ module Braintree
|
|
19
28
|
attr_reader :virtual_card_last_4
|
20
29
|
attr_reader :virtual_card_type
|
21
30
|
|
22
|
-
def initialize(gateway, attributes)
|
31
|
+
def initialize(gateway, attributes)
|
23
32
|
@gateway = gateway
|
24
33
|
set_instance_variables_from_hash(attributes)
|
25
34
|
@subscriptions = (@subscriptions || []).map { |subscription_hash| Subscription._new(@gateway, subscription_hash) }
|
@@ -29,6 +38,10 @@ module Braintree
|
|
29
38
|
@default
|
30
39
|
end
|
31
40
|
|
41
|
+
def is_network_tokenized?
|
42
|
+
@is_network_tokenized
|
43
|
+
end
|
44
|
+
|
32
45
|
def card_type
|
33
46
|
virtual_card_type
|
34
47
|
end
|
@@ -41,8 +54,8 @@ module Braintree
|
|
41
54
|
protected :new
|
42
55
|
end
|
43
56
|
|
44
|
-
def self._new(*args)
|
45
|
-
self.new
|
57
|
+
def self._new(*args)
|
58
|
+
self.new(*args)
|
46
59
|
end
|
47
60
|
end
|
48
61
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
module Braintree
|
2
|
-
class GraphQLClient < Http
|
2
|
+
class GraphQLClient < Http
|
3
3
|
|
4
4
|
def initialize(config)
|
5
5
|
@config = config
|
6
6
|
@graphql_headers = {
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
"Accept" => "application/json",
|
8
|
+
"Braintree-Version" => @config.graphql_api_version,
|
9
|
+
"Content-Type" => "application/json"
|
10
10
|
}
|
11
11
|
end
|
12
12
|
|
@@ -14,15 +14,21 @@ module Braintree
|
|
14
14
|
graphql_connection = _setup_connection(@config.graphql_server, @config.graphql_port)
|
15
15
|
|
16
16
|
request = {}
|
17
|
-
request[
|
18
|
-
request[
|
19
|
-
request[
|
17
|
+
request["query"] = definition
|
18
|
+
request["operationName"] = operationName if operationName
|
19
|
+
request["variables"] = variables
|
20
20
|
|
21
21
|
response = _http_do Net::HTTP::Post, @config.graphql_base_url, request.to_json, nil, graphql_connection, @graphql_headers
|
22
|
-
data =
|
22
|
+
data = _parse_response(response)
|
23
23
|
Util.raise_exception_for_graphql_error(data)
|
24
24
|
|
25
25
|
data
|
26
26
|
end
|
27
|
+
|
28
|
+
def _parse_response(response)
|
29
|
+
body = response.body
|
30
|
+
body = Zlib::GzipReader.new(StringIO.new(body)).read if response.header["Content-Encoding"] == "gzip"
|
31
|
+
JSON.parse(body, :symbolize_names => true)
|
32
|
+
end
|
27
33
|
end
|
28
34
|
end
|
data/lib/braintree/http.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Braintree
|
2
|
-
class Http
|
2
|
+
class Http
|
3
3
|
|
4
4
|
LINE_FEED = "\r\n"
|
5
5
|
|
@@ -7,8 +7,7 @@ module Braintree
|
|
7
7
|
@config = config
|
8
8
|
end
|
9
9
|
|
10
|
-
def delete(
|
11
|
-
path = _path + _build_query_string(query_params)
|
10
|
+
def delete(path, query_params = {})
|
12
11
|
response = _http_do Net::HTTP::Delete, path
|
13
12
|
if response.code.to_i == 200 || response.code.to_i == 204
|
14
13
|
true
|
@@ -19,8 +18,7 @@ module Braintree
|
|
19
18
|
end
|
20
19
|
end
|
21
20
|
|
22
|
-
def get(
|
23
|
-
path = _path + _build_query_string(query_params)
|
21
|
+
def get(path, query_params = {})
|
24
22
|
response = _http_do Net::HTTP::Get, path
|
25
23
|
if response.code.to_i == 200 || response.code.to_i == 422
|
26
24
|
Xml.hash_from_xml(_body(response))
|
@@ -69,16 +67,16 @@ module Braintree
|
|
69
67
|
|
70
68
|
def _setup_connection(server = @config.server, port = @config.port)
|
71
69
|
if @config.proxy_address
|
72
|
-
|
70
|
+
Net::HTTP.new(
|
73
71
|
server,
|
74
72
|
port,
|
75
73
|
@config.proxy_address,
|
76
74
|
@config.proxy_port,
|
77
75
|
@config.proxy_user,
|
78
|
-
@config.proxy_pass
|
76
|
+
@config.proxy_pass,
|
79
77
|
)
|
80
78
|
else
|
81
|
-
|
79
|
+
Net::HTTP.new(server, port)
|
82
80
|
end
|
83
81
|
end
|
84
82
|
|
@@ -127,7 +125,7 @@ module Braintree
|
|
127
125
|
form_params.push(_add_form_field(k, v))
|
128
126
|
end
|
129
127
|
form_params.push(_add_file_part("file", file))
|
130
|
-
request.body = form_params.collect {|p| "--" + boundary + "#{LINE_FEED}" + p}.join("") + "--" + boundary + "--"
|
128
|
+
request.body = form_params.collect { |p| "--" + boundary + "#{LINE_FEED}" + p }.join("") + "--" + boundary + "--"
|
131
129
|
@config.logger.debug _format_and_sanitize_body_for_log(_build_xml(body))
|
132
130
|
else
|
133
131
|
request.body = body
|
@@ -187,7 +185,8 @@ module Braintree
|
|
187
185
|
def _format_and_sanitize_body_for_log(input_xml)
|
188
186
|
formatted_xml = input_xml.gsub(/^/, "[Braintree] ")
|
189
187
|
formatted_xml = formatted_xml.gsub(/<number>(.{6}).+?(.{4})<\/number>/m, '<number>\1******\2</number>')
|
190
|
-
formatted_xml = formatted_xml.gsub(/<cvv>.+?<\/cvv>/m,
|
188
|
+
formatted_xml = formatted_xml.gsub(/<cvv>.+?<\/cvv>/m, "<cvv>***</cvv>")
|
189
|
+
formatted_xml = formatted_xml.gsub(/<encrypted-card-data>.+?<\/encrypted-card-data>/m, "<encrypted-card-data>***</encrypted-card-data>")
|
191
190
|
formatted_xml
|
192
191
|
end
|
193
192
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Braintree
|
2
|
+
class LocalPaymentCompleted
|
3
|
+
class BlikAlias
|
4
|
+
include BaseModule
|
5
|
+
|
6
|
+
attr_reader :key
|
7
|
+
attr_reader :label
|
8
|
+
|
9
|
+
def initialize(attributes)
|
10
|
+
set_instance_variables_from_hash attributes unless attributes.nil?
|
11
|
+
end
|
12
|
+
|
13
|
+
def inspect
|
14
|
+
attrs = [:key, :label]
|
15
|
+
formatted_attrs = attrs.map do |attr|
|
16
|
+
"#{attr}: #{send(attr).inspect}"
|
17
|
+
end
|
18
|
+
|
19
|
+
"#<#{formatted_attrs.join(", ")}>"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -2,22 +2,27 @@ module Braintree
|
|
2
2
|
class LocalPaymentCompleted
|
3
3
|
include BaseModule
|
4
4
|
|
5
|
-
attr_reader :
|
5
|
+
attr_reader :bic
|
6
|
+
attr_reader :blik_aliases
|
7
|
+
attr_reader :iban_last_chars
|
6
8
|
attr_reader :payer_id
|
9
|
+
attr_reader :payer_name
|
10
|
+
attr_reader :payment_id
|
7
11
|
attr_reader :payment_method_nonce
|
8
12
|
attr_reader :transaction
|
9
13
|
|
10
|
-
def initialize(attributes)
|
14
|
+
def initialize(attributes)
|
11
15
|
set_instance_variables_from_hash(attributes)
|
12
|
-
@transaction = Transaction._new(Configuration.gateway, transaction)
|
16
|
+
@transaction = Transaction._new(Configuration.gateway, transaction) unless transaction.nil?
|
17
|
+
blik_aliases.map { |attrs| BlikAlias.new(attrs) } if blik_aliases
|
13
18
|
end
|
14
19
|
|
15
20
|
class << self
|
16
21
|
protected :new
|
17
22
|
end
|
18
23
|
|
19
|
-
def self._new(*args)
|
20
|
-
self.new
|
24
|
+
def self._new(*args)
|
25
|
+
self.new(*args)
|
21
26
|
end
|
22
27
|
end
|
23
28
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Braintree
|
2
|
+
class LocalPaymentExpired
|
3
|
+
include BaseModule
|
4
|
+
|
5
|
+
attr_reader :payment_id
|
6
|
+
attr_reader :payment_context_id
|
7
|
+
|
8
|
+
def initialize(attributes)
|
9
|
+
set_instance_variables_from_hash(attributes)
|
10
|
+
end
|
11
|
+
|
12
|
+
class << self
|
13
|
+
protected :new
|
14
|
+
end
|
15
|
+
|
16
|
+
def self._new(*args)
|
17
|
+
self.new(*args)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Braintree
|
2
|
+
class LocalPaymentFunded
|
3
|
+
include BaseModule
|
4
|
+
|
5
|
+
attr_reader :payment_id
|
6
|
+
attr_reader :payment_context_id
|
7
|
+
attr_reader :transaction
|
8
|
+
|
9
|
+
def initialize(attributes)
|
10
|
+
set_instance_variables_from_hash(attributes)
|
11
|
+
@transaction = Transaction._new(Configuration.gateway, transaction)
|
12
|
+
end
|
13
|
+
|
14
|
+
class << self
|
15
|
+
protected :new
|
16
|
+
end
|
17
|
+
|
18
|
+
def self._new(*args)
|
19
|
+
self.new(*args)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
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)
|
8
|
+
set_instance_variables_from_hash(attributes)
|
9
|
+
end
|
10
|
+
|
11
|
+
class << self
|
12
|
+
protected :new
|
13
|
+
end
|
14
|
+
|
15
|
+
def self._new(*args)
|
16
|
+
self.new(*args)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/braintree/merchant.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Braintree
|
2
2
|
class Merchant
|
3
|
-
include BaseModule
|
3
|
+
include BaseModule
|
4
4
|
|
5
5
|
attr_reader :company_name
|
6
6
|
attr_reader :country_code_alpha2
|
@@ -11,7 +11,7 @@ module Braintree
|
|
11
11
|
attr_reader :id
|
12
12
|
attr_reader :merchant_accounts
|
13
13
|
|
14
|
-
def initialize(gateway, attributes)
|
14
|
+
def initialize(gateway, attributes)
|
15
15
|
@merchant_accounts = attributes.delete(:merchant_accounts).map do |merchant_account|
|
16
16
|
MerchantAccount._new(gateway, merchant_account)
|
17
17
|
end
|
@@ -23,8 +23,8 @@ module Braintree
|
|
23
23
|
protected :new
|
24
24
|
end
|
25
25
|
|
26
|
-
def self._new(*args)
|
27
|
-
self.new
|
26
|
+
def self._new(*args)
|
27
|
+
self.new(*args)
|
28
28
|
end
|
29
29
|
|
30
30
|
def self.provision_raw_apple_pay
|
@@ -49,7 +49,7 @@ module Braintree
|
|
49
49
|
Configuration.gateway.merchant_account.update!(*args)
|
50
50
|
end
|
51
51
|
|
52
|
-
def initialize(gateway, attributes)
|
52
|
+
def initialize(gateway, attributes)
|
53
53
|
@gateway = gateway
|
54
54
|
set_instance_variables_from_hash(attributes)
|
55
55
|
@individual_details = IndividualDetails.new(@individual)
|
@@ -60,8 +60,8 @@ module Braintree
|
|
60
60
|
|
61
61
|
class << self
|
62
62
|
protected :new
|
63
|
-
def _new(*args)
|
64
|
-
self.new
|
63
|
+
def _new(*args)
|
64
|
+
self.new(*args)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|