braintree 4.14.0 → 4.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/braintree/account_updater_daily_report.rb +3 -3
- data/lib/braintree/ach_mandate.rb +1 -1
- data/lib/braintree/add_on_gateway.rb +1 -1
- data/lib/braintree/address.rb +4 -4
- data/lib/braintree/address_gateway.rb +5 -5
- data/lib/braintree/advanced_search.rb +10 -10
- data/lib/braintree/apple_pay.rb +3 -3
- data/lib/braintree/apple_pay_card.rb +3 -3
- data/lib/braintree/apple_pay_options.rb +3 -3
- data/lib/braintree/authorization_adjustment.rb +3 -3
- data/lib/braintree/base_module.rb +1 -1
- data/lib/braintree/bin_data.rb +2 -2
- data/lib/braintree/client_token_gateway.rb +1 -1
- data/lib/braintree/configuration.rb +22 -22
- 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 +22 -9
- data/lib/braintree/credit_card_gateway.rb +23 -11
- data/lib/braintree/credit_card_verification.rb +3 -3
- data/lib/braintree/credit_card_verification_search.rb +1 -1
- data/lib/braintree/customer.rb +5 -9
- data/lib/braintree/customer_gateway.rb +7 -7
- data/lib/braintree/customer_search.rb +1 -1
- data/lib/braintree/descriptor.rb +1 -1
- data/lib/braintree/digest.rb +1 -1
- data/lib/braintree/disbursement.rb +5 -5
- data/lib/braintree/discount_gateway.rb +1 -1
- data/lib/braintree/dispute/evidence.rb +1 -1
- data/lib/braintree/dispute/paypal_message.rb +1 -1
- data/lib/braintree/dispute/status_history.rb +1 -1
- data/lib/braintree/dispute/transaction.rb +1 -1
- data/lib/braintree/dispute/transaction_details.rb +1 -1
- data/lib/braintree/dispute.rb +3 -3
- data/lib/braintree/dispute_gateway.rb +1 -1
- data/lib/braintree/dispute_search.rb +1 -1
- data/lib/braintree/document_upload.rb +2 -2
- data/lib/braintree/document_upload_gateway.rb +3 -3
- data/lib/braintree/enriched_customer_data.rb +2 -2
- data/lib/braintree/error_result.rb +2 -3
- data/lib/braintree/errors.rb +3 -3
- data/lib/braintree/exceptions.rb +1 -2
- data/lib/braintree/exchange_rate.rb +2 -2
- data/lib/braintree/exchange_rate_quote.rb +3 -3
- data/lib/braintree/exchange_rate_quote_gateway.rb +1 -1
- data/lib/braintree/exchange_rate_quote_input.rb +3 -3
- data/lib/braintree/exchange_rate_quote_request.rb +3 -3
- data/lib/braintree/exchange_rate_quote_response.rb +3 -3
- data/lib/braintree/facilitated_details.rb +1 -1
- data/lib/braintree/facilitator_details.rb +1 -1
- data/lib/braintree/google_pay_card.rb +3 -3
- data/lib/braintree/granted_payment_instrument_update.rb +1 -1
- data/lib/braintree/graphql_client.rb +1 -1
- data/lib/braintree/http.rb +1 -1
- data/lib/braintree/local_payment_completed.rb +2 -2
- data/lib/braintree/local_payment_expired.rb +2 -2
- data/lib/braintree/local_payment_funded.rb +2 -2
- data/lib/braintree/local_payment_reversed.rb +2 -2
- data/lib/braintree/merchant.rb +3 -3
- data/lib/braintree/merchant_account.rb +2 -2
- data/lib/braintree/merchant_account_gateway.rb +9 -9
- data/lib/braintree/meta_checkout_card.rb +89 -0
- data/lib/braintree/meta_checkout_token.rb +88 -0
- data/lib/braintree/modification.rb +3 -3
- data/lib/braintree/oauth_credentials.rb +3 -3
- data/lib/braintree/paginated_collection.rb +2 -2
- data/lib/braintree/paginated_result.rb +1 -1
- data/lib/braintree/payment_instrument_type.rb +2 -0
- data/lib/braintree/payment_method_customer_data_updated_metadata.rb +2 -2
- data/lib/braintree/payment_method_gateway.rb +23 -10
- data/lib/braintree/payment_method_nonce.rb +4 -4
- data/lib/braintree/payment_method_nonce_details.rb +1 -1
- data/lib/braintree/payment_method_nonce_details_payer_info.rb +1 -1
- data/lib/braintree/payment_method_nonce_gateway.rb +1 -1
- data/lib/braintree/paypal_account.rb +1 -2
- data/lib/braintree/paypal_account_gateway.rb +5 -5
- data/lib/braintree/plan.rb +1 -1
- data/lib/braintree/plan_gateway.rb +2 -2
- data/lib/braintree/resource_collection.rb +2 -2
- data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
- data/lib/braintree/risk_data.rb +1 -1
- data/lib/braintree/samsung_pay_card.rb +5 -5
- data/lib/braintree/sepa_direct_debit_account.rb +2 -2
- data/lib/braintree/sepa_direct_debit_account_nonce_details.rb +1 -1
- 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 +2 -2
- data/lib/braintree/subscription_gateway.rb +6 -6
- data/lib/braintree/subscription_search.rb +1 -1
- data/lib/braintree/successful_result.rb +2 -2
- data/lib/braintree/test/credit_card.rb +7 -10
- data/lib/braintree/test/merchant_account.rb +1 -1
- data/lib/braintree/test/nonce.rb +4 -0
- 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 +1 -1
- data/lib/braintree/transaction/address_details.rb +1 -1
- data/lib/braintree/transaction/credit_card_details.rb +4 -1
- data/lib/braintree/transaction/customer_details.rb +1 -1
- data/lib/braintree/transaction/disbursement_details.rb +1 -1
- data/lib/braintree/transaction/local_payment_details.rb +2 -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/samsung_pay_card_details.rb +1 -1
- data/lib/braintree/transaction/sepa_direct_debit_account_details.rb +1 -1
- data/lib/braintree/transaction/status_details.rb +1 -1
- data/lib/braintree/transaction/subscription_details.rb +1 -1
- data/lib/braintree/transaction/us_bank_account_details.rb +1 -1
- data/lib/braintree/transaction/visa_checkout_card_details.rb +1 -1
- data/lib/braintree/transaction.rb +27 -20
- data/lib/braintree/transaction_gateway.rb +23 -12
- data/lib/braintree/transaction_line_item.rb +2 -2
- data/lib/braintree/transaction_line_item_gateway.rb +1 -1
- data/lib/braintree/transaction_review.rb +1 -1
- data/lib/braintree/transaction_search.rb +7 -6
- data/lib/braintree/unknown_payment_method.rb +1 -1
- data/lib/braintree/us_bank_account.rb +2 -2
- data/lib/braintree/us_bank_account_verification.rb +23 -15
- data/lib/braintree/us_bank_account_verification_search.rb +1 -1
- data/lib/braintree/util.rb +3 -3
- data/lib/braintree/validation_error.rb +1 -1
- data/lib/braintree/validation_error_collection.rb +3 -3
- data/lib/braintree/venmo_account.rb +3 -3
- data/lib/braintree/venmo_profile_data.rb +6 -4
- data/lib/braintree/version.rb +1 -1
- data/lib/braintree/visa_checkout_card.rb +7 -7
- data/lib/braintree/webhook_notification.rb +3 -2
- data/lib/braintree/webhook_notification_gateway.rb +3 -3
- data/lib/braintree/webhook_testing.rb +1 -1
- data/lib/braintree/webhook_testing_gateway.rb +18 -1
- data/lib/braintree/xml/generator.rb +1 -1
- data/lib/braintree/xml/libxml.rb +1 -1
- data/lib/braintree/xml/parser.rb +2 -2
- data/lib/braintree/xml/rexml.rb +2 -2
- data/lib/braintree/xml.rb +1 -1
- data/lib/braintree.rb +4 -1
- data/spec/integration/braintree/add_on_spec.rb +9 -9
- data/spec/integration/braintree/address_spec.rb +69 -69
- data/spec/integration/braintree/advanced_search_spec.rb +45 -45
- data/spec/integration/braintree/apple_pay_spec.rb +8 -8
- data/spec/integration/braintree/client_api/client_token_spec.rb +15 -15
- data/spec/integration/braintree/credit_card_spec.rb +223 -223
- data/spec/integration/braintree/credit_card_verification_search_spec.rb +16 -16
- data/spec/integration/braintree/credit_card_verification_spec.rb +52 -52
- data/spec/integration/braintree/customer_search_spec.rb +20 -20
- data/spec/integration/braintree/customer_spec.rb +313 -313
- 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 +0 -1
- data/spec/integration/braintree/dispute_spec.rb +87 -87
- data/spec/integration/braintree/document_upload_spec.rb +17 -17
- data/spec/integration/braintree/error_codes_spec.rb +2 -2
- data/spec/integration/braintree/http_spec.rb +28 -28
- data/spec/integration/braintree/merchant_account_spec.rb +127 -127
- data/spec/integration/braintree/merchant_spec.rb +103 -103
- data/spec/integration/braintree/oauth_spec.rb +61 -61
- data/spec/integration/braintree/payment_method_nonce_spec.rb +89 -69
- data/spec/integration/braintree/payment_method_spec.rb +389 -389
- data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +150 -78
- data/spec/integration/braintree/paypal_account_spec.rb +38 -38
- data/spec/integration/braintree/plan_spec.rb +15 -15
- data/spec/integration/braintree/samsung_pay_card_spec.rb +65 -65
- data/spec/integration/braintree/sepa_direct_debit_account_spec.rb +51 -51
- data/spec/integration/braintree/settlement_batch_summary_spec.rb +11 -11
- data/spec/integration/braintree/subscription_spec.rb +364 -364
- data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
- data/spec/integration/braintree/test_transaction_spec.rb +19 -19
- data/spec/integration/braintree/transaction_line_item_spec.rb +6 -6
- data/spec/integration/braintree/transaction_search_spec.rb +225 -165
- data/spec/integration/braintree/transaction_spec.rb +1502 -1210
- data/spec/integration/braintree/transaction_us_bank_account_spec.rb +32 -32
- data/spec/integration/braintree/us_bank_account_spec.rb +30 -30
- data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +18 -18
- data/spec/integration/braintree/us_bank_account_verification_spec.rb +33 -33
- data/spec/integration/braintree/visa_checkout_card_spec.rb +57 -57
- data/spec/spec_helper.rb +9 -8
- data/spec/unit/braintree/address_spec.rb +8 -8
- data/spec/unit/braintree/base_module_spec.rb +4 -4
- data/spec/unit/braintree/client_token_spec.rb +2 -2
- data/spec/unit/braintree/configuration_spec.rb +57 -57
- data/spec/unit/braintree/credentials_parser_spec.rb +6 -6
- data/spec/unit/braintree/credit_card_spec.rb +31 -29
- data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +28 -28
- data/spec/unit/braintree/credit_card_verification_search_spec.rb +9 -9
- data/spec/unit/braintree/credit_card_verification_spec.rb +17 -17
- data/spec/unit/braintree/customer_spec.rb +41 -40
- data/spec/unit/braintree/digest_spec.rb +5 -5
- data/spec/unit/braintree/disbursement_spec.rb +11 -11
- data/spec/unit/braintree/dispute_search_spec.rb +2 -2
- data/spec/unit/braintree/dispute_spec.rb +56 -56
- data/spec/unit/braintree/document_upload_spec.rb +8 -8
- data/spec/unit/braintree/enriched_customer_data_spec.rb +11 -2
- data/spec/unit/braintree/error_result_spec.rb +5 -5
- data/spec/unit/braintree/errors_spec.rb +9 -9
- data/spec/unit/braintree/http_spec.rb +9 -9
- data/spec/unit/braintree/local_payment_completed_spec.rb +11 -11
- data/spec/unit/braintree/local_payment_expired_spec.rb +2 -2
- data/spec/unit/braintree/local_payment_funded_spec.rb +6 -6
- data/spec/unit/braintree/merchant_account_spec.rb +4 -4
- 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/payment_method_customer_data_updated_metadata_spec.rb +6 -6
- data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +7 -7
- data/spec/unit/braintree/payment_method_nonce_details_spec.rb +14 -14
- data/spec/unit/braintree/payment_method_spec.rb +19 -19
- data/spec/unit/braintree/paypal_account_spec.rb +4 -4
- data/spec/unit/braintree/resource_collection_spec.rb +7 -7
- data/spec/unit/braintree/sepa_debit_account_nonce_details_spec.rb +1 -1
- 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 +17 -17
- data/spec/unit/braintree/subscription_spec.rb +8 -8
- data/spec/unit/braintree/successful_result_spec.rb +5 -5
- data/spec/unit/braintree/three_d_secure_info_spec.rb +20 -20
- data/spec/unit/braintree/transaction/credit_card_details_spec.rb +5 -5
- 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/local_payment_details_spec.rb +30 -0
- data/spec/unit/braintree/transaction_gateway_spec.rb +39 -7
- data/spec/unit/braintree/transaction_search_spec.rb +2 -2
- data/spec/unit/braintree/transaction_spec.rb +101 -93
- 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 +27 -27
- data/spec/unit/braintree/validation_error_collection_spec.rb +34 -34
- data/spec/unit/braintree/validation_error_spec.rb +4 -4
- data/spec/unit/braintree/venmo_profile_data_spec.rb +16 -5
- data/spec/unit/braintree/webhook_notification_spec.rb +206 -191
- data/spec/unit/braintree/xml/libxml_spec.rb +5 -5
- data/spec/unit/braintree/xml/parser_spec.rb +8 -8
- data/spec/unit/braintree/xml/rexml_spec.rb +5 -5
- data/spec/unit/braintree/xml_spec.rb +17 -17
- data/spec/unit/braintree_spec.rb +2 -2
- metadata +11 -2
@@ -6,7 +6,7 @@ module Braintree
|
|
6
6
|
attr_reader :payment_context_id
|
7
7
|
attr_reader :transaction
|
8
8
|
|
9
|
-
def initialize(attributes)
|
9
|
+
def initialize(attributes)
|
10
10
|
set_instance_variables_from_hash(attributes)
|
11
11
|
@transaction = Transaction._new(Configuration.gateway, transaction)
|
12
12
|
end
|
@@ -15,7 +15,7 @@ module Braintree
|
|
15
15
|
protected :new
|
16
16
|
end
|
17
17
|
|
18
|
-
def self._new(*args)
|
18
|
+
def self._new(*args)
|
19
19
|
self.new(*args)
|
20
20
|
end
|
21
21
|
end
|
@@ -4,7 +4,7 @@ module Braintree
|
|
4
4
|
|
5
5
|
attr_reader :payment_id
|
6
6
|
|
7
|
-
def initialize(attributes)
|
7
|
+
def initialize(attributes)
|
8
8
|
set_instance_variables_from_hash(attributes)
|
9
9
|
end
|
10
10
|
|
@@ -12,7 +12,7 @@ module Braintree
|
|
12
12
|
protected :new
|
13
13
|
end
|
14
14
|
|
15
|
-
def self._new(*args)
|
15
|
+
def self._new(*args)
|
16
16
|
self.new(*args)
|
17
17
|
end
|
18
18
|
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,7 +23,7 @@ module Braintree
|
|
23
23
|
protected :new
|
24
24
|
end
|
25
25
|
|
26
|
-
def self._new(*args)
|
26
|
+
def self._new(*args)
|
27
27
|
self.new(*args)
|
28
28
|
end
|
29
29
|
|
@@ -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,7 +60,7 @@ module Braintree
|
|
60
60
|
|
61
61
|
class << self
|
62
62
|
protected :new
|
63
|
-
def _new(*args)
|
63
|
+
def _new(*args)
|
64
64
|
self.new(*args)
|
65
65
|
end
|
66
66
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Braintree
|
2
|
-
class MerchantAccountGateway
|
2
|
+
class MerchantAccountGateway
|
3
3
|
include BaseModule
|
4
4
|
|
5
5
|
def initialize(gateway)
|
@@ -51,7 +51,7 @@ module Braintree
|
|
51
51
|
_create_for_currency(params)
|
52
52
|
end
|
53
53
|
|
54
|
-
def _do_create(path, params=nil)
|
54
|
+
def _do_create(path, params=nil)
|
55
55
|
response = @config.http.post("#{@config.base_merchant_path}#{path}", params)
|
56
56
|
if response[:api_error_response]
|
57
57
|
ErrorResult.new(@gateway, response[:api_error_response])
|
@@ -60,7 +60,7 @@ module Braintree
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
def _do_update(path, params=nil)
|
63
|
+
def _do_update(path, params=nil)
|
64
64
|
response = @config.http.put("#{@config.base_merchant_path}#{path}", params)
|
65
65
|
if response[:api_error_response]
|
66
66
|
ErrorResult.new(@gateway, response[:api_error_response])
|
@@ -83,7 +83,7 @@ module Braintree
|
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
|
-
# this is part of Marketplace and shouldn't be removed unless we're removing all Marketplace code
|
86
|
+
# NEXT_MAJOR_VERSION this is part of Marketplace and shouldn't be removed unless we're removing all Marketplace code
|
87
87
|
def self._detect_signature(attributes)
|
88
88
|
if attributes.has_key?(:applicant_details)
|
89
89
|
warn "[DEPRECATED] Passing :applicant_details to create is deprecated. Please use :individual, :business, and :funding."
|
@@ -93,8 +93,8 @@ module Braintree
|
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
96
|
-
# this is part of Marketplace and shouldn't be removed unless we're removing all Marketplace code
|
97
|
-
def self._deprecated_create_signature
|
96
|
+
# NEXT_MAJOR_VERSION this is part of Marketplace and shouldn't be removed unless we're removing all Marketplace code
|
97
|
+
def self._deprecated_create_signature
|
98
98
|
[
|
99
99
|
{:applicant_details => [
|
100
100
|
:first_name, :last_name, :email, :date_of_birth, :ssn, :routing_number,
|
@@ -105,7 +105,7 @@ module Braintree
|
|
105
105
|
]
|
106
106
|
end
|
107
107
|
|
108
|
-
def self._signature
|
108
|
+
def self._signature
|
109
109
|
[
|
110
110
|
{:individual => [
|
111
111
|
:first_name, :last_name, :email, :date_of_birth, :ssn, :phone,
|
@@ -119,11 +119,11 @@ module Braintree
|
|
119
119
|
]
|
120
120
|
end
|
121
121
|
|
122
|
-
def self._create_signature
|
122
|
+
def self._create_signature
|
123
123
|
_signature + [:tos_accepted, :master_merchant_account_id, :id]
|
124
124
|
end
|
125
125
|
|
126
|
-
def self._update_signature
|
126
|
+
def self._update_signature
|
127
127
|
_signature
|
128
128
|
end
|
129
129
|
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
module Braintree
|
2
|
+
class MetaCheckoutCard
|
3
|
+
include BaseModule # :nodoc:
|
4
|
+
include Braintree::Util::TokenEquality
|
5
|
+
|
6
|
+
attr_reader :bin
|
7
|
+
attr_reader :container_id
|
8
|
+
attr_reader :card_type
|
9
|
+
attr_reader :cardholder_name
|
10
|
+
attr_reader :commercial
|
11
|
+
attr_reader :country_of_issuance
|
12
|
+
attr_reader :created_at
|
13
|
+
attr_reader :customer_id
|
14
|
+
attr_reader :customer_location
|
15
|
+
attr_reader :debit
|
16
|
+
attr_reader :durbin_regulated
|
17
|
+
attr_reader :expiration_month
|
18
|
+
attr_reader :expiration_year
|
19
|
+
attr_reader :healthcare
|
20
|
+
attr_reader :image_url
|
21
|
+
attr_reader :issuing_bank
|
22
|
+
attr_reader :last_4
|
23
|
+
attr_reader :payroll
|
24
|
+
attr_reader :prepaid
|
25
|
+
attr_reader :product_id
|
26
|
+
attr_reader :subscriptions
|
27
|
+
attr_reader :token
|
28
|
+
attr_reader :unique_number_identifier
|
29
|
+
attr_reader :updated_at
|
30
|
+
attr_reader :verification
|
31
|
+
|
32
|
+
|
33
|
+
def initialize(gateway, attributes) # :nodoc:
|
34
|
+
@gateway = gateway
|
35
|
+
set_instance_variables_from_hash(attributes)
|
36
|
+
@subscriptions = (@subscriptions || []).map { |subscription_hash| Subscription._new(@gateway, subscription_hash) }
|
37
|
+
@verification = _most_recent_verification(attributes)
|
38
|
+
end
|
39
|
+
|
40
|
+
def _most_recent_verification(attributes)
|
41
|
+
verification = (attributes[:verifications] || []).sort_by { |v| v[:created_at] }.reverse.first
|
42
|
+
CreditCardVerification._new(verification) if verification
|
43
|
+
end
|
44
|
+
|
45
|
+
def default?
|
46
|
+
@default
|
47
|
+
end
|
48
|
+
|
49
|
+
# Expiration date formatted as MM/YYYY
|
50
|
+
def expiration_date
|
51
|
+
"#{expiration_month}/#{expiration_year}"
|
52
|
+
end
|
53
|
+
|
54
|
+
def expired?
|
55
|
+
@expired
|
56
|
+
end
|
57
|
+
|
58
|
+
def inspect # :nodoc:
|
59
|
+
first = [:token]
|
60
|
+
order = first + (self.class._attributes - first)
|
61
|
+
nice_attributes = order.map do |attr|
|
62
|
+
"#{attr}: #{send(attr).inspect}"
|
63
|
+
end
|
64
|
+
"#<#{self.class} #{nice_attributes.join(', ')}>"
|
65
|
+
end
|
66
|
+
|
67
|
+
def masked_number
|
68
|
+
"#{bin}******#{last_4}"
|
69
|
+
end
|
70
|
+
|
71
|
+
class << self
|
72
|
+
protected :new
|
73
|
+
end
|
74
|
+
|
75
|
+
def self._attributes # :nodoc:
|
76
|
+
[
|
77
|
+
:bin, :card_type, :cardholder_name, :created_at,
|
78
|
+
:customer_id, :customer_location, :expiration_month, :expiration_year,
|
79
|
+
:last_4, :token, :updated_at, :prepaid, :payroll, :product_id,
|
80
|
+
:commercial, :debit, :durbin_regulated, :healthcare,
|
81
|
+
:country_of_issuance, :issuing_bank, :image_url, :container_id
|
82
|
+
]
|
83
|
+
end
|
84
|
+
|
85
|
+
def self._new(*args) # :nodoc:
|
86
|
+
self.new(*args)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
module Braintree
|
2
|
+
class MetaCheckoutToken
|
3
|
+
include BaseModule # :nodoc:
|
4
|
+
include Braintree::Util::TokenEquality
|
5
|
+
|
6
|
+
attr_reader :bin
|
7
|
+
attr_reader :container_id
|
8
|
+
attr_reader :card_type
|
9
|
+
attr_reader :cardholder_name
|
10
|
+
attr_reader :commercial
|
11
|
+
attr_reader :country_of_issuance
|
12
|
+
attr_reader :created_at
|
13
|
+
attr_reader :cryptogram
|
14
|
+
attr_reader :customer_id
|
15
|
+
attr_reader :customer_location
|
16
|
+
attr_reader :debit
|
17
|
+
attr_reader :durbin_regulated
|
18
|
+
attr_reader :ecommerce_indicator
|
19
|
+
attr_reader :expiration_month
|
20
|
+
attr_reader :expiration_year
|
21
|
+
attr_reader :healthcare
|
22
|
+
attr_reader :image_url
|
23
|
+
attr_reader :issuing_bank
|
24
|
+
attr_reader :last_4
|
25
|
+
attr_reader :payroll
|
26
|
+
attr_reader :prepaid
|
27
|
+
attr_reader :product_id
|
28
|
+
attr_reader :token
|
29
|
+
attr_reader :unique_number_identifier
|
30
|
+
attr_reader :updated_at
|
31
|
+
attr_reader :verification
|
32
|
+
|
33
|
+
def initialize(gateway, attributes) # :nodoc:
|
34
|
+
@gateway = gateway
|
35
|
+
set_instance_variables_from_hash(attributes)
|
36
|
+
@verification = _most_recent_verification(attributes)
|
37
|
+
end
|
38
|
+
|
39
|
+
def _most_recent_verification(attributes)
|
40
|
+
verification = (attributes[:verifications] || []).sort_by { |v| v[:created_at] }.reverse.first
|
41
|
+
CreditCardVerification._new(verification) if verification
|
42
|
+
end
|
43
|
+
|
44
|
+
def default?
|
45
|
+
@default
|
46
|
+
end
|
47
|
+
|
48
|
+
# Expiration date formatted as MM/YYYY
|
49
|
+
def expiration_date
|
50
|
+
"#{expiration_month}/#{expiration_year}"
|
51
|
+
end
|
52
|
+
|
53
|
+
def expired?
|
54
|
+
@expired
|
55
|
+
end
|
56
|
+
|
57
|
+
def inspect # :nodoc:
|
58
|
+
first = [:token]
|
59
|
+
order = first + (self.class._attributes - first)
|
60
|
+
nice_attributes = order.map do |attr|
|
61
|
+
"#{attr}: #{send(attr).inspect}"
|
62
|
+
end
|
63
|
+
"#<#{self.class} #{nice_attributes.join(', ')}>"
|
64
|
+
end
|
65
|
+
|
66
|
+
def masked_number
|
67
|
+
"#{bin}******#{last_4}"
|
68
|
+
end
|
69
|
+
|
70
|
+
class << self
|
71
|
+
protected :new
|
72
|
+
end
|
73
|
+
|
74
|
+
def self._attributes # :nodoc:
|
75
|
+
[
|
76
|
+
:bin, :card_type, :cardholder_name, :created_at,
|
77
|
+
:customer_id, :customer_location, :expiration_month, :expiration_year,
|
78
|
+
:last_4, :token, :updated_at, :prepaid, :payroll, :product_id,
|
79
|
+
:commercial, :debit, :durbin_regulated, :healthcare, :ecommerce_indicator,
|
80
|
+
:country_of_issuance, :issuing_bank, :image_url, :container_id, :cryptogram
|
81
|
+
]
|
82
|
+
end
|
83
|
+
|
84
|
+
def self._new(*args) # :nodoc:
|
85
|
+
self.new(*args)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Braintree
|
2
|
-
class Modification
|
2
|
+
class Modification
|
3
3
|
include BaseModule
|
4
4
|
|
5
5
|
attr_reader :amount
|
@@ -17,12 +17,12 @@ module Braintree
|
|
17
17
|
|
18
18
|
class << self
|
19
19
|
protected :new
|
20
|
-
def _new(*args)
|
20
|
+
def _new(*args)
|
21
21
|
self.new(*args)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
def initialize(attributes)
|
25
|
+
def initialize(attributes)
|
26
26
|
set_instance_variables_from_hash(attributes)
|
27
27
|
@amount = Util.to_big_decimal(amount)
|
28
28
|
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
module Braintree
|
2
2
|
class OAuthCredentials
|
3
|
-
include BaseModule
|
3
|
+
include BaseModule
|
4
4
|
|
5
5
|
attr_reader :access_token
|
6
6
|
attr_reader :expires_at
|
7
7
|
attr_reader :refresh_token
|
8
8
|
attr_reader :token_type
|
9
9
|
|
10
|
-
def initialize(attributes)
|
10
|
+
def initialize(attributes)
|
11
11
|
set_instance_variables_from_hash(attributes)
|
12
12
|
end
|
13
13
|
|
@@ -15,7 +15,7 @@ module Braintree
|
|
15
15
|
protected :new
|
16
16
|
end
|
17
17
|
|
18
|
-
def self._new(*args)
|
18
|
+
def self._new(*args)
|
19
19
|
self.new(*args)
|
20
20
|
end
|
21
21
|
end
|
@@ -6,7 +6,7 @@ module Braintree
|
|
6
6
|
attr_reader :page_size
|
7
7
|
attr_reader :total_items
|
8
8
|
|
9
|
-
def initialize(total_items, page_size, current_page)
|
9
|
+
def initialize(total_items, page_size, current_page)
|
10
10
|
@total_items = total_items
|
11
11
|
@current_page = current_page
|
12
12
|
@page_size = page_size
|
@@ -4,6 +4,8 @@ module Braintree
|
|
4
4
|
CreditCard = "credit_card"
|
5
5
|
GooglePayCard = "android_pay_card"
|
6
6
|
LocalPayment = "local_payment"
|
7
|
+
MetaCheckoutCard = "meta_checkout_card"
|
8
|
+
MetaCheckoutToken = "meta_checkout_token"
|
7
9
|
PayPalAccount = "paypal_account"
|
8
10
|
PayPalHere = "paypal_here"
|
9
11
|
SamsungPayCard = "samsung_pay_card"
|
@@ -7,7 +7,7 @@ module Braintree
|
|
7
7
|
attr_reader :datetime_updated
|
8
8
|
attr_reader :enriched_customer_data
|
9
9
|
|
10
|
-
def initialize(gateway, attributes)
|
10
|
+
def initialize(gateway, attributes)
|
11
11
|
set_instance_variables_from_hash(attributes)
|
12
12
|
@payment_method = PaymentMethodParser.parse_payment_method(gateway, attributes[:payment_method])
|
13
13
|
@enriched_customer_data = EnrichedCustomerData._new(enriched_customer_data) if enriched_customer_data
|
@@ -17,7 +17,7 @@ module Braintree
|
|
17
17
|
protected :new
|
18
18
|
end
|
19
19
|
|
20
|
-
def self._new(*args)
|
20
|
+
def self._new(*args)
|
21
21
|
self.new(*args)
|
22
22
|
end
|
23
23
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Braintree
|
2
|
-
class PaymentMethodGateway
|
2
|
+
class PaymentMethodGateway
|
3
3
|
include BaseModule
|
4
4
|
|
5
5
|
def initialize(gateway)
|
@@ -9,6 +9,10 @@ module Braintree
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def create(attributes)
|
12
|
+
# NEXT_MAJOR_VERSION remove this check
|
13
|
+
if attributes.has_key?(:venmo_sdk_payment_method_code) || attributes.has_key?(:venmo_sdk_session)
|
14
|
+
warn "[DEPRECATED] The Venmo SDK integration is Unsupported. Please update your integration to use Pay with Venmo instead."
|
15
|
+
end
|
12
16
|
Util.verify_keys(PaymentMethodGateway._create_signature, attributes)
|
13
17
|
_do_create("/payment_methods", :payment_method => attributes)
|
14
18
|
end
|
@@ -17,7 +21,7 @@ module Braintree
|
|
17
21
|
return_object_or_raise(:payment_method) { create(*args) }
|
18
22
|
end
|
19
23
|
|
20
|
-
def _do_create(path, params=nil)
|
24
|
+
def _do_create(path, params=nil)
|
21
25
|
response = @config.http.post("#{@config.base_merchant_path}#{path}", params)
|
22
26
|
if response[:api_error_response]
|
23
27
|
ErrorResult.new(@gateway, response[:api_error_response])
|
@@ -60,6 +64,10 @@ module Braintree
|
|
60
64
|
end
|
61
65
|
|
62
66
|
def update(token, attributes)
|
67
|
+
# NEXT_MAJOR_VERSION remove this check
|
68
|
+
if attributes.has_key?(:venmo_sdk_payment_method_code) || attributes.has_key?(:venmo_sdk_session)
|
69
|
+
warn "[DEPRECATED] The Venmo SDK integration is Unsupported. Please update your integration to use Pay with Venmo instead."
|
70
|
+
end
|
63
71
|
Util.verify_keys(PaymentMethodGateway._update_signature, attributes)
|
64
72
|
_do_update(:put, "/payment_methods/any/#{token}", :payment_method => attributes)
|
65
73
|
end
|
@@ -68,7 +76,7 @@ module Braintree
|
|
68
76
|
return_object_or_raise(:payment_method) { update(*args) }
|
69
77
|
end
|
70
78
|
|
71
|
-
def _do_update(http_verb, path, params)
|
79
|
+
def _do_update(http_verb, path, params)
|
72
80
|
response = @config.http.send(http_verb, "#{@config.base_merchant_path}#{path}", params)
|
73
81
|
if response[:api_error_response]
|
74
82
|
ErrorResult.new(@gateway, response[:api_error_response])
|
@@ -134,27 +142,30 @@ module Braintree
|
|
134
142
|
end
|
135
143
|
end
|
136
144
|
|
137
|
-
def self._create_signature
|
145
|
+
def self._create_signature
|
138
146
|
_signature(:create)
|
139
147
|
end
|
140
148
|
|
141
|
-
def self._update_signature
|
149
|
+
def self._update_signature
|
142
150
|
_signature(:update)
|
143
151
|
end
|
144
152
|
|
145
|
-
def self._delete_signature
|
153
|
+
def self._delete_signature
|
146
154
|
[:revoke_all_grants]
|
147
155
|
end
|
148
156
|
|
149
|
-
def self._signature(type)
|
157
|
+
def self._signature(type)
|
150
158
|
billing_address_params = AddressGateway._shared_signature
|
151
159
|
paypal_options_shipping_signature = AddressGateway._shared_signature
|
160
|
+
# NEXT_MAJOR_VERSION Remove venmo_sdk_session
|
161
|
+
# The old venmo SDK class has been deprecated
|
152
162
|
options = [
|
153
163
|
:make_default,
|
154
164
|
:skip_advanced_fraud_checking,
|
155
165
|
:us_bank_account_verification_method,
|
156
|
-
:venmo_sdk_session,
|
166
|
+
:venmo_sdk_session, # Deprecated
|
157
167
|
:verification_account_type,
|
168
|
+
:verification_add_ons,
|
158
169
|
:verification_amount,
|
159
170
|
:verification_currency_iso_code,
|
160
171
|
:verification_merchant_account_id,
|
@@ -168,10 +179,12 @@ module Braintree
|
|
168
179
|
{:shipping => paypal_options_shipping_signature}
|
169
180
|
],
|
170
181
|
]
|
182
|
+
# NEXT_MAJOR_VERSION Remove venmo_sdk_payment_method_code
|
183
|
+
# The old venmo SDK class has been deprecated
|
171
184
|
signature = [
|
172
185
|
:billing_address_id, :cardholder_name, :cvv, :expiration_date, :expiration_month,
|
173
|
-
:expiration_year, :number, :token, :venmo_sdk_payment_method_code,
|
174
|
-
:payment_method_nonce,
|
186
|
+
:expiration_year, :number, :token, :venmo_sdk_payment_method_code, # Deprecated
|
187
|
+
:device_data, :payment_method_nonce,
|
175
188
|
{:options => options},
|
176
189
|
{:billing_address => billing_address_params}
|
177
190
|
]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Braintree
|
2
2
|
class PaymentMethodNonce
|
3
|
-
include BaseModule
|
3
|
+
include BaseModule
|
4
4
|
|
5
5
|
def self.create(*args)
|
6
6
|
Configuration.gateway.payment_method_nonce.create(*args)
|
@@ -22,7 +22,7 @@ module Braintree
|
|
22
22
|
attr_reader :type
|
23
23
|
attr_reader :authentication_insight
|
24
24
|
|
25
|
-
def initialize(gateway, attributes)
|
25
|
+
def initialize(gateway, attributes)
|
26
26
|
@gateway = gateway
|
27
27
|
set_instance_variables_from_hash(attributes)
|
28
28
|
@details = PaymentMethodNonceDetails.new(attributes[:details]) if attributes[:details]
|
@@ -34,7 +34,7 @@ module Braintree
|
|
34
34
|
@default
|
35
35
|
end
|
36
36
|
|
37
|
-
def to_s
|
37
|
+
def to_s
|
38
38
|
nonce
|
39
39
|
end
|
40
40
|
|
@@ -42,7 +42,7 @@ module Braintree
|
|
42
42
|
protected :new
|
43
43
|
end
|
44
44
|
|
45
|
-
def self._new(gateway, attributes)
|
45
|
+
def self._new(gateway, attributes)
|
46
46
|
new(gateway, attributes)
|
47
47
|
end
|
48
48
|
end
|
@@ -13,7 +13,7 @@ module Braintree
|
|
13
13
|
attr_reader :token
|
14
14
|
attr_reader :updated_at
|
15
15
|
|
16
|
-
def initialize(gateway, attributes)
|
16
|
+
def initialize(gateway, attributes)
|
17
17
|
@gateway = gateway
|
18
18
|
set_instance_variables_from_hash(attributes)
|
19
19
|
@subscriptions = (@subscriptions || []).map { |subscription_hash| Subscription._new(@gateway, subscription_hash) }
|
@@ -51,7 +51,6 @@ module Braintree
|
|
51
51
|
return_object_or_raise(:transaction) { sale(token, transaction_attributes) }
|
52
52
|
end
|
53
53
|
|
54
|
-
# Returns true if this paypal account is the customer's default payment method.
|
55
54
|
def default?
|
56
55
|
@default
|
57
56
|
end
|
@@ -28,7 +28,7 @@ module Braintree
|
|
28
28
|
@config.http.delete("#{@config.base_merchant_path}/payment_methods/paypal_account/#{token}")
|
29
29
|
end
|
30
30
|
|
31
|
-
def _do_create(path, params)
|
31
|
+
def _do_create(path, params)
|
32
32
|
response = @config.http.post("#{@config.base_merchant_path}#{path}", params)
|
33
33
|
if response[:paypal_account]
|
34
34
|
SuccessfulResult.new(:paypal_account => PayPalAccount._new(@gateway, response[:paypal_account]))
|
@@ -39,7 +39,7 @@ module Braintree
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
def _do_update(http_verb, path, params)
|
42
|
+
def _do_update(http_verb, path, params)
|
43
43
|
response = @config.http.send(http_verb, "#{@config.base_merchant_path}#{path}", params)
|
44
44
|
if response[:paypal_account]
|
45
45
|
SuccessfulResult.new(:paypal_account => PayPalAccount._new(@gateway, response[:paypal_account]))
|
@@ -50,7 +50,7 @@ module Braintree
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
def self._create_signature
|
53
|
+
def self._create_signature
|
54
54
|
options = [:fail_on_duplicate_payment_method, :make_default]
|
55
55
|
[
|
56
56
|
:email, :token, :billing_agreement_id, :customer_id,
|
@@ -58,14 +58,14 @@ module Braintree
|
|
58
58
|
]
|
59
59
|
end
|
60
60
|
|
61
|
-
def self._create_nested_signature
|
61
|
+
def self._create_nested_signature
|
62
62
|
[
|
63
63
|
:email, :token, :billing_agreement_id,
|
64
64
|
{:options => [:make_default]}
|
65
65
|
]
|
66
66
|
end
|
67
67
|
|
68
|
-
def self._update_signature
|
68
|
+
def self._update_signature
|
69
69
|
options = [:fail_on_duplicate_payment_method, :make_default]
|
70
70
|
[:email, :token, :billing_agreement_id, {:options => options}]
|
71
71
|
end
|
data/lib/braintree/plan.rb
CHANGED
@@ -23,7 +23,7 @@ module Braintree
|
|
23
23
|
Configuration.gateway.plan.all
|
24
24
|
end
|
25
25
|
|
26
|
-
def initialize(gateway, attributes)
|
26
|
+
def initialize(gateway, attributes)
|
27
27
|
@gateway = gateway
|
28
28
|
set_instance_variables_from_hash(attributes)
|
29
29
|
add_ons.map! { |attrs| AddOn._new(attrs) }
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Braintree
|
2
|
-
class PlanGateway
|
2
|
+
class PlanGateway
|
3
3
|
include BaseModule
|
4
4
|
|
5
5
|
def initialize(gateway)
|
@@ -102,7 +102,7 @@ module Braintree
|
|
102
102
|
]
|
103
103
|
end
|
104
104
|
|
105
|
-
def _do_create(path, params)
|
105
|
+
def _do_create(path, params)
|
106
106
|
response = @config.http.post("#{@config.base_merchant_path}#{path}", params)
|
107
107
|
if response[:plan]
|
108
108
|
SuccessfulResult.new(:plan => Plan._new(@gateway, response[:plan]))
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Braintree
|
2
|
-
class ResourceCollection
|
2
|
+
class ResourceCollection
|
3
3
|
include Enumerable
|
4
4
|
|
5
5
|
attr_reader :ids
|
6
6
|
|
7
|
-
def initialize(response, &block)
|
7
|
+
def initialize(response, &block)
|
8
8
|
@ids = Util.extract_attribute_as_array(response[:search_results], :ids)
|
9
9
|
@page_size = response[:search_results][:page_size]
|
10
10
|
@paging_block = block
|