Class: Braintree::TransparentRedirectGateway

### Home Classes Methods

### In Files

- lib/braintree/transparent_redirect_gateway.rb

### Parent

Object

### Methods

- ::new
- #confirm
- #create_credit_card_data
- #create_customer_data
- #transaction_data
- #update_credit_card_data
- #update_customer_data
- #url

### Class/Module Index

Quicksearch

- Braintree
- Braintree::AddOn
- Braintree::AddOnGateway
- Braintree::Address
- Braintree::AddressGateway
- Braintree::AdvancedSearch
- Braintree::AdvancedSearch::MultipleValueOrTextNode
- Braintree::AuthenticationError
- Braintree::AuthorizationError
- Braintree::BraintreeError
- Braintree::Configuration
- Braintree::ConfigurationError
- Braintree::CreditCard
- Braintree::CreditCard::CardType
- Braintree::CreditCard::CustomerLocation
- Braintree::CreditCardVerification
- Braintree::CreditCardVerification::Status
- Braintree::Customer
- Braintree::Discount
- Braintree::DiscountGateway
- Braintree::DownForMaintenanceError
- Braintree::ErrorCodes
- Braintree::ErrorCodes::Address
- Braintree::ErrorCodes::CreditCard
- Braintree::ErrorCodes::CreditCard::Options
- Braintree::ErrorCodes::Customer
- Braintree::ErrorCodes::Descriptor
- Braintree::ErrorCodes::SettlementBatchSummary
- Braintree::ErrorCodes::Subscription
- Braintree::ErrorCodes::Subscription::Modification
- Braintree::ErrorCodes::Transaction
- Braintree::ErrorCodes::Transaction::Options
- Braintree::ErrorResult
- Braintree::Errors
- Braintree::ForgedQueryString
- Braintree::NotFoundError
- Braintree::Plan
- Braintree::SSLCertificateError
- Braintree::ServerError
- Braintree::SettlementBatchSummary
- Braintree::SettlementBatchSummaryGateway
- Braintree::Subscription
- Braintree::Subscription::Status
- Braintree::Subscription::TrialDurationUnit
- Braintree::SuccessfulResult
- Braintree::Test
- Braintree::Test::CreditCardNumbers
- Braintree::Test::CreditCardNumbers::FailsSandboxVerification
- Braintree::Test::TransactionAmounts
- Braintree::Transaction
- Braintree::Transaction::CreatedUsing
- Braintree::Transaction::GatewayRejectionReason
- Braintree::Transaction::Source
- Braintree::Transaction::Status
- Braintree::TransparentRedirect
- Braintree::TransparentRedirectGateway
- Braintree::UnexpectedError
- Braintree::UpgradeRequiredError
- Braintree::ValidationError
- Braintree::ValidationErrorCollection
- Braintree::ValidationsFailed
- Braintree::Version

No matching classes.

# Braintree::TransparentRedirectGateway

### Public Class Methods

new(gateway) click to toggle source

    # File lib/braintree/transparent_redirect_gateway.rb, line 10
    def initialize(gateway)
      @gateway = gateway
      @config = gateway.config
    end

### Public Instance Methods

confirm(query_string) click to toggle source

    # File lib/braintree/transparent_redirect_gateway.rb, line 15
    def confirm(query_string)
      params = @gateway.transparent_redirect.parse_and_validate_query_string query_string
      confirmation_gateway = {
        TransparentRedirect::Kind::CreateCustomer => :customer,
        TransparentRedirect::Kind::UpdateCustomer => :customer,
        TransparentRedirect::Kind::CreatePaymentMethod => :credit_card,
        TransparentRedirect::Kind::UpdatePaymentMethod => :credit_card,
        TransparentRedirect::Kind::CreateTransaction => :transaction
      }[params[:kind]]

      @gateway.send(confirmation_gateway)._do_create("/transparent_redirect_requests/#{params[:id]}/confirm")
    end

create_credit_card_data(params) click to toggle source

    # File lib/braintree/transparent_redirect_gateway.rb, line 28
    def create_credit_card_data(params)
      Util.verify_keys(CreateCreditCardSignature, params)
      params[:kind] = TransparentRedirect::Kind::CreatePaymentMethod
      _data(params)
    end

create_customer_data(params) click to toggle source

    # File lib/braintree/transparent_redirect_gateway.rb, line 34
    def create_customer_data(params)
      Util.verify_keys(CreateCustomerSignature, params)
      params[:kind] = TransparentRedirect::Kind::CreateCustomer
      _data(params)
    end

transaction_data(params) click to toggle source

    # File lib/braintree/transparent_redirect_gateway.rb, line 57
    def transaction_data(params)
      Util.verify_keys(TransactionSignature, params)
      params[:kind] = TransparentRedirect::Kind::CreateTransaction
      transaction_type = params[:transaction] && params[:transaction][:type]
      unless ]sale credit].include?(transaction_type)
        raise ArgumentError, "expected transaction[type] of sale or credit, was: #{transaction_type.inspect}"
      end
      _data(params)
    end

update_credit_card_data(params) click to toggle source

    # File lib/braintree/transparent_redirect_gateway.rb, line 67
    def update_credit_card_data(params)
      Util.verify_keys(UpdateCreditCardSignature, params)
      unless params[:payment_method_token]
        raise ArgumentError, "expected params to contain :payment_method_token of payment method to update"
      end
      params[:kind] = TransparentRedirect::Kind::UpdatePaymentMethod
      _data(params)
    end

update_customer_data(params) click to toggle source

    # File lib/braintree/transparent_redirect_gateway.rb, line 76
    def update_customer_data(params)
      Util.verify_keys(UpdateCustomerSignature, params)
      unless params[:customer_id]
        raise ArgumentError, "expected params to contain :customer_id of customer to update"
      end
      params[:kind] = TransparentRedirect::Kind::UpdateCustomer
      _data(params)
    end

url() click to toggle source

    # File lib/braintree/transparent_redirect_gateway.rb, line 85
    def url
      "#{@config.base_merchant_url}/transparent_redirect_requests"
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.