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
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: ca8e969e0988757df5800a440fdc36293b48bc0c72cc8c56b1175d74d79f309b
|
|
4
|
+
data.tar.gz: b44530a7eb4a73728fd4c79292633fc7d7ca0d6476c26b7277c1a3051d29fcaa
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 2d985f754fa864774601dad717587b5d5d7f1e75a9579286100559e9cd4ab1819fd856b5c90c6d59870149b6d7bfd0cc5d2865f2d96362a208c037854b9ab312
|
|
7
|
+
data.tar.gz: 2ab4e8c0f48d76e10f4854e3e32fe55c154c8bdd40730625409f4259921268788c9bd2baf3152724a6d665ed5d0bf53dc7b540570f2f9777ced5dc53be6aeaa8
|
data/LICENSE
CHANGED
data/braintree.gemspec
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
|
2
|
+
require "braintree/version"
|
|
3
|
+
|
|
4
|
+
Gem::Specification.new do |s|
|
|
5
|
+
s.name = "braintree"
|
|
6
|
+
s.summary = "Braintree Ruby Server SDK"
|
|
7
|
+
s.description = "Resources and tools for developers to integrate Braintree's global payments platform."
|
|
8
|
+
s.version = Braintree::Version::String
|
|
9
|
+
s.license = "MIT"
|
|
10
|
+
s.author = "Braintree"
|
|
11
|
+
s.email = "code@getbraintree.com"
|
|
12
|
+
s.homepage = "https://www.braintreepayments.com/"
|
|
13
|
+
s.files = Dir.glob ["README.rdoc", "LICENSE", "lib/**/*.{rb,crt}", "spec/**/*", "*.gemspec"]
|
|
14
|
+
s.add_dependency "builder", ">= 3.2.4"
|
|
15
|
+
s.add_dependency "rexml", ">= 3.1.9" # Use rexml version associated with minimum supported Ruby version
|
|
16
|
+
s.required_ruby_version = ">=2.6.0"
|
|
17
|
+
s.metadata = {
|
|
18
|
+
"bug_tracker_uri" => "https://github.com/braintree/braintree_ruby/issues",
|
|
19
|
+
"changelog_uri" => "https://github.com/braintree/braintree_ruby/blob/master/CHANGELOG.md",
|
|
20
|
+
"source_code_uri" => "https://github.com/braintree/braintree_ruby",
|
|
21
|
+
"documentation_uri" => "https://developer.paypal.com/braintree/docs"
|
|
22
|
+
}
|
|
23
|
+
end
|
|
24
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Braintree
|
|
2
|
+
class AccountUpdaterDailyReport
|
|
3
|
+
include BaseModule
|
|
4
|
+
|
|
5
|
+
attr_reader :report_date
|
|
6
|
+
attr_reader :report_url
|
|
7
|
+
|
|
8
|
+
class << self
|
|
9
|
+
protected :new
|
|
10
|
+
def _new(*args)
|
|
11
|
+
self.new(*args)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def initialize(attributes)
|
|
16
|
+
set_instance_variables_from_hash(attributes)
|
|
17
|
+
@report_date = Date.parse(report_date)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module Braintree
|
|
2
|
+
class AchMandate
|
|
3
|
+
include BaseModule
|
|
4
|
+
|
|
5
|
+
attr_reader :accepted_at
|
|
6
|
+
attr_reader :text
|
|
7
|
+
|
|
8
|
+
def initialize(attributes)
|
|
9
|
+
set_instance_variables_from_hash(attributes)
|
|
10
|
+
@accepted_at = Time.parse(attributes[:accepted_at]) unless @accepted_at.class == Time
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
end
|
|
14
|
+
end
|
data/lib/braintree/add_on.rb
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Braintree
|
|
2
|
+
class AddOnGateway
|
|
3
|
+
def initialize(gateway)
|
|
4
|
+
@gateway = gateway
|
|
5
|
+
@config = gateway.config
|
|
6
|
+
@config.assert_has_access_token_or_keys
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def all
|
|
10
|
+
response = @config.http.get("#{@config.base_merchant_path}/add_ons")
|
|
11
|
+
attributes_collection = response[:add_ons]
|
|
12
|
+
attributes_collection.map do |attributes|
|
|
13
|
+
AddOn._new(attributes)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -29,6 +29,7 @@ module Braintree
|
|
|
29
29
|
["Bermuda", "BM", "BMU", "060"],
|
|
30
30
|
["Bhutan", "BT", "BTN", "064"],
|
|
31
31
|
["Bolivia", "BO", "BOL", "068"],
|
|
32
|
+
["Bonaire, Sint Eustatius and Saba", "BQ", "BES", "535"],
|
|
32
33
|
["Bosnia and Herzegovina", "BA", "BIH", "070"],
|
|
33
34
|
["Botswana", "BW", "BWA", "072"],
|
|
34
35
|
["Bouvet Island", "BV", "BVT", "074"],
|
|
@@ -58,6 +59,7 @@ module Braintree
|
|
|
58
59
|
["Côte d'Ivoire", "CI", "CIV", "384"],
|
|
59
60
|
["Croatia", "HR", "HRV", "191"],
|
|
60
61
|
["Cuba", "CU", "CUB", "192"],
|
|
62
|
+
["Curaçao", "CW", "CUW", "531"],
|
|
61
63
|
["Cyprus", "CY", "CYP", "196"],
|
|
62
64
|
["Czech Republic", "CZ", "CZE", "203"],
|
|
63
65
|
["Denmark", "DK", "DNK", "208"],
|
|
@@ -156,7 +158,6 @@ module Braintree
|
|
|
156
158
|
["Nauru", "NR", "NRU", "520"],
|
|
157
159
|
["Nepal", "NP", "NPL", "524"],
|
|
158
160
|
["Netherlands", "NL", "NLD", "528"],
|
|
159
|
-
["Netherlands Antilles", "AN", "ANT", "530"],
|
|
160
161
|
["New Caledonia", "NC", "NCL", "540"],
|
|
161
162
|
["New Zealand", "NZ", "NZL", "554"],
|
|
162
163
|
["Nicaragua", "NI", "NIC", "558"],
|
|
@@ -200,12 +201,14 @@ module Braintree
|
|
|
200
201
|
["Seychelles", "SC", "SYC", "690"],
|
|
201
202
|
["Sierra Leone", "SL", "SLE", "694"],
|
|
202
203
|
["Singapore", "SG", "SGP", "702"],
|
|
204
|
+
["Sint Maarten (Dutch part)", "SX", "SXM", "534"],
|
|
203
205
|
["Slovakia", "SK", "SVK", "703"],
|
|
204
206
|
["Slovenia", "SI", "SVN", "705"],
|
|
205
207
|
["Solomon Islands", "SB", "SLB", "090"],
|
|
206
208
|
["Somalia", "SO", "SOM", "706"],
|
|
207
209
|
["South Africa", "ZA", "ZAF", "710"],
|
|
208
210
|
["South Georgia and South Sandwich Islands", "GS", "SGS", "239"],
|
|
211
|
+
["South Sudan", "SS", "SSD", "728"],
|
|
209
212
|
["Spain", "ES", "ESP", "724"],
|
|
210
213
|
["Sri Lanka", "LK", "LKA", "144"],
|
|
211
214
|
["Sudan", "SD", "SDN", "736"],
|
data/lib/braintree/address.rb
CHANGED
|
@@ -1,74 +1,66 @@
|
|
|
1
1
|
module Braintree
|
|
2
|
-
# See http://www.braintreepaymentsolutions.com/docs/ruby/addresses/details
|
|
3
2
|
class Address
|
|
4
|
-
include BaseModule
|
|
3
|
+
include BaseModule
|
|
5
4
|
|
|
6
|
-
attr_reader :company
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
attr_reader :company
|
|
6
|
+
attr_reader :country_code_alpha2
|
|
7
|
+
attr_reader :country_code_alpha3
|
|
8
|
+
attr_reader :country_code_numeric
|
|
9
|
+
attr_reader :country_name
|
|
10
|
+
attr_reader :created_at
|
|
11
|
+
attr_reader :customer_id
|
|
12
|
+
attr_reader :extended_address
|
|
13
|
+
attr_reader :first_name
|
|
14
|
+
attr_reader :id
|
|
15
|
+
attr_reader :international_phone
|
|
16
|
+
attr_reader :last_name
|
|
17
|
+
attr_reader :locality
|
|
18
|
+
attr_reader :phone_number
|
|
19
|
+
attr_reader :postal_code
|
|
20
|
+
attr_reader :region
|
|
21
|
+
attr_reader :street_address
|
|
22
|
+
attr_reader :updated_at
|
|
9
23
|
|
|
10
|
-
def self.create(
|
|
11
|
-
Configuration.gateway.address.create(
|
|
24
|
+
def self.create(*args)
|
|
25
|
+
Configuration.gateway.address.create(*args)
|
|
12
26
|
end
|
|
13
27
|
|
|
14
|
-
def self.create!(
|
|
15
|
-
|
|
28
|
+
def self.create!(*args)
|
|
29
|
+
Configuration.gateway.address.create!(*args)
|
|
16
30
|
end
|
|
17
31
|
|
|
18
|
-
def self.delete(
|
|
19
|
-
Configuration.gateway.address.delete(
|
|
32
|
+
def self.delete(*args)
|
|
33
|
+
Configuration.gateway.address.delete(*args)
|
|
20
34
|
end
|
|
21
35
|
|
|
22
|
-
def self.find(
|
|
23
|
-
Configuration.gateway.address.find(
|
|
36
|
+
def self.find(*args)
|
|
37
|
+
Configuration.gateway.address.find(*args)
|
|
24
38
|
end
|
|
25
39
|
|
|
26
|
-
def self.update(
|
|
27
|
-
Configuration.gateway.address.update(
|
|
40
|
+
def self.update(*args)
|
|
41
|
+
Configuration.gateway.address.update(*args)
|
|
28
42
|
end
|
|
29
43
|
|
|
30
|
-
def self.update!(
|
|
31
|
-
|
|
44
|
+
def self.update!(*args)
|
|
45
|
+
Configuration.gateway.address.update!(*args)
|
|
32
46
|
end
|
|
33
47
|
|
|
34
|
-
def initialize(gateway, attributes)
|
|
48
|
+
def initialize(gateway, attributes)
|
|
35
49
|
@gateway = gateway
|
|
36
50
|
set_instance_variables_from_hash(attributes)
|
|
37
51
|
end
|
|
38
52
|
|
|
39
|
-
def ==(other)
|
|
53
|
+
def ==(other)
|
|
40
54
|
return false unless other.is_a?(Address)
|
|
41
55
|
id == other.id && customer_id == other.customer_id
|
|
42
56
|
end
|
|
43
57
|
|
|
44
|
-
# Deprecated. Use Braintree::Address.delete
|
|
45
|
-
def delete
|
|
46
|
-
warn "[DEPRECATED] delete as an instance method is deprecated. Please use Address.delete"
|
|
47
|
-
@gateway.address.delete(customer_id, self.id)
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
# Deprecated. Use Braintree::Address.update
|
|
51
|
-
def update(attributes)
|
|
52
|
-
warn "[DEPRECATED] update as an instance method is deprecated. Please use Address.update"
|
|
53
|
-
result = @gateway.address.update(customer_id, id, attributes)
|
|
54
|
-
if result.success?
|
|
55
|
-
copy_instance_variables_from_object result.address
|
|
56
|
-
end
|
|
57
|
-
result
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
# Deprecated. Use Braintree::Address.update!
|
|
61
|
-
def update!(attributes)
|
|
62
|
-
warn "[DEPRECATED] update! as an instance method is deprecated. Please use Address.update!"
|
|
63
|
-
return_object_or_raise(:address) { update(attributes) }
|
|
64
|
-
end
|
|
65
|
-
|
|
66
58
|
class << self
|
|
67
59
|
protected :new
|
|
68
60
|
end
|
|
69
61
|
|
|
70
|
-
def self._new(*args)
|
|
71
|
-
self.new
|
|
62
|
+
def self._new(*args)
|
|
63
|
+
self.new(*args)
|
|
72
64
|
end
|
|
73
65
|
end
|
|
74
66
|
end
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
module Braintree
|
|
2
|
-
class AddressGateway
|
|
2
|
+
class AddressGateway
|
|
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)
|
|
@@ -13,7 +16,7 @@ module Braintree
|
|
|
13
16
|
unless attributes[:customer_id] =~ /\A[0-9A-Za-z_-]+\z/
|
|
14
17
|
raise ArgumentError, ":customer_id contains invalid characters"
|
|
15
18
|
end
|
|
16
|
-
response = @config.http.post
|
|
19
|
+
response = @config.http.post("#{@config.base_merchant_path}/customers/#{attributes.delete(:customer_id)}/addresses", :address => attributes)
|
|
17
20
|
if response[:address]
|
|
18
21
|
SuccessfulResult.new(:address => Address._new(@gateway, response[:address]))
|
|
19
22
|
elsif response[:api_error_response]
|
|
@@ -23,15 +26,20 @@ module Braintree
|
|
|
23
26
|
end
|
|
24
27
|
end
|
|
25
28
|
|
|
29
|
+
def create!(*args)
|
|
30
|
+
return_object_or_raise(:address) { create(*args) }
|
|
31
|
+
end
|
|
32
|
+
|
|
26
33
|
def delete(customer_or_customer_id, address_id)
|
|
27
34
|
customer_id = _determine_customer_id(customer_or_customer_id)
|
|
28
|
-
@config.http.delete("/customers/#{customer_id}/addresses/#{address_id}")
|
|
35
|
+
@config.http.delete("#{@config.base_merchant_path}/customers/#{customer_id}/addresses/#{address_id}")
|
|
29
36
|
SuccessfulResult.new
|
|
30
37
|
end
|
|
31
38
|
|
|
32
39
|
def find(customer_or_customer_id, address_id)
|
|
33
40
|
customer_id = _determine_customer_id(customer_or_customer_id)
|
|
34
|
-
|
|
41
|
+
raise ArgumentError if address_id.nil? || address_id.to_s.strip == ""
|
|
42
|
+
response = @config.http.get("#{@config.base_merchant_path}/customers/#{customer_id}/addresses/#{address_id}")
|
|
35
43
|
Address._new(@gateway, response[:address])
|
|
36
44
|
rescue NotFoundError
|
|
37
45
|
raise NotFoundError, "address for customer #{customer_id.inspect} with id #{address_id.inspect} not found"
|
|
@@ -40,7 +48,7 @@ module Braintree
|
|
|
40
48
|
def update(customer_or_customer_id, address_id, attributes)
|
|
41
49
|
Util.verify_keys(AddressGateway._update_signature, attributes)
|
|
42
50
|
customer_id = _determine_customer_id(customer_or_customer_id)
|
|
43
|
-
response = @config.http.put
|
|
51
|
+
response = @config.http.put("#{@config.base_merchant_path}/customers/#{customer_id}/addresses/#{address_id}", :address => attributes)
|
|
44
52
|
if response[:address]
|
|
45
53
|
SuccessfulResult.new(:address => Address._new(@gateway, response[:address]))
|
|
46
54
|
elsif response[:api_error_response]
|
|
@@ -50,7 +58,11 @@ module Braintree
|
|
|
50
58
|
end
|
|
51
59
|
end
|
|
52
60
|
|
|
53
|
-
def
|
|
61
|
+
def update!(*args)
|
|
62
|
+
return_object_or_raise(:address) { update(*args) }
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def _determine_customer_id(customer_or_customer_id)
|
|
54
66
|
customer_id = customer_or_customer_id.is_a?(Customer) ? customer_or_customer_id.id : customer_or_customer_id
|
|
55
67
|
unless customer_id =~ /\A[\w_-]+\z/
|
|
56
68
|
raise ArgumentError, "customer_id contains invalid characters"
|
|
@@ -58,17 +70,18 @@ module Braintree
|
|
|
58
70
|
customer_id
|
|
59
71
|
end
|
|
60
72
|
|
|
61
|
-
def self._create_signature
|
|
73
|
+
def self._create_signature
|
|
62
74
|
_shared_signature + [:customer_id]
|
|
63
75
|
end
|
|
64
76
|
|
|
65
|
-
def self._shared_signature
|
|
77
|
+
def self._shared_signature
|
|
66
78
|
[:company, :country_code_alpha2, :country_code_alpha3, :country_code_numeric,
|
|
67
|
-
|
|
68
|
-
|
|
79
|
+
:country_name, :extended_address, :first_name,
|
|
80
|
+
{:international_phone => [:country_code, :national_number]},
|
|
81
|
+
:last_name, :locality, :phone_number, :postal_code, :region, :street_address]
|
|
69
82
|
end
|
|
70
83
|
|
|
71
|
-
def self._update_signature
|
|
84
|
+
def self._update_signature
|
|
72
85
|
_create_signature
|
|
73
86
|
end
|
|
74
87
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module Braintree
|
|
2
|
-
class AdvancedSearch
|
|
3
|
-
class SearchNode
|
|
2
|
+
class AdvancedSearch
|
|
3
|
+
class SearchNode
|
|
4
4
|
def self.operators(*operator_names)
|
|
5
5
|
operator_names.each do |operator|
|
|
6
6
|
define_method(operator) do |value|
|
|
@@ -14,25 +14,29 @@ module Braintree
|
|
|
14
14
|
end
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
class
|
|
18
|
-
operators :is
|
|
17
|
+
class IsNode < SearchNode
|
|
18
|
+
operators :is
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
class EqualityNode < IsNode
|
|
22
|
+
operators :is_not
|
|
19
23
|
end
|
|
20
24
|
|
|
21
|
-
class PartialMatchNode < EqualityNode
|
|
25
|
+
class PartialMatchNode < EqualityNode
|
|
22
26
|
operators :ends_with, :starts_with
|
|
23
27
|
end
|
|
24
28
|
|
|
25
|
-
class TextNode < PartialMatchNode
|
|
29
|
+
class TextNode < PartialMatchNode
|
|
26
30
|
operators :contains
|
|
27
31
|
end
|
|
28
32
|
|
|
29
|
-
class KeyValueNode < SearchNode
|
|
33
|
+
class KeyValueNode < SearchNode
|
|
30
34
|
def is(value)
|
|
31
35
|
@parent.add_criteria(@node_name, value)
|
|
32
36
|
end
|
|
33
37
|
end
|
|
34
38
|
|
|
35
|
-
class MultipleValueNode < SearchNode
|
|
39
|
+
class MultipleValueNode < SearchNode
|
|
36
40
|
def in(*values)
|
|
37
41
|
values.flatten!
|
|
38
42
|
|
|
@@ -58,6 +62,10 @@ module Braintree
|
|
|
58
62
|
end
|
|
59
63
|
end
|
|
60
64
|
|
|
65
|
+
class EndsWithNode < SearchNode
|
|
66
|
+
operators :ends_with
|
|
67
|
+
end
|
|
68
|
+
|
|
61
69
|
class MultipleValueOrTextNode < MultipleValueNode
|
|
62
70
|
extend Forwardable
|
|
63
71
|
def_delegators :@text_node, :contains, :ends_with, :is, :is_not, :starts_with
|
|
@@ -68,12 +76,11 @@ module Braintree
|
|
|
68
76
|
end
|
|
69
77
|
end
|
|
70
78
|
|
|
71
|
-
class RangeNode < SearchNode
|
|
79
|
+
class RangeNode < SearchNode
|
|
72
80
|
operators :is
|
|
73
81
|
|
|
74
82
|
def between(min, max)
|
|
75
|
-
self >= min
|
|
76
|
-
self <= max
|
|
83
|
+
self >= min && self <= max
|
|
77
84
|
end
|
|
78
85
|
|
|
79
86
|
def >=(min)
|
|
@@ -93,6 +100,10 @@ module Braintree
|
|
|
93
100
|
_create_field_accessors(fields, EqualityNode)
|
|
94
101
|
end
|
|
95
102
|
|
|
103
|
+
def self.is_fields(*fields)
|
|
104
|
+
_create_field_accessors(fields, IsNode)
|
|
105
|
+
end
|
|
106
|
+
|
|
96
107
|
def self.partial_match_fields(*fields)
|
|
97
108
|
_create_field_accessors(fields, PartialMatchNode)
|
|
98
109
|
end
|
|
@@ -121,6 +132,10 @@ module Braintree
|
|
|
121
132
|
_create_field_accessors(fields, DateRangeNode)
|
|
122
133
|
end
|
|
123
134
|
|
|
135
|
+
def self.ends_with_fields(*fields)
|
|
136
|
+
_create_field_accessors(fields, EndsWithNode)
|
|
137
|
+
end
|
|
138
|
+
|
|
124
139
|
def self._create_field_accessors(fields, node_class)
|
|
125
140
|
fields.each do |field|
|
|
126
141
|
define_method(field) do |*args|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module Braintree
|
|
2
|
+
class ApplePay
|
|
3
|
+
include BaseModule
|
|
4
|
+
|
|
5
|
+
def initialize(gateway, attributes)
|
|
6
|
+
set_instance_variables_from_hash(attributes)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
class << self
|
|
10
|
+
protected :new
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self._new(*args)
|
|
14
|
+
self.new(*args)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def self.register_domain(domain)
|
|
18
|
+
Configuration.gateway.apple_pay.register_domain(domain)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def self.unregister_domain(domain)
|
|
22
|
+
Configuration.gateway.apple_pay.unregister_domain(domain)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def self.registered_domains
|
|
26
|
+
Configuration.gateway.apple_pay.registered_domains
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
module Braintree
|
|
2
|
+
class ApplePayCard
|
|
3
|
+
include BaseModule
|
|
4
|
+
|
|
5
|
+
module CardType
|
|
6
|
+
AmEx = "Apple Pay - American Express"
|
|
7
|
+
Visa = "Apple Pay - Visa"
|
|
8
|
+
MasterCard = "Apple Pay - MasterCard"
|
|
9
|
+
|
|
10
|
+
All = constants.map { |c| const_get(c) }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
attr_reader :billing_address
|
|
14
|
+
attr_reader :bin
|
|
15
|
+
attr_reader :card_type
|
|
16
|
+
attr_reader :cardholder_name
|
|
17
|
+
attr_reader :commercial
|
|
18
|
+
attr_reader :country_of_issuance
|
|
19
|
+
attr_reader :created_at
|
|
20
|
+
attr_reader :customer_id
|
|
21
|
+
attr_reader :debit
|
|
22
|
+
attr_reader :default
|
|
23
|
+
attr_reader :durbin_regulated
|
|
24
|
+
attr_reader :expiration_month
|
|
25
|
+
attr_reader :expiration_year
|
|
26
|
+
attr_reader :expired
|
|
27
|
+
attr_reader :healthcare
|
|
28
|
+
attr_reader :image_url
|
|
29
|
+
attr_reader :issuing_bank
|
|
30
|
+
attr_reader :last_4
|
|
31
|
+
attr_reader :merchant_token_identifier
|
|
32
|
+
attr_reader :payment_instrument_name
|
|
33
|
+
attr_reader :payroll
|
|
34
|
+
attr_reader :prepaid
|
|
35
|
+
attr_reader :prepaid_reloadable
|
|
36
|
+
attr_reader :product_id
|
|
37
|
+
attr_reader :source_card_last4
|
|
38
|
+
attr_reader :source_description
|
|
39
|
+
attr_reader :subscriptions
|
|
40
|
+
attr_reader :token
|
|
41
|
+
attr_reader :updated_at
|
|
42
|
+
|
|
43
|
+
def initialize(gateway, attributes)
|
|
44
|
+
@gateway = gateway
|
|
45
|
+
set_instance_variables_from_hash(attributes)
|
|
46
|
+
@billing_address = attributes[:billing_address] ? Address._new(@gateway, attributes[:billing_address]) : nil
|
|
47
|
+
@subscriptions = (@subscriptions || []).map { |subscription_hash| Subscription._new(@gateway, subscription_hash) }
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def default?
|
|
51
|
+
@default
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def expired?
|
|
55
|
+
@expired
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
class << self
|
|
59
|
+
protected :new
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def self._new(*args)
|
|
63
|
+
self.new(*args)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module Braintree
|
|
2
|
+
class ApplePayGateway
|
|
3
|
+
def initialize(gateway)
|
|
4
|
+
@gateway = gateway
|
|
5
|
+
@config = gateway.config
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def register_domain(domain)
|
|
9
|
+
response = @config.http.post("#{@config.base_merchant_path}/processing/apple_pay/validate_domains", :url => domain)
|
|
10
|
+
|
|
11
|
+
if response.has_key?(:response) && response[:response][:success]
|
|
12
|
+
Braintree::SuccessfulResult.new
|
|
13
|
+
elsif response[:api_error_response]
|
|
14
|
+
ErrorResult.new(@gateway, response[:api_error_response])
|
|
15
|
+
else
|
|
16
|
+
raise "expected :response or :api_error_response"
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def unregister_domain(domain)
|
|
21
|
+
@config.http.delete("#{@config.base_merchant_path}/processing/apple_pay/unregister_domain", :url => CGI.escape(domain))
|
|
22
|
+
SuccessfulResult.new
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def registered_domains
|
|
26
|
+
response = @config.http.get("#{@config.base_merchant_path}/processing/apple_pay/registered_domains")
|
|
27
|
+
|
|
28
|
+
if response.has_key?(:response)
|
|
29
|
+
Braintree::SuccessfulResult.new(:apple_pay_options => ApplePayOptions._new(response[:response]))
|
|
30
|
+
elsif response[:api_error_response]
|
|
31
|
+
ErrorResult.new(@gateway, response[:api_error_response])
|
|
32
|
+
else
|
|
33
|
+
raise "expected :response or :api_error_response"
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module Braintree
|
|
2
|
+
class ApplePayOptions
|
|
3
|
+
include BaseModule
|
|
4
|
+
|
|
5
|
+
attr_reader :domains
|
|
6
|
+
|
|
7
|
+
def initialize(attributes)
|
|
8
|
+
set_instance_variables_from_hash(attributes)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
class << self
|
|
12
|
+
protected :new
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self._new(*args)
|
|
16
|
+
self.new(*args)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Braintree
|
|
2
|
+
class AuthorizationAdjustment
|
|
3
|
+
include BaseModule
|
|
4
|
+
|
|
5
|
+
attr_reader :amount
|
|
6
|
+
attr_reader :success
|
|
7
|
+
attr_reader :timestamp
|
|
8
|
+
attr_reader :processor_response_code
|
|
9
|
+
attr_reader :processor_response_text
|
|
10
|
+
attr_reader :processor_response_type
|
|
11
|
+
|
|
12
|
+
class << self
|
|
13
|
+
protected :new
|
|
14
|
+
def _new(*args)
|
|
15
|
+
self.new(*args)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def initialize(attributes)
|
|
20
|
+
set_instance_variables_from_hash(attributes)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module Braintree
|
|
2
|
-
module BaseModule
|
|
2
|
+
module BaseModule
|
|
3
3
|
module Methods
|
|
4
4
|
def return_object_or_raise(object_to_return)
|
|
5
5
|
result = yield
|
|
@@ -18,6 +18,16 @@ module Braintree
|
|
|
18
18
|
|
|
19
19
|
def set_instance_variables_from_hash(hash)
|
|
20
20
|
hash.each do |key, value|
|
|
21
|
+
if key == :global_id
|
|
22
|
+
instance_variable_set "@graphql_id", value
|
|
23
|
+
elsif key == :android_pay_cards
|
|
24
|
+
instance_variable_set "@google_pay_cards", value
|
|
25
|
+
elsif key == :android_pay_card
|
|
26
|
+
instance_variable_set "@google_pay_card", value
|
|
27
|
+
elsif key == :android_pay_details
|
|
28
|
+
instance_variable_set "@google_pay_details", value
|
|
29
|
+
end
|
|
30
|
+
|
|
21
31
|
instance_variable_set "@#{key}", value
|
|
22
32
|
end
|
|
23
33
|
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
module Braintree
|
|
2
|
+
class BinData
|
|
3
|
+
include BaseModule
|
|
4
|
+
|
|
5
|
+
attr_reader :commercial
|
|
6
|
+
attr_reader :country_of_issuance
|
|
7
|
+
attr_reader :debit
|
|
8
|
+
attr_reader :durbin_regulated
|
|
9
|
+
attr_reader :healthcare
|
|
10
|
+
attr_reader :issuing_bank
|
|
11
|
+
attr_reader :payroll
|
|
12
|
+
attr_reader :prepaid
|
|
13
|
+
attr_reader :prepaid_reloadable
|
|
14
|
+
attr_reader :product_id
|
|
15
|
+
|
|
16
|
+
def initialize(attributes)
|
|
17
|
+
set_instance_variables_from_hash attributes unless attributes.nil?
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def inspect
|
|
21
|
+
formatted_attributes = self.class._attributes.map do |attr|
|
|
22
|
+
"#{attr}: #{send(attr).inspect}"
|
|
23
|
+
end
|
|
24
|
+
"#<#{self.class} #{formatted_attributes.join(", ")}>"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def self._attributes
|
|
28
|
+
[
|
|
29
|
+
:commercial, :country_of_issuance, :debit, :durbin_regulated, :healthcare,
|
|
30
|
+
:issuing_bank, :payroll, :prepaid, :prepaid_reloadable, :product_id
|
|
31
|
+
]
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|