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,32 +1,92 @@
|
|
|
1
1
|
module Braintree
|
|
2
|
-
# See http://www.braintreepaymentsolutions.com/docs/ruby/general/card_verification
|
|
3
2
|
class CreditCardVerification
|
|
4
3
|
include BaseModule
|
|
4
|
+
include Braintree::Util::IdEquality
|
|
5
|
+
|
|
6
|
+
module GatewayRejectionReason
|
|
7
|
+
ApplicationIncomplete = "application_incomplete"
|
|
8
|
+
AVS = "avs"
|
|
9
|
+
AVSAndCVV = "avs_and_cvv"
|
|
10
|
+
CVV = "cvv"
|
|
11
|
+
Duplicate = "duplicate"
|
|
12
|
+
Fraud = "fraud"
|
|
13
|
+
RiskThreshold = "risk_threshold"
|
|
14
|
+
ThreeDSecure = "three_d_secure"
|
|
15
|
+
TokenIssuance = "token_issuance"
|
|
16
|
+
Unrecognized = "unrecognized"
|
|
17
|
+
end
|
|
5
18
|
|
|
6
19
|
module Status
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
20
|
+
Failed = "failed"
|
|
21
|
+
GatewayRejected = "gateway_rejected"
|
|
22
|
+
ProcessorDeclined = "processor_declined"
|
|
23
|
+
Verified = "verified"
|
|
24
|
+
|
|
25
|
+
All = [Failed, GatewayRejected, ProcessorDeclined, Verified]
|
|
11
26
|
end
|
|
12
27
|
|
|
13
|
-
attr_reader :
|
|
14
|
-
|
|
15
|
-
|
|
28
|
+
attr_reader :amount
|
|
29
|
+
attr_reader :ani_first_name_response_code
|
|
30
|
+
attr_reader :ani_last_name_response_code
|
|
31
|
+
attr_reader :avs_error_response_code
|
|
32
|
+
attr_reader :avs_postal_code_response_code
|
|
33
|
+
attr_reader :avs_street_address_response_code
|
|
34
|
+
attr_reader :billing
|
|
35
|
+
attr_reader :created_at
|
|
36
|
+
attr_reader :credit_card
|
|
37
|
+
attr_reader :currency_iso_code
|
|
38
|
+
attr_reader :cvv_response_code
|
|
39
|
+
attr_reader :gateway_rejection_reason
|
|
40
|
+
attr_reader :graphql_id
|
|
41
|
+
attr_reader :id
|
|
42
|
+
attr_reader :merchant_account_id
|
|
43
|
+
attr_reader :network_response_code
|
|
44
|
+
attr_reader :network_response_text
|
|
45
|
+
attr_reader :network_transaction_id
|
|
46
|
+
attr_reader :processor_response_code
|
|
47
|
+
attr_reader :processor_response_text
|
|
48
|
+
attr_reader :processor_response_type
|
|
49
|
+
attr_reader :risk_data
|
|
50
|
+
attr_reader :status
|
|
51
|
+
attr_reader :three_d_secure_info
|
|
16
52
|
|
|
17
|
-
def initialize(attributes)
|
|
53
|
+
def initialize(attributes)
|
|
18
54
|
set_instance_variables_from_hash(attributes)
|
|
55
|
+
|
|
56
|
+
@amount = Util.to_big_decimal(amount)
|
|
57
|
+
|
|
58
|
+
@risk_data = RiskData.new(attributes[:risk_data]) if attributes[:risk_data]
|
|
59
|
+
@three_d_secure_info = ThreeDSecureInfo.new(attributes[:three_d_secure_info]) if attributes[:three_d_secure_info]
|
|
19
60
|
end
|
|
20
61
|
|
|
21
|
-
def inspect
|
|
62
|
+
def inspect
|
|
22
63
|
attr_order = [
|
|
23
|
-
:
|
|
24
|
-
:
|
|
25
|
-
:
|
|
26
|
-
:
|
|
64
|
+
:amount,
|
|
65
|
+
:ani_first_name_response_code,
|
|
66
|
+
:ani_last_name_response_code,
|
|
67
|
+
:avs_error_response_code,
|
|
68
|
+
:avs_postal_code_response_code,
|
|
69
|
+
:avs_street_address_response_code,
|
|
70
|
+
:billing,
|
|
71
|
+
:created_at,
|
|
72
|
+
:credit_card,
|
|
73
|
+
:currency_iso_code,
|
|
74
|
+
:cvv_response_code,
|
|
75
|
+
:gateway_rejection_reason,
|
|
76
|
+
:id,
|
|
77
|
+
:merchant_account_id,
|
|
78
|
+
:network_response_code,
|
|
79
|
+
:network_response_text,
|
|
80
|
+
:processor_response_code,
|
|
81
|
+
:processor_response_text,
|
|
82
|
+
:status
|
|
27
83
|
]
|
|
28
84
|
formatted_attrs = attr_order.map do |attr|
|
|
29
|
-
|
|
85
|
+
if attr == :amount
|
|
86
|
+
Util.inspect_amount(self.amount)
|
|
87
|
+
else
|
|
88
|
+
"#{attr}: #{send(attr).inspect}"
|
|
89
|
+
end
|
|
30
90
|
end
|
|
31
91
|
"#<#{self.class} #{formatted_attrs.join(", ")}>"
|
|
32
92
|
end
|
|
@@ -35,8 +95,21 @@ module Braintree
|
|
|
35
95
|
protected :new
|
|
36
96
|
end
|
|
37
97
|
|
|
38
|
-
def self._new(*args)
|
|
39
|
-
self.new
|
|
98
|
+
def self._new(*args)
|
|
99
|
+
self.new(*args)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def self.find(*args)
|
|
103
|
+
Configuration.gateway.verification.find(*args)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def self.search(&block)
|
|
107
|
+
Configuration.gateway.verification.search(&block)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def self.create(attributes)
|
|
111
|
+
Util.verify_keys(CreditCardVerificationGateway._create_signature, attributes)
|
|
112
|
+
Configuration.gateway.verification.create(attributes)
|
|
40
113
|
end
|
|
41
114
|
end
|
|
42
115
|
end
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
module Braintree
|
|
2
|
+
class CreditCardVerificationGateway
|
|
3
|
+
def initialize(gateway)
|
|
4
|
+
@gateway = gateway
|
|
5
|
+
@config = gateway.config
|
|
6
|
+
@config.assert_has_access_token_or_keys
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def find(id)
|
|
10
|
+
raise ArgumentError if id.nil? || id.to_s.strip == ""
|
|
11
|
+
response = @config.http.get("#{@config.base_merchant_path}/verifications/#{id}")
|
|
12
|
+
CreditCardVerification._new(response[:verification])
|
|
13
|
+
rescue NotFoundError
|
|
14
|
+
raise NotFoundError, "verification with id #{id.inspect} not found"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def search(&block)
|
|
18
|
+
search = CreditCardVerificationSearch.new
|
|
19
|
+
block.call(search) if block
|
|
20
|
+
|
|
21
|
+
response = @config.http.post("#{@config.base_merchant_path}/verifications/advanced_search_ids", {:search => search.to_hash})
|
|
22
|
+
ResourceCollection.new(response) { |ids| _fetch_verifications(search, ids) }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def create(params)
|
|
26
|
+
response = @config.http.post("#{@config.base_merchant_path}/verifications", :verification => params)
|
|
27
|
+
_handle_verification_create_response(response)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def _handle_verification_create_response(response)
|
|
31
|
+
if response[:verification]
|
|
32
|
+
SuccessfulResult.new(:verification => CreditCardVerification._new(response[:verification]))
|
|
33
|
+
elsif response[:api_error_response]
|
|
34
|
+
ErrorResult.new(@gateway, response[:api_error_response])
|
|
35
|
+
else
|
|
36
|
+
raise UnexpectedError, "expected :verification or :api_error_response"
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def _fetch_verifications(search, ids)
|
|
41
|
+
search.ids.in ids
|
|
42
|
+
response = @config.http.post("#{@config.base_merchant_path}/verifications/advanced_search", {:search => search.to_hash})
|
|
43
|
+
attributes = response[:credit_card_verifications]
|
|
44
|
+
Util.extract_attribute_as_array(attributes, :verification).map { |attrs| CreditCardVerification._new(attrs) }
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def self._create_signature
|
|
48
|
+
[
|
|
49
|
+
{:credit_card => [
|
|
50
|
+
{:billing_address => AddressGateway._shared_signature},
|
|
51
|
+
:cardholder_name,
|
|
52
|
+
:cvv,
|
|
53
|
+
:expiration_date,
|
|
54
|
+
:expiration_month,
|
|
55
|
+
:expiration_year,
|
|
56
|
+
:number,
|
|
57
|
+
]},
|
|
58
|
+
{:external_vault => [
|
|
59
|
+
:previous_network_transaction_id,
|
|
60
|
+
:status,
|
|
61
|
+
]},
|
|
62
|
+
:intended_transaction_source,
|
|
63
|
+
{:options => [
|
|
64
|
+
:account_type,
|
|
65
|
+
:amount,
|
|
66
|
+
:merchant_account_id,
|
|
67
|
+
]},
|
|
68
|
+
:payment_method_nonce,
|
|
69
|
+
{:risk_data => [
|
|
70
|
+
:customer_browser,
|
|
71
|
+
:customer_ip,
|
|
72
|
+
]},
|
|
73
|
+
:three_d_secure_authentication_id,
|
|
74
|
+
{:three_d_secure_pass_thru => [
|
|
75
|
+
:authentication_response,
|
|
76
|
+
:cavv,
|
|
77
|
+
:cavv_algorithm,
|
|
78
|
+
:directory_response,
|
|
79
|
+
:ds_transaction_id,
|
|
80
|
+
:eci_flag,
|
|
81
|
+
:three_d_secure_version,
|
|
82
|
+
:xid,
|
|
83
|
+
]},
|
|
84
|
+
]
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Braintree
|
|
2
|
+
class CreditCardVerificationSearch < AdvancedSearch
|
|
3
|
+
text_fields(
|
|
4
|
+
:billing_address_details_postal_code,
|
|
5
|
+
:credit_card_cardholder_name,
|
|
6
|
+
:customer_email,
|
|
7
|
+
:customer_id,
|
|
8
|
+
:id,
|
|
9
|
+
:payment_method_token,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
equality_fields :credit_card_expiration_date
|
|
13
|
+
partial_match_fields :credit_card_number
|
|
14
|
+
|
|
15
|
+
multiple_value_field :credit_card_card_type, :allows => CreditCard::CardType::All
|
|
16
|
+
multiple_value_field :status, :allows => CreditCardVerification::Status::All
|
|
17
|
+
multiple_value_field :ids
|
|
18
|
+
range_fields :created_at
|
|
19
|
+
end
|
|
20
|
+
end
|
data/lib/braintree/customer.rb
CHANGED
|
@@ -1,133 +1,134 @@
|
|
|
1
1
|
module Braintree
|
|
2
|
-
# See http://www.braintreepaymentsolutions.com/docs/ruby
|
|
3
2
|
class Customer
|
|
4
3
|
include BaseModule
|
|
4
|
+
include Braintree::Util::IdEquality
|
|
5
|
+
|
|
6
|
+
attr_reader :addresses
|
|
7
|
+
attr_reader :apple_pay_cards
|
|
8
|
+
attr_reader :company
|
|
9
|
+
attr_reader :created_at
|
|
10
|
+
attr_reader :credit_cards
|
|
11
|
+
attr_reader :custom_fields
|
|
12
|
+
attr_reader :email
|
|
13
|
+
attr_reader :fax
|
|
14
|
+
attr_reader :first_name
|
|
15
|
+
attr_reader :google_pay_cards
|
|
16
|
+
attr_reader :graphql_id
|
|
17
|
+
attr_reader :id
|
|
18
|
+
attr_reader :international_phone
|
|
19
|
+
attr_reader :last_name
|
|
20
|
+
attr_reader :paypal_accounts
|
|
21
|
+
attr_reader :phone
|
|
22
|
+
attr_reader :samsung_pay_cards
|
|
23
|
+
attr_reader :sepa_direct_debit_accounts
|
|
24
|
+
attr_reader :tax_identifiers
|
|
25
|
+
attr_reader :updated_at
|
|
26
|
+
attr_reader :us_bank_accounts
|
|
27
|
+
attr_reader :venmo_accounts
|
|
28
|
+
attr_reader :visa_checkout_cards
|
|
29
|
+
attr_reader :website
|
|
5
30
|
|
|
6
|
-
attr_reader :addresses, :company, :created_at, :credit_cards, :email, :fax, :first_name, :id, :last_name,
|
|
7
|
-
:phone, :updated_at, :website, :custom_fields
|
|
8
|
-
|
|
9
|
-
# See http://www.braintreepaymentsolutions.com/docs/ruby/customers/search
|
|
10
31
|
def self.all
|
|
11
32
|
Configuration.gateway.customer.all
|
|
12
33
|
end
|
|
13
34
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
Configuration.gateway.customer.create(attributes)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
# See http://www.braintreepaymentsolutions.com/docs/ruby/customers/create
|
|
20
|
-
def self.create!(attributes = {})
|
|
21
|
-
return_object_or_raise(:customer) { create(attributes) }
|
|
35
|
+
def self.create(*args)
|
|
36
|
+
Configuration.gateway.customer.create(*args)
|
|
22
37
|
end
|
|
23
38
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
# See http://www.braintreepaymentsolutions.com/docs/ruby/customers/create_tr
|
|
27
|
-
def self.create_customer_url
|
|
28
|
-
warn "[DEPRECATED] Customer.create_customer_url is deprecated. Please use TransparentRedirect.url"
|
|
29
|
-
Configuration.gateway.customer.create_customer_url
|
|
39
|
+
def self.create!(*args)
|
|
40
|
+
Configuration.gateway.customer.create!(*args)
|
|
30
41
|
end
|
|
31
42
|
|
|
32
|
-
# Deprecated. Use Braintree::TransparentRedirect.confirm
|
|
33
|
-
#
|
|
34
|
-
# See http://www.braintreepaymentsolutions.com/docs/ruby/customers/create_tr
|
|
35
|
-
def self.create_from_transparent_redirect(query_string)
|
|
36
|
-
warn "[DEPRECATED] Customer.create_from_transparent_redirect is deprecated. Please use TransparentRedirect.confirm"
|
|
37
|
-
Configuration.gateway.customer.create_from_transparent_redirect(query_string)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
# See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create_from_vault
|
|
41
43
|
def self.credit(customer_id, transaction_attributes)
|
|
42
44
|
Transaction.credit(transaction_attributes.merge(:customer_id => customer_id))
|
|
43
45
|
end
|
|
44
46
|
|
|
45
|
-
# See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create_from_vault
|
|
46
47
|
def self.credit!(customer_id, transaction_attributes)
|
|
47
|
-
return_object_or_raise(:transaction){ credit(customer_id, transaction_attributes) }
|
|
48
|
+
return_object_or_raise(:transaction) { credit(customer_id, transaction_attributes) }
|
|
48
49
|
end
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
Configuration.gateway.customer.delete(customer_id)
|
|
51
|
+
def self.delete(*args)
|
|
52
|
+
Configuration.gateway.customer.delete(*args)
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
Configuration.gateway.customer.find(customer_id)
|
|
55
|
+
def self.find(*args)
|
|
56
|
+
Configuration.gateway.customer.find(*args)
|
|
58
57
|
end
|
|
59
58
|
|
|
60
|
-
# See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create_from_vault
|
|
61
59
|
def self.sale(customer_id, transaction_attributes)
|
|
62
60
|
Transaction.sale(transaction_attributes.merge(:customer_id => customer_id))
|
|
63
61
|
end
|
|
64
62
|
|
|
65
|
-
# See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create_from_vault
|
|
66
63
|
def self.sale!(customer_id, transaction_attributes)
|
|
67
64
|
return_object_or_raise(:transaction) { sale(customer_id, transaction_attributes) }
|
|
68
65
|
end
|
|
69
66
|
|
|
70
|
-
# See http://www.braintreepaymentsolutions.com/docs/ruby/customers/search
|
|
71
67
|
def self.search(&block)
|
|
72
68
|
Configuration.gateway.customer.search(&block)
|
|
73
69
|
end
|
|
74
70
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
Configuration.gateway.customer.transactions(customer_id, options = {})
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
# See http://www.braintreepaymentsolutions.com/docs/ruby/customers/update
|
|
81
|
-
def self.update(customer_id, attributes)
|
|
82
|
-
Configuration.gateway.customer.update(customer_id, attributes)
|
|
71
|
+
def self.transactions(*args)
|
|
72
|
+
Configuration.gateway.customer.transactions(*args)
|
|
83
73
|
end
|
|
84
74
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
return_object_or_raise(:customer) { update(customer_id, attributes) }
|
|
75
|
+
def self.update(*args)
|
|
76
|
+
Configuration.gateway.customer.update(*args)
|
|
88
77
|
end
|
|
89
78
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
# See http://www.braintreepaymentsolutions.com/docs/ruby/customers/update_tr
|
|
93
|
-
def self.update_customer_url
|
|
94
|
-
warn "[DEPRECATED] Customer.update_customer_url is deprecated. Please use TransparentRedirect.url"
|
|
95
|
-
Configuration.gateway.customer.update_customer_url
|
|
79
|
+
def self.update!(*args)
|
|
80
|
+
Configuration.gateway.customer.update!(*args)
|
|
96
81
|
end
|
|
97
82
|
|
|
98
|
-
#
|
|
99
|
-
|
|
100
|
-
# See http://www.braintreepaymentsolutions.com/docs/ruby/customers/update_tr
|
|
101
|
-
def self.update_from_transparent_redirect(query_string)
|
|
102
|
-
warn "[DEPRECATED] Customer.update_from_transparent_redirect is deprecated. Please use TransparentRedirect.confirm"
|
|
103
|
-
Configuration.gateway.customer.update_from_transparent_redirect(query_string)
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
def initialize(gateway, attributes) # :nodoc:
|
|
83
|
+
# NEXT_MAJOR_VERSION remove samsung_pay_cards
|
|
84
|
+
def initialize(gateway, attributes)
|
|
107
85
|
@gateway = gateway
|
|
108
86
|
set_instance_variables_from_hash(attributes)
|
|
109
87
|
@credit_cards = (@credit_cards || []).map { |pm| CreditCard._new gateway, pm }
|
|
88
|
+
@paypal_accounts = (@paypal_accounts || []).map { |pm| PayPalAccount._new gateway, pm }
|
|
89
|
+
@apple_pay_cards = (@apple_pay_cards || []).map { |pm| ApplePayCard._new gateway, pm }
|
|
90
|
+
@google_pay_cards = (@google_pay_cards || []).map { |pm| GooglePayCard._new gateway, pm }
|
|
91
|
+
@venmo_accounts = (@venmo_accounts || []).map { |pm| VenmoAccount._new gateway, pm }
|
|
92
|
+
@us_bank_accounts = (@us_bank_accounts || []).map { |pm| UsBankAccount._new gateway, pm }
|
|
93
|
+
@visa_checkout_cards = (@visa_checkout_cards|| []).map { |pm| VisaCheckoutCard._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
|
|
110
96
|
@addresses = (@addresses || []).map { |addr| Address._new gateway, addr }
|
|
97
|
+
@tax_identifiers = (@tax_identifiers || []).map { |addr| TaxIdentifier._new gateway, addr }
|
|
98
|
+
@custom_fields = attributes[:custom_fields].is_a?(Hash) ? attributes[:custom_fields] : {}
|
|
111
99
|
end
|
|
112
100
|
|
|
113
|
-
# See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create_from_vault
|
|
114
101
|
def credit(transaction_attributes)
|
|
115
102
|
@gateway.transaction.credit(transaction_attributes.merge(:customer_id => id))
|
|
116
103
|
end
|
|
117
104
|
|
|
118
|
-
# See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create_from_vault
|
|
119
105
|
def credit!(transaction_attributes)
|
|
120
106
|
return_object_or_raise(:transaction) { credit(transaction_attributes) }
|
|
121
107
|
end
|
|
122
108
|
|
|
123
|
-
|
|
109
|
+
def default_payment_method
|
|
110
|
+
payment_methods.find { |payment_instrument| payment_instrument.default? }
|
|
111
|
+
end
|
|
112
|
+
|
|
124
113
|
def delete
|
|
125
114
|
@gateway.customer.delete(id)
|
|
126
115
|
end
|
|
127
116
|
|
|
128
|
-
def
|
|
117
|
+
def payment_methods
|
|
118
|
+
@credit_cards +
|
|
119
|
+
@paypal_accounts +
|
|
120
|
+
@apple_pay_cards +
|
|
121
|
+
@google_pay_cards +
|
|
122
|
+
@venmo_accounts +
|
|
123
|
+
@us_bank_accounts +
|
|
124
|
+
@visa_checkout_cards +
|
|
125
|
+
@samsung_pay_cards +
|
|
126
|
+
@sepa_direct_debit_accounts
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
def inspect
|
|
129
130
|
first = [:id]
|
|
130
|
-
last = [:addresses, :credit_cards]
|
|
131
|
+
last = [:addresses, :credit_cards, :paypal_accounts, :tax_identifiers]
|
|
131
132
|
order = first + (self.class._attributes - first - last) + last
|
|
132
133
|
nice_attributes = order.map do |attr|
|
|
133
134
|
"#{attr}: #{send(attr).inspect}"
|
|
@@ -135,66 +136,27 @@ module Braintree
|
|
|
135
136
|
"#<#{self.class} #{nice_attributes.join(', ')}>"
|
|
136
137
|
end
|
|
137
138
|
|
|
138
|
-
# Deprecated. Use Braintree::Customer.sale
|
|
139
|
-
#
|
|
140
|
-
# See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create_from_vault
|
|
141
|
-
def sale(transaction_attributes)
|
|
142
|
-
warn "[DEPRECATED] sale as an instance method is deprecated. Please use Customer.sale"
|
|
143
|
-
@gateway.transaction.sale(transaction_attributes.merge(:customer_id => id))
|
|
144
|
-
end
|
|
145
|
-
|
|
146
|
-
# Deprecated. Use Braintree::Customer.sale!
|
|
147
|
-
#
|
|
148
|
-
# See http://www.braintreepaymentsolutions.com/docs/ruby/transactions/create_from_vault
|
|
149
|
-
def sale!(transaction_attributes)
|
|
150
|
-
warn "[DEPRECATED] sale! as an instance method is deprecated. Please use Customer.sale!"
|
|
151
|
-
return_object_or_raise(:transaction) { sale(transaction_attributes) }
|
|
152
|
-
end
|
|
153
|
-
|
|
154
|
-
# Returns a ResourceCollection of transactions for the customer.
|
|
155
139
|
def transactions(options = {})
|
|
156
140
|
@gateway.customer.transactions(id, options)
|
|
157
141
|
end
|
|
158
142
|
|
|
159
|
-
# Deprecated. Use Braintree::Customer.update
|
|
160
|
-
#
|
|
161
|
-
# See http://www.braintreepaymentsolutions.com/docs/ruby/customers/update
|
|
162
|
-
def update(attributes)
|
|
163
|
-
warn "[DEPRECATED] update as an instance method is deprecated. Please use Customer.update"
|
|
164
|
-
result = @gateway.customer.update(id, attributes)
|
|
165
|
-
if result.success?
|
|
166
|
-
copy_instance_variables_from_object result.customer
|
|
167
|
-
end
|
|
168
|
-
result
|
|
169
|
-
end
|
|
170
|
-
|
|
171
|
-
# Deprecated. Use Braintree::Customer.update!
|
|
172
|
-
#
|
|
173
|
-
# See http://www.braintreepaymentsolutions.com/docs/ruby/customers/update
|
|
174
|
-
def update!(attributes)
|
|
175
|
-
warn "[DEPRECATED] update! as an instance method is deprecated. Please use Customer.update!"
|
|
176
|
-
return_object_or_raise(:customer) { update(attributes) }
|
|
177
|
-
end
|
|
178
|
-
|
|
179
|
-
# Returns true if +other+ is a Customer with the same id
|
|
180
|
-
def ==(other)
|
|
181
|
-
return false unless other.is_a?(Customer)
|
|
182
|
-
id == other.id
|
|
183
|
-
end
|
|
184
|
-
|
|
185
143
|
class << self
|
|
186
144
|
protected :new
|
|
187
145
|
end
|
|
188
146
|
|
|
189
|
-
def self._new(*args)
|
|
190
|
-
self.new
|
|
147
|
+
def self._new(*args)
|
|
148
|
+
self.new(*args)
|
|
191
149
|
end
|
|
192
150
|
|
|
193
|
-
def self._attributes
|
|
151
|
+
def self._attributes
|
|
194
152
|
[
|
|
195
|
-
:addresses, :company, :credit_cards, :email, :fax, :first_name, :id, :
|
|
196
|
-
: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
|
|
197
155
|
]
|
|
198
156
|
end
|
|
157
|
+
|
|
158
|
+
def self._now_timestamp
|
|
159
|
+
Time.now.to_i
|
|
160
|
+
end
|
|
199
161
|
end
|
|
200
162
|
end
|