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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module Braintree
|
|
2
|
-
# See http://www.braintreepaymentsolutions.com/docs/ruby
|
|
3
2
|
class CreditCard
|
|
4
|
-
include BaseModule
|
|
3
|
+
include BaseModule
|
|
4
|
+
include Braintree::Util::TokenEquality
|
|
5
5
|
|
|
6
6
|
module CardType
|
|
7
7
|
AmEx = "American Express"
|
|
@@ -9,8 +9,10 @@ module Braintree
|
|
|
9
9
|
ChinaUnionPay = "China UnionPay"
|
|
10
10
|
DinersClubInternational = "Diners Club"
|
|
11
11
|
Discover = "Discover"
|
|
12
|
+
Elo = "Elo"
|
|
12
13
|
JCB = "JCB"
|
|
13
14
|
Laser = "Laser"
|
|
15
|
+
UK_Maestro = "UK Maestro"
|
|
14
16
|
Maestro = "Maestro"
|
|
15
17
|
MasterCard = "MasterCard"
|
|
16
18
|
Solo = "Solo"
|
|
@@ -21,136 +23,134 @@ module Braintree
|
|
|
21
23
|
All = constants.map { |c| const_get(c) }
|
|
22
24
|
end
|
|
23
25
|
|
|
24
|
-
module
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
# See http://www.braintreepaymentsolutions.com/docs/ruby/credit_cards/create
|
|
33
|
-
def self.create(attributes)
|
|
34
|
-
Configuration.gateway.credit_card.create(attributes)
|
|
35
|
-
end
|
|
26
|
+
module DebitNetwork
|
|
27
|
+
Accel = "ACCEL"
|
|
28
|
+
Maestro = "MAESTRO"
|
|
29
|
+
Nyce = "NYCE"
|
|
30
|
+
Pulse = "PULSE"
|
|
31
|
+
Star = "STAR"
|
|
32
|
+
Star_Access = "STAR_ACCESS"
|
|
36
33
|
|
|
37
|
-
|
|
38
|
-
def self.create!(attributes)
|
|
39
|
-
return_object_or_raise(:credit_card) { create(attributes) }
|
|
34
|
+
All = constants.map { |c| const_get(c) }
|
|
40
35
|
end
|
|
41
36
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
warn "[DEPRECATED] CreditCard.create_credit_card_url is deprecated. Please use TransparentRedirect.url"
|
|
46
|
-
Configuration.gateway.credit_card.create_credit_card_url
|
|
37
|
+
module CustomerLocation
|
|
38
|
+
International = "international"
|
|
39
|
+
US = "us"
|
|
47
40
|
end
|
|
48
41
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
Configuration.gateway.credit_card.create_from_transparent_redirect(query_string)
|
|
42
|
+
module CardTypeIndicator
|
|
43
|
+
Yes = "Yes"
|
|
44
|
+
No = "No"
|
|
45
|
+
Unknown = "Unknown"
|
|
54
46
|
end
|
|
55
47
|
|
|
56
|
-
|
|
48
|
+
Commercial = CountryOfIssuance = Debit = DurbinRegulated = Healthcare =
|
|
49
|
+
IssuingBank = Payroll = Prepaid = PrepaidReloadable = ProductId = CardTypeIndicator
|
|
50
|
+
|
|
51
|
+
attr_reader :billing_address
|
|
52
|
+
attr_reader :bin
|
|
53
|
+
attr_reader :card_type
|
|
54
|
+
attr_reader :cardholder_name
|
|
55
|
+
attr_reader :commercial
|
|
56
|
+
attr_reader :country_of_issuance
|
|
57
|
+
attr_reader :created_at
|
|
58
|
+
attr_reader :customer_id
|
|
59
|
+
attr_reader :debit
|
|
60
|
+
attr_reader :durbin_regulated
|
|
61
|
+
attr_reader :expiration_month
|
|
62
|
+
attr_reader :expiration_year
|
|
63
|
+
attr_reader :healthcare
|
|
64
|
+
attr_reader :image_url
|
|
65
|
+
attr_reader :issuing_bank
|
|
66
|
+
attr_reader :last_4
|
|
67
|
+
attr_reader :payroll
|
|
68
|
+
attr_reader :prepaid
|
|
69
|
+
attr_reader :prepaid_reloadable
|
|
70
|
+
attr_reader :product_id
|
|
71
|
+
attr_reader :subscriptions
|
|
72
|
+
attr_reader :token
|
|
73
|
+
attr_reader :unique_number_identifier
|
|
74
|
+
attr_reader :updated_at
|
|
75
|
+
attr_reader :verification
|
|
76
|
+
|
|
77
|
+
def self.create(*args)
|
|
78
|
+
Configuration.gateway.credit_card.create(*args)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def self.create!(*args)
|
|
82
|
+
Configuration.gateway.credit_card.create!(*args)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# NEXT_MAJOR_VERSION remove this method
|
|
86
|
+
# CreditCard.credit has been deprecated in favor of Transaction.credit
|
|
57
87
|
def self.credit(token, transaction_attributes)
|
|
88
|
+
warn "[DEPRECATED] CreditCard.credit is deprecated. Use Transaction.credit instead"
|
|
58
89
|
Transaction.credit(transaction_attributes.merge(:payment_method_token => token))
|
|
59
90
|
end
|
|
60
91
|
|
|
61
|
-
#
|
|
92
|
+
# NEXT_MAJOR_VERSION remove this method
|
|
93
|
+
# CreditCard.credit has been deprecated in favor of Transaction.credit
|
|
62
94
|
def self.credit!(token, transaction_attributes)
|
|
95
|
+
warn "[DEPRECATED] CreditCard.credit is deprecated. Use Transaction.credit instead"
|
|
63
96
|
return_object_or_raise(:transaction) { credit(token, transaction_attributes) }
|
|
64
97
|
end
|
|
65
98
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
99
|
+
def self.delete(*args)
|
|
100
|
+
Configuration.gateway.credit_card.delete(*args)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def self.expired(*args)
|
|
104
|
+
Configuration.gateway.credit_card.expired(*args)
|
|
69
105
|
end
|
|
70
106
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
Configuration.gateway.credit_card.expired(options)
|
|
107
|
+
def self.expiring_between(*args)
|
|
108
|
+
Configuration.gateway.credit_card.expiring_between(*args)
|
|
74
109
|
end
|
|
75
110
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
Configuration.gateway.credit_card.expiring_between(start_date, end_date, options)
|
|
111
|
+
def self.find(*args)
|
|
112
|
+
Configuration.gateway.credit_card.find(*args)
|
|
79
113
|
end
|
|
80
114
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
Configuration.gateway.credit_card.find(token)
|
|
115
|
+
def self.from_nonce(*args)
|
|
116
|
+
Configuration.gateway.credit_card.from_nonce(*args)
|
|
84
117
|
end
|
|
85
118
|
|
|
86
|
-
#
|
|
119
|
+
# NEXT_MAJOR_VERSION remove this method
|
|
120
|
+
# CreditCard.sale has been deprecated in favor of Transaction.sale
|
|
87
121
|
def self.sale(token, transaction_attributes)
|
|
122
|
+
warn "[DEPRECATED] CreditCard.sale is deprecated. Use Transaction.sale instead"
|
|
88
123
|
Configuration.gateway.transaction.sale(transaction_attributes.merge(:payment_method_token => token))
|
|
89
124
|
end
|
|
90
125
|
|
|
91
|
-
#
|
|
126
|
+
# NEXT_MAJOR_VERSION remove this method
|
|
127
|
+
# CreditCard.sale has been deprecated in favor of Transaction.sale
|
|
92
128
|
def self.sale!(token, transaction_attributes)
|
|
129
|
+
warn "[DEPRECATED] CreditCard.sale is deprecated. Use Transaction.sale instead"
|
|
93
130
|
return_object_or_raise(:transaction) { sale(token, transaction_attributes) }
|
|
94
131
|
end
|
|
95
132
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
Configuration.gateway.credit_card.update(token, attributes)
|
|
133
|
+
def self.update(*args)
|
|
134
|
+
Configuration.gateway.credit_card.update(*args)
|
|
99
135
|
end
|
|
100
136
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return_object_or_raise(:credit_card) { update(token, attributes) }
|
|
137
|
+
def self.update!(*args)
|
|
138
|
+
Configuration.gateway.credit_card.update!(*args)
|
|
104
139
|
end
|
|
105
140
|
|
|
106
|
-
|
|
107
|
-
#
|
|
108
|
-
# See http://www.braintreepaymentsolutions.com/docs/ruby/credit_cards/update_tr
|
|
109
|
-
def self.update_from_transparent_redirect(query_string)
|
|
110
|
-
warn "[DEPRECATED] CreditCard.update_via_transparent_redirect_request is deprecated. Please use TransparentRedirect.confirm"
|
|
111
|
-
Configuration.gateway.credit_card.update_from_transparent_redirect(query_string)
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
# Deprecated. Use Braintree::TransparentRedirect.url
|
|
115
|
-
#
|
|
116
|
-
# See http://www.braintreepaymentsolutions.com/docs/ruby/credit_cards/update_tr
|
|
117
|
-
def self.update_credit_card_url
|
|
118
|
-
warn "[DEPRECATED] CreditCard.update_credit_card_url is deprecated. Please use TransparentRedirect.url"
|
|
119
|
-
Configuration.gateway.credit_card.update_credit_card_url
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
def initialize(gateway, attributes) # :nodoc:
|
|
141
|
+
def initialize(gateway, attributes)
|
|
123
142
|
@gateway = gateway
|
|
124
143
|
set_instance_variables_from_hash(attributes)
|
|
125
144
|
@billing_address = attributes[:billing_address] ? Address._new(@gateway, attributes[:billing_address]) : nil
|
|
126
145
|
@subscriptions = (@subscriptions || []).map { |subscription_hash| Subscription._new(@gateway, subscription_hash) }
|
|
146
|
+
@verification = _most_recent_verification(attributes)
|
|
127
147
|
end
|
|
128
148
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
def credit(transaction_attributes)
|
|
133
|
-
warn "[DEPRECATED] credit as an instance method is deprecated. Please use CreditCard.credit"
|
|
134
|
-
@gateway.transaction.credit(transaction_attributes.merge(:payment_method_token => token))
|
|
149
|
+
def _most_recent_verification(attributes)
|
|
150
|
+
sorted_verifications = (attributes[:verifications] || []).sort_by { |verification| verification[:created_at] }.reverse.first
|
|
151
|
+
CreditCardVerification._new(sorted_verifications) if sorted_verifications
|
|
135
152
|
end
|
|
136
153
|
|
|
137
|
-
# Deprecated. Use Braintree::CreditCard.credit!
|
|
138
|
-
#
|
|
139
|
-
# See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create_from_vault
|
|
140
|
-
def credit!(transaction_attributes)
|
|
141
|
-
warn "[DEPRECATED] credit! as an instance method is deprecated. Please use CreditCard.credit!"
|
|
142
|
-
return_object_or_raise(:transaction) { credit(transaction_attributes) }
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
# Deprecated. Use Braintree::CreditCard.delete
|
|
146
|
-
#
|
|
147
|
-
# http://www.braintreepaymentsolutions.com/docs/ruby/credit_cards/delete
|
|
148
|
-
def delete
|
|
149
|
-
warn "[DEPRECATED] delete as an instance method is deprecated. Please use CreditCard.delete"
|
|
150
|
-
@gateway.credit_card.delete(token)
|
|
151
|
-
end
|
|
152
|
-
|
|
153
|
-
# Returns true if this credit card is the customer's default.
|
|
154
154
|
def default?
|
|
155
155
|
@default
|
|
156
156
|
end
|
|
@@ -160,12 +160,11 @@ module Braintree
|
|
|
160
160
|
"#{expiration_month}/#{expiration_year}"
|
|
161
161
|
end
|
|
162
162
|
|
|
163
|
-
# Returns true if the credit card is expired.
|
|
164
163
|
def expired?
|
|
165
164
|
@expired
|
|
166
165
|
end
|
|
167
166
|
|
|
168
|
-
def inspect
|
|
167
|
+
def inspect
|
|
169
168
|
first = [:token]
|
|
170
169
|
order = first + (self.class._attributes - first)
|
|
171
170
|
nice_attributes = order.map do |attr|
|
|
@@ -178,61 +177,37 @@ module Braintree
|
|
|
178
177
|
"#{bin}******#{last_4}"
|
|
179
178
|
end
|
|
180
179
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
# See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create_from_vault
|
|
184
|
-
def sale(transaction_attributes)
|
|
185
|
-
warn "[DEPRECATED] sale as an instance method is deprecated. Please use CreditCard.sale"
|
|
186
|
-
@gateway.transaction.sale(transaction_attributes.merge(:payment_method_token => token))
|
|
187
|
-
end
|
|
188
|
-
|
|
189
|
-
# Deprecated. Use Braintree::CreditCard.sale!
|
|
190
|
-
#
|
|
191
|
-
# See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create_from_vault
|
|
192
|
-
def sale!(transaction_attributes)
|
|
193
|
-
warn "[DEPRECATED] sale! as an instance method is deprecated. Please use CreditCard.sale!"
|
|
194
|
-
return_object_or_raise(:transaction) { sale(transaction_attributes) }
|
|
195
|
-
end
|
|
196
|
-
|
|
197
|
-
# Deprecated. Use Braintree::CreditCard.update
|
|
198
|
-
#
|
|
199
|
-
# See http://www.braintreepaymentsolutions.com/docs/ruby/credit_cards/update
|
|
200
|
-
def update(attributes)
|
|
201
|
-
warn "[DEPRECATED] update as an instance method is deprecated. Please use CreditCard.update"
|
|
202
|
-
result = @gateway.credit_card.update(token, attributes)
|
|
203
|
-
if result.success?
|
|
204
|
-
copy_instance_variables_from_object result.credit_card
|
|
205
|
-
end
|
|
206
|
-
result
|
|
180
|
+
def nonce
|
|
181
|
+
@nonce ||= PaymentMethodNonce.create(token)
|
|
207
182
|
end
|
|
208
183
|
|
|
209
|
-
#
|
|
210
|
-
#
|
|
211
|
-
#
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
184
|
+
# NEXT_MAJOR_VERSION can this be removed? Venmo SDK integration is no more
|
|
185
|
+
# Returns true if the card is associated with Venmo SDK
|
|
186
|
+
# NEXT_MAJOR_VERSION Remove this method
|
|
187
|
+
# The old venmo SDK class has been deprecated
|
|
188
|
+
def venmo_sdk?
|
|
189
|
+
warn "[DEPRECATED] The Venmo SDK integration is Unsupported. Please update your integration to use Pay with Venmo instead."
|
|
190
|
+
@venmo_sdk
|
|
215
191
|
end
|
|
216
192
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
return false unless other.is_a?(CreditCard)
|
|
220
|
-
token == other.token
|
|
193
|
+
def is_network_tokenized?
|
|
194
|
+
@is_network_tokenized
|
|
221
195
|
end
|
|
222
196
|
|
|
223
197
|
class << self
|
|
224
198
|
protected :new
|
|
225
199
|
end
|
|
226
200
|
|
|
227
|
-
def self._attributes
|
|
201
|
+
def self._attributes
|
|
228
202
|
[
|
|
229
|
-
:billing_address, :bin, :card_type, :cardholder_name, :
|
|
230
|
-
:expiration_year, :
|
|
203
|
+
:billing_address, :bin, :card_type, :cardholder_name, :commercial, :country_of_issuance, :created_at, :customer_id,
|
|
204
|
+
:debit, :durbin_regulated, :expiration_month, :expiration_year, :healthcare, :image_url, :is_network_tokenized?,
|
|
205
|
+
:issuing_bank, :last_4, :payroll, :prepaid, :prepaid_reloadable, :product_id, :token, :updated_at
|
|
231
206
|
]
|
|
232
207
|
end
|
|
233
208
|
|
|
234
|
-
def self._new(*args)
|
|
235
|
-
self.new
|
|
209
|
+
def self._new(*args)
|
|
210
|
+
self.new(*args)
|
|
236
211
|
end
|
|
237
212
|
end
|
|
238
213
|
end
|
|
@@ -1,87 +1,136 @@
|
|
|
1
1
|
module Braintree
|
|
2
|
-
class CreditCardGateway
|
|
2
|
+
class CreditCardGateway
|
|
3
|
+
include BaseModule
|
|
4
|
+
|
|
3
5
|
def initialize(gateway)
|
|
4
6
|
@gateway = gateway
|
|
5
7
|
@config = gateway.config
|
|
8
|
+
@config.assert_has_access_token_or_keys
|
|
6
9
|
end
|
|
7
10
|
|
|
8
11
|
def create(attributes)
|
|
9
12
|
if attributes.has_key?(:expiration_date) && (attributes.has_key?(:expiration_month) || attributes.has_key?(:expiration_year))
|
|
10
13
|
raise ArgumentError.new("create with both expiration_month and expiration_year or only expiration_date")
|
|
11
14
|
end
|
|
15
|
+
# NEXT_MAJOR_VERSION remove this check
|
|
16
|
+
if attributes.has_key?(:venmo_sdk_payment_method_code) || attributes.has_key?(:venmo_sdk_session)
|
|
17
|
+
warn "[DEPRECATED] The Venmo SDK integration is Unsupported. Please update your integration to use Pay with Venmo instead."
|
|
18
|
+
end
|
|
12
19
|
Util.verify_keys(CreditCardGateway._create_signature, attributes)
|
|
13
20
|
_do_create("/payment_methods", :credit_card => attributes)
|
|
14
21
|
end
|
|
15
22
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
23
|
+
def create!(*args)
|
|
24
|
+
return_object_or_raise(:credit_card) { create(*args) }
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# NEXT_MAJOR_VERSION remove this method
|
|
28
|
+
# CreditCard.credit has been deprecated in favor of Transaction.credit
|
|
29
|
+
def credit(token, transaction_attributes)
|
|
30
|
+
warn "[DEPRECATED] CreditCard.credit is deprecated. Use Transaction.credit instead"
|
|
31
|
+
@gateway.transaction.credit(transaction_attributes.merge(:payment_method_token => token))
|
|
19
32
|
end
|
|
20
33
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
34
|
+
# NEXT_MAJOR_VERSION remove this method
|
|
35
|
+
# CreditCard.credit has been deprecated in favor of Transaction.credit
|
|
36
|
+
def credit!(*args)
|
|
37
|
+
warn "[DEPRECATED] CreditCard.credit is deprecated. Use Transaction.credit instead"
|
|
38
|
+
return_object_or_raise(:transaction) { credit(*args) }
|
|
25
39
|
end
|
|
26
40
|
|
|
27
41
|
def delete(token)
|
|
28
|
-
@config.http.delete("/payment_methods/#{token}")
|
|
42
|
+
@config.http.delete("#{@config.base_merchant_path}/payment_methods/credit_card/#{token}")
|
|
29
43
|
end
|
|
30
44
|
|
|
31
45
|
def expired(options = {})
|
|
32
|
-
response = @config.http.post("/payment_methods/all/expired_ids")
|
|
46
|
+
response = @config.http.post("#{@config.base_merchant_path}/payment_methods/all/expired_ids")
|
|
33
47
|
ResourceCollection.new(response) { |ids| _fetch_expired(ids) }
|
|
34
48
|
end
|
|
35
49
|
|
|
36
50
|
def expiring_between(start_date, end_date, options = {})
|
|
37
|
-
formatted_start_date = start_date.strftime(
|
|
38
|
-
formatted_end_date = end_date.strftime(
|
|
39
|
-
response = @config.http.post("/payment_methods/all/expiring_ids?start=#{formatted_start_date}&end=#{formatted_end_date}")
|
|
51
|
+
formatted_start_date = start_date.strftime("%m%Y")
|
|
52
|
+
formatted_end_date = end_date.strftime("%m%Y")
|
|
53
|
+
response = @config.http.post("#{@config.base_merchant_path}/payment_methods/all/expiring_ids?start=#{formatted_start_date}&end=#{formatted_end_date}")
|
|
40
54
|
ResourceCollection.new(response) { |ids| _fetch_expiring_between(formatted_start_date, formatted_end_date, ids) }
|
|
41
55
|
end
|
|
42
56
|
|
|
43
57
|
def find(token)
|
|
44
|
-
|
|
58
|
+
raise ArgumentError if token.nil? || token.to_s.strip == ""
|
|
59
|
+
response = @config.http.get("#{@config.base_merchant_path}/payment_methods/credit_card/#{token}")
|
|
45
60
|
CreditCard._new(@gateway, response[:credit_card])
|
|
46
61
|
rescue NotFoundError
|
|
47
62
|
raise NotFoundError, "payment method with token #{token.inspect} not found"
|
|
48
63
|
end
|
|
49
64
|
|
|
50
|
-
def
|
|
51
|
-
|
|
52
|
-
|
|
65
|
+
def from_nonce(nonce)
|
|
66
|
+
raise ArgumentError if nonce.nil? || nonce.to_s.strip == ""
|
|
67
|
+
response = @config.http.get("#{@config.base_merchant_path}/payment_methods/from_nonce/#{nonce}")
|
|
68
|
+
CreditCard._new(@gateway, response[:credit_card])
|
|
69
|
+
rescue NotFoundError
|
|
70
|
+
raise NotFoundError, "nonce #{nonce.inspect} locked, consumed, or not found"
|
|
53
71
|
end
|
|
54
72
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
73
|
+
def update(token, attributes)
|
|
74
|
+
# NEXT_MAJOR_VERSION remove this check
|
|
75
|
+
if attributes.has_key?(:venmo_sdk_payment_method_code) || attributes.has_key?(:venmo_sdk_session)
|
|
76
|
+
warn "[DEPRECATED] The Venmo SDK integration is Unsupported. Please update your integration to use Pay with Venmo instead."
|
|
77
|
+
end
|
|
78
|
+
Util.verify_keys(CreditCardGateway._update_signature, attributes)
|
|
79
|
+
_do_update(:put, "/payment_methods/credit_card/#{token}", :credit_card => attributes)
|
|
60
80
|
end
|
|
61
81
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
warn "[DEPRECATED] CreditCard.update_credit_card_url is deprecated. Please use TransparentRedirect.url"
|
|
65
|
-
"#{@config.base_merchant_url}/payment_methods/all/update_via_transparent_redirect_request"
|
|
82
|
+
def update!(*args)
|
|
83
|
+
return_object_or_raise(:credit_card) { update(*args) }
|
|
66
84
|
end
|
|
67
85
|
|
|
68
|
-
def self._create_signature
|
|
86
|
+
def self._create_signature
|
|
69
87
|
_signature(:create)
|
|
70
88
|
end
|
|
71
89
|
|
|
72
|
-
def self._update_signature
|
|
90
|
+
def self._update_signature
|
|
73
91
|
_signature(:update)
|
|
74
92
|
end
|
|
75
93
|
|
|
76
|
-
def self._signature(type)
|
|
94
|
+
def self._signature(type)
|
|
77
95
|
billing_address_params = AddressGateway._shared_signature
|
|
96
|
+
# NEXT_MAJOR_VERSION Remove venmo_sdk_session
|
|
97
|
+
# The old venmo SDK class has been deprecated
|
|
98
|
+
options = [
|
|
99
|
+
:fail_on_duplicate_payment_method,
|
|
100
|
+
:fail_on_duplicate_payment_method_for_customer,
|
|
101
|
+
:make_default,
|
|
102
|
+
:skip_advanced_fraud_checking,
|
|
103
|
+
:venmo_sdk_session, # Deprecated
|
|
104
|
+
:verification_account_type,
|
|
105
|
+
:verification_amount,
|
|
106
|
+
:verification_currency_iso_code,
|
|
107
|
+
:verification_merchant_account_id,
|
|
108
|
+
:verify_card
|
|
109
|
+
]
|
|
110
|
+
# NEXT_MAJOR_VERSION Remove venmo_sdk_payment_method_code
|
|
111
|
+
# The old venmo SDK class has been deprecated
|
|
78
112
|
signature = [
|
|
79
|
-
:billing_address_id, :cardholder_name, :cvv, :expiration_date,
|
|
80
|
-
:
|
|
81
|
-
|
|
113
|
+
:billing_address_id, :cardholder_name, :cvv, :expiration_date, :expiration_month,
|
|
114
|
+
:expiration_year, :number, :token, :venmo_sdk_payment_method_code, # Deprecated
|
|
115
|
+
:device_data, :payment_method_nonce,
|
|
116
|
+
{:external_vault => [:network_transaction_id]},
|
|
117
|
+
{:options => options},
|
|
82
118
|
{:billing_address => billing_address_params}
|
|
83
119
|
]
|
|
84
120
|
|
|
121
|
+
signature << {
|
|
122
|
+
:three_d_secure_pass_thru => [
|
|
123
|
+
:eci_flag,
|
|
124
|
+
:cavv,
|
|
125
|
+
:xid,
|
|
126
|
+
:three_d_secure_version,
|
|
127
|
+
:authentication_response,
|
|
128
|
+
:directory_response,
|
|
129
|
+
:cavv_algorithm,
|
|
130
|
+
:ds_transaction_id,
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
|
|
85
134
|
case type
|
|
86
135
|
when :create
|
|
87
136
|
signature << :customer_id
|
|
@@ -94,8 +143,8 @@ module Braintree
|
|
|
94
143
|
return signature
|
|
95
144
|
end
|
|
96
145
|
|
|
97
|
-
def _do_create(
|
|
98
|
-
response = @config.http.post
|
|
146
|
+
def _do_create(path, params=nil)
|
|
147
|
+
response = @config.http.post("#{@config.base_merchant_path}#{path}", params)
|
|
99
148
|
if response[:credit_card]
|
|
100
149
|
SuccessfulResult.new(:credit_card => CreditCard._new(@gateway, response[:credit_card]))
|
|
101
150
|
elsif response[:api_error_response]
|
|
@@ -105,8 +154,8 @@ module Braintree
|
|
|
105
154
|
end
|
|
106
155
|
end
|
|
107
156
|
|
|
108
|
-
def _do_update(http_verb,
|
|
109
|
-
response = @config.http.send
|
|
157
|
+
def _do_update(http_verb, path, params)
|
|
158
|
+
response = @config.http.send(http_verb, "#{@config.base_merchant_path}#{path}", params)
|
|
110
159
|
if response[:credit_card]
|
|
111
160
|
SuccessfulResult.new(:credit_card => CreditCard._new(@gateway, response[:credit_card]))
|
|
112
161
|
elsif response[:api_error_response]
|
|
@@ -116,16 +165,16 @@ module Braintree
|
|
|
116
165
|
end
|
|
117
166
|
end
|
|
118
167
|
|
|
119
|
-
def _fetch_expired(ids)
|
|
120
|
-
response = @config.http.post("/payment_methods/all/expired", :search => {:ids => ids})
|
|
168
|
+
def _fetch_expired(ids)
|
|
169
|
+
response = @config.http.post("#{@config.base_merchant_path}/payment_methods/all/expired", :search => {:ids => ids})
|
|
121
170
|
attributes = response[:payment_methods]
|
|
122
171
|
Util.extract_attribute_as_array(attributes, :credit_card).map { |attrs| CreditCard._new(@gateway, attrs) }
|
|
123
172
|
end
|
|
124
173
|
|
|
125
|
-
def _fetch_expiring_between(formatted_start_date, formatted_end_date, ids)
|
|
174
|
+
def _fetch_expiring_between(formatted_start_date, formatted_end_date, ids)
|
|
126
175
|
response = @config.http.post(
|
|
127
|
-
"/payment_methods/all/expiring?start=#{formatted_start_date}&end=#{formatted_end_date}",
|
|
128
|
-
:search => {:ids => ids}
|
|
176
|
+
"#{@config.base_merchant_path}/payment_methods/all/expiring?start=#{formatted_start_date}&end=#{formatted_end_date}",
|
|
177
|
+
:search => {:ids => ids},
|
|
129
178
|
)
|
|
130
179
|
attributes = response[:payment_methods]
|
|
131
180
|
Util.extract_attribute_as_array(attributes, :credit_card).map { |attrs| CreditCard._new(@gateway, attrs) }
|