balanced / balanced-ruby

Balanced API library in ruby.
MIT License
111 stars 47 forks source link

The example on the Balanced homepage is broken #39

Closed mjallday closed 11 years ago

mjallday commented 12 years ago

Example fails tokenizing card:

require 'balanced'

# create a test marketplace
api_key = Balanced::ApiKey.new.save
Balanced.configure(api_key.secret)
marketplace = Balanced::Marketplace.new.save

# charge $100.00 on a card
buyer = Balanced::Account.new(
  :email_address => "ekant@example.com",
  :card => {
    :card_number => "4111 1111 1111 1111",
    :expiration_month => 12,
    :expiration_year => 2014
  }
).save

Error message:

Balanced::Conflict: Balanced::Conflict(409)::Conflict:: POST https://api.balancedpayments.com/v1/marketplaces/TEST-MP6v3vA90ItsYTBehUxDtchV/accounts: card-not-validated: Card cannot be validated. Your request id is OHMd6f29340029a11e294aa026ba7c1aba6. 
    from /Users/marshall/.rvm/gems/ruby-1.9.3-p194/gems/balanced-0.3.9/lib/balanced/response/balanced_exception_middleware.rb:28:in `on_complete'
    from /Users/marshall/.rvm/gems/ruby-1.9.3-p194/gems/faraday-0.8.1/lib/faraday/response.rb:9:in `block in call'
    from /Users/marshall/.rvm/gems/ruby-1.9.3-p194/gems/faraday-0.8.1/lib/faraday/response.rb:63:in `on_complete'
    from /Users/marshall/.rvm/gems/ruby-1.9.3-p194/gems/faraday-0.8.1/lib/faraday/response.rb:8:in `call'
    from /Users/marshall/.rvm/gems/ruby-1.9.3-p194/gems/faraday-0.8.1/lib/faraday/response.rb:8:in `call'
    from /Users/marshall/.rvm/gems/ruby-1.9.3-p194/gems/faraday-0.8.1/lib/faraday/response/logger.rb:20:in `call'
    from /Users/marshall/.rvm/gems/ruby-1.9.3-p194/gems/faraday_middleware-0.8.8/lib/faraday_middleware/request/encode_json.rb:23:in `call'
    from /Users/marshall/.rvm/gems/ruby-1.9.3-p194/gems/faraday-0.8.1/lib/faraday/connection.rb:226:in `run_request'
    from /Users/marshall/.rvm/gems/ruby-1.9.3-p194/gems/faraday-0.8.1/lib/faraday/connection.rb:99:in `post'
    from /Users/marshall/.rvm/gems/ruby-1.9.3-p194/gems/balanced-0.3.9/lib/balanced/client.rb:62:in `method_missing'
    from /Users/marshall/.rvm/gems/ruby-1.9.3-p194/gems/balanced-0.3.9/lib/balanced.rb:70:in `post'
    from /Users/marshall/.rvm/gems/ruby-1.9.3-p194/gems/balanced-0.3.9/lib/balanced/resources/resource.rb:26:in `save'
    from (irb):9
    from /Users/marshall/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `<main>'
1.9.3p194 :017 > 
mahmoudimus commented 11 years ago

Homepage is not the same anymore :)