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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a83d6966dbe837625c68efa0fdee683820705fba7c4c1f65118892d61ea2261b
|
4
|
+
data.tar.gz: f947bda53f860763dc3c57080ded11b1823e9c48e71efb05a89bb0490e7dad79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9a82a773ef66320358e028dbb9a403f6bcc97d7c32d727bff0b00a2936ab54ae8bbfba201024a7e8d5956ef17be0247b61f0e8e3cc23aecb819a5e77d833a9a
|
7
|
+
data.tar.gz: 21a069ff7615e48429c6882ed354334f37fd7e0600e6696b97b000178a03531955d6156dcd77b3927bc2d35a144ecafa07d65d2b6d9566d5202630bfac62cb37
|
data/LICENSE
CHANGED
data/braintree.gemspec
CHANGED
@@ -1,21 +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
12
|
s.homepage = "https://www.braintreepayments.com/"
|
13
13
|
s.files = Dir.glob ["README.rdoc", "LICENSE", "lib/**/*.{rb,crt}", "spec/**/*", "*.gemspec"]
|
14
|
-
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"
|
15
17
|
s.metadata = {
|
16
18
|
"bug_tracker_uri" => "https://github.com/braintree/braintree_ruby/issues",
|
17
19
|
"changelog_uri" => "https://github.com/braintree/braintree_ruby/blob/master/CHANGELOG.md",
|
18
20
|
"source_code_uri" => "https://github.com/braintree/braintree_ruby",
|
21
|
+
"documentation_uri" => "https://developer.paypal.com/braintree/docs"
|
19
22
|
}
|
20
23
|
end
|
21
24
|
|
data/lib/braintree/address.rb
CHANGED
@@ -14,6 +14,7 @@ module Braintree
|
|
14
14
|
attr_reader :id
|
15
15
|
attr_reader :last_name
|
16
16
|
attr_reader :locality
|
17
|
+
attr_reader :phone_number
|
17
18
|
attr_reader :postal_code
|
18
19
|
attr_reader :region
|
19
20
|
attr_reader :street_address
|
@@ -53,34 +54,12 @@ module Braintree
|
|
53
54
|
id == other.id && customer_id == other.customer_id
|
54
55
|
end
|
55
56
|
|
56
|
-
# Deprecated. Use Braintree::Address.delete
|
57
|
-
def delete
|
58
|
-
warn "[DEPRECATED] delete as an instance method is deprecated. Please use Address.delete"
|
59
|
-
@gateway.address.delete(customer_id, self.id)
|
60
|
-
end
|
61
|
-
|
62
|
-
# Deprecated. Use Braintree::Address.update
|
63
|
-
def update(attributes)
|
64
|
-
warn "[DEPRECATED] update as an instance method is deprecated. Please use Address.update"
|
65
|
-
result = @gateway.address.update(customer_id, id, attributes)
|
66
|
-
if result.success?
|
67
|
-
copy_instance_variables_from_object result.address
|
68
|
-
end
|
69
|
-
result
|
70
|
-
end
|
71
|
-
|
72
|
-
# Deprecated. Use Braintree::Address.update!
|
73
|
-
def update!(attributes)
|
74
|
-
warn "[DEPRECATED] update! as an instance method is deprecated. Please use Address.update!"
|
75
|
-
return_object_or_raise(:address) { update(attributes) }
|
76
|
-
end
|
77
|
-
|
78
57
|
class << self
|
79
58
|
protected :new
|
80
59
|
end
|
81
60
|
|
82
61
|
def self._new(*args) # :nodoc:
|
83
|
-
self.new
|
62
|
+
self.new(*args)
|
84
63
|
end
|
85
64
|
end
|
86
65
|
end
|
data/lib/braintree/apple_pay.rb
CHANGED
@@ -12,15 +12,25 @@ module Braintree
|
|
12
12
|
|
13
13
|
attr_reader :bin
|
14
14
|
attr_reader :card_type
|
15
|
+
attr_reader :cardholder_name
|
16
|
+
attr_reader :commercial
|
17
|
+
attr_reader :country_of_issuance
|
15
18
|
attr_reader :created_at
|
16
19
|
attr_reader :customer_id
|
20
|
+
attr_reader :debit
|
17
21
|
attr_reader :default
|
22
|
+
attr_reader :durbin_regulated
|
18
23
|
attr_reader :expiration_month
|
19
24
|
attr_reader :expiration_year
|
20
25
|
attr_reader :expired
|
26
|
+
attr_reader :healthcare
|
21
27
|
attr_reader :image_url
|
28
|
+
attr_reader :issuing_bank
|
22
29
|
attr_reader :last_4
|
23
30
|
attr_reader :payment_instrument_name
|
31
|
+
attr_reader :payroll
|
32
|
+
attr_reader :prepaid
|
33
|
+
attr_reader :product_id
|
24
34
|
attr_reader :source_description
|
25
35
|
attr_reader :subscriptions
|
26
36
|
attr_reader :token
|
@@ -45,7 +55,7 @@ module Braintree
|
|
45
55
|
end
|
46
56
|
|
47
57
|
def self._new(*args) # :nodoc:
|
48
|
-
self.new
|
58
|
+
self.new(*args)
|
49
59
|
end
|
50
60
|
end
|
51
61
|
end
|
@@ -20,6 +20,12 @@ module Braintree
|
|
20
20
|
hash.each do |key, value|
|
21
21
|
if key == :global_id
|
22
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
|
23
29
|
end
|
24
30
|
|
25
31
|
instance_variable_set "@#{key}", value
|
data/lib/braintree/bin_data.rb
CHANGED
@@ -17,10 +17,17 @@ module Braintree
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def inspect
|
20
|
-
|
20
|
+
formatted_attributes = self.class._attributes.map do |attr|
|
21
21
|
"#{attr}: #{send(attr).inspect}"
|
22
22
|
end
|
23
|
-
"
|
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
|
+
]
|
24
31
|
end
|
25
32
|
end
|
26
33
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Braintree
|
2
2
|
class Configuration
|
3
|
-
API_VERSION = "
|
3
|
+
API_VERSION = "6" # :nodoc:
|
4
4
|
DEFAULT_ENDPOINT = "api" # :nodoc:
|
5
5
|
GRAPHQL_API_VERSION = "2018-09-10" # :nodoc:
|
6
6
|
|
@@ -40,12 +40,12 @@ module Braintree
|
|
40
40
|
]
|
41
41
|
|
42
42
|
class << self
|
43
|
-
attr_writer
|
44
|
-
attr_reader
|
43
|
+
attr_writer(*WRITABLE_ATTRIBUTES)
|
44
|
+
attr_reader(*NON_REQUIRED_READABLE_ATTRIBUTES)
|
45
45
|
end
|
46
|
-
attr_reader
|
47
|
-
attr_reader
|
48
|
-
attr_writer
|
46
|
+
attr_reader(*READABLE_ATTRIBUTES)
|
47
|
+
attr_reader(*NON_REQUIRED_READABLE_ATTRIBUTES)
|
48
|
+
attr_writer(*WRITABLE_ATTRIBUTES)
|
49
49
|
|
50
50
|
def self.expectant_reader(*attributes) # :nodoc:
|
51
51
|
attributes.each do |attribute|
|
@@ -56,7 +56,7 @@ module Braintree
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
59
|
-
expectant_reader
|
59
|
+
expectant_reader(*READABLE_ATTRIBUTES)
|
60
60
|
|
61
61
|
# Sets the Braintree environment to use. Valid values are <tt>:sandbox</tt> and <tt>:production</tt>
|
62
62
|
def self.environment=(env)
|
@@ -86,7 +86,7 @@ module Braintree
|
|
86
86
|
:proxy_port => proxy_port,
|
87
87
|
:proxy_user => proxy_user,
|
88
88
|
:proxy_pass => proxy_pass,
|
89
|
-
:ssl_version => ssl_version
|
89
|
+
:ssl_version => ssl_version,
|
90
90
|
)
|
91
91
|
end
|
92
92
|
|
@@ -205,7 +205,7 @@ module Braintree
|
|
205
205
|
def port # :nodoc:
|
206
206
|
case @environment
|
207
207
|
when :development, :integration
|
208
|
-
ENV[
|
208
|
+
ENV["GATEWAY_PORT"] || 3000
|
209
209
|
when :production, :qa, :sandbox
|
210
210
|
443
|
211
211
|
end
|
@@ -214,7 +214,7 @@ module Braintree
|
|
214
214
|
def graphql_port # :nodoc:
|
215
215
|
case @environment
|
216
216
|
when :development, :integration
|
217
|
-
ENV[
|
217
|
+
ENV["GRAPHQL_PORT"] || 8080
|
218
218
|
when :production, :qa, :sandbox
|
219
219
|
443
|
220
220
|
end
|
@@ -235,7 +235,7 @@ module Braintree
|
|
235
235
|
def server # :nodoc:
|
236
236
|
case @environment
|
237
237
|
when :development, :integration
|
238
|
-
ENV[
|
238
|
+
ENV["GATEWAY_HOST"] || "localhost"
|
239
239
|
when :production
|
240
240
|
"#{endpoint}.braintreegateway.com"
|
241
241
|
when :qa
|
@@ -248,7 +248,7 @@ module Braintree
|
|
248
248
|
def graphql_server # :nodoc:
|
249
249
|
case @environment
|
250
250
|
when :development, :integration
|
251
|
-
ENV[
|
251
|
+
ENV["GRAPHQL_HOST"] || "graphql.bt.local"
|
252
252
|
when :production
|
253
253
|
"payments.braintree-api.com"
|
254
254
|
when :qa
|
@@ -70,18 +70,6 @@ module Braintree
|
|
70
70
|
Configuration.gateway.credit_card.create!(*args)
|
71
71
|
end
|
72
72
|
|
73
|
-
# Deprecated. Use Braintree::TransparentRedirect.url
|
74
|
-
def self.create_credit_card_url
|
75
|
-
warn "[DEPRECATED] CreditCard.create_credit_card_url is deprecated. Please use TransparentRedirect.url"
|
76
|
-
Configuration.gateway.credit_card.create_credit_card_url
|
77
|
-
end
|
78
|
-
|
79
|
-
# Deprecated. Use Braintree::TransparentRedirect.confirm
|
80
|
-
def self.create_from_transparent_redirect(query_string)
|
81
|
-
warn "[DEPRECATED] CreditCard.create_from_transparent_redirect is deprecated. Please use TransparentRedirect.confirm"
|
82
|
-
Configuration.gateway.credit_card.create_from_transparent_redirect(query_string)
|
83
|
-
end
|
84
|
-
|
85
73
|
def self.credit(token, transaction_attributes)
|
86
74
|
Transaction.credit(transaction_attributes.merge(:payment_method_token => token))
|
87
75
|
end
|
@@ -110,11 +98,6 @@ module Braintree
|
|
110
98
|
Configuration.gateway.credit_card.from_nonce(*args)
|
111
99
|
end
|
112
100
|
|
113
|
-
# Deprecated. Use Braintree::PaymentMethod.grant
|
114
|
-
def self.grant(*args)
|
115
|
-
Configuration.gateway.credit_card.grant(*args)
|
116
|
-
end
|
117
|
-
|
118
101
|
def self.sale(token, transaction_attributes)
|
119
102
|
Configuration.gateway.transaction.sale(transaction_attributes.merge(:payment_method_token => token))
|
120
103
|
end
|
@@ -131,18 +114,6 @@ module Braintree
|
|
131
114
|
Configuration.gateway.credit_card.update!(*args)
|
132
115
|
end
|
133
116
|
|
134
|
-
# Deprecated. Use Braintree::TransparentRedirect.confirm
|
135
|
-
def self.update_from_transparent_redirect(query_string)
|
136
|
-
warn "[DEPRECATED] CreditCard.update_via_transparent_redirect_request is deprecated. Please use TransparentRedirect.confirm"
|
137
|
-
Configuration.gateway.credit_card.update_from_transparent_redirect(query_string)
|
138
|
-
end
|
139
|
-
|
140
|
-
# Deprecated. Use Braintree::TransparentRedirect.url
|
141
|
-
def self.update_credit_card_url
|
142
|
-
warn "[DEPRECATED] CreditCard.update_credit_card_url is deprecated. Please use TransparentRedirect.url"
|
143
|
-
Configuration.gateway.credit_card.update_credit_card_url
|
144
|
-
end
|
145
|
-
|
146
117
|
def initialize(gateway, attributes) # :nodoc:
|
147
118
|
@gateway = gateway
|
148
119
|
set_instance_variables_from_hash(attributes)
|
@@ -152,28 +123,10 @@ module Braintree
|
|
152
123
|
end
|
153
124
|
|
154
125
|
def _most_recent_verification(attributes)
|
155
|
-
verification = (attributes[:verifications] || []).sort_by{ |verification| verification[:created_at] }.reverse.first
|
126
|
+
verification = (attributes[:verifications] || []).sort_by { |verification| verification[:created_at] }.reverse.first
|
156
127
|
CreditCardVerification._new(verification) if verification
|
157
128
|
end
|
158
129
|
|
159
|
-
# Deprecated. Use Braintree::CreditCard.credit
|
160
|
-
def credit(transaction_attributes)
|
161
|
-
warn "[DEPRECATED] credit as an instance method is deprecated. Please use CreditCard.credit"
|
162
|
-
@gateway.transaction.credit(transaction_attributes.merge(:payment_method_token => token))
|
163
|
-
end
|
164
|
-
|
165
|
-
# Deprecated. Use Braintree::CreditCard.credit!
|
166
|
-
def credit!(transaction_attributes)
|
167
|
-
warn "[DEPRECATED] credit! as an instance method is deprecated. Please use CreditCard.credit!"
|
168
|
-
return_object_or_raise(:transaction) { credit(transaction_attributes) }
|
169
|
-
end
|
170
|
-
|
171
|
-
# Deprecated. Use Braintree::CreditCard.delete
|
172
|
-
def delete
|
173
|
-
warn "[DEPRECATED] delete as an instance method is deprecated. Please use CreditCard.delete"
|
174
|
-
@gateway.credit_card.delete(token)
|
175
|
-
end
|
176
|
-
|
177
130
|
# Returns true if this credit card is the customer's default payment method.
|
178
131
|
def default?
|
179
132
|
@default
|
@@ -202,34 +155,6 @@ module Braintree
|
|
202
155
|
"#{bin}******#{last_4}"
|
203
156
|
end
|
204
157
|
|
205
|
-
# Deprecated. Use Braintree::CreditCard.sale
|
206
|
-
def sale(transaction_attributes)
|
207
|
-
warn "[DEPRECATED] sale as an instance method is deprecated. Please use CreditCard.sale"
|
208
|
-
@gateway.transaction.sale(transaction_attributes.merge(:payment_method_token => token))
|
209
|
-
end
|
210
|
-
|
211
|
-
# Deprecated. Use Braintree::CreditCard.sale!
|
212
|
-
def sale!(transaction_attributes)
|
213
|
-
warn "[DEPRECATED] sale! as an instance method is deprecated. Please use CreditCard.sale!"
|
214
|
-
return_object_or_raise(:transaction) { sale(transaction_attributes) }
|
215
|
-
end
|
216
|
-
|
217
|
-
# Deprecated. Use Braintree::CreditCard.update
|
218
|
-
def update(attributes)
|
219
|
-
warn "[DEPRECATED] update as an instance method is deprecated. Please use CreditCard.update"
|
220
|
-
result = @gateway.credit_card.update(token, attributes)
|
221
|
-
if result.success?
|
222
|
-
copy_instance_variables_from_object result.credit_card
|
223
|
-
end
|
224
|
-
result
|
225
|
-
end
|
226
|
-
|
227
|
-
# Deprecated. Use Braintree::CreditCard.update!
|
228
|
-
def update!(attributes)
|
229
|
-
warn "[DEPRECATED] update! as an instance method is deprecated. Please use CreditCard.update!"
|
230
|
-
return_object_or_raise(:credit_card) { update(attributes) }
|
231
|
-
end
|
232
|
-
|
233
158
|
def nonce
|
234
159
|
@nonce ||= PaymentMethodNonce.create(token)
|
235
160
|
end
|
@@ -256,7 +181,7 @@ module Braintree
|
|
256
181
|
end
|
257
182
|
|
258
183
|
def self._new(*args) # :nodoc:
|
259
|
-
self.new
|
184
|
+
self.new(*args)
|
260
185
|
end
|
261
186
|
end
|
262
187
|
end
|
@@ -20,17 +20,6 @@ module Braintree
|
|
20
20
|
return_object_or_raise(:credit_card) { create(*args) }
|
21
21
|
end
|
22
22
|
|
23
|
-
# Deprecated
|
24
|
-
def create_credit_card_url
|
25
|
-
"#{@config.base_merchant_url}/payment_methods/all/create_via_transparent_redirect_request"
|
26
|
-
end
|
27
|
-
|
28
|
-
# Deprecated
|
29
|
-
def create_from_transparent_redirect(query_string)
|
30
|
-
params = @gateway.transparent_redirect.parse_and_validate_query_string query_string
|
31
|
-
_do_create("/payment_methods/all/confirm_transparent_redirect_request", :id => params[:id])
|
32
|
-
end
|
33
|
-
|
34
23
|
def credit(token, transaction_attributes)
|
35
24
|
@gateway.transaction.credit(transaction_attributes.merge(:payment_method_token => token))
|
36
25
|
end
|
@@ -49,8 +38,8 @@ module Braintree
|
|
49
38
|
end
|
50
39
|
|
51
40
|
def expiring_between(start_date, end_date, options = {})
|
52
|
-
formatted_start_date = start_date.strftime(
|
53
|
-
formatted_end_date = end_date.strftime(
|
41
|
+
formatted_start_date = start_date.strftime("%m%Y")
|
42
|
+
formatted_end_date = end_date.strftime("%m%Y")
|
54
43
|
response = @config.http.post("#{@config.base_merchant_path}/payment_methods/all/expiring_ids?start=#{formatted_start_date}&end=#{formatted_end_date}")
|
55
44
|
ResourceCollection.new(response) { |ids| _fetch_expiring_between(formatted_start_date, formatted_end_date, ids) }
|
56
45
|
end
|
@@ -71,11 +60,6 @@ module Braintree
|
|
71
60
|
raise NotFoundError, "nonce #{nonce.inspect} locked, consumed, or not found"
|
72
61
|
end
|
73
62
|
|
74
|
-
# Deprecated in favor of PaymentMethodGateway.grant
|
75
|
-
def grant(token, allow_vaulting)
|
76
|
-
@gateway.payment_method.grant(token, allow_vaulting)
|
77
|
-
end
|
78
|
-
|
79
63
|
def update(token, attributes)
|
80
64
|
Util.verify_keys(CreditCardGateway._update_signature, attributes)
|
81
65
|
_do_update(:put, "/payment_methods/credit_card/#{token}", :credit_card => attributes)
|
@@ -85,19 +69,6 @@ module Braintree
|
|
85
69
|
return_object_or_raise(:credit_card) { update(*args) }
|
86
70
|
end
|
87
71
|
|
88
|
-
# Deprecated
|
89
|
-
def update_from_transparent_redirect(query_string)
|
90
|
-
warn "[DEPRECATED] CreditCard.update_via_transparent_redirect_request is deprecated. Please use TransparentRedirect.confirm"
|
91
|
-
params = @gateway.transparent_redirect.parse_and_validate_query_string query_string
|
92
|
-
_do_update(:post, "/payment_methods/all/confirm_transparent_redirect_request", :id => params[:id])
|
93
|
-
end
|
94
|
-
|
95
|
-
# Deprecated
|
96
|
-
def update_credit_card_url
|
97
|
-
warn "[DEPRECATED] CreditCard.update_credit_card_url is deprecated. Please use TransparentRedirect.url"
|
98
|
-
"#{@config.base_merchant_url}/payment_methods/all/update_via_transparent_redirect_request"
|
99
|
-
end
|
100
|
-
|
101
72
|
def self._create_signature # :nodoc:
|
102
73
|
_signature(:create)
|
103
74
|
end
|
@@ -108,11 +79,21 @@ module Braintree
|
|
108
79
|
|
109
80
|
def self._signature(type) # :nodoc:
|
110
81
|
billing_address_params = AddressGateway._shared_signature
|
111
|
-
options = [
|
82
|
+
options = [
|
83
|
+
:fail_on_duplicate_payment_method,
|
84
|
+
:make_default,
|
85
|
+
:skip_advanced_fraud_checking,
|
86
|
+
:venmo_sdk_session,
|
87
|
+
:verification_account_type,
|
88
|
+
:verification_amount,
|
89
|
+
:verification_currency_iso_code,
|
90
|
+
:verification_merchant_account_id,
|
91
|
+
:verify_card
|
92
|
+
]
|
112
93
|
signature = [
|
113
|
-
:billing_address_id, :cardholder_name, :cvv, :
|
114
|
-
:
|
115
|
-
:
|
94
|
+
:billing_address_id, :cardholder_name, :cvv, :expiration_date, :expiration_month,
|
95
|
+
:expiration_year, :number, :token, :venmo_sdk_payment_method_code, :device_data,
|
96
|
+
:payment_method_nonce,
|
116
97
|
{:external_vault => [:network_transaction_id]},
|
117
98
|
{:options => options},
|
118
99
|
{:billing_address => billing_address_params}
|
@@ -174,7 +155,7 @@ module Braintree
|
|
174
155
|
def _fetch_expiring_between(formatted_start_date, formatted_end_date, ids) # :nodoc:
|
175
156
|
response = @config.http.post(
|
176
157
|
"#{@config.base_merchant_path}/payment_methods/all/expiring?start=#{formatted_start_date}&end=#{formatted_end_date}",
|
177
|
-
:search => {:ids => ids}
|
158
|
+
:search => {:ids => ids},
|
178
159
|
)
|
179
160
|
attributes = response[:payment_methods]
|
180
161
|
Util.extract_attribute_as_array(attributes, :credit_card).map { |attrs| CreditCard._new(@gateway, attrs) }
|
@@ -3,11 +3,24 @@ module Braintree
|
|
3
3
|
include BaseModule
|
4
4
|
include Braintree::Util::IdEquality
|
5
5
|
|
6
|
+
module GatewayRejectionReason
|
7
|
+
ApplicationIncomplete = "application_incomplete"
|
8
|
+
AVS = "avs"
|
9
|
+
AVSAndCVV = "avs_and_cvv"
|
10
|
+
CVV = "cvv"
|
11
|
+
Duplicate = "duplicate"
|
12
|
+
Fraud = "fraud"
|
13
|
+
RiskThreshold = "risk_threshold"
|
14
|
+
ThreeDSecure = "three_d_secure"
|
15
|
+
TokenIssuance = "token_issuance"
|
16
|
+
Unrecognized = "unrecognized"
|
17
|
+
end
|
18
|
+
|
6
19
|
module Status
|
7
|
-
Failed =
|
8
|
-
GatewayRejected =
|
9
|
-
ProcessorDeclined =
|
10
|
-
Verified =
|
20
|
+
Failed = "failed"
|
21
|
+
GatewayRejected = "gateway_rejected"
|
22
|
+
ProcessorDeclined = "processor_declined"
|
23
|
+
Verified = "verified"
|
11
24
|
|
12
25
|
All = [Failed, GatewayRejected, ProcessorDeclined, Verified]
|
13
26
|
end
|
@@ -79,7 +92,7 @@ module Braintree
|
|
79
92
|
end
|
80
93
|
|
81
94
|
def self._new(*args) # :nodoc:
|
82
|
-
self.new
|
95
|
+
self.new(*args)
|
83
96
|
end
|
84
97
|
|
85
98
|
def self.find(*args)
|