braintree 2.98.0 → 4.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/braintree.gemspec +7 -4
- data/lib/braintree/account_updater_daily_report.rb +4 -4
- data/lib/braintree/ach_mandate.rb +1 -1
- data/lib/braintree/add_on_gateway.rb +1 -1
- data/lib/braintree/address.rb +7 -27
- data/lib/braintree/address_gateway.rb +8 -7
- data/lib/braintree/advanced_search.rb +11 -12
- data/lib/braintree/apple_pay.rb +4 -4
- data/lib/braintree/apple_pay_card.rb +18 -4
- data/lib/braintree/apple_pay_options.rb +4 -4
- data/lib/braintree/authorization_adjustment.rb +4 -4
- data/lib/braintree/base_module.rb +11 -1
- data/lib/braintree/bin_data.rb +10 -3
- data/lib/braintree/client_token.rb +1 -1
- data/lib/braintree/client_token_gateway.rb +4 -3
- data/lib/braintree/configuration.rb +35 -35
- data/lib/braintree/connected_merchant_paypal_status_changed.rb +2 -2
- data/lib/braintree/connected_merchant_status_transitioned.rb +2 -2
- data/lib/braintree/credit_card.rb +40 -86
- data/lib/braintree/credit_card_gateway.rb +58 -44
- data/lib/braintree/credit_card_verification.rb +39 -20
- data/lib/braintree/credit_card_verification_gateway.rb +35 -5
- data/lib/braintree/credit_card_verification_search.rb +2 -2
- data/lib/braintree/customer.rb +23 -88
- data/lib/braintree/customer_gateway.rb +17 -32
- data/lib/braintree/customer_search.rb +2 -2
- data/lib/braintree/descriptor.rb +1 -1
- data/lib/braintree/digest.rb +1 -1
- data/lib/braintree/disbursement.rb +7 -7
- data/lib/braintree/discount_gateway.rb +1 -1
- data/lib/braintree/dispute/evidence.rb +1 -1
- data/lib/braintree/{transaction/coinbase_details.rb → dispute/paypal_message.rb} +5 -6
- data/lib/braintree/dispute/{history_event.rb → status_history.rb} +3 -1
- data/lib/braintree/dispute/transaction.rb +3 -1
- data/lib/braintree/dispute/transaction_details.rb +1 -1
- data/lib/braintree/dispute.rb +47 -6
- data/lib/braintree/dispute_gateway.rb +5 -10
- data/lib/braintree/dispute_search.rb +8 -4
- data/lib/braintree/document_upload.rb +3 -3
- data/lib/braintree/document_upload_gateway.rb +3 -3
- data/lib/braintree/enriched_customer_data.rb +21 -0
- data/lib/braintree/error_codes.rb +217 -175
- data/lib/braintree/error_result.rb +2 -3
- data/lib/braintree/errors.rb +3 -3
- data/lib/braintree/exceptions.rb +6 -5
- data/lib/braintree/exchange_rate.rb +13 -0
- data/lib/braintree/exchange_rate_quote.rb +24 -0
- data/lib/braintree/exchange_rate_quote_gateway.rb +35 -0
- data/lib/braintree/exchange_rate_quote_input.rb +21 -0
- data/lib/braintree/exchange_rate_quote_request.rb +18 -0
- data/lib/braintree/exchange_rate_quote_response.rb +18 -0
- data/lib/braintree/facilitated_details.rb +1 -1
- data/lib/braintree/facilitator_details.rb +1 -1
- data/lib/braintree/gateway.rb +6 -12
- data/lib/braintree/{android_pay_card.rb → google_pay_card.rb} +18 -5
- data/lib/braintree/granted_payment_instrument_update.rb +2 -2
- data/lib/braintree/graphql_client.rb +14 -8
- data/lib/braintree/http.rb +9 -10
- data/lib/braintree/local_payment_completed/blik_alias.rb +23 -0
- data/lib/braintree/local_payment_completed.rb +10 -5
- data/lib/braintree/local_payment_expired.rb +21 -0
- data/lib/braintree/local_payment_funded.rb +22 -0
- data/lib/braintree/local_payment_reversed.rb +19 -0
- data/lib/braintree/merchant.rb +4 -4
- data/lib/braintree/merchant_account.rb +3 -3
- data/lib/braintree/merchant_account_gateway.rb +10 -8
- data/lib/braintree/merchant_gateway.rb +1 -1
- data/lib/braintree/meta_checkout_card.rb +89 -0
- data/lib/braintree/meta_checkout_token.rb +88 -0
- data/lib/braintree/modification.rb +4 -4
- data/lib/braintree/oauth_credentials.rb +4 -4
- data/lib/braintree/oauth_gateway.rb +5 -5
- data/lib/braintree/paginated_collection.rb +2 -2
- data/lib/braintree/paginated_result.rb +1 -1
- data/lib/braintree/payment_instrument_type.rb +14 -13
- data/lib/braintree/payment_method_customer_data_updated_metadata.rb +24 -0
- data/lib/braintree/payment_method_gateway.rb +52 -22
- data/lib/braintree/payment_method_nonce.rb +12 -7
- data/lib/braintree/payment_method_nonce_details.rb +40 -0
- data/lib/braintree/payment_method_nonce_details_payer_info.rb +32 -0
- data/lib/braintree/payment_method_nonce_gateway.rb +14 -3
- data/lib/braintree/payment_method_parser.rb +4 -7
- data/lib/braintree/paypal_account.rb +3 -2
- data/lib/braintree/paypal_account_gateway.rb +5 -5
- data/lib/braintree/plan.rb +22 -2
- data/lib/braintree/plan_gateway.rb +101 -1
- data/lib/braintree/processor_response_types.rb +3 -3
- data/lib/braintree/resource_collection.rb +10 -5
- data/lib/braintree/revoked_payment_method_metadata.rb +2 -2
- data/lib/braintree/risk_data/liability_shift.rb +22 -0
- data/lib/braintree/risk_data.rb +10 -3
- data/lib/braintree/samsung_pay_card.rb +8 -6
- data/lib/braintree/sepa_direct_debit_account.rb +60 -0
- data/lib/braintree/sepa_direct_debit_account_gateway.rb +25 -0
- data/lib/braintree/sepa_direct_debit_account_nonce_details.rb +28 -0
- data/lib/braintree/settlement_batch_summary.rb +2 -2
- data/lib/braintree/settlement_batch_summary_gateway.rb +1 -1
- data/lib/braintree/sha256_digest.rb +1 -1
- data/lib/braintree/subscription/status_details.rb +1 -1
- data/lib/braintree/subscription.rb +13 -13
- data/lib/braintree/subscription_gateway.rb +6 -6
- data/lib/braintree/subscription_search.rb +1 -1
- data/lib/braintree/successful_result.rb +5 -4
- data/lib/braintree/test/authentication_id.rb +21 -0
- data/lib/braintree/test/credit_card.rb +9 -10
- data/lib/braintree/test/merchant_account.rb +1 -1
- data/lib/braintree/test/nonce.rb +27 -20
- data/lib/braintree/test/transaction_amounts.rb +2 -3
- data/lib/braintree/test/venmo_sdk.rb +2 -0
- data/lib/braintree/testing_gateway.rb +1 -1
- data/lib/braintree/three_d_secure_info.rb +23 -11
- data/lib/braintree/transaction/address_details.rb +14 -1
- data/lib/braintree/transaction/apple_pay_details.rb +13 -10
- data/lib/braintree/transaction/credit_card_details.rb +8 -1
- data/lib/braintree/transaction/customer_details.rb +3 -2
- data/lib/braintree/transaction/disbursement_details.rb +2 -1
- data/lib/braintree/transaction/{android_pay_details.rb → google_pay_details.rb} +6 -1
- data/lib/braintree/transaction/installment/adjustment.rb +33 -0
- data/lib/braintree/transaction/installment.rb +28 -0
- data/lib/braintree/transaction/local_payment_details.rb +3 -0
- data/lib/braintree/transaction/meta_checkout_card_details.rb +52 -0
- data/lib/braintree/transaction/meta_checkout_token_details.rb +54 -0
- data/lib/braintree/transaction/package_details.rb +19 -0
- data/lib/braintree/transaction/payment_receipt/card_present_data.rb +36 -0
- data/lib/braintree/transaction/payment_receipt/merchant_address.rb +19 -0
- data/lib/braintree/transaction/payment_receipt.rb +31 -0
- data/lib/braintree/transaction/paypal_details.rb +5 -0
- data/lib/braintree/transaction/samsung_pay_card_details.rb +3 -1
- data/lib/braintree/transaction/sepa_direct_debit_account_details.rb +27 -0
- data/lib/braintree/transaction/status_details.rb +1 -1
- data/lib/braintree/transaction/subscription_details.rb +3 -1
- data/lib/braintree/transaction/us_bank_account_details.rb +2 -1
- data/lib/braintree/transaction/visa_checkout_card_details.rb +1 -1
- data/lib/braintree/transaction.rb +119 -128
- data/lib/braintree/transaction_gateway.rb +138 -64
- data/lib/braintree/transaction_line_item.rb +14 -11
- data/lib/braintree/transaction_line_item_gateway.rb +1 -1
- data/lib/braintree/transaction_review.rb +18 -0
- data/lib/braintree/transaction_search.rb +11 -7
- data/lib/braintree/unknown_payment_method.rb +2 -2
- data/lib/braintree/us_bank_account.rb +5 -5
- data/lib/braintree/us_bank_account_verification.rb +24 -16
- data/lib/braintree/us_bank_account_verification_gateway.rb +1 -1
- data/lib/braintree/us_bank_account_verification_search.rb +1 -1
- data/lib/braintree/util.rb +25 -10
- data/lib/braintree/validation_error.rb +1 -1
- data/lib/braintree/validation_error_collection.rb +3 -3
- data/lib/braintree/venmo_account.rb +4 -4
- data/lib/braintree/venmo_profile_data.rb +25 -0
- data/lib/braintree/version.rb +2 -2
- data/lib/braintree/visa_checkout_card.rb +8 -8
- data/lib/braintree/webhook_notification.rb +55 -33
- data/lib/braintree/webhook_notification_gateway.rb +9 -9
- data/lib/braintree/webhook_testing.rb +1 -1
- data/lib/braintree/webhook_testing_gateway.rb +569 -46
- data/lib/braintree/xml/generator.rb +6 -5
- data/lib/braintree/xml/libxml.rb +1 -1
- data/lib/braintree/xml/parser.rb +24 -37
- data/lib/braintree/xml/rexml.rb +6 -7
- data/lib/braintree/xml.rb +1 -1
- data/lib/braintree.rb +41 -24
- data/lib/ssl/api_braintreegateway_com.ca.crt +401 -168
- data/spec/integration/braintree/add_on_spec.rb +10 -10
- data/spec/integration/braintree/address_spec.rb +101 -178
- data/spec/integration/braintree/advanced_search_spec.rb +93 -93
- data/spec/integration/braintree/apple_pay_spec.rb +12 -12
- data/spec/integration/braintree/braintree_gateway_spec.rb +2 -1
- data/spec/integration/braintree/client_api/client_token_spec.rb +279 -62
- data/spec/integration/braintree/client_api/spec_helper.rb +99 -73
- data/spec/integration/braintree/credit_card_spec.rb +522 -821
- data/spec/integration/braintree/credit_card_verification_search_spec.rb +18 -18
- data/spec/integration/braintree/credit_card_verification_spec.rb +219 -30
- data/spec/integration/braintree/customer_search_spec.rb +28 -28
- data/spec/integration/braintree/customer_spec.rb +840 -757
- data/spec/integration/braintree/disbursement_spec.rb +2 -2
- data/spec/integration/braintree/discount_spec.rb +9 -9
- data/spec/integration/braintree/dispute_search_spec.rb +45 -9
- data/spec/integration/braintree/dispute_spec.rb +109 -82
- data/spec/integration/braintree/document_upload_spec.rb +29 -17
- data/spec/integration/braintree/error_codes_spec.rb +3 -3
- data/spec/integration/braintree/exchange_rate_quote_spec.rb +97 -0
- data/spec/integration/braintree/graphql_client_spec.rb +0 -2
- data/spec/integration/braintree/http_spec.rb +31 -33
- data/spec/integration/braintree/merchant_account_spec.rb +155 -156
- data/spec/integration/braintree/merchant_spec.rb +71 -192
- data/spec/integration/braintree/oauth_spec.rb +72 -72
- data/spec/integration/braintree/package_tracking_spec.rb +130 -0
- data/spec/integration/braintree/payment_method_nonce_spec.rb +173 -78
- data/spec/integration/braintree/payment_method_spec.rb +953 -501
- data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +147 -234
- data/spec/integration/braintree/paypal_account_spec.rb +74 -72
- data/spec/integration/braintree/plan_spec.rb +96 -15
- data/spec/integration/braintree/samsung_pay_card_spec.rb +75 -73
- data/spec/integration/braintree/sepa_direct_debit_account_spec.rb +194 -0
- data/spec/integration/braintree/settlement_batch_summary_spec.rb +18 -18
- data/spec/integration/braintree/subscription_spec.rb +507 -513
- data/spec/integration/braintree/test/transaction_amounts_spec.rb +4 -4
- data/spec/integration/braintree/test_transaction_spec.rb +29 -29
- data/spec/integration/braintree/transaction_line_item_spec.rb +12 -6
- data/spec/integration/braintree/transaction_search_spec.rb +410 -217
- data/spec/integration/braintree/transaction_spec.rb +3252 -2102
- data/spec/integration/braintree/transaction_us_bank_account_spec.rb +42 -278
- data/spec/integration/braintree/us_bank_account_spec.rb +36 -36
- data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +25 -25
- data/spec/integration/braintree/us_bank_account_verification_spec.rb +41 -41
- data/spec/integration/braintree/visa_checkout_card_spec.rb +62 -62
- data/spec/integration/spec_helper.rb +22 -7
- data/spec/oauth_test_helper.rb +1 -1
- data/spec/script/httpsd.rb +6 -6
- data/spec/spec_helper.rb +15 -20
- data/spec/unit/braintree/address_spec.rb +9 -17
- data/spec/unit/braintree/apple_pay_card_spec.rb +110 -7
- data/spec/unit/braintree/base_module_spec.rb +4 -4
- data/spec/unit/braintree/client_token_spec.rb +6 -6
- data/spec/unit/braintree/configuration_spec.rb +84 -84
- data/spec/unit/braintree/credentials_parser_spec.rb +6 -6
- data/spec/unit/braintree/credit_card_spec.rb +91 -58
- data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +56 -0
- data/spec/unit/braintree/credit_card_verification_search_spec.rb +10 -10
- data/spec/unit/braintree/credit_card_verification_spec.rb +40 -18
- data/spec/unit/braintree/customer_spec.rb +102 -57
- data/spec/unit/braintree/digest_spec.rb +5 -6
- data/spec/unit/braintree/disbursement_spec.rb +14 -14
- data/spec/unit/braintree/dispute_search_spec.rb +6 -2
- data/spec/unit/braintree/dispute_spec.rb +144 -66
- data/spec/unit/braintree/document_upload_spec.rb +8 -8
- data/spec/unit/braintree/enriched_customer_data_spec.rb +41 -0
- data/spec/unit/braintree/error_result_spec.rb +11 -11
- data/spec/unit/braintree/errors_spec.rb +17 -17
- data/spec/unit/braintree/exchange_rate_quote_input_spec.rb +42 -0
- data/spec/unit/braintree/exchange_rate_quote_request_spec.rb +82 -0
- data/spec/unit/braintree/exchange_rate_quote_response_spec.rb +52 -0
- data/spec/unit/braintree/exchange_rate_quote_spec.rb +42 -0
- data/spec/unit/braintree/exchange_rate_spec.rb +23 -0
- data/spec/unit/braintree/http_spec.rb +19 -17
- data/spec/unit/braintree/local_payment_completed_spec.rb +62 -8
- data/spec/unit/braintree/local_payment_expired_spec.rb +24 -0
- data/spec/unit/braintree/local_payment_funded_spec.rb +34 -0
- data/spec/unit/braintree/merchant_account_spec.rb +5 -5
- data/spec/unit/braintree/meta_checkout_card_details_spec.rb +60 -0
- data/spec/unit/braintree/meta_checkout_card_spec.rb +60 -0
- data/spec/unit/braintree/meta_checkout_token_details_spec.rb +63 -0
- data/spec/unit/braintree/meta_checkout_token_spec.rb +63 -0
- data/spec/unit/braintree/modification_spec.rb +1 -1
- data/spec/unit/braintree/package_tracking_spec.rb +77 -0
- data/spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb +45 -0
- data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +31 -0
- data/spec/unit/braintree/payment_method_nonce_details_spec.rb +51 -0
- data/spec/unit/braintree/payment_method_nonce_spec.rb +40 -0
- data/spec/unit/braintree/payment_method_spec.rb +20 -20
- data/spec/unit/braintree/paypal_account_spec.rb +16 -7
- data/spec/unit/braintree/resource_collection_spec.rb +34 -5
- data/spec/unit/braintree/risk_data/liability_shift.rb +26 -0
- data/spec/unit/braintree/risk_data_spec.rb +38 -8
- data/spec/unit/braintree/sepa_debit_account_nonce_details_spec.rb +29 -0
- data/spec/unit/braintree/sepa_debit_account_spec.rb +86 -0
- data/spec/unit/braintree/sha256_digest_spec.rb +1 -1
- data/spec/unit/braintree/signature_service_spec.rb +2 -2
- data/spec/unit/braintree/subscription_search_spec.rb +18 -18
- data/spec/unit/braintree/subscription_spec.rb +8 -8
- data/spec/unit/braintree/successful_result_spec.rb +6 -6
- data/spec/unit/braintree/three_d_secure_info_spec.rb +37 -17
- data/spec/unit/braintree/transaction/credit_card_details_spec.rb +22 -6
- data/spec/unit/braintree/transaction/customer_details_spec.rb +3 -2
- data/spec/unit/braintree/transaction/deposit_details_spec.rb +4 -4
- data/spec/unit/braintree/transaction/installment_spec.rb +25 -0
- data/spec/unit/braintree/transaction/local_payment_details_spec.rb +36 -0
- data/spec/unit/braintree/transaction/payment_receipt_spec.rb +73 -0
- data/spec/unit/braintree/transaction/paypal_details_spec.rb +63 -0
- data/spec/unit/braintree/transaction/sepa_direct_debit_account_details_spec.rb +33 -0
- data/spec/unit/braintree/transaction_gateway_spec.rb +150 -0
- data/spec/unit/braintree/transaction_search_spec.rb +12 -12
- data/spec/unit/braintree/transaction_spec.rb +221 -124
- data/spec/unit/braintree/unknown_payment_method_spec.rb +4 -4
- data/spec/unit/braintree/us_bank_account_spec.rb +2 -2
- data/spec/unit/braintree/us_bank_account_verification_search_spec.rb +7 -7
- data/spec/unit/braintree/us_bank_account_verification_spec.rb +12 -7
- data/spec/unit/braintree/util_spec.rb +78 -44
- data/spec/unit/braintree/validation_error_collection_spec.rb +62 -62
- data/spec/unit/braintree/validation_error_spec.rb +4 -4
- data/spec/unit/braintree/venmo_profile_data_spec.rb +43 -0
- data/spec/unit/braintree/webhook_notification_spec.rb +434 -197
- data/spec/unit/braintree/xml/libxml_spec.rb +5 -5
- data/spec/unit/braintree/xml/parser_spec.rb +27 -22
- data/spec/unit/braintree/xml/rexml_spec.rb +5 -5
- data/spec/unit/braintree/xml_spec.rb +38 -38
- data/spec/unit/braintree_spec.rb +2 -2
- metadata +91 -30
- data/lib/braintree/amex_express_checkout_card.rb +0 -38
- data/lib/braintree/coinbase_account.rb +0 -34
- data/lib/braintree/europe_bank_account.rb +0 -36
- data/lib/braintree/europe_bank_account_gateway.rb +0 -17
- data/lib/braintree/ideal_payment.rb +0 -61
- data/lib/braintree/ideal_payment_gateway.rb +0 -19
- data/lib/braintree/masterpass_card.rb +0 -81
- data/lib/braintree/settlement_batch.rb +0 -0
- data/lib/braintree/transaction/amex_express_checkout_details.rb +0 -21
- data/lib/braintree/transaction/ideal_payment_details.rb +0 -19
- data/lib/braintree/transaction/masterpass_card_details.rb +0 -47
- data/lib/braintree/transparent_redirect.rb +0 -40
- data/lib/braintree/transparent_redirect_gateway.rb +0 -105
- data/spec/hacks/tcp_socket.rb +0 -18
- data/spec/integration/braintree/coinbase_spec.rb +0 -34
- data/spec/integration/braintree/masterpass_card_spec.rb +0 -97
- data/spec/integration/braintree/transparent_redirect_spec.rb +0 -268
- data/spec/unit/braintree/transparent_redirect_spec.rb +0 -223
@@ -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])
|
@@ -74,7 +74,7 @@ module Braintree
|
|
74
74
|
|
75
75
|
if response.has_key?(:response) && response[:response][:merchant_account]
|
76
76
|
Braintree::SuccessfulResult.new(
|
77
|
-
:merchant_account => MerchantAccount._new(@gateway, response[:response][:merchant_account])
|
77
|
+
:merchant_account => MerchantAccount._new(@gateway, response[:response][:merchant_account]),
|
78
78
|
)
|
79
79
|
elsif response[:api_error_response]
|
80
80
|
ErrorResult.new(@gateway, response[:api_error_response])
|
@@ -83,6 +83,7 @@ module Braintree
|
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
|
+
# NEXT_MAJOR_VERSION this is part of Marketplace and shouldn't be removed unless we're removing all Marketplace code
|
86
87
|
def self._detect_signature(attributes)
|
87
88
|
if attributes.has_key?(:applicant_details)
|
88
89
|
warn "[DEPRECATED] Passing :applicant_details to create is deprecated. Please use :individual, :business, and :funding."
|
@@ -92,7 +93,8 @@ module Braintree
|
|
92
93
|
end
|
93
94
|
end
|
94
95
|
|
95
|
-
|
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
|
96
98
|
[
|
97
99
|
{:applicant_details => [
|
98
100
|
:first_name, :last_name, :email, :date_of_birth, :ssn, :routing_number,
|
@@ -103,7 +105,7 @@ module Braintree
|
|
103
105
|
]
|
104
106
|
end
|
105
107
|
|
106
|
-
def self._signature
|
108
|
+
def self._signature
|
107
109
|
[
|
108
110
|
{:individual => [
|
109
111
|
:first_name, :last_name, :email, :date_of_birth, :ssn, :phone,
|
@@ -117,11 +119,11 @@ module Braintree
|
|
117
119
|
]
|
118
120
|
end
|
119
121
|
|
120
|
-
def self._create_signature
|
122
|
+
def self._create_signature
|
121
123
|
_signature + [:tos_accepted, :master_merchant_account_id, :id]
|
122
124
|
end
|
123
125
|
|
124
|
-
def self._update_signature
|
126
|
+
def self._update_signature
|
125
127
|
_signature
|
126
128
|
end
|
127
129
|
end
|
@@ -26,7 +26,7 @@ module Braintree
|
|
26
26
|
if response.has_key?(:response) && response[:response][:merchant]
|
27
27
|
Braintree::SuccessfulResult.new(
|
28
28
|
:merchant => Merchant._new(@gateway, response[:response][:merchant]),
|
29
|
-
:credentials => OAuthCredentials._new(response[:response][:credentials])
|
29
|
+
:credentials => OAuthCredentials._new(response[:response][:credentials]),
|
30
30
|
)
|
31
31
|
elsif response[:api_error_response]
|
32
32
|
ErrorResult.new(@gateway, response[:api_error_response])
|
@@ -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)
|
21
|
-
self.new
|
20
|
+
def _new(*args)
|
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,8 +15,8 @@ module Braintree
|
|
15
15
|
protected :new
|
16
16
|
end
|
17
17
|
|
18
|
-
def self._new(*args)
|
19
|
-
self.new
|
18
|
+
def self._new(*args)
|
19
|
+
self.new(*args)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -22,7 +22,7 @@ module Braintree
|
|
22
22
|
})
|
23
23
|
if response[:credentials]
|
24
24
|
Braintree::SuccessfulResult.new(
|
25
|
-
:credentials => OAuthCredentials._new(response[:credentials])
|
25
|
+
:credentials => OAuthCredentials._new(response[:credentials]),
|
26
26
|
)
|
27
27
|
elsif response[:api_error_response]
|
28
28
|
ErrorResult.new(@gateway, response[:api_error_response])
|
@@ -47,10 +47,10 @@ module Braintree
|
|
47
47
|
user_params = _sub_query(params, :user)
|
48
48
|
business_params = _sub_query(params, :business)
|
49
49
|
payment_methods = _sub_array_query(params, :payment_methods)
|
50
|
-
query = params.to_a
|
51
|
-
concat(user_params)
|
52
|
-
concat(business_params)
|
53
|
-
concat(payment_methods)
|
50
|
+
query = params.to_a
|
51
|
+
.concat(user_params)
|
52
|
+
.concat(business_params)
|
53
|
+
.concat(payment_methods)
|
54
54
|
|
55
55
|
query_string = query.map { |k, v| "#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}" }.join("&")
|
56
56
|
"#{@config.base_url}/oauth/connect?#{query_string}"
|
@@ -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
|
@@ -1,17 +1,18 @@
|
|
1
1
|
module Braintree
|
2
2
|
module PaymentInstrumentType
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
3
|
+
ApplePayCard = "apple_pay_card"
|
4
|
+
CreditCard = "credit_card"
|
5
|
+
GooglePayCard = "android_pay_card"
|
6
|
+
LocalPayment = "local_payment"
|
7
|
+
MetaCheckoutCard = "meta_checkout_card"
|
8
|
+
MetaCheckoutToken = "meta_checkout_token"
|
9
|
+
PayPalAccount = "paypal_account"
|
10
|
+
PayPalHere = "paypal_here"
|
11
|
+
# NEXT_MAJOR_VERSION remove SamsungPayCard
|
12
|
+
SamsungPayCard = "samsung_pay_card"
|
13
|
+
SepaDirectDebitAccount = "sepa_debit_account"
|
14
|
+
UsBankAccount = "us_bank_account"
|
15
|
+
VenmoAccount = "venmo_account"
|
16
|
+
VisaCheckoutCard = "visa_checkout_card"
|
16
17
|
end
|
17
18
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Braintree
|
2
|
+
class PaymentMethodCustomerDataUpdatedMetadata
|
3
|
+
include BaseModule
|
4
|
+
|
5
|
+
attr_reader :token
|
6
|
+
attr_reader :payment_method
|
7
|
+
attr_reader :datetime_updated
|
8
|
+
attr_reader :enriched_customer_data
|
9
|
+
|
10
|
+
def initialize(gateway, attributes)
|
11
|
+
set_instance_variables_from_hash(attributes)
|
12
|
+
@payment_method = PaymentMethodParser.parse_payment_method(gateway, attributes[:payment_method])
|
13
|
+
@enriched_customer_data = EnrichedCustomerData._new(enriched_customer_data) if enriched_customer_data
|
14
|
+
end
|
15
|
+
|
16
|
+
class << self
|
17
|
+
protected :new
|
18
|
+
end
|
19
|
+
|
20
|
+
def self._new(*args)
|
21
|
+
self.new(*args)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
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,9 +21,8 @@ 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
|
-
|
23
26
|
if response[:api_error_response]
|
24
27
|
ErrorResult.new(@gateway, response[:api_error_response])
|
25
28
|
elsif response
|
@@ -43,18 +46,16 @@ module Braintree
|
|
43
46
|
CreditCard._new(@gateway, response[:credit_card])
|
44
47
|
elsif response.has_key?(:paypal_account)
|
45
48
|
PayPalAccount._new(@gateway, response[:paypal_account])
|
46
|
-
elsif response[:coinbase_account]
|
47
|
-
SuccessfulResult.new(:payment_method => CoinbaseAccount._new(@gateway, response[:coinbase_account]))
|
48
49
|
elsif response.has_key?(:us_bank_account)
|
49
50
|
UsBankAccount._new(@gateway, response[:us_bank_account])
|
50
|
-
elsif response.has_key?(:europe_bank_account)
|
51
|
-
EuropeBankAccount._new(@gateway, response[:europe_bank_account])
|
52
51
|
elsif response.has_key?(:apple_pay_card)
|
53
52
|
ApplePayCard._new(@gateway, response[:apple_pay_card])
|
54
53
|
elsif response.has_key?(:android_pay_card)
|
55
|
-
|
54
|
+
GooglePayCard._new(@gateway, response[:android_pay_card])
|
56
55
|
elsif response.has_key?(:venmo_account)
|
57
56
|
VenmoAccount._new(@gateway, response[:venmo_account])
|
57
|
+
elsif response.has_key?(:sepa_debit_account)
|
58
|
+
SepaDirectDebitAccount._new(@gateway, response[:sepa_debit_account])
|
58
59
|
else
|
59
60
|
UnknownPaymentMethod._new(@gateway, response)
|
60
61
|
end
|
@@ -63,6 +64,10 @@ module Braintree
|
|
63
64
|
end
|
64
65
|
|
65
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
|
66
71
|
Util.verify_keys(PaymentMethodGateway._update_signature, attributes)
|
67
72
|
_do_update(:put, "/payment_methods/any/#{token}", :payment_method => attributes)
|
68
73
|
end
|
@@ -71,7 +76,7 @@ module Braintree
|
|
71
76
|
return_object_or_raise(:payment_method) { update(*args) }
|
72
77
|
end
|
73
78
|
|
74
|
-
def _do_update(http_verb, path, params)
|
79
|
+
def _do_update(http_verb, path, params)
|
75
80
|
response = @config.http.send(http_verb, "#{@config.base_merchant_path}#{path}", params)
|
76
81
|
if response[:api_error_response]
|
77
82
|
ErrorResult.new(@gateway, response[:api_error_response])
|
@@ -87,7 +92,7 @@ module Braintree
|
|
87
92
|
if options.class == Hash
|
88
93
|
grant_options = options
|
89
94
|
elsif [true, false].include?(options)
|
90
|
-
grant_options = {
|
95
|
+
grant_options = {:allow_vaulting => options}
|
91
96
|
else
|
92
97
|
raise ArgumentError
|
93
98
|
end
|
@@ -96,7 +101,7 @@ module Braintree
|
|
96
101
|
"/payment_methods/grant",
|
97
102
|
:payment_method => {
|
98
103
|
:shared_payment_method_token => token,
|
99
|
-
}.merge(grant_options)
|
104
|
+
}.merge(grant_options),
|
100
105
|
)
|
101
106
|
rescue NotFoundError
|
102
107
|
raise NotFoundError, "payment method with token #{token.inspect} not found"
|
@@ -120,7 +125,7 @@ module Braintree
|
|
120
125
|
"/payment_methods/revoke",
|
121
126
|
:payment_method => {
|
122
127
|
:shared_payment_method_token => token
|
123
|
-
}
|
128
|
+
},
|
124
129
|
)
|
125
130
|
rescue NotFoundError
|
126
131
|
raise NotFoundError, "payment method with token #{token.inspect} not found"
|
@@ -137,25 +142,34 @@ module Braintree
|
|
137
142
|
end
|
138
143
|
end
|
139
144
|
|
140
|
-
def self._create_signature
|
145
|
+
def self._create_signature
|
141
146
|
_signature(:create)
|
142
147
|
end
|
143
148
|
|
144
|
-
def self._update_signature
|
149
|
+
def self._update_signature
|
145
150
|
_signature(:update)
|
146
151
|
end
|
147
152
|
|
148
|
-
def self._delete_signature
|
153
|
+
def self._delete_signature
|
149
154
|
[:revoke_all_grants]
|
150
155
|
end
|
151
156
|
|
152
|
-
def self._signature(type)
|
157
|
+
def self._signature(type)
|
153
158
|
billing_address_params = AddressGateway._shared_signature
|
154
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
|
155
162
|
options = [
|
156
|
-
:make_default,
|
157
|
-
:
|
163
|
+
:make_default,
|
164
|
+
:skip_advanced_fraud_checking,
|
165
|
+
:us_bank_account_verification_method,
|
166
|
+
:venmo_sdk_session, # Deprecated
|
158
167
|
:verification_account_type,
|
168
|
+
:verification_add_ons,
|
169
|
+
:verification_amount,
|
170
|
+
:verification_currency_iso_code,
|
171
|
+
:verification_merchant_account_id,
|
172
|
+
:verify_card,
|
159
173
|
:paypal => [
|
160
174
|
:payee_email,
|
161
175
|
:order_id,
|
@@ -165,21 +179,37 @@ module Braintree
|
|
165
179
|
{:shipping => paypal_options_shipping_signature}
|
166
180
|
],
|
167
181
|
]
|
182
|
+
# NEXT_MAJOR_VERSION Remove venmo_sdk_payment_method_code
|
183
|
+
# The old venmo SDK class has been deprecated
|
168
184
|
signature = [
|
169
|
-
:billing_address_id, :cardholder_name, :cvv, :
|
170
|
-
:
|
171
|
-
:device_data, :
|
185
|
+
:billing_address_id, :cardholder_name, :cvv, :expiration_date, :expiration_month,
|
186
|
+
:expiration_year, :number, :token, :venmo_sdk_payment_method_code, # Deprecated
|
187
|
+
:device_data, :payment_method_nonce,
|
172
188
|
{:options => options},
|
173
189
|
{:billing_address => billing_address_params}
|
174
190
|
]
|
191
|
+
signature << {
|
192
|
+
:three_d_secure_pass_thru => [
|
193
|
+
:eci_flag,
|
194
|
+
:cavv,
|
195
|
+
:xid,
|
196
|
+
:three_d_secure_version,
|
197
|
+
:authentication_response,
|
198
|
+
:directory_response,
|
199
|
+
:cavv_algorithm,
|
200
|
+
:ds_transaction_id,
|
201
|
+
]
|
202
|
+
}
|
175
203
|
|
176
204
|
case type
|
177
205
|
when :create
|
178
206
|
options << :fail_on_duplicate_payment_method
|
207
|
+
options << :fail_on_duplicate_payment_method_for_customer
|
179
208
|
signature << :customer_id
|
180
209
|
signature << :paypal_refresh_token
|
181
|
-
signature << :paypal_vault_without_upgrade
|
182
210
|
when :update
|
211
|
+
options << :fail_on_duplicate_payment_method
|
212
|
+
options << :fail_on_duplicate_payment_method_for_customer
|
183
213
|
billing_address_params << {:options => [:update_existing]}
|
184
214
|
else
|
185
215
|
raise ArgumentError
|
@@ -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)
|
@@ -15,21 +15,26 @@ module Braintree
|
|
15
15
|
end
|
16
16
|
|
17
17
|
attr_reader :bin_data
|
18
|
+
attr_reader :default
|
18
19
|
attr_reader :details
|
19
20
|
attr_reader :nonce
|
20
21
|
attr_reader :three_d_secure_info
|
21
22
|
attr_reader :type
|
23
|
+
attr_reader :authentication_insight
|
22
24
|
|
23
|
-
def initialize(gateway, attributes)
|
25
|
+
def initialize(gateway, attributes)
|
24
26
|
@gateway = gateway
|
25
|
-
|
26
|
-
@
|
27
|
-
@details = attributes.fetch(:details)
|
27
|
+
set_instance_variables_from_hash(attributes)
|
28
|
+
@details = PaymentMethodNonceDetails.new(attributes[:details]) if attributes[:details]
|
28
29
|
@three_d_secure_info = ThreeDSecureInfo.new(attributes[:three_d_secure_info]) if attributes[:three_d_secure_info]
|
29
30
|
@bin_data = BinData.new(attributes[:bin_data]) if attributes[:bin_data]
|
30
31
|
end
|
31
32
|
|
32
|
-
def
|
33
|
+
def default?
|
34
|
+
@default
|
35
|
+
end
|
36
|
+
|
37
|
+
def to_s
|
33
38
|
nonce
|
34
39
|
end
|
35
40
|
|
@@ -37,7 +42,7 @@ module Braintree
|
|
37
42
|
protected :new
|
38
43
|
end
|
39
44
|
|
40
|
-
def self._new(gateway, attributes)
|
45
|
+
def self._new(gateway, attributes)
|
41
46
|
new(gateway, attributes)
|
42
47
|
end
|
43
48
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Braintree
|
2
|
+
class PaymentMethodNonceDetails
|
3
|
+
include BaseModule
|
4
|
+
|
5
|
+
attr_reader :bin
|
6
|
+
attr_reader :card_type
|
7
|
+
attr_reader :expiration_month
|
8
|
+
attr_reader :expiration_year
|
9
|
+
attr_reader :is_network_tokenized
|
10
|
+
attr_reader :last_two
|
11
|
+
attr_reader :payer_info
|
12
|
+
attr_reader :sepa_direct_debit_account_nonce_details
|
13
|
+
|
14
|
+
alias_method :is_network_tokenized?, :is_network_tokenized
|
15
|
+
|
16
|
+
def initialize(attributes)
|
17
|
+
set_instance_variables_from_hash attributes unless attributes.nil?
|
18
|
+
@payer_info = PaymentMethodNonceDetailsPayerInfo.new(attributes[:payer_info]) if attributes[:payer_info]
|
19
|
+
@sepa_direct_debit_account_nonce_details = ::Braintree::SepaDirectDebitAccountNonceDetails.new(attributes)
|
20
|
+
end
|
21
|
+
|
22
|
+
def inspect
|
23
|
+
attr_order = [
|
24
|
+
:bin,
|
25
|
+
:card_type,
|
26
|
+
:expiration_month,
|
27
|
+
:expiration_year,
|
28
|
+
:is_network_tokenized,
|
29
|
+
:last_two,
|
30
|
+
:payer_info,
|
31
|
+
:sepa_direct_debit_account_nonce_details,
|
32
|
+
]
|
33
|
+
|
34
|
+
formatted_attrs = attr_order.map do |attr|
|
35
|
+
"#{attr}: #{send(attr).inspect}"
|
36
|
+
end
|
37
|
+
"#<PaymentMethodNonceDetails #{formatted_attrs.join(", ")}>"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|