braintree 2.74.0 → 4.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/LICENSE +1 -1
- data/braintree.gemspec +13 -7
- data/lib/braintree/account_updater_daily_report.rb +2 -2
- data/lib/braintree/ach_mandate.rb +2 -1
- data/lib/braintree/address/country_names.rb +4 -1
- data/lib/braintree/address.rb +30 -38
- data/lib/braintree/address_gateway.rb +12 -2
- data/lib/braintree/advanced_search.rb +8 -0
- data/lib/braintree/apple_pay.rb +29 -0
- data/lib/braintree/apple_pay_card.rb +28 -4
- data/lib/braintree/apple_pay_gateway.rb +37 -0
- data/lib/braintree/apple_pay_options.rb +19 -0
- data/lib/braintree/authorization_adjustment.rb +23 -0
- data/lib/braintree/base_module.rb +10 -0
- data/lib/braintree/bin_data.rb +33 -0
- data/lib/braintree/client_token.rb +3 -3
- data/lib/braintree/client_token_gateway.rb +3 -1
- data/lib/braintree/configuration.rb +57 -10
- data/lib/braintree/connected_merchant_paypal_status_changed.rb +6 -2
- data/lib/braintree/connected_merchant_status_transitioned.rb +6 -2
- data/lib/braintree/credentials_parser.rb +5 -1
- data/lib/braintree/credit_card.rb +53 -107
- data/lib/braintree/credit_card_gateway.rb +43 -30
- data/lib/braintree/credit_card_verification.rb +61 -21
- data/lib/braintree/credit_card_verification_gateway.rb +19 -6
- data/lib/braintree/credit_card_verification_search.rb +1 -1
- data/lib/braintree/customer.rb +51 -98
- data/lib/braintree/customer_gateway.rb +30 -23
- data/lib/braintree/customer_search.rb +1 -1
- data/lib/braintree/descriptor.rb +3 -1
- data/lib/braintree/disbursement.rb +24 -2
- data/lib/braintree/dispute/evidence.rb +24 -0
- data/lib/braintree/{transaction/coinbase_details.rb → dispute/paypal_message.rb} +5 -3
- data/lib/braintree/dispute/status_history.rb +18 -0
- data/lib/braintree/dispute/transaction.rb +20 -0
- data/lib/braintree/dispute/transaction_details.rb +2 -1
- data/lib/braintree/dispute.rb +114 -10
- data/lib/braintree/dispute_gateway.rb +142 -0
- data/lib/braintree/dispute_search.rb +31 -0
- data/lib/braintree/document_upload.rb +37 -0
- data/lib/braintree/document_upload_gateway.rb +38 -0
- data/lib/braintree/enriched_customer_data.rb +21 -0
- data/lib/braintree/error_codes.rb +328 -109
- data/lib/braintree/error_result.rb +8 -1
- data/lib/braintree/exceptions.rb +5 -3
- data/lib/braintree/exchange_rate.rb +13 -0
- data/lib/braintree/exchange_rate_quote.rb +24 -0
- data/lib/braintree/exchange_rate_quote_gateway.rb +35 -0
- data/lib/braintree/exchange_rate_quote_input.rb +21 -0
- data/lib/braintree/exchange_rate_quote_request.rb +18 -0
- data/lib/braintree/exchange_rate_quote_response.rb +18 -0
- data/lib/braintree/facilitated_details.rb +21 -0
- data/lib/braintree/facilitator_details.rb +2 -1
- data/lib/braintree/gateway.rb +29 -11
- data/lib/braintree/google_pay_card.rb +61 -0
- data/lib/braintree/granted_payment_instrument_update.rb +23 -0
- data/lib/braintree/graphql_client.rb +34 -0
- data/lib/braintree/http.rb +81 -20
- data/lib/braintree/local_payment_completed.rb +23 -0
- data/lib/braintree/local_payment_expired.rb +21 -0
- data/lib/braintree/local_payment_funded.rb +22 -0
- data/lib/braintree/local_payment_reversed.rb +19 -0
- data/lib/braintree/merchant.rb +11 -4
- data/lib/braintree/merchant_account/address_details.rb +4 -1
- data/lib/braintree/merchant_account/business_details.rb +4 -1
- data/lib/braintree/merchant_account/funding_details.rb +6 -1
- data/lib/braintree/merchant_account/individual_details.rb +7 -2
- data/lib/braintree/merchant_account.rb +23 -10
- data/lib/braintree/merchant_account_gateway.rb +13 -1
- data/lib/braintree/merchant_gateway.rb +2 -2
- data/lib/braintree/modification.rb +1 -1
- data/lib/braintree/oauth_credentials.rb +5 -2
- data/lib/braintree/oauth_gateway.rb +8 -14
- data/lib/braintree/paginated_result.rb +3 -1
- data/lib/braintree/payment_instrument_type.rb +11 -11
- data/lib/braintree/payment_method.rb +20 -12
- data/lib/braintree/payment_method_customer_data_updated_metadata.rb +24 -0
- data/lib/braintree/payment_method_gateway.rb +82 -54
- data/lib/braintree/payment_method_nonce.rb +22 -8
- data/lib/braintree/payment_method_nonce_details.rb +40 -0
- data/lib/braintree/payment_method_nonce_details_payer_info.rb +32 -0
- data/lib/braintree/payment_method_nonce_gateway.rb +19 -2
- data/lib/braintree/payment_method_parser.rb +28 -0
- data/lib/braintree/paypal_account.rb +10 -1
- data/lib/braintree/plan.rb +25 -5
- data/lib/braintree/plan_gateway.rb +100 -0
- data/lib/braintree/processor_response_types.rb +7 -0
- data/lib/braintree/resource_collection.rb +8 -3
- data/lib/braintree/revoked_payment_method_metadata.rb +22 -0
- data/lib/braintree/risk_data/liability_shift.rb +22 -0
- data/lib/braintree/risk_data.rb +12 -2
- data/lib/braintree/samsung_pay_card.rb +83 -0
- data/lib/braintree/sepa_direct_debit_account.rb +60 -0
- data/lib/braintree/sepa_direct_debit_account_gateway.rb +25 -0
- data/lib/braintree/sepa_direct_debit_account_nonce_details.rb +28 -0
- data/lib/braintree/settlement_batch_summary.rb +2 -1
- data/lib/braintree/settlement_batch_summary_gateway.rb +2 -0
- data/lib/braintree/subscription/status_details.rb +8 -1
- data/lib/braintree/subscription.rb +56 -41
- data/lib/braintree/subscription_gateway.rb +25 -2
- data/lib/braintree/successful_result.rb +23 -1
- data/lib/braintree/test/authentication_id.rb +21 -0
- data/lib/braintree/test/credit_card.rb +13 -0
- data/lib/braintree/test/nonce.rb +28 -20
- data/lib/braintree/test/transaction_amounts.rb +1 -0
- data/lib/braintree/three_d_secure_info.rb +34 -2
- data/lib/braintree/transaction/address_details.rb +24 -4
- data/lib/braintree/transaction/apple_pay_details.rb +20 -2
- data/lib/braintree/transaction/credit_card_details.rb +45 -6
- data/lib/braintree/transaction/customer_details.rb +8 -1
- data/lib/braintree/transaction/disbursement_details.rb +6 -1
- data/lib/braintree/transaction/google_pay_details.rb +41 -0
- data/lib/braintree/transaction/installment/adjustment.rb +33 -0
- data/lib/braintree/transaction/installment.rb +28 -0
- data/lib/braintree/transaction/local_payment_details.rb +24 -0
- data/lib/braintree/transaction/paypal_details.rb +26 -4
- data/lib/braintree/transaction/paypal_here_details.rb +23 -0
- data/lib/braintree/transaction/{masterpass_card_details.rb → samsung_pay_card_details.rb} +21 -6
- data/lib/braintree/transaction/sepa_direct_debit_account_details.rb +27 -0
- data/lib/braintree/transaction/status_details.rb +5 -1
- data/lib/braintree/transaction/subscription_details.rb +4 -1
- data/lib/braintree/transaction/us_bank_account_details.rb +8 -1
- data/lib/braintree/transaction/venmo_account_details.rb +5 -1
- data/lib/braintree/transaction/visa_checkout_card_details.rb +19 -4
- data/lib/braintree/transaction.rb +201 -188
- data/lib/braintree/transaction_gateway.rb +124 -30
- data/lib/braintree/transaction_line_item.rb +40 -0
- data/lib/braintree/transaction_line_item_gateway.rb +19 -0
- data/lib/braintree/transaction_review.rb +18 -0
- data/lib/braintree/transaction_search.rb +6 -3
- data/lib/braintree/unknown_payment_method.rb +3 -2
- data/lib/braintree/us_bank_account.rb +24 -8
- data/lib/braintree/us_bank_account_gateway.rb +0 -1
- data/lib/braintree/us_bank_account_verification.rb +81 -0
- data/lib/braintree/us_bank_account_verification_gateway.rb +51 -0
- data/lib/braintree/us_bank_account_verification_search.rb +19 -0
- data/lib/braintree/util.rb +79 -9
- data/lib/braintree/validation_error.rb +13 -3
- data/lib/braintree/validation_error_collection.rb +2 -1
- data/lib/braintree/venmo_account.rb +11 -4
- data/lib/braintree/venmo_profile_data.rb +23 -0
- data/lib/braintree/version.rb +2 -2
- data/lib/braintree/visa_checkout_card.rb +29 -13
- data/lib/braintree/webhook_notification.rb +66 -26
- data/lib/braintree/webhook_notification_gateway.rb +5 -3
- data/lib/braintree/webhook_testing.rb +2 -2
- data/lib/braintree/webhook_testing_gateway.rb +721 -55
- data/lib/braintree/xml/generator.rb +6 -4
- data/lib/braintree/xml/parser.rb +22 -35
- data/lib/braintree/xml/rexml.rb +4 -5
- data/lib/braintree.rb +60 -22
- data/lib/ssl/api_braintreegateway_com.ca.crt +50 -0
- data/spec/fixtures/files/bt_logo.png +0 -0
- data/spec/fixtures/files/gif_extension_bt_logo.gif +0 -0
- data/spec/fixtures/files/malformed_pdf.pdf +1 -0
- data/spec/fixtures/files/too_long.pdf +0 -0
- data/spec/integration/braintree/add_on_spec.rb +3 -3
- data/spec/integration/braintree/address_spec.rb +30 -113
- data/spec/integration/braintree/advanced_search_spec.rb +45 -45
- data/spec/integration/braintree/apple_pay_spec.rb +63 -0
- data/spec/integration/braintree/braintree_gateway_spec.rb +72 -0
- data/spec/integration/braintree/client_api/client_token_spec.rb +14 -32
- data/spec/integration/braintree/client_api/spec_helper.rb +104 -65
- data/spec/integration/braintree/credit_card_spec.rb +460 -615
- data/spec/integration/braintree/credit_card_verification_search_spec.rb +2 -2
- data/spec/integration/braintree/credit_card_verification_spec.rb +222 -6
- data/spec/integration/braintree/customer_search_spec.rb +8 -8
- data/spec/integration/braintree/customer_spec.rb +810 -498
- data/spec/integration/braintree/discount_spec.rb +1 -1
- data/spec/integration/braintree/dispute_search_spec.rb +167 -0
- data/spec/integration/braintree/dispute_spec.rb +333 -0
- data/spec/integration/braintree/document_upload_spec.rb +87 -0
- data/spec/integration/braintree/error_codes_spec.rb +1 -1
- data/spec/integration/braintree/exchange_rate_quote_spec.rb +97 -0
- data/spec/integration/braintree/graphql_client_spec.rb +72 -0
- data/spec/integration/braintree/http_spec.rb +12 -4
- data/spec/integration/braintree/merchant_account_spec.rb +74 -26
- data/spec/integration/braintree/merchant_spec.rb +39 -13
- data/spec/integration/braintree/oauth_spec.rb +18 -25
- data/spec/integration/braintree/payment_method_nonce_spec.rb +239 -5
- data/spec/integration/braintree/payment_method_spec.rb +882 -300
- data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +416 -0
- data/spec/integration/braintree/paypal_account_spec.rb +32 -31
- data/spec/integration/braintree/plan_spec.rb +82 -0
- data/spec/integration/braintree/samsung_pay_card_spec.rb +144 -0
- data/spec/integration/braintree/sepa_direct_debit_account_spec.rb +196 -0
- data/spec/integration/braintree/settlement_batch_summary_spec.rb +8 -8
- data/spec/integration/braintree/subscription_spec.rb +274 -180
- data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
- data/spec/integration/braintree/test_transaction_spec.rb +18 -18
- data/spec/integration/braintree/transaction_line_item_spec.rb +38 -0
- data/spec/integration/braintree/transaction_search_spec.rb +280 -152
- data/spec/integration/braintree/transaction_spec.rb +3709 -1175
- data/spec/integration/braintree/transaction_us_bank_account_spec.rb +438 -0
- data/spec/integration/braintree/us_bank_account_spec.rb +38 -17
- data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +178 -0
- data/spec/integration/braintree/us_bank_account_verification_spec.rb +240 -0
- data/spec/integration/braintree/visa_checkout_card_spec.rb +5 -5
- data/spec/integration/spec_helper.rb +27 -6
- data/spec/oauth_test_helper.rb +1 -1
- data/spec/script/httpsd.rb +6 -6
- data/spec/spec_helper.rb +26 -23
- data/spec/unit/braintree/address_spec.rb +1 -9
- data/spec/unit/braintree/apple_pay_card_spec.rb +104 -4
- data/spec/unit/braintree/client_token_spec.rb +2 -2
- data/spec/unit/braintree/configuration_spec.rb +108 -33
- data/spec/unit/braintree/credit_card_spec.rb +62 -33
- data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +51 -0
- data/spec/unit/braintree/credit_card_verification_search_spec.rb +1 -1
- data/spec/unit/braintree/credit_card_verification_spec.rb +39 -6
- data/spec/unit/braintree/customer_spec.rb +107 -27
- data/spec/unit/braintree/disbursement_spec.rb +59 -7
- data/spec/unit/braintree/dispute_search_spec.rb +66 -0
- data/spec/unit/braintree/dispute_spec.rb +472 -8
- data/spec/unit/braintree/document_upload_spec.rb +35 -0
- data/spec/unit/braintree/enriched_customer_data_spec.rb +32 -0
- data/spec/unit/braintree/error_result_spec.rb +5 -5
- data/spec/unit/braintree/errors_spec.rb +8 -8
- data/spec/unit/braintree/exchange_rate_quote_input_spec.rb +42 -0
- data/spec/unit/braintree/exchange_rate_quote_request_spec.rb +82 -0
- data/spec/unit/braintree/exchange_rate_quote_response_spec.rb +52 -0
- data/spec/unit/braintree/exchange_rate_quote_spec.rb +42 -0
- data/spec/unit/braintree/exchange_rate_spec.rb +23 -0
- data/spec/unit/braintree/http_spec.rb +93 -5
- data/spec/unit/braintree/local_payment_completed_spec.rb +50 -0
- data/spec/unit/braintree/local_payment_expired_spec.rb +24 -0
- data/spec/unit/braintree/local_payment_funded_spec.rb +34 -0
- data/spec/unit/braintree/merchant_account_spec.rb +1 -1
- data/spec/unit/braintree/modification_spec.rb +1 -1
- data/spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb +45 -0
- data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +31 -0
- data/spec/unit/braintree/payment_method_nonce_details_spec.rb +51 -0
- data/spec/unit/braintree/payment_method_nonce_spec.rb +40 -0
- data/spec/unit/braintree/payment_method_spec.rb +1 -1
- data/spec/unit/braintree/paypal_account_spec.rb +2 -2
- data/spec/unit/braintree/resource_collection_spec.rb +30 -1
- data/spec/unit/braintree/risk_data/liability_shift.rb +26 -0
- data/spec/unit/braintree/risk_data_spec.rb +40 -6
- data/spec/unit/braintree/sepa_debit_account_nonce_details_spec.rb +29 -0
- data/spec/unit/braintree/sepa_debit_account_spec.rb +86 -0
- data/spec/unit/braintree/subscription_search_spec.rb +1 -1
- data/spec/unit/braintree/subscription_spec.rb +2 -2
- data/spec/unit/braintree/successful_result_spec.rb +1 -1
- data/spec/unit/braintree/three_d_secure_info_spec.rb +34 -6
- data/spec/unit/braintree/transaction/credit_card_details_spec.rb +19 -3
- data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
- data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
- data/spec/unit/braintree/transaction/installment_spec.rb +25 -0
- data/spec/unit/braintree/transaction/paypal_details_spec.rb +63 -0
- data/spec/unit/braintree/transaction/sepa_direct_debit_account_details_spec.rb +33 -0
- data/spec/unit/braintree/transaction_gateway_spec.rb +111 -0
- data/spec/unit/braintree/transaction_search_spec.rb +12 -12
- data/spec/unit/braintree/transaction_spec.rb +171 -55
- data/spec/unit/braintree/us_bank_account_verification_search_spec.rb +60 -0
- data/spec/unit/braintree/us_bank_account_verification_spec.rb +93 -0
- data/spec/unit/braintree/util_spec.rb +162 -19
- data/spec/unit/braintree/validation_error_collection_spec.rb +336 -133
- data/spec/unit/braintree/venmo_profile_data_spec.rb +32 -0
- data/spec/unit/braintree/webhook_notification_spec.rb +546 -114
- data/spec/unit/braintree/xml/parser_spec.rb +21 -16
- data/spec/unit/braintree/xml_spec.rb +31 -24
- data/spec/unit/braintree_spec.rb +1 -0
- metadata +290 -198
- data/README.rdoc +0 -93
- data/lib/braintree/amex_express_checkout_card.rb +0 -26
- data/lib/braintree/android_pay_card.rb +0 -35
- data/lib/braintree/coinbase_account.rb +0 -25
- data/lib/braintree/europe_bank_account.rb +0 -34
- data/lib/braintree/europe_bank_account_gateway.rb +0 -17
- data/lib/braintree/ideal_payment.rb +0 -46
- data/lib/braintree/ideal_payment_gateway.rb +0 -18
- data/lib/braintree/masterpass_card.rb +0 -66
- data/lib/braintree/settlement_batch.rb +0 -0
- data/lib/braintree/transaction/amex_express_checkout_details.rb +0 -14
- data/lib/braintree/transaction/android_pay_details.rb +0 -17
- data/lib/braintree/transaction/ideal_payment_details.rb +0 -13
- data/lib/braintree/transparent_redirect.rb +0 -40
- data/lib/braintree/transparent_redirect_gateway.rb +0 -105
- data/spec/hacks/tcp_socket.rb +0 -18
- data/spec/httpsd.pid +0 -1
- data/spec/integration/braintree/coinbase_spec.rb +0 -31
- data/spec/integration/braintree/ideal_payment_spec.rb +0 -87
- data/spec/integration/braintree/masterpass_card_spec.rb +0 -97
- data/spec/integration/braintree/transparent_redirect_spec.rb +0 -268
- data/spec/unit/braintree/transparent_redirect_spec.rb +0 -223
data/lib/braintree/merchant.rb
CHANGED
@@ -2,11 +2,18 @@ module Braintree
|
|
2
2
|
class Merchant
|
3
3
|
include BaseModule # :nodoc:
|
4
4
|
|
5
|
-
attr_reader :
|
5
|
+
attr_reader :company_name
|
6
|
+
attr_reader :country_code_alpha2
|
7
|
+
attr_reader :country_code_alpha3
|
8
|
+
attr_reader :country_code_numeric
|
9
|
+
attr_reader :country_name
|
10
|
+
attr_reader :email
|
11
|
+
attr_reader :id
|
12
|
+
attr_reader :merchant_accounts
|
6
13
|
|
7
|
-
def initialize(attributes) # :nodoc:
|
14
|
+
def initialize(gateway, attributes) # :nodoc:
|
8
15
|
@merchant_accounts = attributes.delete(:merchant_accounts).map do |merchant_account|
|
9
|
-
MerchantAccount._new(
|
16
|
+
MerchantAccount._new(gateway, merchant_account)
|
10
17
|
end
|
11
18
|
|
12
19
|
set_instance_variables_from_hash(attributes)
|
@@ -17,7 +24,7 @@ module Braintree
|
|
17
24
|
end
|
18
25
|
|
19
26
|
def self._new(*args) # :nodoc:
|
20
|
-
self.new
|
27
|
+
self.new(*args)
|
21
28
|
end
|
22
29
|
|
23
30
|
def self.provision_raw_apple_pay
|
@@ -3,7 +3,10 @@ module Braintree
|
|
3
3
|
class AddressDetails
|
4
4
|
include BaseModule
|
5
5
|
|
6
|
-
attr_reader :
|
6
|
+
attr_reader :locality
|
7
|
+
attr_reader :postal_code
|
8
|
+
attr_reader :region
|
9
|
+
attr_reader :street_address
|
7
10
|
|
8
11
|
def initialize(attributes)
|
9
12
|
set_instance_variables_from_hash attributes unless attributes.nil?
|
@@ -3,7 +3,10 @@ module Braintree
|
|
3
3
|
class BusinessDetails
|
4
4
|
include BaseModule
|
5
5
|
|
6
|
-
attr_reader :
|
6
|
+
attr_reader :address_details
|
7
|
+
attr_reader :dba_name
|
8
|
+
attr_reader :legal_name
|
9
|
+
attr_reader :tax_id
|
7
10
|
|
8
11
|
def initialize(attributes)
|
9
12
|
set_instance_variables_from_hash attributes unless attributes.nil?
|
@@ -3,7 +3,12 @@ module Braintree
|
|
3
3
|
class FundingDetails
|
4
4
|
include BaseModule
|
5
5
|
|
6
|
-
attr_reader :account_number_last_4
|
6
|
+
attr_reader :account_number_last_4
|
7
|
+
attr_reader :descriptor
|
8
|
+
attr_reader :destination
|
9
|
+
attr_reader :email
|
10
|
+
attr_reader :mobile_phone
|
11
|
+
attr_reader :routing_number
|
7
12
|
|
8
13
|
def initialize(attributes)
|
9
14
|
set_instance_variables_from_hash attributes unless attributes.nil?
|
@@ -3,8 +3,13 @@ module Braintree
|
|
3
3
|
class IndividualDetails
|
4
4
|
include BaseModule
|
5
5
|
|
6
|
-
attr_reader :
|
7
|
-
|
6
|
+
attr_reader :address_details
|
7
|
+
attr_reader :date_of_birth
|
8
|
+
attr_reader :email
|
9
|
+
attr_reader :first_name
|
10
|
+
attr_reader :last_name
|
11
|
+
attr_reader :phone
|
12
|
+
attr_reader :ssn_last_4
|
8
13
|
|
9
14
|
def initialize(attributes)
|
10
15
|
set_instance_variables_from_hash attributes unless attributes.nil?
|
@@ -18,22 +18,35 @@ module Braintree
|
|
18
18
|
include Braintree::MerchantAccount::FundingDestination
|
19
19
|
end
|
20
20
|
|
21
|
-
attr_reader :
|
22
|
-
|
23
|
-
|
21
|
+
attr_reader :business_details
|
22
|
+
attr_reader :currency_iso_code
|
23
|
+
attr_reader :default
|
24
|
+
attr_reader :funding_details
|
25
|
+
attr_reader :id
|
26
|
+
attr_reader :individual_details
|
27
|
+
attr_reader :master_merchant_account
|
28
|
+
attr_reader :status
|
24
29
|
|
25
30
|
alias_method :default?, :default
|
26
31
|
|
27
|
-
def self.create(
|
28
|
-
Configuration.gateway.merchant_account.create(
|
32
|
+
def self.create(*args)
|
33
|
+
Configuration.gateway.merchant_account.create(*args)
|
29
34
|
end
|
30
35
|
|
31
|
-
def self.
|
32
|
-
Configuration.gateway.merchant_account.
|
36
|
+
def self.create!(*args)
|
37
|
+
Configuration.gateway.merchant_account.create!(*args)
|
33
38
|
end
|
34
39
|
|
35
|
-
def self.
|
36
|
-
Configuration.gateway.merchant_account.
|
40
|
+
def self.find(*args)
|
41
|
+
Configuration.gateway.merchant_account.find(*args)
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.update(*args)
|
45
|
+
Configuration.gateway.merchant_account.update(*args)
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.update!(*args)
|
49
|
+
Configuration.gateway.merchant_account.update!(*args)
|
37
50
|
end
|
38
51
|
|
39
52
|
def initialize(gateway, attributes) # :nodoc
|
@@ -48,7 +61,7 @@ module Braintree
|
|
48
61
|
class << self
|
49
62
|
protected :new
|
50
63
|
def _new(*args) # :nodoc:
|
51
|
-
self.new
|
64
|
+
self.new(*args)
|
52
65
|
end
|
53
66
|
end
|
54
67
|
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module Braintree
|
2
2
|
class MerchantAccountGateway # :nodoc:
|
3
|
+
include BaseModule
|
4
|
+
|
3
5
|
def initialize(gateway)
|
4
6
|
@gateway = gateway
|
5
7
|
@config = gateway.config
|
@@ -24,6 +26,10 @@ module Braintree
|
|
24
26
|
_do_create "/merchant_accounts/create_via_api", :merchant_account => attributes
|
25
27
|
end
|
26
28
|
|
29
|
+
def create!(*args)
|
30
|
+
return_object_or_raise(:merchant_account) { create(*args) }
|
31
|
+
end
|
32
|
+
|
27
33
|
def find(merchant_account_id)
|
28
34
|
raise ArgumentError if merchant_account_id.nil? || merchant_account_id.to_s.strip == ""
|
29
35
|
response = @config.http.get("#{@config.base_merchant_path}/merchant_accounts/#{merchant_account_id}")
|
@@ -37,6 +43,10 @@ module Braintree
|
|
37
43
|
_do_update "/merchant_accounts/#{merchant_account_id}/update_via_api", :merchant_account => attributes
|
38
44
|
end
|
39
45
|
|
46
|
+
def update!(*args)
|
47
|
+
return_object_or_raise(:merchant_account) { update(*args) }
|
48
|
+
end
|
49
|
+
|
40
50
|
def create_for_currency(params)
|
41
51
|
_create_for_currency(params)
|
42
52
|
end
|
@@ -64,7 +74,7 @@ module Braintree
|
|
64
74
|
|
65
75
|
if response.has_key?(:response) && response[:response][:merchant_account]
|
66
76
|
Braintree::SuccessfulResult.new(
|
67
|
-
:merchant_account => MerchantAccount._new(@gateway, response[:response][:merchant_account])
|
77
|
+
:merchant_account => MerchantAccount._new(@gateway, response[:response][:merchant_account]),
|
68
78
|
)
|
69
79
|
elsif response[:api_error_response]
|
70
80
|
ErrorResult.new(@gateway, response[:api_error_response])
|
@@ -73,6 +83,7 @@ module Braintree
|
|
73
83
|
end
|
74
84
|
end
|
75
85
|
|
86
|
+
# this is part of Marketplace and shouldn't be removed unless we're removing all Marketplace code
|
76
87
|
def self._detect_signature(attributes)
|
77
88
|
if attributes.has_key?(:applicant_details)
|
78
89
|
warn "[DEPRECATED] Passing :applicant_details to create is deprecated. Please use :individual, :business, and :funding."
|
@@ -82,6 +93,7 @@ module Braintree
|
|
82
93
|
end
|
83
94
|
end
|
84
95
|
|
96
|
+
# this is part of Marketplace and shouldn't be removed unless we're removing all Marketplace code
|
85
97
|
def self._deprecated_create_signature # :nodoc:
|
86
98
|
[
|
87
99
|
{:applicant_details => [
|
@@ -25,8 +25,8 @@ module Braintree
|
|
25
25
|
|
26
26
|
if response.has_key?(:response) && response[:response][:merchant]
|
27
27
|
Braintree::SuccessfulResult.new(
|
28
|
-
:merchant => Merchant._new(response[:response][:merchant]),
|
29
|
-
:credentials => OAuthCredentials._new(response[:response][:credentials])
|
28
|
+
:merchant => Merchant._new(@gateway, response[:response][:merchant]),
|
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])
|
@@ -2,7 +2,10 @@ module Braintree
|
|
2
2
|
class OAuthCredentials
|
3
3
|
include BaseModule # :nodoc:
|
4
4
|
|
5
|
-
attr_reader :access_token
|
5
|
+
attr_reader :access_token
|
6
|
+
attr_reader :expires_at
|
7
|
+
attr_reader :refresh_token
|
8
|
+
attr_reader :token_type
|
6
9
|
|
7
10
|
def initialize(attributes) # :nodoc:
|
8
11
|
set_instance_variables_from_hash(attributes)
|
@@ -13,7 +16,7 @@ module Braintree
|
|
13
16
|
end
|
14
17
|
|
15
18
|
def self._new(*args) # :nodoc:
|
16
|
-
self.new
|
19
|
+
self.new(*args)
|
17
20
|
end
|
18
21
|
end
|
19
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])
|
@@ -42,19 +42,18 @@ module Braintree
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
def connect_url(
|
46
|
-
params
|
45
|
+
def connect_url(raw_params)
|
46
|
+
params = raw_params.merge({:client_id => @config.client_id})
|
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
|
-
|
57
|
-
"#{url}&signature=#{_compute_signature(url)}&algorithm=SHA256"
|
56
|
+
"#{@config.base_url}/oauth/connect?#{query_string}"
|
58
57
|
end
|
59
58
|
|
60
59
|
def _sub_query(params, root)
|
@@ -70,10 +69,5 @@ module Braintree
|
|
70
69
|
["#{root}[]", value]
|
71
70
|
end
|
72
71
|
end
|
73
|
-
|
74
|
-
def _compute_signature(url)
|
75
|
-
key_digest = OpenSSL::Digest::SHA256.digest(@config.client_secret)
|
76
|
-
OpenSSL::HMAC.hexdigest(OpenSSL::Digest::SHA256.new, key_digest, url)
|
77
|
-
end
|
78
72
|
end
|
79
73
|
end
|
@@ -2,7 +2,9 @@ module Braintree
|
|
2
2
|
class PaginatedResult
|
3
3
|
include BaseModule
|
4
4
|
|
5
|
-
attr_reader :
|
5
|
+
attr_reader :current_page
|
6
|
+
attr_reader :page_size
|
7
|
+
attr_reader :total_items
|
6
8
|
|
7
9
|
def initialize(total_items, page_size, current_page) # :nodoc:
|
8
10
|
@total_items = total_items
|
@@ -1,15 +1,15 @@
|
|
1
1
|
module Braintree
|
2
2
|
module PaymentInstrumentType
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
3
|
+
ApplePayCard = "apple_pay_card"
|
4
|
+
CreditCard = "credit_card"
|
5
|
+
GooglePayCard = "android_pay_card"
|
6
|
+
LocalPayment = "local_payment"
|
7
|
+
PayPalAccount = "paypal_account"
|
8
|
+
PayPalHere = "paypal_here"
|
9
|
+
SamsungPayCard = "samsung_pay_card"
|
10
|
+
SepaDirectDebitAccount = "sepa_debit_account"
|
11
|
+
UsBankAccount = "us_bank_account"
|
12
|
+
VenmoAccount = "venmo_account"
|
13
|
+
VisaCheckoutCard = "visa_checkout_card"
|
14
14
|
end
|
15
15
|
end
|
@@ -2,28 +2,36 @@ module Braintree
|
|
2
2
|
class PaymentMethod
|
3
3
|
include BaseModule
|
4
4
|
|
5
|
-
def self.create(
|
6
|
-
Configuration.gateway.payment_method.create(
|
5
|
+
def self.create(*args)
|
6
|
+
Configuration.gateway.payment_method.create(*args)
|
7
7
|
end
|
8
8
|
|
9
|
-
def self.
|
10
|
-
Configuration.gateway.payment_method.
|
9
|
+
def self.create!(*args)
|
10
|
+
Configuration.gateway.payment_method.create!(*args)
|
11
11
|
end
|
12
12
|
|
13
|
-
def self.
|
14
|
-
Configuration.gateway.payment_method.
|
13
|
+
def self.find(*args)
|
14
|
+
Configuration.gateway.payment_method.find(*args)
|
15
15
|
end
|
16
16
|
|
17
|
-
def self.
|
18
|
-
Configuration.gateway.payment_method.
|
17
|
+
def self.update(*args)
|
18
|
+
Configuration.gateway.payment_method.update(*args)
|
19
19
|
end
|
20
20
|
|
21
|
-
def self.
|
22
|
-
Configuration.gateway.payment_method.
|
21
|
+
def self.update!(*args)
|
22
|
+
Configuration.gateway.payment_method.update!(*args)
|
23
23
|
end
|
24
24
|
|
25
|
-
def self.
|
26
|
-
Configuration.gateway.payment_method.
|
25
|
+
def self.delete(*args)
|
26
|
+
Configuration.gateway.payment_method.delete(*args)
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.grant(*args)
|
30
|
+
Configuration.gateway.payment_method.grant(*args)
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.revoke(*args)
|
34
|
+
Configuration.gateway.payment_method.revoke(*args)
|
27
35
|
end
|
28
36
|
end
|
29
37
|
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) # :nodoc:
|
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) # :nodoc:
|
21
|
+
self.new(*args)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module Braintree
|
2
2
|
class PaymentMethodGateway # :nodoc:
|
3
|
+
include BaseModule
|
4
|
+
|
3
5
|
def initialize(gateway)
|
4
6
|
@gateway = gateway
|
5
7
|
@config = gateway.config
|
@@ -11,38 +13,16 @@ module Braintree
|
|
11
13
|
_do_create("/payment_methods", :payment_method => attributes)
|
12
14
|
end
|
13
15
|
|
16
|
+
def create!(*args)
|
17
|
+
return_object_or_raise(:payment_method) { create(*args) }
|
18
|
+
end
|
19
|
+
|
14
20
|
def _do_create(path, params=nil) # :nodoc:
|
15
21
|
response = @config.http.post("#{@config.base_merchant_path}#{path}", params)
|
16
|
-
if response[:
|
17
|
-
SuccessfulResult.new(:payment_method => CreditCard._new(@gateway, response[:credit_card]))
|
18
|
-
elsif response[:paypal_account]
|
19
|
-
SuccessfulResult.new(:payment_method => PayPalAccount._new(@gateway, response[:paypal_account]))
|
20
|
-
elsif response[:coinbase_account]
|
21
|
-
SuccessfulResult.new(:payment_method => CoinbaseAccount._new(@gateway, response[:coinbase_account]))
|
22
|
-
elsif response[:us_bank_account]
|
23
|
-
SuccessfulResult.new(:payment_method => UsBankAccount._new(@gateway, response[:us_bank_account]))
|
24
|
-
elsif response[:europe_bank_account]
|
25
|
-
SuccessfulResult.new(:payment_method => EuropeBankAccount._new(@gateway, response[:europe_bank_account]))
|
26
|
-
elsif response[:apple_pay_card]
|
27
|
-
SuccessfulResult.new(:payment_method => ApplePayCard._new(@gateway, response[:apple_pay_card]))
|
28
|
-
elsif response[:android_pay_card]
|
29
|
-
SuccessfulResult.new(:payment_method => AndroidPayCard._new(@gateway, response[:android_pay_card]))
|
30
|
-
elsif response[:amex_express_checkout_card]
|
31
|
-
SuccessfulResult.new(:payment_method => AmexExpressCheckoutCard._new(@gateway, response[:amex_express_checkout_card]))
|
32
|
-
elsif response[:venmo_account]
|
33
|
-
SuccessfulResult.new(:payment_method => VenmoAccount._new(@gateway, response[:venmo_account]))
|
34
|
-
elsif response[:visa_checkout_card]
|
35
|
-
SuccessfulResult.new(:payment_method => VisaCheckoutCard._new(@gateway, response[:visa_checkout_card]))
|
36
|
-
elsif response[:masterpass_card]
|
37
|
-
SuccessfulResult.new(:payment_method => MasterpassCard._new(@gateway, response[:masterpass_card]))
|
38
|
-
elsif response[:payment_method_nonce]
|
39
|
-
SuccessfulResult.new(:payment_method_nonce => PaymentMethodNonce._new(@gateway, response[:payment_method_nonce]))
|
40
|
-
elsif response[:success]
|
41
|
-
SuccessfulResult.new
|
42
|
-
elsif response[:api_error_response]
|
22
|
+
if response[:api_error_response]
|
43
23
|
ErrorResult.new(@gateway, response[:api_error_response])
|
44
24
|
elsif response
|
45
|
-
SuccessfulResult.new(:payment_method =>
|
25
|
+
SuccessfulResult.new(:payment_method => PaymentMethodParser.parse_payment_method(@gateway, response))
|
46
26
|
else
|
47
27
|
raise UnexpectedError, "expected :payment_method or :api_error_response"
|
48
28
|
end
|
@@ -62,16 +42,16 @@ module Braintree
|
|
62
42
|
CreditCard._new(@gateway, response[:credit_card])
|
63
43
|
elsif response.has_key?(:paypal_account)
|
64
44
|
PayPalAccount._new(@gateway, response[:paypal_account])
|
65
|
-
elsif response[:coinbase_account]
|
66
|
-
SuccessfulResult.new(:payment_method => CoinbaseAccount._new(@gateway, response[:coinbase_account]))
|
67
45
|
elsif response.has_key?(:us_bank_account)
|
68
46
|
UsBankAccount._new(@gateway, response[:us_bank_account])
|
69
|
-
elsif response.has_key?(:europe_bank_account)
|
70
|
-
EuropeBankAccount._new(@gateway, response[:europe_bank_account])
|
71
47
|
elsif response.has_key?(:apple_pay_card)
|
72
48
|
ApplePayCard._new(@gateway, response[:apple_pay_card])
|
73
49
|
elsif response.has_key?(:android_pay_card)
|
74
|
-
|
50
|
+
GooglePayCard._new(@gateway, response[:android_pay_card])
|
51
|
+
elsif response.has_key?(:venmo_account)
|
52
|
+
VenmoAccount._new(@gateway, response[:venmo_account])
|
53
|
+
elsif response.has_key?(:sepa_debit_account)
|
54
|
+
SepaDirectDebitAccount._new(@gateway, response[:sepa_debit_account])
|
75
55
|
else
|
76
56
|
UnknownPaymentMethod._new(@gateway, response)
|
77
57
|
end
|
@@ -84,53 +64,73 @@ module Braintree
|
|
84
64
|
_do_update(:put, "/payment_methods/any/#{token}", :payment_method => attributes)
|
85
65
|
end
|
86
66
|
|
67
|
+
def update!(*args)
|
68
|
+
return_object_or_raise(:payment_method) { update(*args) }
|
69
|
+
end
|
70
|
+
|
71
|
+
def _do_update(http_verb, path, params) # :nodoc:
|
72
|
+
response = @config.http.send(http_verb, "#{@config.base_merchant_path}#{path}", params)
|
73
|
+
if response[:api_error_response]
|
74
|
+
ErrorResult.new(@gateway, response[:api_error_response])
|
75
|
+
elsif response
|
76
|
+
SuccessfulResult.new(:payment_method => PaymentMethodParser.parse_payment_method(@gateway, response))
|
77
|
+
else
|
78
|
+
raise UnexpectedError, "expected :payment_method or :api_error_response"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
87
82
|
def grant(token, options = {})
|
88
83
|
raise ArgumentError if token.nil? || token.to_s.strip == ""
|
89
84
|
if options.class == Hash
|
90
85
|
grant_options = options
|
91
86
|
elsif [true, false].include?(options)
|
92
|
-
grant_options = {
|
87
|
+
grant_options = {:allow_vaulting => options}
|
93
88
|
else
|
94
89
|
raise ArgumentError
|
95
90
|
end
|
96
91
|
|
97
|
-
|
92
|
+
_do_grant(
|
98
93
|
"/payment_methods/grant",
|
99
94
|
:payment_method => {
|
100
95
|
:shared_payment_method_token => token,
|
101
|
-
}.merge(grant_options)
|
96
|
+
}.merge(grant_options),
|
102
97
|
)
|
103
98
|
rescue NotFoundError
|
104
99
|
raise NotFoundError, "payment method with token #{token.inspect} not found"
|
105
100
|
end
|
106
101
|
|
102
|
+
def _do_grant(path, params=nil)
|
103
|
+
response = @config.http.post("#{@config.base_merchant_path}#{path}", params)
|
104
|
+
if response[:payment_method_nonce]
|
105
|
+
SuccessfulResult.new(:payment_method_nonce => PaymentMethodNonce._new(@gateway, response[:payment_method_nonce]))
|
106
|
+
elsif response[:api_error_response]
|
107
|
+
ErrorResult.new(@gateway, response[:api_error_response])
|
108
|
+
else
|
109
|
+
raise UnexpectedError, "expected :payment_method_nonce or :api_error_response"
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
107
113
|
def revoke(token)
|
108
114
|
raise ArgumentError if token.nil? || token.to_s.strip == ""
|
109
115
|
|
110
|
-
|
116
|
+
_do_revoke(
|
111
117
|
"/payment_methods/revoke",
|
112
118
|
:payment_method => {
|
113
119
|
:shared_payment_method_token => token
|
114
|
-
}
|
120
|
+
},
|
115
121
|
)
|
116
122
|
rescue NotFoundError
|
117
123
|
raise NotFoundError, "payment method with token #{token.inspect} not found"
|
118
124
|
end
|
119
125
|
|
120
|
-
def
|
121
|
-
response = @config.http.
|
122
|
-
if response[:
|
123
|
-
SuccessfulResult.new
|
124
|
-
elsif response[:paypal_account]
|
125
|
-
SuccessfulResult.new(:payment_method => PayPalAccount._new(@gateway, response[:paypal_account]))
|
126
|
-
elsif response[:coinbase_account]
|
127
|
-
SuccessfulResult.new(:payment_method => CoinbaseAccount._new(@gateway, response[:coinbase_account]))
|
126
|
+
def _do_revoke(path, params=nil)
|
127
|
+
response = @config.http.post("#{@config.base_merchant_path}#{path}", params)
|
128
|
+
if response[:success]
|
129
|
+
SuccessfulResult.new
|
128
130
|
elsif response[:api_error_response]
|
129
131
|
ErrorResult.new(@gateway, response[:api_error_response])
|
130
|
-
elsif response
|
131
|
-
SuccessfulResult.new(:payment_method => UnknownPaymentMethod._new(@gateway, response))
|
132
132
|
else
|
133
|
-
raise UnexpectedError, "expected :
|
133
|
+
raise UnexpectedError, "expected :success or :api_error_response"
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
@@ -148,23 +148,51 @@ module Braintree
|
|
148
148
|
|
149
149
|
def self._signature(type) # :nodoc:
|
150
150
|
billing_address_params = AddressGateway._shared_signature
|
151
|
+
paypal_options_shipping_signature = AddressGateway._shared_signature
|
151
152
|
options = [
|
152
|
-
:make_default,
|
153
|
+
:make_default,
|
154
|
+
:skip_advanced_fraud_checking,
|
155
|
+
:us_bank_account_verification_method,
|
156
|
+
:venmo_sdk_session,
|
157
|
+
:verification_account_type,
|
153
158
|
:verification_amount,
|
154
|
-
:
|
159
|
+
:verification_currency_iso_code,
|
160
|
+
:verification_merchant_account_id,
|
161
|
+
:verify_card,
|
162
|
+
:paypal => [
|
163
|
+
:payee_email,
|
164
|
+
:order_id,
|
165
|
+
:custom_field,
|
166
|
+
:description,
|
167
|
+
:amount,
|
168
|
+
{:shipping => paypal_options_shipping_signature}
|
169
|
+
],
|
155
170
|
]
|
156
171
|
signature = [
|
157
|
-
:billing_address_id, :cardholder_name, :cvv, :
|
158
|
-
:
|
159
|
-
:
|
172
|
+
:billing_address_id, :cardholder_name, :cvv, :expiration_date, :expiration_month,
|
173
|
+
:expiration_year, :number, :token, :venmo_sdk_payment_method_code, :device_data,
|
174
|
+
:payment_method_nonce,
|
160
175
|
{:options => options},
|
161
176
|
{:billing_address => billing_address_params}
|
162
177
|
]
|
178
|
+
signature << {
|
179
|
+
:three_d_secure_pass_thru => [
|
180
|
+
:eci_flag,
|
181
|
+
:cavv,
|
182
|
+
:xid,
|
183
|
+
:three_d_secure_version,
|
184
|
+
:authentication_response,
|
185
|
+
:directory_response,
|
186
|
+
:cavv_algorithm,
|
187
|
+
:ds_transaction_id,
|
188
|
+
]
|
189
|
+
}
|
163
190
|
|
164
191
|
case type
|
165
192
|
when :create
|
166
193
|
options << :fail_on_duplicate_payment_method
|
167
194
|
signature << :customer_id
|
195
|
+
signature << :paypal_refresh_token
|
168
196
|
when :update
|
169
197
|
billing_address_params << {:options => [:update_existing]}
|
170
198
|
else
|
@@ -2,22 +2,36 @@ module Braintree
|
|
2
2
|
class PaymentMethodNonce
|
3
3
|
include BaseModule # :nodoc:
|
4
4
|
|
5
|
-
def self.create(
|
6
|
-
Configuration.gateway.payment_method_nonce.create(
|
5
|
+
def self.create(*args)
|
6
|
+
Configuration.gateway.payment_method_nonce.create(*args)
|
7
7
|
end
|
8
8
|
|
9
|
-
def self.
|
10
|
-
Configuration.gateway.payment_method_nonce.
|
9
|
+
def self.create!(*args)
|
10
|
+
Configuration.gateway.payment_method_nonce.create!(*args)
|
11
11
|
end
|
12
12
|
|
13
|
-
|
13
|
+
def self.find(*args)
|
14
|
+
Configuration.gateway.payment_method_nonce.find(*args)
|
15
|
+
end
|
16
|
+
|
17
|
+
attr_reader :bin_data
|
18
|
+
attr_reader :default
|
19
|
+
attr_reader :details
|
20
|
+
attr_reader :nonce
|
21
|
+
attr_reader :three_d_secure_info
|
22
|
+
attr_reader :type
|
23
|
+
attr_reader :authentication_insight
|
14
24
|
|
15
25
|
def initialize(gateway, attributes) # :nodoc:
|
16
26
|
@gateway = gateway
|
17
|
-
|
18
|
-
@
|
19
|
-
@details = attributes.fetch(:details)
|
27
|
+
set_instance_variables_from_hash(attributes)
|
28
|
+
@details = PaymentMethodNonceDetails.new(attributes[:details]) if attributes[:details]
|
20
29
|
@three_d_secure_info = ThreeDSecureInfo.new(attributes[:three_d_secure_info]) if attributes[:three_d_secure_info]
|
30
|
+
@bin_data = BinData.new(attributes[:bin_data]) if attributes[:bin_data]
|
31
|
+
end
|
32
|
+
|
33
|
+
def default?
|
34
|
+
@default
|
21
35
|
end
|
22
36
|
|
23
37
|
def to_s # :nodoc:
|