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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbacdc492fa27aed57086131c1feab00ed435923034cae5dd7b5c6d4c3184a1a
|
4
|
+
data.tar.gz: a3c9be778fb88ef5a0ea6c23182f74654b511dca659e34529fade077712418ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b6e24f668d3bd022069f5e85ed55afe9fbdce43205af6dd44a101f6aef3f78d2b2099d5b8d5c8297cbf3076dee72da16e61d7b758cb162278190e99d9f95d91
|
7
|
+
data.tar.gz: 3ee3af6a1854de4b02db4670b3d32232b2ce7d26ae478bfa792dcc4ccfe638f52259e80e818704d630c8a0b453a1f566062865045f370f5f83a377e0c7083d16
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Braintree
|
2
|
-
class AccountUpdaterDailyReport
|
2
|
+
class AccountUpdaterDailyReport
|
3
3
|
include BaseModule
|
4
4
|
|
5
5
|
attr_reader :report_date
|
@@ -7,12 +7,12 @@ module Braintree
|
|
7
7
|
|
8
8
|
class << self
|
9
9
|
protected :new
|
10
|
-
def _new(*args)
|
10
|
+
def _new(*args)
|
11
11
|
self.new(*args)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
def initialize(attributes)
|
15
|
+
def initialize(attributes)
|
16
16
|
set_instance_variables_from_hash(attributes)
|
17
17
|
@report_date = Date.parse(report_date)
|
18
18
|
end
|
data/lib/braintree/address.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Braintree
|
2
2
|
class Address
|
3
|
-
include BaseModule
|
3
|
+
include BaseModule
|
4
4
|
|
5
5
|
attr_reader :company
|
6
6
|
attr_reader :country_code_alpha2
|
@@ -44,12 +44,12 @@ module Braintree
|
|
44
44
|
Configuration.gateway.address.update!(*args)
|
45
45
|
end
|
46
46
|
|
47
|
-
def initialize(gateway, attributes)
|
47
|
+
def initialize(gateway, attributes)
|
48
48
|
@gateway = gateway
|
49
49
|
set_instance_variables_from_hash(attributes)
|
50
50
|
end
|
51
51
|
|
52
|
-
def ==(other)
|
52
|
+
def ==(other)
|
53
53
|
return false unless other.is_a?(Address)
|
54
54
|
id == other.id && customer_id == other.customer_id
|
55
55
|
end
|
@@ -58,7 +58,7 @@ module Braintree
|
|
58
58
|
protected :new
|
59
59
|
end
|
60
60
|
|
61
|
-
def self._new(*args)
|
61
|
+
def self._new(*args)
|
62
62
|
self.new(*args)
|
63
63
|
end
|
64
64
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Braintree
|
2
|
-
class AddressGateway
|
2
|
+
class AddressGateway
|
3
3
|
include BaseModule
|
4
4
|
|
5
5
|
def initialize(gateway)
|
@@ -62,7 +62,7 @@ module Braintree
|
|
62
62
|
return_object_or_raise(:address) { update(*args) }
|
63
63
|
end
|
64
64
|
|
65
|
-
def _determine_customer_id(customer_or_customer_id)
|
65
|
+
def _determine_customer_id(customer_or_customer_id)
|
66
66
|
customer_id = customer_or_customer_id.is_a?(Customer) ? customer_or_customer_id.id : customer_or_customer_id
|
67
67
|
unless customer_id =~ /\A[\w_-]+\z/
|
68
68
|
raise ArgumentError, "customer_id contains invalid characters"
|
@@ -70,17 +70,17 @@ module Braintree
|
|
70
70
|
customer_id
|
71
71
|
end
|
72
72
|
|
73
|
-
def self._create_signature
|
73
|
+
def self._create_signature
|
74
74
|
_shared_signature + [:customer_id]
|
75
75
|
end
|
76
76
|
|
77
|
-
def self._shared_signature
|
77
|
+
def self._shared_signature
|
78
78
|
[:company, :country_code_alpha2, :country_code_alpha3, :country_code_numeric,
|
79
79
|
:country_name, :extended_address, :first_name, :last_name, :locality, :phone_number,
|
80
80
|
:postal_code, :region, :street_address]
|
81
81
|
end
|
82
82
|
|
83
|
-
def self._update_signature
|
83
|
+
def self._update_signature
|
84
84
|
_create_signature
|
85
85
|
end
|
86
86
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Braintree
|
2
|
-
class AdvancedSearch
|
3
|
-
class SearchNode
|
2
|
+
class AdvancedSearch
|
3
|
+
class SearchNode
|
4
4
|
def self.operators(*operator_names)
|
5
5
|
operator_names.each do |operator|
|
6
6
|
define_method(operator) do |value|
|
@@ -14,29 +14,29 @@ module Braintree
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
class IsNode < SearchNode
|
17
|
+
class IsNode < SearchNode
|
18
18
|
operators :is
|
19
19
|
end
|
20
20
|
|
21
|
-
class EqualityNode < IsNode
|
21
|
+
class EqualityNode < IsNode
|
22
22
|
operators :is_not
|
23
23
|
end
|
24
24
|
|
25
|
-
class PartialMatchNode < EqualityNode
|
25
|
+
class PartialMatchNode < EqualityNode
|
26
26
|
operators :ends_with, :starts_with
|
27
27
|
end
|
28
28
|
|
29
|
-
class TextNode < PartialMatchNode
|
29
|
+
class TextNode < PartialMatchNode
|
30
30
|
operators :contains
|
31
31
|
end
|
32
32
|
|
33
|
-
class KeyValueNode < SearchNode
|
33
|
+
class KeyValueNode < SearchNode
|
34
34
|
def is(value)
|
35
35
|
@parent.add_criteria(@node_name, value)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
class MultipleValueNode < SearchNode
|
39
|
+
class MultipleValueNode < SearchNode
|
40
40
|
def in(*values)
|
41
41
|
values.flatten!
|
42
42
|
|
@@ -62,7 +62,7 @@ module Braintree
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
-
class EndsWithNode < SearchNode
|
65
|
+
class EndsWithNode < SearchNode
|
66
66
|
operators :ends_with
|
67
67
|
end
|
68
68
|
|
@@ -76,7 +76,7 @@ module Braintree
|
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
-
class RangeNode < SearchNode
|
79
|
+
class RangeNode < SearchNode
|
80
80
|
operators :is
|
81
81
|
|
82
82
|
def between(min, max)
|
data/lib/braintree/apple_pay.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
module Braintree
|
2
2
|
class ApplePay
|
3
|
-
include BaseModule
|
3
|
+
include BaseModule
|
4
4
|
|
5
|
-
def initialize(gateway, attributes)
|
5
|
+
def initialize(gateway, attributes)
|
6
6
|
set_instance_variables_from_hash(attributes)
|
7
7
|
end
|
8
8
|
|
@@ -10,7 +10,7 @@ module Braintree
|
|
10
10
|
protected :new
|
11
11
|
end
|
12
12
|
|
13
|
-
def self._new(*args)
|
13
|
+
def self._new(*args)
|
14
14
|
self.new(*args)
|
15
15
|
end
|
16
16
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Braintree
|
2
2
|
class ApplePayCard
|
3
|
-
include BaseModule
|
3
|
+
include BaseModule
|
4
4
|
|
5
5
|
module CardType
|
6
6
|
AmEx = "Apple Pay - American Express"
|
@@ -39,7 +39,7 @@ module Braintree
|
|
39
39
|
attr_reader :token
|
40
40
|
attr_reader :updated_at
|
41
41
|
|
42
|
-
def initialize(gateway, attributes)
|
42
|
+
def initialize(gateway, attributes)
|
43
43
|
@gateway = gateway
|
44
44
|
set_instance_variables_from_hash(attributes)
|
45
45
|
@billing_address = attributes[:billing_address] ? Address._new(@gateway, attributes[:billing_address]) : nil
|
@@ -58,7 +58,7 @@ module Braintree
|
|
58
58
|
protected :new
|
59
59
|
end
|
60
60
|
|
61
|
-
def self._new(*args)
|
61
|
+
def self._new(*args)
|
62
62
|
self.new(*args)
|
63
63
|
end
|
64
64
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Braintree
|
2
2
|
class ApplePayOptions
|
3
|
-
include BaseModule
|
3
|
+
include BaseModule
|
4
4
|
|
5
5
|
attr_reader :domains
|
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
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Braintree
|
2
|
-
class AuthorizationAdjustment
|
2
|
+
class AuthorizationAdjustment
|
3
3
|
include BaseModule
|
4
4
|
|
5
5
|
attr_reader :amount
|
@@ -11,12 +11,12 @@ module Braintree
|
|
11
11
|
|
12
12
|
class << self
|
13
13
|
protected :new
|
14
|
-
def _new(*args)
|
14
|
+
def _new(*args)
|
15
15
|
self.new(*args)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
def initialize(attributes)
|
19
|
+
def initialize(attributes)
|
20
20
|
set_instance_variables_from_hash(attributes)
|
21
21
|
end
|
22
22
|
end
|
data/lib/braintree/bin_data.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Braintree
|
2
|
-
class BinData
|
2
|
+
class BinData
|
3
3
|
include BaseModule
|
4
4
|
|
5
5
|
attr_reader :commercial
|
@@ -23,7 +23,7 @@ module Braintree
|
|
23
23
|
"#<#{self.class} #{formatted_attributes.join(", ")}>"
|
24
24
|
end
|
25
25
|
|
26
|
-
def self._attributes
|
26
|
+
def self._attributes
|
27
27
|
[
|
28
28
|
:commercial, :country_of_issuance, :debit, :durbin_regulated, :healthcare,
|
29
29
|
:issuing_bank, :payroll, :prepaid, :product_id
|
@@ -1,8 +1,9 @@
|
|
1
1
|
module Braintree
|
2
2
|
class Configuration
|
3
|
-
API_VERSION = "6"
|
4
|
-
DEFAULT_ENDPOINT = "api"
|
5
|
-
|
3
|
+
API_VERSION = "6"
|
4
|
+
DEFAULT_ENDPOINT = "api"
|
5
|
+
# NEXT_MAJOR_VERSION update to the latest version of GraphQL API
|
6
|
+
GRAPHQL_API_VERSION = "2018-09-10"
|
6
7
|
|
7
8
|
READABLE_ATTRIBUTES = [
|
8
9
|
:merchant_id,
|
@@ -47,18 +48,17 @@ module Braintree
|
|
47
48
|
attr_reader(*NON_REQUIRED_READABLE_ATTRIBUTES)
|
48
49
|
attr_writer(*WRITABLE_ATTRIBUTES)
|
49
50
|
|
50
|
-
def self.expectant_reader(*attributes)
|
51
|
+
def self.expectant_reader(*attributes)
|
51
52
|
attributes.each do |attribute|
|
52
53
|
(class << self; self; end).send(:define_method, attribute) do
|
53
54
|
attribute_value = instance_variable_get("@#{attribute}")
|
54
|
-
raise ConfigurationError.new("Braintree::Configuration.#{attribute
|
55
|
+
raise ConfigurationError.new("Braintree::Configuration.#{attribute} needs to be set") if attribute_value.nil? || attribute_value.to_s.empty?
|
55
56
|
attribute_value
|
56
57
|
end
|
57
58
|
end
|
58
59
|
end
|
59
60
|
expectant_reader(*READABLE_ATTRIBUTES)
|
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)
|
63
63
|
env = env.to_sym
|
64
64
|
unless [:development, :qa, :sandbox, :production].include?(env)
|
@@ -67,11 +67,11 @@ module Braintree
|
|
67
67
|
@environment = env
|
68
68
|
end
|
69
69
|
|
70
|
-
def self.gateway
|
70
|
+
def self.gateway
|
71
71
|
Braintree::Gateway.new(instantiate)
|
72
72
|
end
|
73
73
|
|
74
|
-
def self.instantiate
|
74
|
+
def self.instantiate
|
75
75
|
config = new(
|
76
76
|
:custom_user_agent => @custom_user_agent,
|
77
77
|
:endpoint => @endpoint,
|
@@ -158,15 +158,15 @@ module Braintree
|
|
158
158
|
end
|
159
159
|
end
|
160
160
|
|
161
|
-
def api_version
|
161
|
+
def api_version
|
162
162
|
API_VERSION
|
163
163
|
end
|
164
164
|
|
165
|
-
def graphql_api_version
|
165
|
+
def graphql_api_version
|
166
166
|
GRAPHQL_API_VERSION
|
167
167
|
end
|
168
168
|
|
169
|
-
def base_merchant_path
|
169
|
+
def base_merchant_path
|
170
170
|
"/merchants/#{merchant_id}"
|
171
171
|
end
|
172
172
|
|
@@ -178,11 +178,11 @@ module Braintree
|
|
178
178
|
"#{protocol}://#{graphql_server}:#{graphql_port}/graphql"
|
179
179
|
end
|
180
180
|
|
181
|
-
def base_merchant_url
|
181
|
+
def base_merchant_url
|
182
182
|
"#{base_url}#{base_merchant_path}"
|
183
183
|
end
|
184
184
|
|
185
|
-
def ca_file
|
185
|
+
def ca_file
|
186
186
|
File.expand_path(File.join(File.dirname(__FILE__), "..", "ssl", "api_braintreegateway_com.ca.crt"))
|
187
187
|
end
|
188
188
|
|
@@ -190,7 +190,7 @@ module Braintree
|
|
190
190
|
@endpoint || DEFAULT_ENDPOINT
|
191
191
|
end
|
192
192
|
|
193
|
-
def http
|
193
|
+
def http
|
194
194
|
Http.new(self)
|
195
195
|
end
|
196
196
|
|
@@ -202,7 +202,7 @@ module Braintree
|
|
202
202
|
@logger ||= self.class._default_logger
|
203
203
|
end
|
204
204
|
|
205
|
-
def port
|
205
|
+
def port
|
206
206
|
case @environment
|
207
207
|
when :development, :integration
|
208
208
|
ENV["GATEWAY_PORT"] || 3000
|
@@ -211,7 +211,7 @@ module Braintree
|
|
211
211
|
end
|
212
212
|
end
|
213
213
|
|
214
|
-
def graphql_port
|
214
|
+
def graphql_port
|
215
215
|
case @environment
|
216
216
|
when :development, :integration
|
217
217
|
ENV["GRAPHQL_PORT"] || 8080
|
@@ -220,7 +220,7 @@ module Braintree
|
|
220
220
|
end
|
221
221
|
end
|
222
222
|
|
223
|
-
def protocol
|
223
|
+
def protocol
|
224
224
|
ssl? ? "https" : "http"
|
225
225
|
end
|
226
226
|
|
@@ -232,7 +232,7 @@ module Braintree
|
|
232
232
|
@http_read_timeout
|
233
233
|
end
|
234
234
|
|
235
|
-
def server
|
235
|
+
def server
|
236
236
|
case @environment
|
237
237
|
when :development, :integration
|
238
238
|
ENV["GATEWAY_HOST"] || "localhost"
|
@@ -245,7 +245,7 @@ module Braintree
|
|
245
245
|
end
|
246
246
|
end
|
247
247
|
|
248
|
-
def graphql_server
|
248
|
+
def graphql_server
|
249
249
|
case @environment
|
250
250
|
when :development, :integration
|
251
251
|
ENV["GRAPHQL_HOST"] || "graphql.bt.local"
|
@@ -271,7 +271,7 @@ module Braintree
|
|
271
271
|
end
|
272
272
|
end
|
273
273
|
|
274
|
-
def ssl?
|
274
|
+
def ssl?
|
275
275
|
case @environment
|
276
276
|
when :development, :integration
|
277
277
|
false
|
@@ -280,12 +280,12 @@ module Braintree
|
|
280
280
|
end
|
281
281
|
end
|
282
282
|
|
283
|
-
def user_agent
|
283
|
+
def user_agent
|
284
284
|
base_user_agent = "Braintree Ruby Gem #{Braintree::Version::String}"
|
285
285
|
@custom_user_agent ? "#{base_user_agent} (#{@custom_user_agent})" : base_user_agent
|
286
286
|
end
|
287
287
|
|
288
|
-
def self._default_logger
|
288
|
+
def self._default_logger
|
289
289
|
logger = Logger.new(STDOUT)
|
290
290
|
logger.level = Logger::INFO
|
291
291
|
logger
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Braintree
|
2
2
|
class CreditCard
|
3
|
-
include BaseModule
|
3
|
+
include BaseModule
|
4
4
|
include Braintree::Util::TokenEquality
|
5
5
|
|
6
6
|
module CardType
|
@@ -23,6 +23,17 @@ module Braintree
|
|
23
23
|
All = constants.map { |c| const_get(c) }
|
24
24
|
end
|
25
25
|
|
26
|
+
module DebitNetwork
|
27
|
+
Accel = "ACCEL"
|
28
|
+
Maestro = "MAESTRO"
|
29
|
+
Nyce = "NYCE"
|
30
|
+
Pulse = "PULSE"
|
31
|
+
Star = "STAR"
|
32
|
+
Star_Access = "STAR_ACCESS"
|
33
|
+
|
34
|
+
All = constants.map { |c| const_get(c) }
|
35
|
+
end
|
36
|
+
|
26
37
|
module CustomerLocation
|
27
38
|
International = "international"
|
28
39
|
US = "us"
|
@@ -114,7 +125,7 @@ module Braintree
|
|
114
125
|
Configuration.gateway.credit_card.update!(*args)
|
115
126
|
end
|
116
127
|
|
117
|
-
def initialize(gateway, attributes)
|
128
|
+
def initialize(gateway, attributes)
|
118
129
|
@gateway = gateway
|
119
130
|
set_instance_variables_from_hash(attributes)
|
120
131
|
@billing_address = attributes[:billing_address] ? Address._new(@gateway, attributes[:billing_address]) : nil
|
@@ -123,11 +134,10 @@ module Braintree
|
|
123
134
|
end
|
124
135
|
|
125
136
|
def _most_recent_verification(attributes)
|
126
|
-
|
127
|
-
CreditCardVerification._new(
|
137
|
+
sorted_verifications = (attributes[:verifications] || []).sort_by { |verification| verification[:created_at] }.reverse.first
|
138
|
+
CreditCardVerification._new(sorted_verifications) if sorted_verifications
|
128
139
|
end
|
129
140
|
|
130
|
-
# Returns true if this credit card is the customer's default payment method.
|
131
141
|
def default?
|
132
142
|
@default
|
133
143
|
end
|
@@ -137,12 +147,11 @@ module Braintree
|
|
137
147
|
"#{expiration_month}/#{expiration_year}"
|
138
148
|
end
|
139
149
|
|
140
|
-
# Returns true if the credit card is expired.
|
141
150
|
def expired?
|
142
151
|
@expired
|
143
152
|
end
|
144
153
|
|
145
|
-
def inspect
|
154
|
+
def inspect
|
146
155
|
first = [:token]
|
147
156
|
order = first + (self.class._attributes - first)
|
148
157
|
nice_attributes = order.map do |attr|
|
@@ -159,8 +168,12 @@ module Braintree
|
|
159
168
|
@nonce ||= PaymentMethodNonce.create(token)
|
160
169
|
end
|
161
170
|
|
171
|
+
# NEXT_MAJOR_VERSION can this be removed? Venmo SDK integration is no more
|
162
172
|
# Returns true if the card is associated with Venmo SDK
|
173
|
+
# NEXT_MAJOR_VERSION Remove this method
|
174
|
+
# The old venmo SDK class has been deprecated
|
163
175
|
def venmo_sdk?
|
176
|
+
warn "[DEPRECATED] The Venmo SDK integration is Unsupported. Please update your integration to use Pay with Venmo instead."
|
164
177
|
@venmo_sdk
|
165
178
|
end
|
166
179
|
|
@@ -172,7 +185,7 @@ module Braintree
|
|
172
185
|
protected :new
|
173
186
|
end
|
174
187
|
|
175
|
-
def self._attributes
|
188
|
+
def self._attributes
|
176
189
|
[
|
177
190
|
:billing_address, :bin, :card_type, :cardholder_name, :created_at, :customer_id, :expiration_month,
|
178
191
|
:expiration_year, :last_4, :token, :updated_at, :prepaid, :payroll, :product_id, :commercial, :debit, :durbin_regulated,
|
@@ -180,7 +193,7 @@ module Braintree
|
|
180
193
|
]
|
181
194
|
end
|
182
195
|
|
183
|
-
def self._new(*args)
|
196
|
+
def self._new(*args)
|
184
197
|
self.new(*args)
|
185
198
|
end
|
186
199
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Braintree
|
2
|
-
class CreditCardGateway
|
2
|
+
class CreditCardGateway
|
3
3
|
include BaseModule
|
4
4
|
|
5
5
|
def initialize(gateway)
|
@@ -12,6 +12,10 @@ module Braintree
|
|
12
12
|
if attributes.has_key?(:expiration_date) && (attributes.has_key?(:expiration_month) || attributes.has_key?(:expiration_year))
|
13
13
|
raise ArgumentError.new("create with both expiration_month and expiration_year or only expiration_date")
|
14
14
|
end
|
15
|
+
# NEXT_MAJOR_VERSION remove this check
|
16
|
+
if attributes.has_key?(:venmo_sdk_payment_method_code) || attributes.has_key?(:venmo_sdk_session)
|
17
|
+
warn "[DEPRECATED] The Venmo SDK integration is Unsupported. Please update your integration to use Pay with Venmo instead."
|
18
|
+
end
|
15
19
|
Util.verify_keys(CreditCardGateway._create_signature, attributes)
|
16
20
|
_do_create("/payment_methods", :credit_card => attributes)
|
17
21
|
end
|
@@ -61,6 +65,10 @@ module Braintree
|
|
61
65
|
end
|
62
66
|
|
63
67
|
def update(token, attributes)
|
68
|
+
# NEXT_MAJOR_VERSION remove this check
|
69
|
+
if attributes.has_key?(:venmo_sdk_payment_method_code) || attributes.has_key?(:venmo_sdk_session)
|
70
|
+
warn "[DEPRECATED] The Venmo SDK integration is Unsupported. Please update your integration to use Pay with Venmo instead."
|
71
|
+
end
|
64
72
|
Util.verify_keys(CreditCardGateway._update_signature, attributes)
|
65
73
|
_do_update(:put, "/payment_methods/credit_card/#{token}", :credit_card => attributes)
|
66
74
|
end
|
@@ -69,31 +77,35 @@ module Braintree
|
|
69
77
|
return_object_or_raise(:credit_card) { update(*args) }
|
70
78
|
end
|
71
79
|
|
72
|
-
def self._create_signature
|
80
|
+
def self._create_signature
|
73
81
|
_signature(:create)
|
74
82
|
end
|
75
83
|
|
76
|
-
def self._update_signature
|
84
|
+
def self._update_signature
|
77
85
|
_signature(:update)
|
78
86
|
end
|
79
87
|
|
80
|
-
def self._signature(type)
|
88
|
+
def self._signature(type)
|
81
89
|
billing_address_params = AddressGateway._shared_signature
|
90
|
+
# NEXT_MAJOR_VERSION Remove venmo_sdk_session
|
91
|
+
# The old venmo SDK class has been deprecated
|
82
92
|
options = [
|
83
93
|
:fail_on_duplicate_payment_method,
|
84
94
|
:make_default,
|
85
95
|
:skip_advanced_fraud_checking,
|
86
|
-
:venmo_sdk_session,
|
96
|
+
:venmo_sdk_session, # Deprecated
|
87
97
|
:verification_account_type,
|
88
98
|
:verification_amount,
|
89
99
|
:verification_currency_iso_code,
|
90
100
|
:verification_merchant_account_id,
|
91
101
|
:verify_card
|
92
102
|
]
|
103
|
+
# NEXT_MAJOR_VERSION Remove venmo_sdk_payment_method_code
|
104
|
+
# The old venmo SDK class has been deprecated
|
93
105
|
signature = [
|
94
106
|
:billing_address_id, :cardholder_name, :cvv, :expiration_date, :expiration_month,
|
95
|
-
:expiration_year, :number, :token, :venmo_sdk_payment_method_code,
|
96
|
-
:payment_method_nonce,
|
107
|
+
:expiration_year, :number, :token, :venmo_sdk_payment_method_code, # Deprecated
|
108
|
+
:device_data, :payment_method_nonce,
|
97
109
|
{:external_vault => [:network_transaction_id]},
|
98
110
|
{:options => options},
|
99
111
|
{:billing_address => billing_address_params}
|
@@ -124,7 +136,7 @@ module Braintree
|
|
124
136
|
return signature
|
125
137
|
end
|
126
138
|
|
127
|
-
def _do_create(path, params=nil)
|
139
|
+
def _do_create(path, params=nil)
|
128
140
|
response = @config.http.post("#{@config.base_merchant_path}#{path}", params)
|
129
141
|
if response[:credit_card]
|
130
142
|
SuccessfulResult.new(:credit_card => CreditCard._new(@gateway, response[:credit_card]))
|
@@ -135,7 +147,7 @@ module Braintree
|
|
135
147
|
end
|
136
148
|
end
|
137
149
|
|
138
|
-
def _do_update(http_verb, path, params)
|
150
|
+
def _do_update(http_verb, path, params)
|
139
151
|
response = @config.http.send(http_verb, "#{@config.base_merchant_path}#{path}", params)
|
140
152
|
if response[:credit_card]
|
141
153
|
SuccessfulResult.new(:credit_card => CreditCard._new(@gateway, response[:credit_card]))
|
@@ -146,13 +158,13 @@ module Braintree
|
|
146
158
|
end
|
147
159
|
end
|
148
160
|
|
149
|
-
def _fetch_expired(ids)
|
161
|
+
def _fetch_expired(ids)
|
150
162
|
response = @config.http.post("#{@config.base_merchant_path}/payment_methods/all/expired", :search => {:ids => ids})
|
151
163
|
attributes = response[:payment_methods]
|
152
164
|
Util.extract_attribute_as_array(attributes, :credit_card).map { |attrs| CreditCard._new(@gateway, attrs) }
|
153
165
|
end
|
154
166
|
|
155
|
-
def _fetch_expiring_between(formatted_start_date, formatted_end_date, ids)
|
167
|
+
def _fetch_expiring_between(formatted_start_date, formatted_end_date, ids)
|
156
168
|
response = @config.http.post(
|
157
169
|
"#{@config.base_merchant_path}/payment_methods/all/expiring?start=#{formatted_start_date}&end=#{formatted_end_date}",
|
158
170
|
:search => {:ids => ids},
|