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
data/lib/braintree/customer.rb
CHANGED
@@ -4,10 +4,7 @@ module Braintree
|
|
4
4
|
include Braintree::Util::IdEquality
|
5
5
|
|
6
6
|
attr_reader :addresses
|
7
|
-
attr_reader :amex_express_checkout_cards
|
8
|
-
attr_reader :android_pay_cards
|
9
7
|
attr_reader :apple_pay_cards
|
10
|
-
attr_reader :coinbase_accounts
|
11
8
|
attr_reader :company
|
12
9
|
attr_reader :created_at
|
13
10
|
attr_reader :credit_cards
|
@@ -15,12 +12,16 @@ module Braintree
|
|
15
12
|
attr_reader :email
|
16
13
|
attr_reader :fax
|
17
14
|
attr_reader :first_name
|
15
|
+
attr_reader :google_pay_cards
|
16
|
+
attr_reader :graphql_id
|
18
17
|
attr_reader :id
|
18
|
+
attr_reader :international_phone
|
19
19
|
attr_reader :last_name
|
20
|
-
attr_reader :masterpass_cards
|
21
20
|
attr_reader :paypal_accounts
|
22
21
|
attr_reader :phone
|
23
22
|
attr_reader :samsung_pay_cards
|
23
|
+
attr_reader :sepa_direct_debit_accounts
|
24
|
+
attr_reader :tax_identifiers
|
24
25
|
attr_reader :updated_at
|
25
26
|
attr_reader :us_bank_accounts
|
26
27
|
attr_reader :venmo_accounts
|
@@ -39,24 +40,12 @@ module Braintree
|
|
39
40
|
Configuration.gateway.customer.create!(*args)
|
40
41
|
end
|
41
42
|
|
42
|
-
# Deprecated. Use Braintree::TransparentRedirect.url
|
43
|
-
def self.create_customer_url
|
44
|
-
warn "[DEPRECATED] Customer.create_customer_url is deprecated. Please use TransparentRedirect.url"
|
45
|
-
Configuration.gateway.customer.create_customer_url
|
46
|
-
end
|
47
|
-
|
48
|
-
# Deprecated. Use Braintree::TransparentRedirect.confirm
|
49
|
-
def self.create_from_transparent_redirect(*args)
|
50
|
-
warn "[DEPRECATED] Customer.create_from_transparent_redirect is deprecated. Please use TransparentRedirect.confirm"
|
51
|
-
Configuration.gateway.customer.create_from_transparent_redirect(*args)
|
52
|
-
end
|
53
|
-
|
54
43
|
def self.credit(customer_id, transaction_attributes)
|
55
44
|
Transaction.credit(transaction_attributes.merge(:customer_id => customer_id))
|
56
45
|
end
|
57
46
|
|
58
47
|
def self.credit!(customer_id, transaction_attributes)
|
59
|
-
return_object_or_raise(:transaction){ credit(customer_id, transaction_attributes) }
|
48
|
+
return_object_or_raise(:transaction) { credit(customer_id, transaction_attributes) }
|
60
49
|
end
|
61
50
|
|
62
51
|
def self.delete(*args)
|
@@ -79,7 +68,6 @@ module Braintree
|
|
79
68
|
Configuration.gateway.customer.search(&block)
|
80
69
|
end
|
81
70
|
|
82
|
-
# Returns a ResourceCollection of transactions for the customer with the given +customer_id+.
|
83
71
|
def self.transactions(*args)
|
84
72
|
Configuration.gateway.customer.transactions(*args)
|
85
73
|
end
|
@@ -92,34 +80,21 @@ module Braintree
|
|
92
80
|
Configuration.gateway.customer.update!(*args)
|
93
81
|
end
|
94
82
|
|
95
|
-
#
|
96
|
-
def
|
97
|
-
warn "[DEPRECATED] Customer.update_customer_url is deprecated. Please use TransparentRedirect.url"
|
98
|
-
Configuration.gateway.customer.update_customer_url
|
99
|
-
end
|
100
|
-
|
101
|
-
# Deprecated. Use Braintree::TransparentRedirect.confirm
|
102
|
-
def self.update_from_transparent_redirect(*args)
|
103
|
-
warn "[DEPRECATED] Customer.update_from_transparent_redirect is deprecated. Please use TransparentRedirect.confirm"
|
104
|
-
Configuration.gateway.customer.update_from_transparent_redirect(*args)
|
105
|
-
end
|
106
|
-
|
107
|
-
def initialize(gateway, attributes) # :nodoc:
|
83
|
+
# NEXT_MAJOR_VERSION remove samsung_pay_cards
|
84
|
+
def initialize(gateway, attributes)
|
108
85
|
@gateway = gateway
|
109
86
|
set_instance_variables_from_hash(attributes)
|
110
87
|
@credit_cards = (@credit_cards || []).map { |pm| CreditCard._new gateway, pm }
|
111
88
|
@paypal_accounts = (@paypal_accounts || []).map { |pm| PayPalAccount._new gateway, pm }
|
112
|
-
@coinbase_accounts = (@coinbase_accounts || []).map { |pm| CoinbaseAccount._new gateway, pm }
|
113
89
|
@apple_pay_cards = (@apple_pay_cards || []).map { |pm| ApplePayCard._new gateway, pm }
|
114
|
-
@
|
115
|
-
@android_pay_cards = (@android_pay_cards || []).map { |pm| AndroidPayCard._new gateway, pm }
|
116
|
-
@amex_express_checkout_cards = (@amex_express_checkout_cards || []).map { |pm| AmexExpressCheckoutCard._new gateway, pm }
|
90
|
+
@google_pay_cards = (@google_pay_cards || []).map { |pm| GooglePayCard._new gateway, pm }
|
117
91
|
@venmo_accounts = (@venmo_accounts || []).map { |pm| VenmoAccount._new gateway, pm }
|
118
92
|
@us_bank_accounts = (@us_bank_accounts || []).map { |pm| UsBankAccount._new gateway, pm }
|
119
93
|
@visa_checkout_cards = (@visa_checkout_cards|| []).map { |pm| VisaCheckoutCard._new gateway, pm }
|
120
|
-
@
|
121
|
-
@samsung_pay_cards = (@samsung_pay_cards|| []).map { |pm| SamsungPayCard._new gateway, pm }
|
94
|
+
@sepa_direct_debit_accounts = (@sepa_debit_accounts || []).map { |pm| SepaDirectDebitAccount._new gateway, pm }
|
95
|
+
@samsung_pay_cards = (@samsung_pay_cards|| []).map { |pm| SamsungPayCard._new gateway, pm } # Deprecated
|
122
96
|
@addresses = (@addresses || []).map { |addr| Address._new gateway, addr }
|
97
|
+
@tax_identifiers = (@tax_identifiers || []).map { |addr| TaxIdentifier._new gateway, addr }
|
123
98
|
@custom_fields = attributes[:custom_fields].is_a?(Hash) ? attributes[:custom_fields] : {}
|
124
99
|
end
|
125
100
|
|
@@ -131,15 +106,6 @@ module Braintree
|
|
131
106
|
return_object_or_raise(:transaction) { credit(transaction_attributes) }
|
132
107
|
end
|
133
108
|
|
134
|
-
# Deprecated. Use Braintree::Customer.default_payment_method
|
135
|
-
#
|
136
|
-
# Returns the customer's default credit card.
|
137
|
-
def default_credit_card
|
138
|
-
warn "[DEPRECATED] Customer#default_credit_card is deprecated. Please use Customer#default_payment_method"
|
139
|
-
@credit_cards.find { |credit_card| credit_card.default? }
|
140
|
-
end
|
141
|
-
|
142
|
-
# Returns the customer's default payment method.
|
143
109
|
def default_payment_method
|
144
110
|
payment_methods.find { |payment_instrument| payment_instrument.default? }
|
145
111
|
end
|
@@ -148,23 +114,21 @@ module Braintree
|
|
148
114
|
@gateway.customer.delete(id)
|
149
115
|
end
|
150
116
|
|
151
|
-
# Returns the customer's payment methods
|
152
117
|
def payment_methods
|
153
118
|
@credit_cards +
|
154
119
|
@paypal_accounts +
|
155
120
|
@apple_pay_cards +
|
156
|
-
@
|
157
|
-
@android_pay_cards +
|
158
|
-
@amex_express_checkout_cards +
|
121
|
+
@google_pay_cards +
|
159
122
|
@venmo_accounts +
|
160
123
|
@us_bank_accounts +
|
161
124
|
@visa_checkout_cards +
|
162
|
-
@samsung_pay_cards
|
125
|
+
@samsung_pay_cards +
|
126
|
+
@sepa_direct_debit_accounts
|
163
127
|
end
|
164
128
|
|
165
|
-
def inspect
|
129
|
+
def inspect
|
166
130
|
first = [:id]
|
167
|
-
last = [:addresses, :credit_cards, :paypal_accounts]
|
131
|
+
last = [:addresses, :credit_cards, :paypal_accounts, :tax_identifiers]
|
168
132
|
order = first + (self.class._attributes - first - last) + last
|
169
133
|
nice_attributes = order.map do |attr|
|
170
134
|
"#{attr}: #{send(attr).inspect}"
|
@@ -172,55 +136,26 @@ module Braintree
|
|
172
136
|
"#<#{self.class} #{nice_attributes.join(', ')}>"
|
173
137
|
end
|
174
138
|
|
175
|
-
# Deprecated. Use Braintree::Customer.sale
|
176
|
-
def sale(transaction_attributes)
|
177
|
-
warn "[DEPRECATED] sale as an instance method is deprecated. Please use Customer.sale"
|
178
|
-
@gateway.transaction.sale(transaction_attributes.merge(:customer_id => id))
|
179
|
-
end
|
180
|
-
|
181
|
-
# Deprecated. Use Braintree::Customer.sale!
|
182
|
-
def sale!(transaction_attributes)
|
183
|
-
warn "[DEPRECATED] sale! as an instance method is deprecated. Please use Customer.sale!"
|
184
|
-
return_object_or_raise(:transaction) { sale(transaction_attributes) }
|
185
|
-
end
|
186
|
-
|
187
|
-
# Returns a ResourceCollection of transactions for the customer.
|
188
139
|
def transactions(options = {})
|
189
140
|
@gateway.customer.transactions(id, options)
|
190
141
|
end
|
191
142
|
|
192
|
-
# Deprecated. Use Braintree::Customer.update
|
193
|
-
def update(attributes)
|
194
|
-
warn "[DEPRECATED] update as an instance method is deprecated. Please use Customer.update"
|
195
|
-
result = @gateway.customer.update(id, attributes)
|
196
|
-
if result.success?
|
197
|
-
copy_instance_variables_from_object result.customer
|
198
|
-
end
|
199
|
-
result
|
200
|
-
end
|
201
|
-
|
202
|
-
# Deprecated. Use Braintree::Customer.update!
|
203
|
-
def update!(attributes)
|
204
|
-
warn "[DEPRECATED] update! as an instance method is deprecated. Please use Customer.update!"
|
205
|
-
return_object_or_raise(:customer) { update(attributes) }
|
206
|
-
end
|
207
|
-
|
208
143
|
class << self
|
209
144
|
protected :new
|
210
145
|
end
|
211
146
|
|
212
|
-
def self._new(*args)
|
213
|
-
self.new
|
147
|
+
def self._new(*args)
|
148
|
+
self.new(*args)
|
214
149
|
end
|
215
150
|
|
216
|
-
def self._attributes
|
151
|
+
def self._attributes
|
217
152
|
[
|
218
|
-
:addresses, :company, :credit_cards, :email, :fax, :first_name, :id, :
|
219
|
-
:created_at, :updated_at
|
153
|
+
:addresses, :company, :credit_cards, :email, :fax, :first_name, :id, :international_phone,
|
154
|
+
:last_name, :phone, :website, :created_at, :updated_at, :tax_identifiers
|
220
155
|
]
|
221
156
|
end
|
222
157
|
|
223
|
-
def self._now_timestamp
|
158
|
+
def self._now_timestamp
|
224
159
|
Time.now.to_i
|
225
160
|
end
|
226
161
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Braintree
|
2
|
-
class CustomerGateway
|
2
|
+
class CustomerGateway
|
3
3
|
include BaseModule
|
4
4
|
|
5
5
|
def initialize(gateway)
|
@@ -22,17 +22,6 @@ module Braintree
|
|
22
22
|
return_object_or_raise(:customer) { create(*args) }
|
23
23
|
end
|
24
24
|
|
25
|
-
# Deprecated
|
26
|
-
def create_customer_url
|
27
|
-
"#{@config.base_merchant_url}/customers/all/create_via_transparent_redirect_request"
|
28
|
-
end
|
29
|
-
|
30
|
-
# Deprecated
|
31
|
-
def create_from_transparent_redirect(query_string)
|
32
|
-
params = @gateway.transparent_redirect.parse_and_validate_query_string query_string
|
33
|
-
_do_create("/customers/all/confirm_transparent_redirect_request", :id => params[:id])
|
34
|
-
end
|
35
|
-
|
36
25
|
def delete(customer_id)
|
37
26
|
@config.http.delete("#{@config.base_merchant_path}/customers/#{customer_id}")
|
38
27
|
SuccessfulResult.new
|
@@ -71,20 +60,10 @@ module Braintree
|
|
71
60
|
return_object_or_raise(:customer) { update(*args) }
|
72
61
|
end
|
73
62
|
|
74
|
-
|
75
|
-
def update_customer_url
|
76
|
-
warn "[DEPRECATED] Customer.update_customer_url is deprecated. Please use TransparentRedirect.url"
|
77
|
-
"#{@config.base_merchant_url}/customers/all/update_via_transparent_redirect_request"
|
78
|
-
end
|
79
|
-
|
80
|
-
# Deprecated
|
81
|
-
def update_from_transparent_redirect(query_string)
|
82
|
-
params = @gateway.transparent_redirect.parse_and_validate_query_string(query_string)
|
83
|
-
_do_update(:post, "/customers/all/confirm_transparent_redirect_request", :id => params[:id])
|
84
|
-
end
|
85
|
-
|
86
|
-
def self._create_signature # :nodoc:
|
63
|
+
def self._create_signature
|
87
64
|
credit_card_signature = CreditCardGateway._create_signature - [:customer_id]
|
65
|
+
credit_card_options = credit_card_signature.find { |item| item.respond_to?(:keys) && item.keys == [:options] }
|
66
|
+
credit_card_options[:options].delete_if { |option| option == :fail_on_duplicate_payment_method_for_customer }
|
88
67
|
paypal_account_signature = PayPalAccountGateway._create_nested_signature
|
89
68
|
paypal_options_shipping_signature = AddressGateway._shared_signature
|
90
69
|
options = [
|
@@ -98,17 +77,20 @@ module Braintree
|
|
98
77
|
],
|
99
78
|
]
|
100
79
|
[
|
101
|
-
:company, :email, :fax, :first_name, :id,
|
80
|
+
:company, :email, :fax, :first_name, :id,
|
81
|
+
{:international_phone => [:country_code, :national_number]},
|
82
|
+
:last_name, :phone, :website,
|
102
83
|
:device_data, :payment_method_nonce,
|
103
84
|
{:risk_data => [:customer_browser, :customer_ip]},
|
104
85
|
{:credit_card => credit_card_signature},
|
105
86
|
{:paypal_account => paypal_account_signature},
|
87
|
+
{:tax_identifiers => [:country_code, :identifier]},
|
106
88
|
{:options => options},
|
107
89
|
{:custom_fields => :_any_key_}
|
108
90
|
]
|
109
91
|
end
|
110
92
|
|
111
|
-
def _do_create(path, params=nil)
|
93
|
+
def _do_create(path, params=nil)
|
112
94
|
response = @config.http.post("#{@config.base_merchant_path}#{path}", params)
|
113
95
|
if response[:customer]
|
114
96
|
SuccessfulResult.new(:customer => Customer._new(@gateway, response[:customer]))
|
@@ -119,7 +101,7 @@ module Braintree
|
|
119
101
|
end
|
120
102
|
end
|
121
103
|
|
122
|
-
def _do_update(http_verb, path, params)
|
104
|
+
def _do_update(http_verb, path, params)
|
123
105
|
response = @config.http.send(http_verb, "#{@config.base_merchant_path}#{path}", params)
|
124
106
|
if response[:customer]
|
125
107
|
SuccessfulResult.new(:customer => Customer._new(@gateway, response[:customer]))
|
@@ -130,14 +112,14 @@ module Braintree
|
|
130
112
|
end
|
131
113
|
end
|
132
114
|
|
133
|
-
def _fetch_customers(search, ids)
|
115
|
+
def _fetch_customers(search, ids)
|
134
116
|
search.ids.in ids
|
135
117
|
response = @config.http.post("#{@config.base_merchant_path}/customers/advanced_search", {:search => search.to_hash})
|
136
118
|
attributes = response[:customers]
|
137
119
|
Util.extract_attribute_as_array(attributes, :customer).map { |attrs| Customer._new(@gateway, attrs) }
|
138
120
|
end
|
139
121
|
|
140
|
-
def _fetch_transactions(customer_id, ids)
|
122
|
+
def _fetch_transactions(customer_id, ids)
|
141
123
|
response = @config.http.post("#{@config.base_merchant_path}/customers/#{customer_id}/transactions", :search => {:ids => ids})
|
142
124
|
attributes = response[:credit_card_transactions]
|
143
125
|
Util.extract_attribute_as_array(attributes, :transaction).map do |transaction_attributes|
|
@@ -145,7 +127,7 @@ module Braintree
|
|
145
127
|
end
|
146
128
|
end
|
147
129
|
|
148
|
-
def self._update_signature
|
130
|
+
def self._update_signature
|
149
131
|
credit_card_signature = CreditCardGateway._update_signature - [:customer_id]
|
150
132
|
credit_card_options = credit_card_signature.find { |item| item.respond_to?(:keys) && item.keys == [:options] }
|
151
133
|
credit_card_options[:options] << :update_existing_token
|
@@ -161,9 +143,12 @@ module Braintree
|
|
161
143
|
],
|
162
144
|
]
|
163
145
|
[
|
164
|
-
:company, :email, :fax, :first_name, :id,
|
146
|
+
:company, :email, :fax, :first_name, :id,
|
147
|
+
{:international_phone => [:country_code, :national_number]},
|
148
|
+
:last_name, :phone, :website,
|
165
149
|
:device_data, :payment_method_nonce, :default_payment_method_token,
|
166
150
|
{:credit_card => credit_card_signature},
|
151
|
+
{:tax_identifiers => [:country_code, :identifier]},
|
167
152
|
{:options => options},
|
168
153
|
{:custom_fields => :_any_key_}
|
169
154
|
]
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Braintree
|
2
|
-
class CustomerSearch < AdvancedSearch
|
2
|
+
class CustomerSearch < AdvancedSearch
|
3
3
|
text_fields(
|
4
4
|
:address_country_name,
|
5
5
|
:address_extended_address,
|
@@ -19,7 +19,7 @@ module Braintree
|
|
19
19
|
:payment_method_token,
|
20
20
|
:paypal_account_email,
|
21
21
|
:phone,
|
22
|
-
:website
|
22
|
+
:website,
|
23
23
|
)
|
24
24
|
|
25
25
|
is_fields :payment_method_token_with_duplicates
|
data/lib/braintree/descriptor.rb
CHANGED
data/lib/braintree/digest.rb
CHANGED
@@ -20,7 +20,7 @@ module Braintree
|
|
20
20
|
|
21
21
|
alias_method :success?, :success
|
22
22
|
|
23
|
-
def initialize(gateway, attributes)
|
23
|
+
def initialize(gateway, attributes)
|
24
24
|
@gateway = gateway
|
25
25
|
set_instance_variables_from_hash(attributes)
|
26
26
|
@amount = Util.to_big_decimal(amount)
|
@@ -29,15 +29,15 @@ module Braintree
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def transactions
|
32
|
-
|
32
|
+
@gateway.transaction.search do |search|
|
33
33
|
search.ids.in transaction_ids
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
def inspect
|
37
|
+
def inspect
|
38
38
|
nice_attributes = self.class._inspect_attributes.map { |attr| "#{attr}: #{send(attr).inspect}" }
|
39
39
|
nice_attributes << "amount: #{self.amount.to_s("F").inspect}"
|
40
|
-
nice_attributes << "disbursement_date: #{self.disbursement_date
|
40
|
+
nice_attributes << "disbursement_date: #{self.disbursement_date}"
|
41
41
|
"#<#{self.class} #{nice_attributes.join(', ')}>"
|
42
42
|
end
|
43
43
|
|
@@ -51,12 +51,12 @@ module Braintree
|
|
51
51
|
|
52
52
|
class << self
|
53
53
|
protected :new
|
54
|
-
def _new(*args)
|
55
|
-
self.new
|
54
|
+
def _new(*args)
|
55
|
+
self.new(*args)
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
def self._inspect_attributes
|
59
|
+
def self._inspect_attributes
|
60
60
|
[:id, :exception_message, :follow_up_action, :merchant_account, :transaction_ids, :retry, :success]
|
61
61
|
end
|
62
62
|
end
|
@@ -1,12 +1,11 @@
|
|
1
1
|
module Braintree
|
2
|
-
class
|
3
|
-
class
|
2
|
+
class Dispute
|
3
|
+
class PayPalMessage
|
4
4
|
include BaseModule
|
5
5
|
|
6
|
-
attr_reader :
|
7
|
-
|
8
|
-
|
9
|
-
attr_reader :token
|
6
|
+
attr_reader :message,
|
7
|
+
:sender,
|
8
|
+
:sent_at
|
10
9
|
|
11
10
|
def initialize(attributes)
|
12
11
|
set_instance_variables_from_hash attributes unless attributes.nil?
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Braintree
|
2
2
|
class Dispute
|
3
|
-
class
|
3
|
+
class StatusHistory
|
4
4
|
include BaseModule
|
5
5
|
|
6
6
|
attr_reader :disbursement_date
|
@@ -10,6 +10,8 @@ module Braintree
|
|
10
10
|
|
11
11
|
def initialize(attributes)
|
12
12
|
set_instance_variables_from_hash attributes unless attributes.nil?
|
13
|
+
@disbursement_date = Date.parse(disbursement_date) unless disbursement_date.nil?
|
14
|
+
@effective_date = Date.parse(effective_date) unless effective_date.nil?
|
13
15
|
end
|
14
16
|
end
|
15
17
|
end
|
@@ -1,10 +1,12 @@
|
|
1
1
|
module Braintree
|
2
2
|
class Dispute
|
3
|
-
class Transaction
|
3
|
+
class Transaction
|
4
4
|
include BaseModule
|
5
5
|
|
6
6
|
attr_reader :amount
|
7
|
+
attr_reader :created_at
|
7
8
|
attr_reader :id
|
9
|
+
attr_reader :installment_count
|
8
10
|
attr_reader :order_id
|
9
11
|
attr_reader :purchase_order_number
|
10
12
|
attr_reader :payment_instrument_subtype
|
data/lib/braintree/dispute.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Braintree
|
2
|
-
class Dispute
|
2
|
+
class Dispute
|
3
3
|
include BaseModule
|
4
4
|
include Braintree::Util::IdEquality
|
5
5
|
|
@@ -7,16 +7,23 @@ module Braintree
|
|
7
7
|
attr_reader :amount_disputed
|
8
8
|
attr_reader :amount_won
|
9
9
|
attr_reader :case_number
|
10
|
+
# NEXT_MAJOR_VERSION Remove this attribute
|
11
|
+
# DEPRECATED The chargeback_protection_level attribute is deprecated in favor of protection_level
|
12
|
+
attr_reader :chargeback_protection_level #Deprecated
|
10
13
|
attr_reader :created_at
|
11
14
|
attr_reader :currency_iso_code
|
12
15
|
attr_reader :date_opened
|
13
16
|
attr_reader :date_won
|
14
17
|
attr_reader :evidence
|
15
|
-
attr_reader :
|
18
|
+
attr_reader :graphql_id
|
16
19
|
attr_reader :id
|
17
20
|
attr_reader :kind
|
18
21
|
attr_reader :merchant_account_id
|
19
22
|
attr_reader :original_dispute_id
|
23
|
+
attr_reader :paypal_messages
|
24
|
+
attr_reader :pre_dispute_program
|
25
|
+
attr_reader :processor_comments
|
26
|
+
attr_reader :protection_level
|
20
27
|
attr_reader :reason
|
21
28
|
attr_reader :reason_code
|
22
29
|
attr_reader :reason_description
|
@@ -31,10 +38,12 @@ module Braintree
|
|
31
38
|
|
32
39
|
module Status
|
33
40
|
Accepted = "accepted"
|
41
|
+
AutoAccepted = "auto_accepted"
|
34
42
|
Disputed = "disputed"
|
35
43
|
Expired = "expired"
|
36
44
|
Open = "open"
|
37
45
|
Lost = "lost"
|
46
|
+
UnderReview = "under_review"
|
38
47
|
Won = "won"
|
39
48
|
|
40
49
|
All = constants.map { |c| const_get(c) }
|
@@ -64,10 +73,33 @@ module Braintree
|
|
64
73
|
All = constants.map { |c| const_get(c) }
|
65
74
|
end
|
66
75
|
|
76
|
+
module ChargebackProtectionLevel
|
77
|
+
Effortless = "effortless"
|
78
|
+
Standard = "standard"
|
79
|
+
NotProtected = "not_protected"
|
80
|
+
|
81
|
+
All = constants.map { |c| const_get(c) }
|
82
|
+
end
|
83
|
+
|
84
|
+
module ProtectionLevel
|
85
|
+
EffortlessCBP = "Effortless Chargeback Protection tool"
|
86
|
+
StandardCBP = "Chargeback Protection tool"
|
87
|
+
NoProtection = "No Protection"
|
88
|
+
|
89
|
+
All = constants.map { |c| const_get(c) }
|
90
|
+
end
|
91
|
+
|
92
|
+
module PreDisputeProgram
|
93
|
+
None = "none"
|
94
|
+
VisaRdr = "visa_rdr"
|
95
|
+
|
96
|
+
All = constants.map { |c| const_get(c) }
|
97
|
+
end
|
98
|
+
|
67
99
|
class << self
|
68
100
|
protected :new
|
69
|
-
def _new(*args)
|
70
|
-
self.new
|
101
|
+
def _new(*args)
|
102
|
+
self.new(*args)
|
71
103
|
end
|
72
104
|
end
|
73
105
|
|
@@ -99,7 +131,7 @@ module Braintree
|
|
99
131
|
Configuration.gateway.dispute.search(&block)
|
100
132
|
end
|
101
133
|
|
102
|
-
def initialize(attributes)
|
134
|
+
def initialize(attributes)
|
103
135
|
set_instance_variables_from_hash(attributes)
|
104
136
|
@date_opened = Date.parse(date_opened) unless date_opened.nil?
|
105
137
|
@date_won = Date.parse(date_won) unless date_won.nil?
|
@@ -108,16 +140,25 @@ module Braintree
|
|
108
140
|
@amount = Util.to_big_decimal(amount)
|
109
141
|
@amount_disputed = Util.to_big_decimal(amount_disputed)
|
110
142
|
@amount_won = Util.to_big_decimal(amount_won)
|
143
|
+
if (ChargebackProtectionLevel::All - [ChargebackProtectionLevel::NotProtected]).include?(chargeback_protection_level)
|
144
|
+
@protection_level = Dispute.const_get("ProtectionLevel::#{chargeback_protection_level.capitalize}CBP")
|
145
|
+
else
|
146
|
+
@protection_level = ProtectionLevel::NoProtection
|
147
|
+
end
|
111
148
|
|
112
149
|
@evidence = evidence.map do |record|
|
113
150
|
Braintree::Dispute::Evidence.new(record)
|
114
151
|
end unless evidence.nil?
|
115
152
|
|
153
|
+
@paypal_messages = paypal_messages.map do |record|
|
154
|
+
Braintree::Dispute::PayPalMessage.new(record)
|
155
|
+
end unless paypal_messages.nil?
|
156
|
+
|
116
157
|
@transaction_details = TransactionDetails.new(transaction)
|
117
158
|
@transaction = Transaction.new(transaction)
|
118
159
|
|
119
160
|
@status_history = status_history.map do |event|
|
120
|
-
Braintree::Dispute::
|
161
|
+
Braintree::Dispute::StatusHistory.new(event)
|
121
162
|
end unless status_history.nil?
|
122
163
|
end
|
123
164
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Braintree
|
2
|
-
class DisputeGateway
|
2
|
+
class DisputeGateway
|
3
3
|
def initialize(gateway)
|
4
4
|
@gateway = gateway
|
5
5
|
@config = gateway.config
|
@@ -25,7 +25,7 @@ module Braintree
|
|
25
25
|
raise ArgumentError, "dispute_id cannot be blank" if dispute_id.nil? || dispute_id.to_s.strip == ""
|
26
26
|
raise ArgumentError, "document_id_or_request cannot be blank" if document_id_or_request.nil?
|
27
27
|
|
28
|
-
request = document_id_or_request.is_a?(Hash) ? document_id_or_request : {
|
28
|
+
request = document_id_or_request.is_a?(Hash) ? document_id_or_request : {document_id: document_id_or_request}
|
29
29
|
|
30
30
|
raise ArgumentError, "document_id contains invalid characters" unless request[:document_id].to_s =~ /\A[\w-]+\z/
|
31
31
|
raise ArgumentError, "document_id cannot be blank" if request[:document_id].nil? || dispute_id.to_s.strip == ""
|
@@ -55,23 +55,18 @@ module Braintree
|
|
55
55
|
raise ArgumentError, "dispute_id cannot be blank" if dispute_id.nil? || dispute_id.to_s.strip == ""
|
56
56
|
raise ArgumentError, "content_or_request cannot be blank" if content_or_request.nil?
|
57
57
|
|
58
|
-
request = content_or_request.is_a?(String) ? {
|
58
|
+
request = content_or_request.is_a?(String) ? {content: content_or_request} : content_or_request
|
59
59
|
|
60
60
|
raise ArgumentError, "content cannot be blank" if request[:content].nil? || request[:content].to_s.strip == ""
|
61
|
-
raise ArgumentError, "request can only contain the keys [:content, :category, :sequence_number]" if (request.keys - [:category, :content, :
|
61
|
+
raise ArgumentError, "request can only contain the keys [:content, :category, :sequence_number]" if (request.keys - [:category, :content, :sequence_number]).any?
|
62
62
|
raise ArgumentError, "sequence_number must be an integer" if request[:sequence_number] && request[:sequence_number].to_s.match(/\D/)
|
63
|
-
raise ArgumentError, "tag must be a string" if request[:tag] && !request[:tag].is_a?(String)
|
64
63
|
raise ArgumentError, "category must be a string" if request[:category] && !request[:category].is_a?(String)
|
65
64
|
|
66
|
-
warn "[DEPRECATED] tag as an option is deprecated. Please use category" if request[:tag]
|
67
|
-
|
68
|
-
category = request[:category] || request[:tag]
|
69
|
-
|
70
65
|
params_for_http_post = {
|
71
66
|
evidence: {
|
72
67
|
comments: request[:content]
|
73
68
|
}.tap do |evidence_params|
|
74
|
-
evidence_params[:category] = category if category
|
69
|
+
evidence_params[:category] = request[:category] if request[:category]
|
75
70
|
evidence_params[:sequence_number] = request[:sequence_number] if request[:sequence_number]
|
76
71
|
end
|
77
72
|
}
|
@@ -1,15 +1,19 @@
|
|
1
1
|
module Braintree
|
2
|
-
class DisputeSearch < AdvancedSearch
|
2
|
+
class DisputeSearch < AdvancedSearch
|
3
3
|
text_fields(
|
4
4
|
:case_number,
|
5
5
|
:customer_id,
|
6
6
|
:id,
|
7
7
|
:reference_number,
|
8
|
-
:transaction_id
|
8
|
+
:transaction_id,
|
9
9
|
)
|
10
|
-
|
10
|
+
# NEXT_MAJOR_VERSION Remove this attribute
|
11
|
+
# DEPRECATED The chargeback_protection_level attribute is deprecated in favor of protection_level
|
12
|
+
multiple_value_field :chargeback_protection_level, :allows => Dispute::ChargebackProtectionLevel::All
|
13
|
+
multiple_value_field :protection_level, :allows => Dispute::ProtectionLevel::All
|
11
14
|
multiple_value_field :kind, :allows => Dispute::Kind::All
|
12
15
|
multiple_value_field :merchant_account_id
|
16
|
+
multiple_value_field :pre_dispute_program, :allows => Dispute::PreDisputeProgram::All
|
13
17
|
multiple_value_field :reason, :allows => Dispute::Reason::All
|
14
18
|
multiple_value_field :reason_code
|
15
19
|
multiple_value_field :status, :allows => Dispute::Status::All
|
@@ -21,7 +25,7 @@ module Braintree
|
|
21
25
|
:disbursement_date,
|
22
26
|
:effective_date,
|
23
27
|
:received_date,
|
24
|
-
:reply_by_date
|
28
|
+
:reply_by_date,
|
25
29
|
)
|
26
30
|
end
|
27
31
|
end
|