Sha256: ba60ab86a4158b42eeb308912b4d00d4717b212f3a5b032c4bb0f8c2e7bd0158

Contents?: true

Size: 1.99 KB

Versions: 29

Compression:

Stored size: 1.99 KB

Contents

require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")

describe Braintree::ApplePayGateway do
  before(:each) do
    gateway = Braintree::Gateway.new(
      :client_id => "client_id$#{Braintree::Configuration.environment}$integration_client_id",
      :client_secret => "client_secret$#{Braintree::Configuration.environment}$integration_client_secret",
      :logger => Logger.new("/dev/null")
    )

    result = gateway.merchant.create(
      :email => "name@email.com",
      :country_code_alpha3 => "USA",
      :payment_methods => ["credit_card", "paypal"]
    )

    @gateway = Braintree::Gateway.new(
      :access_token => result.credentials.access_token,
      :logger => Logger.new("/dev/null")
    )
  end

  describe "register_domain" do
    it "registers an apple pay domain" do
      result = @gateway.apple_pay.register_domain("www.example.com")
      result.should be_success
    end

    it "gets a validation error when attempting to register no domains" do
      result = @gateway.apple_pay.register_domain("")
      result.should_not be_success
      result.errors.for(:apple_pay)[0].message.should eq("Domain name is required.")
    end
  end

  describe "unregister_domain" do
    it "unregisters an apple pay domain" do
      domain = "example.org"
      result = @gateway.apple_pay.unregister_domain(domain)
      result.should be_success
    end

    it "unregisters an apple pay domain with scheme in url" do
      domain = "http://example.org"
      result = @gateway.apple_pay.unregister_domain(domain)
      result.should be_success
    end

    it "escapes the unregistered domain query parameter" do
      domain = "ex&mple.org"
      result = @gateway.apple_pay.unregister_domain(domain)
      result.should be_success
    end
  end

  describe "registered_domains" do
    it "returns stubbed registered domains" do
      result = @gateway.apple_pay.registered_domains
      result.should be_success
      result.apple_pay_options.domains.should == ["www.example.com"]
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
braintree-3.3.0 spec/integration/braintree/apple_pay_spec.rb
braintree-3.2.0 spec/integration/braintree/apple_pay_spec.rb
braintree-3.1.0 spec/integration/braintree/apple_pay_spec.rb
braintree-3.0.1 spec/integration/braintree/apple_pay_spec.rb
braintree-2.104.1 spec/integration/braintree/apple_pay_spec.rb
braintree-2.104.0 spec/integration/braintree/apple_pay_spec.rb
braintree-2.103.0 spec/integration/braintree/apple_pay_spec.rb
braintree-2.102.0 spec/integration/braintree/apple_pay_spec.rb
braintree-2.101.0 spec/integration/braintree/apple_pay_spec.rb
braintree-2.100.0 spec/integration/braintree/apple_pay_spec.rb
braintree-2.99.0 spec/integration/braintree/apple_pay_spec.rb
braintree-2.98.0 spec/integration/braintree/apple_pay_spec.rb
braintree-2.97.0 spec/integration/braintree/apple_pay_spec.rb
braintree-2.96.0 spec/integration/braintree/apple_pay_spec.rb
braintree-2.95.0 spec/integration/braintree/apple_pay_spec.rb
braintree-2.94.0 spec/integration/braintree/apple_pay_spec.rb
braintree-2.93.0 spec/integration/braintree/apple_pay_spec.rb
braintree-2.92.0 spec/integration/braintree/apple_pay_spec.rb
braintree-2.91.0 spec/integration/braintree/apple_pay_spec.rb
braintree-2.90.0 spec/integration/braintree/apple_pay_spec.rb