braintree 2.74.0 → 4.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/LICENSE +1 -1
- data/braintree.gemspec +13 -7
- data/lib/braintree/account_updater_daily_report.rb +2 -2
- data/lib/braintree/ach_mandate.rb +2 -1
- data/lib/braintree/address/country_names.rb +4 -1
- data/lib/braintree/address.rb +30 -38
- data/lib/braintree/address_gateway.rb +12 -2
- data/lib/braintree/advanced_search.rb +8 -0
- data/lib/braintree/apple_pay.rb +29 -0
- data/lib/braintree/apple_pay_card.rb +28 -4
- data/lib/braintree/apple_pay_gateway.rb +37 -0
- data/lib/braintree/apple_pay_options.rb +19 -0
- data/lib/braintree/authorization_adjustment.rb +23 -0
- data/lib/braintree/base_module.rb +10 -0
- data/lib/braintree/bin_data.rb +33 -0
- data/lib/braintree/client_token.rb +3 -3
- data/lib/braintree/client_token_gateway.rb +3 -1
- data/lib/braintree/configuration.rb +57 -10
- data/lib/braintree/connected_merchant_paypal_status_changed.rb +6 -2
- data/lib/braintree/connected_merchant_status_transitioned.rb +6 -2
- data/lib/braintree/credentials_parser.rb +5 -1
- data/lib/braintree/credit_card.rb +53 -107
- data/lib/braintree/credit_card_gateway.rb +43 -30
- data/lib/braintree/credit_card_verification.rb +61 -21
- data/lib/braintree/credit_card_verification_gateway.rb +19 -6
- data/lib/braintree/credit_card_verification_search.rb +1 -1
- data/lib/braintree/customer.rb +51 -98
- data/lib/braintree/customer_gateway.rb +30 -23
- data/lib/braintree/customer_search.rb +1 -1
- data/lib/braintree/descriptor.rb +3 -1
- data/lib/braintree/disbursement.rb +24 -2
- data/lib/braintree/dispute/evidence.rb +24 -0
- data/lib/braintree/{transaction/coinbase_details.rb → dispute/paypal_message.rb} +5 -3
- data/lib/braintree/dispute/status_history.rb +18 -0
- data/lib/braintree/dispute/transaction.rb +20 -0
- data/lib/braintree/dispute/transaction_details.rb +2 -1
- data/lib/braintree/dispute.rb +114 -10
- data/lib/braintree/dispute_gateway.rb +142 -0
- data/lib/braintree/dispute_search.rb +31 -0
- data/lib/braintree/document_upload.rb +37 -0
- data/lib/braintree/document_upload_gateway.rb +38 -0
- data/lib/braintree/enriched_customer_data.rb +21 -0
- data/lib/braintree/error_codes.rb +328 -109
- data/lib/braintree/error_result.rb +8 -1
- 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/facilitated_details.rb +21 -0
- data/lib/braintree/facilitator_details.rb +2 -1
- data/lib/braintree/gateway.rb +29 -11
- data/lib/braintree/google_pay_card.rb +61 -0
- data/lib/braintree/granted_payment_instrument_update.rb +23 -0
- data/lib/braintree/graphql_client.rb +34 -0
- data/lib/braintree/http.rb +81 -20
- data/lib/braintree/local_payment_completed.rb +23 -0
- 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 +11 -4
- data/lib/braintree/merchant_account/address_details.rb +4 -1
- data/lib/braintree/merchant_account/business_details.rb +4 -1
- data/lib/braintree/merchant_account/funding_details.rb +6 -1
- data/lib/braintree/merchant_account/individual_details.rb +7 -2
- data/lib/braintree/merchant_account.rb +23 -10
- data/lib/braintree/merchant_account_gateway.rb +13 -1
- data/lib/braintree/merchant_gateway.rb +2 -2
- data/lib/braintree/modification.rb +1 -1
- data/lib/braintree/oauth_credentials.rb +5 -2
- data/lib/braintree/oauth_gateway.rb +8 -14
- data/lib/braintree/paginated_result.rb +3 -1
- data/lib/braintree/payment_instrument_type.rb +11 -11
- data/lib/braintree/payment_method.rb +20 -12
- data/lib/braintree/payment_method_customer_data_updated_metadata.rb +24 -0
- data/lib/braintree/payment_method_gateway.rb +82 -54
- data/lib/braintree/payment_method_nonce.rb +22 -8
- 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 +19 -2
- data/lib/braintree/payment_method_parser.rb +28 -0
- data/lib/braintree/paypal_account.rb +10 -1
- data/lib/braintree/plan.rb +25 -5
- data/lib/braintree/plan_gateway.rb +100 -0
- data/lib/braintree/processor_response_types.rb +7 -0
- data/lib/braintree/resource_collection.rb +8 -3
- data/lib/braintree/revoked_payment_method_metadata.rb +22 -0
- data/lib/braintree/risk_data/liability_shift.rb +22 -0
- data/lib/braintree/risk_data.rb +12 -2
- data/lib/braintree/samsung_pay_card.rb +83 -0
- 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 -1
- data/lib/braintree/settlement_batch_summary_gateway.rb +2 -0
- data/lib/braintree/subscription/status_details.rb +8 -1
- data/lib/braintree/subscription.rb +56 -41
- data/lib/braintree/subscription_gateway.rb +25 -2
- data/lib/braintree/successful_result.rb +23 -1
- data/lib/braintree/test/authentication_id.rb +21 -0
- data/lib/braintree/test/credit_card.rb +13 -0
- data/lib/braintree/test/nonce.rb +28 -20
- data/lib/braintree/test/transaction_amounts.rb +1 -0
- data/lib/braintree/three_d_secure_info.rb +34 -2
- data/lib/braintree/transaction/address_details.rb +24 -4
- data/lib/braintree/transaction/apple_pay_details.rb +20 -2
- data/lib/braintree/transaction/credit_card_details.rb +45 -6
- data/lib/braintree/transaction/customer_details.rb +8 -1
- data/lib/braintree/transaction/disbursement_details.rb +6 -1
- data/lib/braintree/transaction/google_pay_details.rb +41 -0
- 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 +24 -0
- data/lib/braintree/transaction/paypal_details.rb +26 -4
- data/lib/braintree/transaction/paypal_here_details.rb +23 -0
- data/lib/braintree/transaction/{masterpass_card_details.rb → samsung_pay_card_details.rb} +21 -6
- data/lib/braintree/transaction/sepa_direct_debit_account_details.rb +27 -0
- data/lib/braintree/transaction/status_details.rb +5 -1
- data/lib/braintree/transaction/subscription_details.rb +4 -1
- data/lib/braintree/transaction/us_bank_account_details.rb +8 -1
- data/lib/braintree/transaction/venmo_account_details.rb +5 -1
- data/lib/braintree/transaction/visa_checkout_card_details.rb +19 -4
- data/lib/braintree/transaction.rb +201 -188
- data/lib/braintree/transaction_gateway.rb +124 -30
- data/lib/braintree/transaction_line_item.rb +40 -0
- data/lib/braintree/transaction_line_item_gateway.rb +19 -0
- data/lib/braintree/transaction_review.rb +18 -0
- data/lib/braintree/transaction_search.rb +6 -3
- data/lib/braintree/unknown_payment_method.rb +3 -2
- data/lib/braintree/us_bank_account.rb +24 -8
- data/lib/braintree/us_bank_account_gateway.rb +0 -1
- data/lib/braintree/us_bank_account_verification.rb +81 -0
- data/lib/braintree/us_bank_account_verification_gateway.rb +51 -0
- data/lib/braintree/us_bank_account_verification_search.rb +19 -0
- data/lib/braintree/util.rb +79 -9
- data/lib/braintree/validation_error.rb +13 -3
- data/lib/braintree/validation_error_collection.rb +2 -1
- data/lib/braintree/venmo_account.rb +11 -4
- data/lib/braintree/venmo_profile_data.rb +23 -0
- data/lib/braintree/version.rb +2 -2
- data/lib/braintree/visa_checkout_card.rb +29 -13
- data/lib/braintree/webhook_notification.rb +66 -26
- data/lib/braintree/webhook_notification_gateway.rb +5 -3
- data/lib/braintree/webhook_testing.rb +2 -2
- data/lib/braintree/webhook_testing_gateway.rb +721 -55
- data/lib/braintree/xml/generator.rb +6 -4
- data/lib/braintree/xml/parser.rb +22 -35
- data/lib/braintree/xml/rexml.rb +4 -5
- data/lib/braintree.rb +60 -22
- data/lib/ssl/api_braintreegateway_com.ca.crt +50 -0
- data/spec/fixtures/files/bt_logo.png +0 -0
- data/spec/fixtures/files/gif_extension_bt_logo.gif +0 -0
- data/spec/fixtures/files/malformed_pdf.pdf +1 -0
- data/spec/fixtures/files/too_long.pdf +0 -0
- data/spec/integration/braintree/add_on_spec.rb +3 -3
- 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 +63 -0
- data/spec/integration/braintree/braintree_gateway_spec.rb +72 -0
- data/spec/integration/braintree/client_api/client_token_spec.rb +14 -32
- data/spec/integration/braintree/client_api/spec_helper.rb +104 -65
- data/spec/integration/braintree/credit_card_spec.rb +460 -615
- data/spec/integration/braintree/credit_card_verification_search_spec.rb +2 -2
- data/spec/integration/braintree/credit_card_verification_spec.rb +222 -6
- data/spec/integration/braintree/customer_search_spec.rb +8 -8
- data/spec/integration/braintree/customer_spec.rb +810 -498
- data/spec/integration/braintree/discount_spec.rb +1 -1
- data/spec/integration/braintree/dispute_search_spec.rb +167 -0
- data/spec/integration/braintree/dispute_spec.rb +333 -0
- data/spec/integration/braintree/document_upload_spec.rb +87 -0
- 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 +72 -0
- data/spec/integration/braintree/http_spec.rb +12 -4
- data/spec/integration/braintree/merchant_account_spec.rb +74 -26
- data/spec/integration/braintree/merchant_spec.rb +39 -13
- data/spec/integration/braintree/oauth_spec.rb +18 -25
- data/spec/integration/braintree/payment_method_nonce_spec.rb +239 -5
- data/spec/integration/braintree/payment_method_spec.rb +882 -300
- data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +416 -0
- data/spec/integration/braintree/paypal_account_spec.rb +32 -31
- data/spec/integration/braintree/plan_spec.rb +82 -0
- data/spec/integration/braintree/samsung_pay_card_spec.rb +144 -0
- data/spec/integration/braintree/sepa_direct_debit_account_spec.rb +196 -0
- data/spec/integration/braintree/settlement_batch_summary_spec.rb +8 -8
- data/spec/integration/braintree/subscription_spec.rb +274 -180
- data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
- data/spec/integration/braintree/test_transaction_spec.rb +18 -18
- data/spec/integration/braintree/transaction_line_item_spec.rb +38 -0
- data/spec/integration/braintree/transaction_search_spec.rb +280 -152
- data/spec/integration/braintree/transaction_spec.rb +3709 -1175
- data/spec/integration/braintree/transaction_us_bank_account_spec.rb +438 -0
- data/spec/integration/braintree/us_bank_account_spec.rb +38 -17
- data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +178 -0
- data/spec/integration/braintree/us_bank_account_verification_spec.rb +240 -0
- data/spec/integration/braintree/visa_checkout_card_spec.rb +5 -5
- data/spec/integration/spec_helper.rb +27 -6
- data/spec/oauth_test_helper.rb +1 -1
- data/spec/script/httpsd.rb +6 -6
- data/spec/spec_helper.rb +26 -23
- data/spec/unit/braintree/address_spec.rb +1 -9
- data/spec/unit/braintree/apple_pay_card_spec.rb +104 -4
- data/spec/unit/braintree/client_token_spec.rb +2 -2
- data/spec/unit/braintree/configuration_spec.rb +108 -33
- data/spec/unit/braintree/credit_card_spec.rb +62 -33
- data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +51 -0
- data/spec/unit/braintree/credit_card_verification_search_spec.rb +1 -1
- data/spec/unit/braintree/credit_card_verification_spec.rb +39 -6
- data/spec/unit/braintree/customer_spec.rb +107 -27
- data/spec/unit/braintree/disbursement_spec.rb +59 -7
- data/spec/unit/braintree/dispute_search_spec.rb +66 -0
- data/spec/unit/braintree/dispute_spec.rb +472 -8
- data/spec/unit/braintree/document_upload_spec.rb +35 -0
- 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 +93 -5
- data/spec/unit/braintree/local_payment_completed_spec.rb +50 -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/modification_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 +51 -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 +40 -6
- 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/subscription_search_spec.rb +1 -1
- data/spec/unit/braintree/subscription_spec.rb +2 -2
- data/spec/unit/braintree/successful_result_spec.rb +1 -1
- data/spec/unit/braintree/three_d_secure_info_spec.rb +34 -6
- data/spec/unit/braintree/transaction/credit_card_details_spec.rb +19 -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 +63 -0
- data/spec/unit/braintree/transaction/sepa_direct_debit_account_details_spec.rb +33 -0
- data/spec/unit/braintree/transaction_gateway_spec.rb +111 -0
- data/spec/unit/braintree/transaction_search_spec.rb +12 -12
- data/spec/unit/braintree/transaction_spec.rb +171 -55
- data/spec/unit/braintree/us_bank_account_verification_search_spec.rb +60 -0
- data/spec/unit/braintree/us_bank_account_verification_spec.rb +93 -0
- data/spec/unit/braintree/util_spec.rb +162 -19
- data/spec/unit/braintree/validation_error_collection_spec.rb +336 -133
- data/spec/unit/braintree/venmo_profile_data_spec.rb +32 -0
- data/spec/unit/braintree/webhook_notification_spec.rb +546 -114
- data/spec/unit/braintree/xml/parser_spec.rb +21 -16
- data/spec/unit/braintree/xml_spec.rb +31 -24
- data/spec/unit/braintree_spec.rb +1 -0
- metadata +290 -198
- data/README.rdoc +0 -93
- data/lib/braintree/amex_express_checkout_card.rb +0 -26
- data/lib/braintree/android_pay_card.rb +0 -35
- data/lib/braintree/coinbase_account.rb +0 -25
- data/lib/braintree/europe_bank_account.rb +0 -34
- data/lib/braintree/europe_bank_account_gateway.rb +0 -17
- data/lib/braintree/ideal_payment.rb +0 -46
- data/lib/braintree/ideal_payment_gateway.rb +0 -18
- data/lib/braintree/masterpass_card.rb +0 -66
- data/lib/braintree/settlement_batch.rb +0 -0
- data/lib/braintree/transaction/amex_express_checkout_details.rb +0 -14
- data/lib/braintree/transaction/android_pay_details.rb +0 -17
- data/lib/braintree/transaction/ideal_payment_details.rb +0 -13
- 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/httpsd.pid +0 -1
- data/spec/integration/braintree/coinbase_spec.rb +0 -31
- data/spec/integration/braintree/ideal_payment_spec.rb +0 -87
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: bfe8849002c4dbacd2476b61311adc19f0939a2c42bb61ccf2ca797d59248054
|
4
|
+
data.tar.gz: 7f97e328fdd729365a0117bc8297edac4e12e8e383e8c7b10b06f74862bd8e34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20e3ed69efa6b094974b3461165a3197958df6e62be5f9952d676d14c7411bdae5c2169b2f0e86eab743a94475f436baf3b907ff1dab4a45e984eafa741e3356
|
7
|
+
data.tar.gz: b7e5bcbe3a4c57e6aa2a60016e93b0adff02b9dd51601370d94f08d56307e319b19381274e032eb8bd80fffa4ecf5a8c601c3da9e17e38526a8860d981a7d471
|
data/LICENSE
CHANGED
data/braintree.gemspec
CHANGED
@@ -1,18 +1,24 @@
|
|
1
1
|
$:.push File.expand_path("../lib", __FILE__)
|
2
|
-
require
|
2
|
+
require "braintree/version"
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "braintree"
|
6
|
-
s.summary = "Braintree
|
7
|
-
s.description = "
|
6
|
+
s.summary = "Braintree Ruby Server SDK"
|
7
|
+
s.description = "Resources and tools for developers to integrate Braintree's global payments platform."
|
8
8
|
s.version = Braintree::Version::String
|
9
9
|
s.license = "MIT"
|
10
10
|
s.author = "Braintree"
|
11
11
|
s.email = "code@getbraintree.com"
|
12
|
-
s.homepage = "
|
13
|
-
s.rubyforge_project = "braintree"
|
14
|
-
s.has_rdoc = false
|
12
|
+
s.homepage = "https://www.braintreepayments.com/"
|
15
13
|
s.files = Dir.glob ["README.rdoc", "LICENSE", "lib/**/*.{rb,crt}", "spec/**/*", "*.gemspec"]
|
16
|
-
s.add_dependency "builder", ">= 2.
|
14
|
+
s.add_dependency "builder", ">= 3.2.4"
|
15
|
+
s.add_dependency "rexml", ">= 3.1.9" # Use rexml version associated with minimum supported Ruby version
|
16
|
+
s.required_ruby_version = ">=2.6.0"
|
17
|
+
s.metadata = {
|
18
|
+
"bug_tracker_uri" => "https://github.com/braintree/braintree_ruby/issues",
|
19
|
+
"changelog_uri" => "https://github.com/braintree/braintree_ruby/blob/master/CHANGELOG.md",
|
20
|
+
"source_code_uri" => "https://github.com/braintree/braintree_ruby",
|
21
|
+
"documentation_uri" => "https://developer.paypal.com/braintree/docs"
|
22
|
+
}
|
17
23
|
end
|
18
24
|
|
@@ -2,13 +2,13 @@ module Braintree
|
|
2
2
|
class AccountUpdaterDailyReport # :nodoc:
|
3
3
|
include BaseModule
|
4
4
|
|
5
|
-
attr_reader :report_url
|
6
5
|
attr_reader :report_date
|
6
|
+
attr_reader :report_url
|
7
7
|
|
8
8
|
class << self
|
9
9
|
protected :new
|
10
10
|
def _new(*args) # :nodoc:
|
11
|
-
self.new
|
11
|
+
self.new(*args)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -29,6 +29,7 @@ module Braintree
|
|
29
29
|
["Bermuda", "BM", "BMU", "060"],
|
30
30
|
["Bhutan", "BT", "BTN", "064"],
|
31
31
|
["Bolivia", "BO", "BOL", "068"],
|
32
|
+
["Bonaire, Sint Eustatius and Saba", "BQ", "BES", "535"],
|
32
33
|
["Bosnia and Herzegovina", "BA", "BIH", "070"],
|
33
34
|
["Botswana", "BW", "BWA", "072"],
|
34
35
|
["Bouvet Island", "BV", "BVT", "074"],
|
@@ -58,6 +59,7 @@ module Braintree
|
|
58
59
|
["Côte d'Ivoire", "CI", "CIV", "384"],
|
59
60
|
["Croatia", "HR", "HRV", "191"],
|
60
61
|
["Cuba", "CU", "CUB", "192"],
|
62
|
+
["Curaçao", "CW", "CUW", "531"],
|
61
63
|
["Cyprus", "CY", "CYP", "196"],
|
62
64
|
["Czech Republic", "CZ", "CZE", "203"],
|
63
65
|
["Denmark", "DK", "DNK", "208"],
|
@@ -156,7 +158,6 @@ module Braintree
|
|
156
158
|
["Nauru", "NR", "NRU", "520"],
|
157
159
|
["Nepal", "NP", "NPL", "524"],
|
158
160
|
["Netherlands", "NL", "NLD", "528"],
|
159
|
-
["Netherlands Antilles", "AN", "ANT", "530"],
|
160
161
|
["New Caledonia", "NC", "NCL", "540"],
|
161
162
|
["New Zealand", "NZ", "NZL", "554"],
|
162
163
|
["Nicaragua", "NI", "NIC", "558"],
|
@@ -200,12 +201,14 @@ module Braintree
|
|
200
201
|
["Seychelles", "SC", "SYC", "690"],
|
201
202
|
["Sierra Leone", "SL", "SLE", "694"],
|
202
203
|
["Singapore", "SG", "SGP", "702"],
|
204
|
+
["Sint Maarten (Dutch part)", "SX", "SXM", "534"],
|
203
205
|
["Slovakia", "SK", "SVK", "703"],
|
204
206
|
["Slovenia", "SI", "SVN", "705"],
|
205
207
|
["Solomon Islands", "SB", "SLB", "090"],
|
206
208
|
["Somalia", "SO", "SOM", "706"],
|
207
209
|
["South Africa", "ZA", "ZAF", "710"],
|
208
210
|
["South Georgia and South Sandwich Islands", "GS", "SGS", "239"],
|
211
|
+
["South Sudan", "SS", "SSD", "728"],
|
209
212
|
["Spain", "ES", "ESP", "724"],
|
210
213
|
["Sri Lanka", "LK", "LKA", "144"],
|
211
214
|
["Sudan", "SD", "SDN", "736"],
|
data/lib/braintree/address.rb
CHANGED
@@ -2,32 +2,46 @@ module Braintree
|
|
2
2
|
class Address
|
3
3
|
include BaseModule # :nodoc:
|
4
4
|
|
5
|
-
attr_reader :company
|
6
|
-
|
7
|
-
|
5
|
+
attr_reader :company
|
6
|
+
attr_reader :country_code_alpha2
|
7
|
+
attr_reader :country_code_alpha3
|
8
|
+
attr_reader :country_code_numeric
|
9
|
+
attr_reader :country_name
|
10
|
+
attr_reader :created_at
|
11
|
+
attr_reader :customer_id
|
12
|
+
attr_reader :extended_address
|
13
|
+
attr_reader :first_name
|
14
|
+
attr_reader :id
|
15
|
+
attr_reader :last_name
|
16
|
+
attr_reader :locality
|
17
|
+
attr_reader :phone_number
|
18
|
+
attr_reader :postal_code
|
19
|
+
attr_reader :region
|
20
|
+
attr_reader :street_address
|
21
|
+
attr_reader :updated_at
|
8
22
|
|
9
|
-
def self.create(
|
10
|
-
Configuration.gateway.address.create(
|
23
|
+
def self.create(*args)
|
24
|
+
Configuration.gateway.address.create(*args)
|
11
25
|
end
|
12
26
|
|
13
|
-
def self.create!(
|
14
|
-
|
27
|
+
def self.create!(*args)
|
28
|
+
Configuration.gateway.address.create!(*args)
|
15
29
|
end
|
16
30
|
|
17
|
-
def self.delete(
|
18
|
-
Configuration.gateway.address.delete(
|
31
|
+
def self.delete(*args)
|
32
|
+
Configuration.gateway.address.delete(*args)
|
19
33
|
end
|
20
34
|
|
21
|
-
def self.find(
|
22
|
-
Configuration.gateway.address.find(
|
35
|
+
def self.find(*args)
|
36
|
+
Configuration.gateway.address.find(*args)
|
23
37
|
end
|
24
38
|
|
25
|
-
def self.update(
|
26
|
-
Configuration.gateway.address.update(
|
39
|
+
def self.update(*args)
|
40
|
+
Configuration.gateway.address.update(*args)
|
27
41
|
end
|
28
42
|
|
29
|
-
def self.update!(
|
30
|
-
|
43
|
+
def self.update!(*args)
|
44
|
+
Configuration.gateway.address.update!(*args)
|
31
45
|
end
|
32
46
|
|
33
47
|
def initialize(gateway, attributes) # :nodoc:
|
@@ -40,34 +54,12 @@ module Braintree
|
|
40
54
|
id == other.id && customer_id == other.customer_id
|
41
55
|
end
|
42
56
|
|
43
|
-
# Deprecated. Use Braintree::Address.delete
|
44
|
-
def delete
|
45
|
-
warn "[DEPRECATED] delete as an instance method is deprecated. Please use Address.delete"
|
46
|
-
@gateway.address.delete(customer_id, self.id)
|
47
|
-
end
|
48
|
-
|
49
|
-
# Deprecated. Use Braintree::Address.update
|
50
|
-
def update(attributes)
|
51
|
-
warn "[DEPRECATED] update as an instance method is deprecated. Please use Address.update"
|
52
|
-
result = @gateway.address.update(customer_id, id, attributes)
|
53
|
-
if result.success?
|
54
|
-
copy_instance_variables_from_object result.address
|
55
|
-
end
|
56
|
-
result
|
57
|
-
end
|
58
|
-
|
59
|
-
# Deprecated. Use Braintree::Address.update!
|
60
|
-
def update!(attributes)
|
61
|
-
warn "[DEPRECATED] update! as an instance method is deprecated. Please use Address.update!"
|
62
|
-
return_object_or_raise(:address) { update(attributes) }
|
63
|
-
end
|
64
|
-
|
65
57
|
class << self
|
66
58
|
protected :new
|
67
59
|
end
|
68
60
|
|
69
61
|
def self._new(*args) # :nodoc:
|
70
|
-
self.new
|
62
|
+
self.new(*args)
|
71
63
|
end
|
72
64
|
end
|
73
65
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module Braintree
|
2
2
|
class AddressGateway # :nodoc
|
3
|
+
include BaseModule
|
4
|
+
|
3
5
|
def initialize(gateway)
|
4
6
|
@gateway = gateway
|
5
7
|
@config = gateway.config
|
@@ -24,6 +26,10 @@ module Braintree
|
|
24
26
|
end
|
25
27
|
end
|
26
28
|
|
29
|
+
def create!(*args)
|
30
|
+
return_object_or_raise(:address) { create(*args) }
|
31
|
+
end
|
32
|
+
|
27
33
|
def delete(customer_or_customer_id, address_id)
|
28
34
|
customer_id = _determine_customer_id(customer_or_customer_id)
|
29
35
|
@config.http.delete("#{@config.base_merchant_path}/customers/#{customer_id}/addresses/#{address_id}")
|
@@ -52,6 +58,10 @@ module Braintree
|
|
52
58
|
end
|
53
59
|
end
|
54
60
|
|
61
|
+
def update!(*args)
|
62
|
+
return_object_or_raise(:address) { update(*args) }
|
63
|
+
end
|
64
|
+
|
55
65
|
def _determine_customer_id(customer_or_customer_id) # :nodoc:
|
56
66
|
customer_id = customer_or_customer_id.is_a?(Customer) ? customer_or_customer_id.id : customer_or_customer_id
|
57
67
|
unless customer_id =~ /\A[\w_-]+\z/
|
@@ -66,8 +76,8 @@ module Braintree
|
|
66
76
|
|
67
77
|
def self._shared_signature # :nodoc:
|
68
78
|
[:company, :country_code_alpha2, :country_code_alpha3, :country_code_numeric,
|
69
|
-
:country_name, :extended_address, :first_name,
|
70
|
-
:
|
79
|
+
:country_name, :extended_address, :first_name, :last_name, :locality, :phone_number,
|
80
|
+
:postal_code, :region, :street_address]
|
71
81
|
end
|
72
82
|
|
73
83
|
def self._update_signature # :nodoc:
|
@@ -62,6 +62,10 @@ module Braintree
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
+
class EndsWithNode < SearchNode # :nodoc:
|
66
|
+
operators :ends_with
|
67
|
+
end
|
68
|
+
|
65
69
|
class MultipleValueOrTextNode < MultipleValueNode
|
66
70
|
extend Forwardable
|
67
71
|
def_delegators :@text_node, :contains, :ends_with, :is, :is_not, :starts_with
|
@@ -129,6 +133,10 @@ module Braintree
|
|
129
133
|
_create_field_accessors(fields, DateRangeNode)
|
130
134
|
end
|
131
135
|
|
136
|
+
def self.ends_with_fields(*fields)
|
137
|
+
_create_field_accessors(fields, EndsWithNode)
|
138
|
+
end
|
139
|
+
|
132
140
|
def self._create_field_accessors(fields, node_class)
|
133
141
|
fields.each do |field|
|
134
142
|
define_method(field) do |*args|
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Braintree
|
2
|
+
class ApplePay
|
3
|
+
include BaseModule # :nodoc:
|
4
|
+
|
5
|
+
def initialize(gateway, attributes) # :nodoc:
|
6
|
+
set_instance_variables_from_hash(attributes)
|
7
|
+
end
|
8
|
+
|
9
|
+
class << self
|
10
|
+
protected :new
|
11
|
+
end
|
12
|
+
|
13
|
+
def self._new(*args) # :nodoc:
|
14
|
+
self.new(*args)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.register_domain(domain)
|
18
|
+
Configuration.gateway.apple_pay.register_domain(domain)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.unregister_domain(domain)
|
22
|
+
Configuration.gateway.apple_pay.unregister_domain(domain)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.registered_domains
|
26
|
+
Configuration.gateway.apple_pay.registered_domains
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -10,13 +10,37 @@ module Braintree
|
|
10
10
|
All = constants.map { |c| const_get(c) }
|
11
11
|
end
|
12
12
|
|
13
|
-
attr_reader :
|
14
|
-
|
15
|
-
|
13
|
+
attr_reader :billing_address
|
14
|
+
attr_reader :bin
|
15
|
+
attr_reader :card_type
|
16
|
+
attr_reader :cardholder_name
|
17
|
+
attr_reader :commercial
|
18
|
+
attr_reader :country_of_issuance
|
19
|
+
attr_reader :created_at
|
20
|
+
attr_reader :customer_id
|
21
|
+
attr_reader :debit
|
22
|
+
attr_reader :default
|
23
|
+
attr_reader :durbin_regulated
|
24
|
+
attr_reader :expiration_month
|
25
|
+
attr_reader :expiration_year
|
26
|
+
attr_reader :expired
|
27
|
+
attr_reader :healthcare
|
28
|
+
attr_reader :image_url
|
29
|
+
attr_reader :issuing_bank
|
30
|
+
attr_reader :last_4
|
31
|
+
attr_reader :payment_instrument_name
|
32
|
+
attr_reader :payroll
|
33
|
+
attr_reader :prepaid
|
34
|
+
attr_reader :product_id
|
35
|
+
attr_reader :source_description
|
36
|
+
attr_reader :subscriptions
|
37
|
+
attr_reader :token
|
38
|
+
attr_reader :updated_at
|
16
39
|
|
17
40
|
def initialize(gateway, attributes) # :nodoc:
|
18
41
|
@gateway = gateway
|
19
42
|
set_instance_variables_from_hash(attributes)
|
43
|
+
@billing_address = attributes[:billing_address] ? Address._new(@gateway, attributes[:billing_address]) : nil
|
20
44
|
@subscriptions = (@subscriptions || []).map { |subscription_hash| Subscription._new(@gateway, subscription_hash) }
|
21
45
|
end
|
22
46
|
|
@@ -33,7 +57,7 @@ module Braintree
|
|
33
57
|
end
|
34
58
|
|
35
59
|
def self._new(*args) # :nodoc:
|
36
|
-
self.new
|
60
|
+
self.new(*args)
|
37
61
|
end
|
38
62
|
end
|
39
63
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Braintree
|
2
|
+
class ApplePayGateway
|
3
|
+
def initialize(gateway)
|
4
|
+
@gateway = gateway
|
5
|
+
@config = gateway.config
|
6
|
+
end
|
7
|
+
|
8
|
+
def register_domain(domain)
|
9
|
+
response = @config.http.post("#{@config.base_merchant_path}/processing/apple_pay/validate_domains", :url => domain)
|
10
|
+
|
11
|
+
if response.has_key?(:response) && response[:response][:success]
|
12
|
+
Braintree::SuccessfulResult.new
|
13
|
+
elsif response[:api_error_response]
|
14
|
+
ErrorResult.new(@gateway, response[:api_error_response])
|
15
|
+
else
|
16
|
+
raise "expected :response or :api_error_response"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def unregister_domain(domain)
|
21
|
+
@config.http.delete("#{@config.base_merchant_path}/processing/apple_pay/unregister_domain", :url => CGI.escape(domain))
|
22
|
+
SuccessfulResult.new
|
23
|
+
end
|
24
|
+
|
25
|
+
def registered_domains
|
26
|
+
response = @config.http.get("#{@config.base_merchant_path}/processing/apple_pay/registered_domains")
|
27
|
+
|
28
|
+
if response.has_key?(:response)
|
29
|
+
Braintree::SuccessfulResult.new(:apple_pay_options => ApplePayOptions._new(response[:response]))
|
30
|
+
elsif response[:api_error_response]
|
31
|
+
ErrorResult.new(@gateway, response[:api_error_response])
|
32
|
+
else
|
33
|
+
raise "expected :response or :api_error_response"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Braintree
|
2
|
+
class ApplePayOptions
|
3
|
+
include BaseModule # :nodoc:
|
4
|
+
|
5
|
+
attr_reader :domains
|
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
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Braintree
|
2
|
+
class AuthorizationAdjustment # :nodoc:
|
3
|
+
include BaseModule
|
4
|
+
|
5
|
+
attr_reader :amount
|
6
|
+
attr_reader :success
|
7
|
+
attr_reader :timestamp
|
8
|
+
attr_reader :processor_response_code
|
9
|
+
attr_reader :processor_response_text
|
10
|
+
attr_reader :processor_response_type
|
11
|
+
|
12
|
+
class << self
|
13
|
+
protected :new
|
14
|
+
def _new(*args) # :nodoc:
|
15
|
+
self.new(*args)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def initialize(attributes) # :nodoc:
|
20
|
+
set_instance_variables_from_hash(attributes)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -18,6 +18,16 @@ module Braintree
|
|
18
18
|
|
19
19
|
def set_instance_variables_from_hash(hash)
|
20
20
|
hash.each do |key, value|
|
21
|
+
if key == :global_id
|
22
|
+
instance_variable_set "@graphql_id", value
|
23
|
+
elsif key == :android_pay_cards
|
24
|
+
instance_variable_set "@google_pay_cards", value
|
25
|
+
elsif key == :android_pay_card
|
26
|
+
instance_variable_set "@google_pay_card", value
|
27
|
+
elsif key == :android_pay_details
|
28
|
+
instance_variable_set "@google_pay_details", value
|
29
|
+
end
|
30
|
+
|
21
31
|
instance_variable_set "@#{key}", value
|
22
32
|
end
|
23
33
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Braintree
|
2
|
+
class BinData # :nodoc:
|
3
|
+
include BaseModule
|
4
|
+
|
5
|
+
attr_reader :commercial
|
6
|
+
attr_reader :country_of_issuance
|
7
|
+
attr_reader :debit
|
8
|
+
attr_reader :durbin_regulated
|
9
|
+
attr_reader :healthcare
|
10
|
+
attr_reader :issuing_bank
|
11
|
+
attr_reader :payroll
|
12
|
+
attr_reader :prepaid
|
13
|
+
attr_reader :product_id
|
14
|
+
|
15
|
+
def initialize(attributes)
|
16
|
+
set_instance_variables_from_hash attributes unless attributes.nil?
|
17
|
+
end
|
18
|
+
|
19
|
+
def inspect
|
20
|
+
formatted_attributes = self.class._attributes.map do |attr|
|
21
|
+
"#{attr}: #{send(attr).inspect}"
|
22
|
+
end
|
23
|
+
"#<#{self.class} #{formatted_attributes.join(", ")}>"
|
24
|
+
end
|
25
|
+
|
26
|
+
def self._attributes # :nodoc:
|
27
|
+
[
|
28
|
+
:commercial, :country_of_issuance, :debit, :durbin_regulated, :healthcare,
|
29
|
+
:issuing_bank, :payroll, :prepaid, :product_id
|
30
|
+
]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -1,11 +1,11 @@
|
|
1
|
-
require
|
1
|
+
require "json"
|
2
2
|
|
3
3
|
module Braintree
|
4
4
|
module ClientToken
|
5
5
|
DEFAULT_VERSION = 2
|
6
6
|
|
7
|
-
def self.generate(
|
8
|
-
Configuration.gateway.client_token.generate(
|
7
|
+
def self.generate(*args)
|
8
|
+
Configuration.gateway.client_token.generate(*args)
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module Braintree
|
2
2
|
class ClientTokenGateway
|
3
|
+
include BaseModule
|
4
|
+
|
3
5
|
def initialize(gateway)
|
4
6
|
@gateway = gateway
|
5
7
|
@config = gateway.config
|
@@ -26,7 +28,7 @@ module Braintree
|
|
26
28
|
def self._generate_signature # :nodoc:
|
27
29
|
[
|
28
30
|
:address_id, :customer_id, :proxy_merchant_id, :merchant_account_id,
|
29
|
-
:version,
|
31
|
+
:version,
|
30
32
|
{:options => [:make_default, :verify_card, :fail_on_duplicate_payment_method]}
|
31
33
|
]
|
32
34
|
end
|