Advertisement
Guest User

Chargify API Payment Profile Updates

a guest
Nov 24th, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.19 KB | None | 0 0
  1. params = {
  2.   "new_address1" => "123 vavavoom",
  3.   "new_address2" => "",
  4.   "new_city" => "New York City",
  5.   "new_province" => "NY",
  6.   "new_zip" => "12101",
  7.   "new_country" => "US"
  8. }
  9. sub = Chargify::Subscription.find(7044248)
  10. old_pp = sub.payment_profile
  11.  
  12. update_attributes = {}
  13. update_attributes["id"] = old_pp.id
  14. update_attributes["billing_address"] = params["new_address1"]
  15. update_attributes["billing_address_2"] = params["new_address2"]
  16. update_attributes["billing_city"] = params["new_city"]
  17. update_attributes["billing_state"] = params["new_province"]
  18. update_attributes["billing_zip"] = params["new_zip"]
  19. update_attributes["billing_country"] = params["new_country"]
  20.  
  21. updated_chargify_payment_profile = Chargify::PaymentProfile.new(update_attributes)
  22. result_of_save_of_billing_address = updated_chargify_payment_profile.save
  23.  
  24.  
  25.  
  26. got this:
  27.  
  28.  
  29. ActiveResource::ResourceNotFound: Failed.  Response code = 404.  Response message = Not Found.
  30.     from /mnt/chargify_accounts-production/shared/bundle/ruby/1.9.1/gems/activeresource-3.2.11/lib/active_resource/connection.rb:136:in `handle_response'
  31.     from /mnt/chargify_accounts-production/shared/bundle/ruby/1.9.1/gems/shopify_api-3.2.1/lib/active_resource/connection_ext.rb:9:in `handle_response_with_response_capture'
  32.     from /mnt/chargify_accounts-production/shared/bundle/ruby/1.9.1/gems/activeresource-3.2.11/lib/active_resource/connection.rb:115:in `request'
  33.     from /mnt/chargify_accounts-production/shared/bundle/ruby/1.9.1/gems/shopify_api-3.2.1/lib/active_resource/connection_ext.rb:13:in `request_with_detailed_log_subscriber'
  34.     from /mnt/chargify_accounts-production/shared/bundle/ruby/1.9.1/gems/activeresource-3.2.11/lib/active_resource/connection.rb:98:in `block in post'
  35.     from /mnt/chargify_accounts-production/shared/bundle/ruby/1.9.1/gems/activeresource-3.2.11/lib/active_resource/connection.rb:218:in `with_auth'
  36.     from /mnt/chargify_accounts-production/shared/bundle/ruby/1.9.1/gems/activeresource-3.2.11/lib/active_resource/connection.rb:98:in `post'
  37.     from /mnt/chargify_accounts-production/shared/bundle/ruby/1.9.1/gems/activeresource-3.2.11/lib/active_resource/base.rb:1360:in `create'
  38.     from /mnt/chargify_accounts-production/shared/bundle/ruby/1.9.1/gems/activeresource-3.2.11/lib/active_resource/observing.rb:19:in `create_with_notifications'
  39.     from /mnt/chargify_accounts-production/shared/bundle/ruby/1.9.1/gems/activeresource-3.2.11/lib/active_resource/base.rb:1155:in `save'
  40.     from /mnt/chargify_accounts-production/shared/bundle/ruby/1.9.1/gems/activeresource-3.2.11/lib/active_resource/validations.rb:79:in `save_with_validation'
  41.     from /mnt/chargify_accounts-production/shared/bundle/ruby/1.9.1/gems/activeresource-3.2.11/lib/active_resource/observing.rb:19:in `save_with_notifications'
  42.     from (irb):47
  43.     from /mnt/chargify_accounts-production/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/commands/console.rb:47:in `start'
  44.     from /mnt/chargify_accounts-production/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/commands/console.rb:8:in `start'
  45.     from /mnt/chargify_accounts-production/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/commands.rb:41:in `<top (required)>'
  46.     from script/rails:6:in `require'
  47.     from script/rails:6:in `<main>'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement