braintree 2.10.0 → 4.26.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 +7 -0
- data/LICENSE +1 -1
- data/braintree.gemspec +24 -0
- data/lib/braintree/account_updater_daily_report.rb +20 -0
- data/lib/braintree/ach_mandate.rb +14 -0
- data/lib/braintree/add_on.rb +4 -0
- data/lib/braintree/add_on_gateway.rb +17 -0
- data/lib/braintree/address/country_names.rb +4 -1
- data/lib/braintree/address.rb +35 -43
- data/lib/braintree/address_gateway.rb +24 -11
- data/lib/braintree/advanced_search.rb +26 -11
- data/lib/braintree/apple_pay.rb +29 -0
- data/lib/braintree/apple_pay_card.rb +66 -0
- 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 +11 -1
- data/lib/braintree/bin_data.rb +34 -0
- data/lib/braintree/client_token.rb +11 -0
- data/lib/braintree/client_token_gateway.rb +45 -0
- data/lib/braintree/configuration.rb +231 -39
- data/lib/braintree/connected_merchant_paypal_status_changed.rb +22 -0
- data/lib/braintree/connected_merchant_status_transitioned.rb +22 -0
- data/lib/braintree/credentials_parser.rb +44 -0
- data/lib/braintree/credit_card.rb +107 -132
- data/lib/braintree/credit_card_gateway.rb +90 -41
- data/lib/braintree/credit_card_verification.rb +90 -17
- data/lib/braintree/credit_card_verification_gateway.rb +87 -0
- data/lib/braintree/credit_card_verification_search.rb +20 -0
- data/lib/braintree/customer.rb +80 -118
- data/lib/braintree/customer_gateway.rb +66 -39
- data/lib/braintree/customer_search.rb +5 -2
- data/lib/braintree/customer_session_gateway.rb +194 -0
- data/lib/braintree/descriptor.rb +4 -2
- data/lib/braintree/digest.rb +16 -3
- data/lib/braintree/disbursement.rb +63 -0
- data/lib/braintree/discount.rb +4 -0
- data/lib/braintree/discount_gateway.rb +17 -0
- data/lib/braintree/dispute/evidence.rb +24 -0
- data/lib/braintree/dispute/paypal_message.rb +15 -0
- data/lib/braintree/dispute/status_history.rb +18 -0
- data/lib/braintree/dispute/transaction.rb +20 -0
- data/lib/braintree/dispute/transaction_details.rb +15 -0
- data/lib/braintree/dispute.rb +165 -0
- 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 +680 -15
- data/lib/braintree/error_result.rb +13 -6
- data/lib/braintree/errors.rb +5 -5
- data/lib/braintree/exceptions.rb +14 -20
- 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 +20 -0
- data/lib/braintree/gateway.rb +104 -6
- data/lib/braintree/google_pay_card.rb +62 -0
- data/lib/braintree/granted_payment_instrument_update.rb +23 -0
- data/lib/braintree/graphql/enums/recommendations.rb +7 -0
- data/lib/braintree/graphql/enums/recommended_payment_option.rb +8 -0
- data/lib/braintree/graphql/inputs/create_customer_session_input.rb +35 -0
- data/lib/braintree/graphql/inputs/customer_recommendations_input.rb +41 -0
- data/lib/braintree/graphql/inputs/customer_session_input.rb +39 -0
- data/lib/braintree/graphql/inputs/phone_input.rb +32 -0
- data/lib/braintree/graphql/inputs/update_customer_session_input.rb +37 -0
- data/lib/braintree/graphql/types/customer_recommendations_payload.rb +32 -0
- data/lib/braintree/graphql/types/payment_options.rb +33 -0
- data/lib/braintree/graphql/unions/customer_recommendations.rb +34 -0
- data/lib/braintree/graphql_client.rb +50 -0
- data/lib/braintree/http.rb +119 -25
- data/lib/braintree/local_payment_completed/blik_alias.rb +23 -0
- data/lib/braintree/local_payment_completed.rb +28 -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 +34 -0
- data/lib/braintree/merchant_account/address_details.rb +16 -0
- data/lib/braintree/merchant_account/business_details.rb +17 -0
- data/lib/braintree/merchant_account/funding_details.rb +18 -0
- data/lib/braintree/merchant_account/individual_details.rb +20 -0
- data/lib/braintree/merchant_account.rb +76 -0
- data/lib/braintree/merchant_account_gateway.rb +130 -0
- data/lib/braintree/merchant_gateway.rb +38 -0
- data/lib/braintree/meta_checkout_card.rb +90 -0
- data/lib/braintree/meta_checkout_token.rb +89 -0
- data/lib/braintree/modification.rb +16 -5
- data/lib/braintree/oauth_credentials.rb +22 -0
- data/lib/braintree/oauth_gateway.rb +73 -0
- data/lib/braintree/paginated_collection.rb +25 -0
- data/lib/braintree/paginated_result.rb +15 -0
- data/lib/braintree/payment_instrument_type.rb +18 -0
- data/lib/braintree/payment_method.rb +37 -0
- data/lib/braintree/payment_method_customer_data_updated_metadata.rb +24 -0
- data/lib/braintree/payment_method_gateway.rb +221 -0
- data/lib/braintree/payment_method_nonce.rb +49 -0
- 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 +38 -0
- data/lib/braintree/payment_method_parser.rb +29 -0
- data/lib/braintree/paypal_account.rb +60 -0
- data/lib/braintree/paypal_account_gateway.rb +73 -0
- data/lib/braintree/paypal_payment_resource.rb +22 -0
- data/lib/braintree/paypal_payment_resource_gateway.rb +36 -0
- data/lib/braintree/plan.rb +62 -0
- data/lib/braintree/plan_gateway.rb +117 -0
- data/lib/braintree/processor_response_types.rb +7 -0
- data/lib/braintree/resource_collection.rb +12 -5
- 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 +29 -0
- data/lib/braintree/samsung_pay_card.rb +85 -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 +25 -0
- data/lib/braintree/settlement_batch_summary_gateway.rb +27 -0
- data/lib/braintree/sha256_digest.rb +13 -0
- data/lib/braintree/signature_service.rb +19 -0
- data/lib/braintree/subscription/status_details.rb +20 -0
- data/lib/braintree/subscription.rb +67 -47
- data/lib/braintree/subscription_gateway.rb +43 -16
- data/lib/braintree/subscription_search.rb +2 -2
- data/lib/braintree/successful_result.rb +30 -10
- data/lib/braintree/test/authentication_id.rb +21 -0
- data/lib/braintree/test/credit_card.rb +76 -0
- data/lib/braintree/test/merchant_account.rb +12 -0
- data/lib/braintree/test/nonce.rb +81 -0
- data/lib/braintree/test/transaction_amounts.rb +3 -5
- data/lib/braintree/test/venmo_sdk.rb +21 -0
- data/lib/braintree/test_transaction.rb +19 -0
- data/lib/braintree/testing_gateway.rb +43 -0
- data/lib/braintree/three_d_secure_info.rb +53 -0
- data/lib/braintree/transaction/address_details.rb +27 -5
- data/lib/braintree/transaction/apple_pay_details.rb +35 -0
- data/lib/braintree/transaction/credit_card_details.rb +55 -4
- data/lib/braintree/transaction/customer_details.rb +11 -3
- data/lib/braintree/transaction/disbursement_details.rb +28 -0
- data/lib/braintree/transaction/google_pay_details.rb +42 -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 +27 -0
- data/lib/braintree/transaction/meta_checkout_card_details.rb +55 -0
- data/lib/braintree/transaction/meta_checkout_token_details.rb +58 -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 +40 -0
- data/lib/braintree/transaction/paypal_here_details.rb +23 -0
- data/lib/braintree/transaction/samsung_pay_card_details.rb +50 -0
- data/lib/braintree/transaction/sepa_direct_debit_account_details.rb +27 -0
- data/lib/braintree/transaction/status_details.rb +6 -2
- data/lib/braintree/transaction/subscription_details.rb +5 -2
- data/lib/braintree/transaction/us_bank_account_details.rb +22 -0
- data/lib/braintree/transaction/venmo_account_details.rb +17 -0
- data/lib/braintree/transaction/visa_checkout_card_details.rb +51 -0
- data/lib/braintree/transaction.rb +293 -150
- data/lib/braintree/transaction_gateway.rb +303 -59
- data/lib/braintree/transaction_line_item.rb +43 -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 +17 -9
- data/lib/braintree/unknown_payment_method.rb +26 -0
- data/lib/braintree/us_bank_account.rb +57 -0
- data/lib/braintree/us_bank_account_gateway.rb +17 -0
- data/lib/braintree/us_bank_account_verification.rb +89 -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 +91 -11
- data/lib/braintree/validation_error.rb +14 -5
- data/lib/braintree/validation_error_collection.rb +5 -5
- data/lib/braintree/venmo_account.rb +34 -0
- data/lib/braintree/venmo_profile_data.rb +25 -0
- data/lib/braintree/version.rb +2 -2
- data/lib/braintree/visa_checkout_card.rb +90 -0
- data/lib/braintree/webhook_notification.rb +146 -0
- data/lib/braintree/webhook_notification_gateway.rb +46 -0
- data/lib/braintree/webhook_testing.rb +7 -0
- data/lib/braintree/webhook_testing_gateway.rb +1239 -0
- data/lib/braintree/xml/generator.rb +18 -10
- data/lib/braintree/xml/libxml.rb +1 -1
- data/lib/braintree/xml/parser.rb +24 -36
- data/lib/braintree/xml/rexml.rb +6 -7
- data/lib/braintree/xml.rb +1 -2
- data/lib/braintree.rb +186 -52
- data/lib/ssl/api_braintreegateway_com.ca.crt +474 -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 +46 -0
- data/spec/integration/braintree/address_spec.rb +101 -178
- data/spec/integration/braintree/advanced_search_spec.rb +100 -97
- 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 +407 -0
- data/spec/integration/braintree/client_api/spec_helper.rb +300 -0
- data/spec/integration/braintree/credit_card_spec.rb +885 -654
- data/spec/integration/braintree/credit_card_verification_search_spec.rb +193 -0
- data/spec/integration/braintree/credit_card_verification_spec.rb +473 -0
- data/spec/integration/braintree/customer_search_spec.rb +69 -21
- data/spec/integration/braintree/customer_session_spec.rb +143 -0
- data/spec/integration/braintree/customer_spec.rb +1437 -518
- data/spec/integration/braintree/disbursement_spec.rb +31 -0
- data/spec/integration/braintree/discount_spec.rb +34 -0
- data/spec/integration/braintree/dispute_search_spec.rb +165 -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 +3 -3
- 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 +106 -56
- data/spec/integration/braintree/merchant_account_spec.rb +603 -0
- data/spec/integration/braintree/merchant_spec.rb +227 -0
- data/spec/integration/braintree/oauth_spec.rb +225 -0
- data/spec/integration/braintree/package_tracking_spec.rb +130 -0
- data/spec/integration/braintree/payment_method_nonce_spec.rb +345 -0
- data/spec/integration/braintree/payment_method_spec.rb +2146 -0
- data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +325 -0
- data/spec/integration/braintree/paypal_account_spec.rb +299 -0
- data/spec/integration/braintree/paypal_payment_resource_spec.rb +141 -0
- data/spec/integration/braintree/plan_spec.rb +136 -0
- data/spec/integration/braintree/samsung_pay_card_spec.rb +146 -0
- data/spec/integration/braintree/sepa_direct_debit_account_spec.rb +194 -0
- data/spec/integration/braintree/settlement_batch_summary_spec.rb +62 -0
- data/spec/integration/braintree/subscription_spec.rb +785 -431
- data/spec/integration/braintree/test/transaction_amounts_spec.rb +4 -4
- data/spec/integration/braintree/test_transaction_spec.rb +145 -0
- data/spec/integration/braintree/transaction_line_item_spec.rb +44 -0
- data/spec/integration/braintree/transaction_search_spec.rb +745 -156
- data/spec/integration/braintree/transaction_spec.rb +7452 -1288
- data/spec/integration/braintree/transaction_us_bank_account_spec.rb +196 -0
- data/spec/integration/braintree/us_bank_account_spec.rb +113 -0
- 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 +110 -0
- data/spec/integration/spec_helper.rb +61 -5
- data/spec/oauth_test_helper.rb +17 -0
- data/spec/script/httpsd.rb +6 -6
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +77 -21
- data/spec/ssl/certificate.crt +17 -0
- data/spec/ssl/geotrust_global.crt +20 -0
- data/spec/ssl/privateKey.key +15 -0
- data/spec/unit/braintree/address_spec.rb +27 -16
- data/spec/unit/braintree/apple_pay_card_spec.rb +133 -0
- data/spec/unit/braintree/base_module_spec.rb +4 -4
- data/spec/unit/braintree/client_token_spec.rb +37 -0
- data/spec/unit/braintree/configuration_spec.rb +293 -43
- data/spec/unit/braintree/credentials_parser_spec.rb +81 -0
- data/spec/unit/braintree/credit_card_spec.rb +138 -47
- data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +56 -0
- data/spec/unit/braintree/credit_card_verification_search_spec.rb +79 -0
- data/spec/unit/braintree/credit_card_verification_spec.rb +132 -6
- data/spec/unit/braintree/customer_session_gateway_spec.rb +120 -0
- data/spec/unit/braintree/customer_spec.rb +196 -40
- data/spec/unit/braintree/digest_spec.rb +16 -3
- data/spec/unit/braintree/disbursement_spec.rb +131 -0
- data/spec/unit/braintree/dispute_search_spec.rb +66 -0
- data/spec/unit/braintree/dispute_spec.rb +479 -0
- data/spec/unit/braintree/document_upload_spec.rb +35 -0
- 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/google_pay_card_spec.rb +8 -0
- data/spec/unit/braintree/graphql/create_customer_session_input_spec.rb +81 -0
- data/spec/unit/braintree/graphql/customer_recommendations_input_spec.rb +110 -0
- data/spec/unit/braintree/graphql/customer_session_input_spec.rb +81 -0
- data/spec/unit/braintree/graphql/phone_input_spec.rb +51 -0
- data/spec/unit/braintree/graphql/update_customer_session_input_spec.rb +93 -0
- data/spec/unit/braintree/graphql_client_spec.rb +37 -0
- data/spec/unit/braintree/http_spec.rb +164 -2
- data/spec/unit/braintree/local_payment_completed_spec.rb +90 -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 +33 -0
- data/spec/unit/braintree/meta_checkout_card_details_spec.rb +60 -0
- data/spec/unit/braintree/meta_checkout_card_spec.rb +62 -0
- data/spec/unit/braintree/meta_checkout_token_details_spec.rb +63 -0
- data/spec/unit/braintree/meta_checkout_token_spec.rb +65 -0
- data/spec/unit/braintree/modification_spec.rb +7 -0
- 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 +43 -0
- data/spec/unit/braintree/payment_method_spec.rb +135 -0
- data/spec/unit/braintree/paypal_account_spec.rb +53 -0
- data/spec/unit/braintree/paypal_payment_resource_spec.rb +125 -0
- data/spec/unit/braintree/resource_collection_spec.rb +44 -3
- data/spec/unit/braintree/risk_data/liability_shift.rb +26 -0
- data/spec/unit/braintree/risk_data_spec.rb +55 -0
- 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 +11 -0
- data/spec/unit/braintree/signature_service_spec.rb +23 -0
- data/spec/unit/braintree/subscription_search_spec.rb +25 -18
- data/spec/unit/braintree/subscription_spec.rb +34 -7
- data/spec/unit/braintree/successful_result_spec.rb +9 -9
- data/spec/unit/braintree/three_d_secure_info_spec.rb +69 -0
- data/spec/unit/braintree/transaction/apple_pay_details_spec.rb +8 -0
- data/spec/unit/braintree/transaction/credit_card_details_spec.rb +34 -6
- data/spec/unit/braintree/transaction/customer_details_spec.rb +3 -2
- data/spec/unit/braintree/transaction/deposit_details_spec.rb +18 -0
- data/spec/unit/braintree/transaction/google_pay_details_spec.rb +8 -0
- 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/meta_checkout_card_details_spec.rb +8 -0
- data/spec/unit/braintree/transaction/meta_checkout_token_details_spec.rb +8 -0
- data/spec/unit/braintree/transaction/payment_receipt_spec.rb +73 -0
- data/spec/unit/braintree/transaction/paypal_details_spec.rb +68 -0
- data/spec/unit/braintree/transaction/sepa_direct_debit_account_details_spec.rb +33 -0
- data/spec/unit/braintree/transaction/visa_checkout_card_details_spec.rb +8 -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 +366 -52
- data/spec/unit/braintree/unknown_payment_method_spec.rb +33 -0
- data/spec/unit/braintree/us_bank_account_spec.rb +13 -0
- data/spec/unit/braintree/us_bank_account_verification_search_spec.rb +60 -0
- data/spec/unit/braintree/us_bank_account_verification_spec.rb +98 -0
- data/spec/unit/braintree/util_spec.rb +199 -39
- data/spec/unit/braintree/validation_error_collection_spec.rb +336 -133
- 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/visa_checkout_card_spec.rb +8 -0
- data/spec/unit/braintree/webhook_notification_spec.rb +977 -0
- data/spec/unit/braintree/xml/libxml_spec.rb +5 -5
- data/spec/unit/braintree/xml/parser_spec.rb +39 -5
- data/spec/unit/braintree/xml/rexml_spec.rb +5 -5
- data/spec/unit/braintree/xml_spec.rb +39 -32
- data/spec/unit/braintree_spec.rb +3 -2
- data/spec/unit/credit_card_details_spec.rb +8 -0
- metadata +314 -73
- data/README.rdoc +0 -80
- data/lib/braintree/test/credit_card_numbers.rb +0 -52
- data/lib/braintree/transparent_redirect.rb +0 -51
- data/lib/braintree/transparent_redirect_gateway.rb +0 -105
- data/lib/ssl/sandbox_braintreegateway_com.ca.crt +0 -19
- data/lib/ssl/www_braintreegateway_com.ca.crt +0 -202
- data/spec/hacks/tcp_socket.rb +0 -18
- data/spec/integration/braintree/transparent_redirect_spec.rb +0 -236
- data/spec/unit/braintree/transparent_redirect_spec.rb +0 -160
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
module Braintree
|
|
2
|
+
class Dispute
|
|
3
|
+
include BaseModule
|
|
4
|
+
include Braintree::Util::IdEquality
|
|
5
|
+
|
|
6
|
+
attr_reader :amount
|
|
7
|
+
attr_reader :amount_disputed
|
|
8
|
+
attr_reader :amount_won
|
|
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
|
|
13
|
+
attr_reader :created_at
|
|
14
|
+
attr_reader :currency_iso_code
|
|
15
|
+
attr_reader :date_opened
|
|
16
|
+
attr_reader :date_won
|
|
17
|
+
attr_reader :evidence
|
|
18
|
+
attr_reader :graphql_id
|
|
19
|
+
attr_reader :id
|
|
20
|
+
attr_reader :kind
|
|
21
|
+
attr_reader :merchant_account_id
|
|
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
|
|
27
|
+
attr_reader :reason
|
|
28
|
+
attr_reader :reason_code
|
|
29
|
+
attr_reader :reason_description
|
|
30
|
+
attr_reader :received_date
|
|
31
|
+
attr_reader :reference_number
|
|
32
|
+
attr_reader :reply_by_date
|
|
33
|
+
attr_reader :status
|
|
34
|
+
attr_reader :status_history
|
|
35
|
+
attr_reader :transaction
|
|
36
|
+
attr_reader :transaction_details
|
|
37
|
+
attr_reader :updated_at
|
|
38
|
+
|
|
39
|
+
module Status
|
|
40
|
+
Accepted = "accepted"
|
|
41
|
+
AutoAccepted = "auto_accepted"
|
|
42
|
+
Disputed = "disputed"
|
|
43
|
+
Expired = "expired"
|
|
44
|
+
Open = "open"
|
|
45
|
+
Lost = "lost"
|
|
46
|
+
UnderReview = "under_review"
|
|
47
|
+
Won = "won"
|
|
48
|
+
|
|
49
|
+
All = constants.map { |c| const_get(c) }
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
module Reason
|
|
53
|
+
CancelledRecurringTransaction = "cancelled_recurring_transaction"
|
|
54
|
+
CreditNotProcessed = "credit_not_processed"
|
|
55
|
+
Duplicate = "duplicate"
|
|
56
|
+
Fraud = "fraud"
|
|
57
|
+
General = "general"
|
|
58
|
+
InvalidAccount = "invalid_account"
|
|
59
|
+
NotRecognized = "not_recognized"
|
|
60
|
+
ProductNotReceived = "product_not_received"
|
|
61
|
+
ProductUnsatisfactory = "product_unsatisfactory"
|
|
62
|
+
TransactionAmountDiffers = "transaction_amount_differs"
|
|
63
|
+
Retrieval = "retrieval"
|
|
64
|
+
|
|
65
|
+
All = constants.map { |c| const_get(c) }
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
module Kind
|
|
69
|
+
Chargeback = "chargeback"
|
|
70
|
+
PreArbitration = "pre_arbitration"
|
|
71
|
+
Retrieval = "retrieval"
|
|
72
|
+
|
|
73
|
+
All = constants.map { |c| const_get(c) }
|
|
74
|
+
end
|
|
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
|
+
|
|
99
|
+
class << self
|
|
100
|
+
protected :new
|
|
101
|
+
def _new(*args)
|
|
102
|
+
self.new(*args)
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def self.accept(*args)
|
|
107
|
+
Configuration.gateway.dispute.accept(*args)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def self.add_file_evidence(*args)
|
|
111
|
+
Configuration.gateway.dispute.add_file_evidence(*args)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def self.add_text_evidence(*args)
|
|
115
|
+
Configuration.gateway.dispute.add_text_evidence(*args)
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def self.finalize(*args)
|
|
119
|
+
Configuration.gateway.dispute.finalize(*args)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def self.find(*args)
|
|
123
|
+
Configuration.gateway.dispute.find(*args)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def self.remove_evidence(*args)
|
|
127
|
+
Configuration.gateway.dispute.remove_evidence(*args)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def self.search(&block)
|
|
131
|
+
Configuration.gateway.dispute.search(&block)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def initialize(attributes)
|
|
135
|
+
set_instance_variables_from_hash(attributes)
|
|
136
|
+
@date_opened = Date.parse(date_opened) unless date_opened.nil?
|
|
137
|
+
@date_won = Date.parse(date_won) unless date_won.nil?
|
|
138
|
+
@received_date = Date.parse(received_date)
|
|
139
|
+
@reply_by_date = Date.parse(reply_by_date) unless reply_by_date.nil?
|
|
140
|
+
@amount = Util.to_big_decimal(amount)
|
|
141
|
+
@amount_disputed = Util.to_big_decimal(amount_disputed)
|
|
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
|
|
148
|
+
|
|
149
|
+
@evidence = evidence.map do |record|
|
|
150
|
+
Braintree::Dispute::Evidence.new(record)
|
|
151
|
+
end unless evidence.nil?
|
|
152
|
+
|
|
153
|
+
@paypal_messages = paypal_messages.map do |record|
|
|
154
|
+
Braintree::Dispute::PayPalMessage.new(record)
|
|
155
|
+
end unless paypal_messages.nil?
|
|
156
|
+
|
|
157
|
+
@transaction_details = TransactionDetails.new(transaction)
|
|
158
|
+
@transaction = Transaction.new(transaction)
|
|
159
|
+
|
|
160
|
+
@status_history = status_history.map do |event|
|
|
161
|
+
Braintree::Dispute::StatusHistory.new(event)
|
|
162
|
+
end unless status_history.nil?
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
end
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
module Braintree
|
|
2
|
+
class DisputeGateway
|
|
3
|
+
def initialize(gateway)
|
|
4
|
+
@gateway = gateway
|
|
5
|
+
@config = gateway.config
|
|
6
|
+
@config.assert_has_access_token_or_keys
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def accept(dispute_id)
|
|
10
|
+
raise ArgumentError, "dispute_id contains invalid characters" unless dispute_id.to_s =~ /\A[\w-]+\z/
|
|
11
|
+
raise ArgumentError, "dispute_id cannot be blank" if dispute_id.nil? || dispute_id.to_s.strip == ""
|
|
12
|
+
|
|
13
|
+
response = @config.http.put("#{@config.base_merchant_path}/disputes/#{dispute_id}/accept")
|
|
14
|
+
if response[:api_error_response]
|
|
15
|
+
ErrorResult.new(@gateway, response[:api_error_response])
|
|
16
|
+
else
|
|
17
|
+
SuccessfulResult.new
|
|
18
|
+
end
|
|
19
|
+
rescue NotFoundError
|
|
20
|
+
raise NotFoundError, "dispute with id #{dispute_id} not found"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def add_file_evidence(dispute_id, document_id_or_request)
|
|
24
|
+
raise ArgumentError, "dispute_id contains invalid characters" unless dispute_id.to_s =~ /\A[\w-]+\z/
|
|
25
|
+
raise ArgumentError, "dispute_id cannot be blank" if dispute_id.nil? || dispute_id.to_s.strip == ""
|
|
26
|
+
raise ArgumentError, "document_id_or_request cannot be blank" if document_id_or_request.nil?
|
|
27
|
+
|
|
28
|
+
request = document_id_or_request.is_a?(Hash) ? document_id_or_request : {document_id: document_id_or_request}
|
|
29
|
+
|
|
30
|
+
raise ArgumentError, "document_id contains invalid characters" unless request[:document_id].to_s =~ /\A[\w-]+\z/
|
|
31
|
+
raise ArgumentError, "document_id cannot be blank" if request[:document_id].nil? || dispute_id.to_s.strip == ""
|
|
32
|
+
raise ArgumentError, "category must be a string" if request[:category] && !request[:category].is_a?(String)
|
|
33
|
+
|
|
34
|
+
params = {
|
|
35
|
+
evidence: {
|
|
36
|
+
document_upload_id: request[:document_id],
|
|
37
|
+
category: request[:category],
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
response = @config.http.post("#{@config.base_merchant_path}/disputes/#{dispute_id}/evidence", params)
|
|
41
|
+
|
|
42
|
+
if response[:evidence]
|
|
43
|
+
SuccessfulResult.new(:evidence => Dispute::Evidence.new(response[:evidence]))
|
|
44
|
+
elsif response[:api_error_response]
|
|
45
|
+
ErrorResult.new(@gateway, response[:api_error_response])
|
|
46
|
+
else
|
|
47
|
+
raise "expected :evidence or :api_error_response"
|
|
48
|
+
end
|
|
49
|
+
rescue NotFoundError
|
|
50
|
+
raise NotFoundError, "dispute with id #{dispute_id} not found"
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def add_text_evidence(dispute_id, content_or_request)
|
|
54
|
+
raise ArgumentError, "dispute_id contains invalid characters" unless dispute_id.to_s =~ /\A[\w-]+\z/
|
|
55
|
+
raise ArgumentError, "dispute_id cannot be blank" if dispute_id.nil? || dispute_id.to_s.strip == ""
|
|
56
|
+
raise ArgumentError, "content_or_request cannot be blank" if content_or_request.nil?
|
|
57
|
+
|
|
58
|
+
request = content_or_request.is_a?(String) ? {content: content_or_request} : content_or_request
|
|
59
|
+
|
|
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, :sequence_number]).any?
|
|
62
|
+
raise ArgumentError, "sequence_number must be an integer" if request[:sequence_number] && request[:sequence_number].to_s.match(/\D/)
|
|
63
|
+
raise ArgumentError, "category must be a string" if request[:category] && !request[:category].is_a?(String)
|
|
64
|
+
|
|
65
|
+
params_for_http_post = {
|
|
66
|
+
evidence: {
|
|
67
|
+
comments: request[:content]
|
|
68
|
+
}.tap do |evidence_params|
|
|
69
|
+
evidence_params[:category] = request[:category] if request[:category]
|
|
70
|
+
evidence_params[:sequence_number] = request[:sequence_number] if request[:sequence_number]
|
|
71
|
+
end
|
|
72
|
+
}
|
|
73
|
+
response = @config.http.post("#{@config.base_merchant_path}/disputes/#{dispute_id}/evidence", params_for_http_post)
|
|
74
|
+
|
|
75
|
+
if response[:evidence]
|
|
76
|
+
SuccessfulResult.new(:evidence => Dispute::Evidence.new(response[:evidence]))
|
|
77
|
+
elsif response[:api_error_response]
|
|
78
|
+
ErrorResult.new(@gateway, response[:api_error_response])
|
|
79
|
+
else
|
|
80
|
+
raise "expected :evidence or :api_error_response"
|
|
81
|
+
end
|
|
82
|
+
rescue NotFoundError
|
|
83
|
+
raise NotFoundError, "dispute with id #{dispute_id} not found"
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def finalize(dispute_id)
|
|
87
|
+
raise ArgumentError, "dispute_id contains invalid characters" unless dispute_id.to_s =~ /\A[\w-]+\z/
|
|
88
|
+
raise ArgumentError, "dispute_id cannot be blank" if dispute_id.nil? || dispute_id.to_s.strip == ""
|
|
89
|
+
|
|
90
|
+
response = @config.http.put("#{@config.base_merchant_path}/disputes/#{dispute_id}/finalize")
|
|
91
|
+
if response[:api_error_response]
|
|
92
|
+
ErrorResult.new(@gateway, response[:api_error_response])
|
|
93
|
+
else
|
|
94
|
+
SuccessfulResult.new
|
|
95
|
+
end
|
|
96
|
+
rescue NotFoundError
|
|
97
|
+
raise NotFoundError, "dispute with id #{dispute_id} not found"
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def find(dispute_id)
|
|
101
|
+
raise ArgumentError, "dispute_id contains invalid characters" unless dispute_id.to_s =~ /\A[\w-]+\z/
|
|
102
|
+
raise ArgumentError, "dispute_id cannot be blank" if dispute_id.nil? || dispute_id.to_s.strip == ""
|
|
103
|
+
response = @config.http.get("#{@config.base_merchant_path}/disputes/#{dispute_id}")
|
|
104
|
+
Dispute._new(response[:dispute])
|
|
105
|
+
rescue NotFoundError
|
|
106
|
+
raise NotFoundError, "dispute with id #{dispute_id} not found"
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def remove_evidence(dispute_id, evidence_id)
|
|
110
|
+
raise ArgumentError, "dispute_id contains invalid characters" unless dispute_id.to_s =~ /\A[\w-]+\z/
|
|
111
|
+
raise ArgumentError, "dispute_id cannot be blank" if dispute_id.nil? || dispute_id.to_s.strip == ""
|
|
112
|
+
raise ArgumentError, "evidence_id contains invalid characters" unless evidence_id.to_s =~ /\A[\w-]+\z/
|
|
113
|
+
raise ArgumentError, "evidence_id cannot be blank" if evidence_id.nil? || evidence_id.to_s.strip == ""
|
|
114
|
+
|
|
115
|
+
response = @config.http.delete("#{@config.base_merchant_path}/disputes/#{dispute_id}/evidence/#{evidence_id}")
|
|
116
|
+
|
|
117
|
+
if response.respond_to?(:to_hash) && response[:api_error_response]
|
|
118
|
+
ErrorResult.new(@gateway, response[:api_error_response])
|
|
119
|
+
else
|
|
120
|
+
SuccessfulResult.new
|
|
121
|
+
end
|
|
122
|
+
rescue NotFoundError
|
|
123
|
+
raise NotFoundError, "evidence with id #{evidence_id} for dispute with id #{dispute_id} not found"
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def search(&block)
|
|
127
|
+
search = DisputeSearch.new
|
|
128
|
+
block.call(search) if block
|
|
129
|
+
|
|
130
|
+
paginated_results = PaginatedCollection.new { |page| _fetch_disputes(search, page) }
|
|
131
|
+
SuccessfulResult.new(:disputes => paginated_results)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def _fetch_disputes(search, page)
|
|
135
|
+
response = @config.http.post("#{@config.base_merchant_path}/disputes/advanced_search?page=#{page}", {:search => search.to_hash, :page => page})
|
|
136
|
+
body = response[:disputes]
|
|
137
|
+
disputes = Util.extract_attribute_as_array(body, :dispute).map { |d| Dispute._new(d) }
|
|
138
|
+
|
|
139
|
+
PaginatedResult.new(body[:total_items], body[:page_size], disputes)
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
module Braintree
|
|
2
|
+
class DisputeSearch < AdvancedSearch
|
|
3
|
+
text_fields(
|
|
4
|
+
:case_number,
|
|
5
|
+
:customer_id,
|
|
6
|
+
:id,
|
|
7
|
+
:reference_number,
|
|
8
|
+
:transaction_id,
|
|
9
|
+
)
|
|
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
|
|
14
|
+
multiple_value_field :kind, :allows => Dispute::Kind::All
|
|
15
|
+
multiple_value_field :merchant_account_id
|
|
16
|
+
multiple_value_field :pre_dispute_program, :allows => Dispute::PreDisputeProgram::All
|
|
17
|
+
multiple_value_field :reason, :allows => Dispute::Reason::All
|
|
18
|
+
multiple_value_field :reason_code
|
|
19
|
+
multiple_value_field :status, :allows => Dispute::Status::All
|
|
20
|
+
multiple_value_field :transaction_source
|
|
21
|
+
|
|
22
|
+
range_fields(
|
|
23
|
+
:amount_disputed,
|
|
24
|
+
:amount_won,
|
|
25
|
+
:disbursement_date,
|
|
26
|
+
:effective_date,
|
|
27
|
+
:received_date,
|
|
28
|
+
:reply_by_date,
|
|
29
|
+
)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module Braintree
|
|
2
|
+
class DocumentUpload
|
|
3
|
+
include BaseModule
|
|
4
|
+
include Braintree::Util::IdEquality
|
|
5
|
+
|
|
6
|
+
module Kind
|
|
7
|
+
IdentityDocument = "identity_document"
|
|
8
|
+
EvidenceDocument = "evidence_document"
|
|
9
|
+
PayoutInvoiceDocument = "payout_invoice_document"
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
attr_reader :content_type
|
|
13
|
+
attr_reader :id
|
|
14
|
+
attr_reader :kind
|
|
15
|
+
attr_reader :name
|
|
16
|
+
attr_reader :size
|
|
17
|
+
|
|
18
|
+
def self.create(*args)
|
|
19
|
+
Configuration.gateway.document_upload.create(*args)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def self.create!(*args)
|
|
23
|
+
Configuration.gateway.document_upload.create!(*args)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def initialize(attributes)
|
|
27
|
+
set_instance_variables_from_hash(attributes)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
class << self
|
|
31
|
+
protected :new
|
|
32
|
+
def _new(*args)
|
|
33
|
+
self.new(*args)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
module Braintree
|
|
2
|
+
class DocumentUploadGateway
|
|
3
|
+
include BaseModule
|
|
4
|
+
|
|
5
|
+
def initialize(gateway)
|
|
6
|
+
@gateway = gateway
|
|
7
|
+
@config = gateway.config
|
|
8
|
+
@config.assert_has_access_token_or_keys
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def create(attributes)
|
|
12
|
+
Util.verify_keys(DocumentUploadGateway._create_signature, attributes)
|
|
13
|
+
_do_create "/document_uploads", {"document_upload[kind]" => attributes[:kind]}, attributes[:file]
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def create!(*args)
|
|
17
|
+
return_object_or_raise(:document_upload) { create(*args) }
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self._create_signature
|
|
21
|
+
[
|
|
22
|
+
:kind,
|
|
23
|
+
:file
|
|
24
|
+
]
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def _do_create(path, params, file)
|
|
28
|
+
response = @config.http.post("#{@config.base_merchant_path}#{path}", params, file)
|
|
29
|
+
if response[:document_upload]
|
|
30
|
+
SuccessfulResult.new(:document_upload => DocumentUpload._new(response[:document_upload]))
|
|
31
|
+
elsif response[:api_error_response]
|
|
32
|
+
ErrorResult.new(@gateway, response[:api_error_response])
|
|
33
|
+
else
|
|
34
|
+
raise UnexpectedError, "expected :document_upload or :api_error_response"
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module Braintree
|
|
2
|
+
class EnrichedCustomerData
|
|
3
|
+
include BaseModule
|
|
4
|
+
|
|
5
|
+
attr_reader :fields_updated
|
|
6
|
+
attr_reader :profile_data
|
|
7
|
+
|
|
8
|
+
def initialize(attributes)
|
|
9
|
+
set_instance_variables_from_hash(attributes)
|
|
10
|
+
@profile_data = VenmoProfileData._new(attributes[:profile_data])
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
class << self
|
|
14
|
+
protected :new
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def self._new(*args)
|
|
18
|
+
self.new(*args)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|