Sha256: 83cc7ae76f430ec58d78e09bd4f059396a1d13fffe3dbf44d96e638449e513e9

Contents?: true

Size: 1.24 KB

Versions: 61

Compression:

Stored size: 1.24 KB

Contents

module Braintree
  class ApplePayGateway
    def initialize(gateway)
      @gateway = gateway
      @config = gateway.config
    end

    def register_domain(domain)
      response = @config.http.post("#{@config.base_merchant_path}/processing/apple_pay/validate_domains", :url => domain)

      if response.has_key?(:response) && response[:response][:success]
        Braintree::SuccessfulResult.new
      elsif response[:api_error_response]
        ErrorResult.new(@gateway, response[:api_error_response])
      else
        raise "expected :response or :api_error_response"
      end
    end

    def unregister_domain(domain)
      @config.http.delete("#{@config.base_merchant_path}/processing/apple_pay/unregister_domain", :url => CGI.escape(domain))
      SuccessfulResult.new
    end

    def registered_domains
      response = @config.http.get("#{@config.base_merchant_path}/processing/apple_pay/registered_domains")

      if response.has_key?(:response)
        Braintree::SuccessfulResult.new(:apple_pay_options => ApplePayOptions._new(response[:response]))
      elsif response[:api_error_response]
        ErrorResult.new(@gateway, response[:api_error_response])
      else
        raise "expected :response or :api_error_response"
      end
    end
  end
end

Version data entries

61 entries across 61 versions & 1 rubygems

Version Path
braintree-4.25.0 lib/braintree/apple_pay_gateway.rb
braintree-4.24.0 lib/braintree/apple_pay_gateway.rb
braintree-4.23.0 lib/braintree/apple_pay_gateway.rb
braintree-4.22.0 lib/braintree/apple_pay_gateway.rb
braintree-4.21.0 lib/braintree/apple_pay_gateway.rb
braintree-4.20.0 lib/braintree/apple_pay_gateway.rb
braintree-4.19.0 lib/braintree/apple_pay_gateway.rb
braintree-4.18.0 lib/braintree/apple_pay_gateway.rb
braintree-4.17.0 lib/braintree/apple_pay_gateway.rb
braintree-4.16.0 lib/braintree/apple_pay_gateway.rb
braintree-4.15.0 lib/braintree/apple_pay_gateway.rb
braintree-4.14.0 lib/braintree/apple_pay_gateway.rb
braintree-4.13.0 lib/braintree/apple_pay_gateway.rb
braintree-4.12.0 lib/braintree/apple_pay_gateway.rb
braintree-4.11.0 lib/braintree/apple_pay_gateway.rb
braintree-4.10.0 lib/braintree/apple_pay_gateway.rb
braintree-4.9.0 lib/braintree/apple_pay_gateway.rb
braintree-4.8.0 lib/braintree/apple_pay_gateway.rb
braintree-4.7.0 lib/braintree/apple_pay_gateway.rb
braintree-4.6.0 lib/braintree/apple_pay_gateway.rb