Giter Club home page Giter Club logo

chargify_api_ares's People

Contributors

aeden avatar alexisraca avatar benhoskings avatar blakeprudhomme avatar brandoncc avatar caffo avatar cmoel avatar davidcole avatar denisahearn avatar dharmamike avatar douglasr avatar drewblas avatar gmcintire avatar hoblin avatar jacegu avatar jeremywrowe avatar jsmestad avatar lscoates avatar moklett avatar mwhagedorn avatar nickhammond avatar npverni avatar russolsen avatar ryansch avatar scotchi avatar shayfrendt avatar speric avatar staugaard avatar wsmoak avatar ysiadf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chargify_api_ares's Issues

Deleting Chargify::Subscription::PaymentProfile

Hi,

I am unable to delete a Payment Profile, without deleting the subscription. The use-case is to remove the users card on file.

sub = Chargify::Subscription.find_by_customer_reference("test") 
sub.payment_profile.destroy
=> DELETE https://<subdomain>.chargify.com:443/payment_profiles/<PP_id>.xml
   --> 404 Not Found 2916 (511.4ms)

Also, this fails too:

Chargify::PaymentProfile.find(sub.payment_profile.id).destroy
=> GET https://<subdomain>.chargify.com:443/payment_profiles/<PP_id>.xml
   --> 200 OK 770 (430.2ms)
   DELETE https://<subdomain>.chargify.com:443/payment_profiles/<PP_id>.xml
   --> 404 Not Found 2916 (432.8ms)

I think, the path for delete is wrong and should be:

https://<subdomain>.chargify.com:443/subscriptions/<sub_id>/payment_profiles/<PP_id>.xml

Metered Components example doesn't seem to work

Trying to do something like:

Chargify::Usage.create(:subscription_id => 9214234, :component_id => 102454, :quantity => 2)

and it returns:

ActiveResource::ResourceNotFound: Failed. Response code = 404. Response message = Not Found.

did something change with this endpoint?

Error Reason

How to see Error reason, when calling charge method.

I get following error.

ActiveResource::ResourceInvalid: Failed with 422 status code 422

when I do this

Chargify::Subscription.find(current_user.chargify_subscription_id).charge(:amount_in_cents => 10, :memo => 'Dry Cleaning Service')

I need to see what was the reason that charge is rejected, I know the code is saying some kind a error, but I need to know the reason, for example. credit card is inactive, credit card is invalid, credit card is blocked or any other message, but I need to know the reason instead of code.

As 422 code have multiple reasons. thanks.

fail to create Chargify::Product

Hi everyone, I test create it in console :
Chargify::Product.create("expiration_interval_unit"=>"never", "handle"=>"buzzflock-subscription","interval"=>1, "interval_unit"=>"month", "name"=>"Buzzflock Subscription111111", "price_in_cents"=>0, "request_credit_card"=>true, "require_credit_card"=>true, "return_params"=>"product_id={product_id}&customer_reference={customer_reference}&subscription_id={subscription_id}", "return_url"=>"http://buzzflock.heroku.com/customers/register", "trial_interval"=>1, "trial_interval_unit"=>"month", "trial_price_in_cents"=>0, "update_return_url"=>"http://buzzflock.heroku.com/customers/register_update", "product_family"=> Chargify::ProductFamily.last)
I have this:

    from /home/wf04/.rvm/gems/ruby-1.9.2-p290/gems/activeresource-3.0.7/lib/active_resource/connection.rb:133:in`handle_response'
    from /home/wf04/.rvm/gems/ruby-1.9.2-p290/gems/activeresource-3.0.7/lib/active_resource/connection.rb:114:in `request'
    from /home/wf04/.rvm/gems/ruby-1.9.2-p290/gems/activeresource-3.0.7/lib/active_resource/connection.rb:97:in`block in post'
    from /home/wf04/.rvm/gems/ruby-1.9.2-p290/gems/activeresource-3.0.7/lib/active_resource/connection.rb:217:in `with_auth'
    from /home/wf04/.rvm/gems/ruby-1.9.2-p290/gems/activeresource-3.0.7/lib/active_resource/connection.rb:97:in`post'
    from /home/wf04/.rvm/gems/ruby-1.9.2-p290/gems/chargify_api_ares-0.5.1/lib/chargify_api_ares/resources/product.rb:19:in `create'
    from /home/wf04/.rvm/gems/ruby-1.9.2-p290/gems/activeresource-3.0.7/lib/active_resource/base.rb:1117:in`save'
    from /home/wf04/.rvm/gems/ruby-1.9.2-p290/gems/activeresource-3.0.7/lib/active_resource/validations.rb:87:in `save_with_validation'
    from /home/wf04/.rvm/gems/ruby-1.9.2-p290/gems/activeresource-3.0.7/lib/active_resource/observing.rb:11:in`save_with_notifications'
    from (irb):113
    from /home/wf04/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/commands/console.rb:44:in `start'
    from /home/wf04/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/commands/console.rb:8:in`start'
    from /home/wf04/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/commands.rb:23:in `<top (required)>'
    from script/rails:6:in`require'
    from script/rails:6:in `<main>'

instruct me how to create a Chargify::Product , I need it to build test data for Chargify::Subcription

Customer#payment_profiles doesn't work

customer = Chargify::Customer.last
customer.payment_profiles

This returns all the payment profiles for the site, rather then the selected customers payment profiles because it Customer#payment_profiles is sending params that are not recognized by the API (specifically, :customer_id => self.customer_id)

change product

I want to be able to change the product of a subscription (not an upgrade/downgrade, but a change product with no migration). This doesn't seem to be working. For example:

subscription.product = p2
subscription.save
(doesn't return an error but has no effect)

subscription.product.id = p2.id
subscription.save
(doesn't return an error but has no effect)

I saw another issue where it said to do:

subscription.product_id = p2.id

but subscription.product_id is not present

Let me know.

Thanks,

Ben

@subscription.reactivate returning object instead of True/False

Problem: A call to @susbcription.reactivate has stopped returning true/false but instead is returning the subscription itself.

Steps to reproduce: Try reactivating a cancelled subscription with the bogus card 2.

Expected response: False

Actual Response: The subscription object containing errors.

Misc thoughts

I'm seeing that the re-activate function here is wrapped in process_capturing_errors which I'm unsure of what this does. Maybe there was a change in how errors are handled in the gem I missed?

My expectation is that a @subscription.save or @subscription.reactivate call would return true/false like any standard ActiveRecord resource allow us to then inspect the errors on the object afterwards.

(cc: @YesThatAllen)

ActiveResource Requirement

I'm running Rails 2.3.8 and get errors that 2.3.4 or 2.3.5 is required. As you know it's an easy fix, but it would be better to have this fix in the original repo rather than a fork just for maintaining that.

BTW, I tested in 2.3.8 and it works fine. Would it be better to ensure that the version was > 2.3.4? Isn't that the real concern?

Thanks!

2013 override causes an ArgumentError in the Migration class

We recently started to experience this error

Failure/Error: subject.migrate("Gold")
ArgumentError:
  wrong number of arguments (2 for 1)
# /Users/weppos/.rvm/gems/ruby-2.1.5@dnsimple/gems/activeresource-4.0.0/lib/active_resource/validations.rb:19:in `[]'
# /Users/weppos/.rvm/gems/ruby-2.1.5@dnsimple/gems/activeresource-4.0.0/lib/active_resource/validations.rb:19:in `block (2 levels) in from_array'
# /Users/weppos/.rvm/gems/ruby-2.1.5@dnsimple/gems/activeresource-4.0.0/lib/active_resource/validations.rb:18:in `each'
# /Users/weppos/.rvm/gems/ruby-2.1.5@dnsimple/gems/activeresource-4.0.0/lib/active_resource/validations.rb:18:in `detect'
# /Users/weppos/.rvm/gems/ruby-2.1.5@dnsimple/gems/activeresource-4.0.0/lib/active_resource/validations.rb:18:in `block in from_array'
# /Users/weppos/.rvm/gems/ruby-2.1.5@dnsimple/gems/activeresource-4.0.0/lib/active_resource/validations.rb:17:in `each'
# /Users/weppos/.rvm/gems/ruby-2.1.5@dnsimple/gems/activeresource-4.0.0/lib/active_resource/validations.rb:17:in `from_array'
# /Users/weppos/.rvm/gems/ruby-2.1.5@dnsimple/gems/chargify_api_ares-1.3.5/lib/chargify_api_ares/resources/migration.rb:22:in `load_remote_errors'
# /Users/weppos/.rvm/gems/ruby-2.1.5@dnsimple/gems/activeresource-4.0.0/lib/active_resource/validations.rb:126:in `rescue in save_with_validation'
# /Users/weppos/.rvm/gems/ruby-2.1.5@dnsimple/gems/activeresource-4.0.0/lib/active_resource/validations.rb:109:in `save_with_validation'
# /Users/weppos/.rvm/gems/ruby-2.1.5@dnsimple/gems/activeresource-4.0.0/lib/active_resource/observing.rb:21:in `save_with_notifications'
# /Users/weppos/.rvm/gems/ruby-2.1.5@dnsimple/gems/activeresource-4.0.0/lib/active_resource/base.rb:806:in `block in create'
# /Users/weppos/.rvm/gems/ruby-2.1.5@dnsimple/gems/activeresource-4.0.0/lib/active_resource/base.rb:806:in `tap'
# /Users/weppos/.rvm/gems/ruby-2.1.5@dnsimple/gems/activeresource-4.0.0/lib/active_resource/base.rb:806:in `create'
# /Users/weppos/.rvm/gems/ruby-2.1.5@dnsimple/gems/chargify_api_ares-1.3.5/lib/chargify_api_ares/resources/subscription.rb:101:in `migrate'

It looks like the cause of this issue is an override of the load_remote_errors method created in 2013.

Removing this override and falling back to the original implementation seems to work as expected.

This is an example response (without the unnecessary headers)

HTTP/1.1 422 Unprocessable Entity
Cache-Control: must-revalidate, private, max-age=0
Content-Type: application/xml; charset=utf-8
Date: Sun, 27 Sep 2015 19:00:53 GMT

<?xml version="1.0" encoding="UTF-8"?><errors><error>Your card was declined.</error></errors>

Any chance that the response was recently changed at Chargify?

Conflicts with the Highrise Gem

This gem conflicts with the Highrise gem, and I get this error below. Here is part of the backtrace. Any help would be greatly appreciated.

[GEM_ROOT]/gems/highrise-2.0.1/lib/highrise/../cachable.rb:73:in delete' [GEM_ROOT]/gems/activeresource-2.3.14/lib/active_resource/base.rb:883:indestroy'
[GEM_ROOT]/gems/chargify_api_ares-0.5.0/lib/chargify_api_ares/resources/subscription.rb:17:in cancel' app/models/organization.rb:830:incancel_subscription!'
[GEM_ROOT]/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:178:in send' [GEM_ROOT]/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:178:inevaluate_method'
[GEM_ROOT]/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:166:in call' [GEM_ROOT]/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:93:inrun'
[GEM_ROOT]/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:92:in each' [GEM_ROOT]/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:92:insend'
[GEM_ROOT]/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:92:in `run'

Setting Chargify::Subscription #next_billing_at= and the calling #save does not work.

I'm trying to set a future billing date and it does not actually change the billing date for the subscription. I have tried this with new and existing subscriptions and it does not work.

# Creating a subscription
s = Chargify::Subscription.new(
  :customer_reference => "<YOUR CUSTOMER REFERENCE>",
  :product_handle => "<PRODUCT HANDLE>",
  :credit_card_attributes => {
    :first_name => "Michael",
    :last_name => "Klett",
    :expiration_month => 1,
    :expiration_year => 2020,
    :full_number => "1"
  },
  :next_billing_at => '2014-12-01'
)
s.save
# => true

# Updating a subscription
s = Chargify::Subscription.find("<SUBSCRIPTION ID>")
s.next_billing_at = '2014-12-01'
s.save
# => true

Both of the above examples do not actually update the the billing date in Chargify.

I have tested the API with curl and the HTTParty gem and both work if I have the subscription key in the json hash.

# curl example
curl -u <AUTH KEY>:x -X PUT -H "Content-Type: application/json" -d '{"subscription": { "next_billing_at": "2014-12-01" }}' https://<SUBDOMAIN>.chargify.com/subscriptions/<SUBSCRIPTION ID>.json
require 'httparty'

options = { 
  query: { subscription: { next_billing_at: "2014-12-01"  } },
  basic_auth: { username:'<AUTH KEY>' , password: 'x' }
}
ChangeCard.put('/<SUBSCRIPTION ID>.json', options)

Is there something I'm doing wrong in when using the ares gem or is this a bug?

Thanks

Allow metafield update on a subscription via the API

Looking here I'm seeing that metafields are valid api endpoints.

It would be great if this gem supported this.

Update

After clarification it appears these endpoints only allow get (list) and post (metafield create) endpoints. It's not yet possible to set/update the metafield of a new or existing subscription via the api. See thread and specificalyl this comment for clarity.

Coupon 'lookup' vs 'find' API endpoints

It seems that the gem uses this endpoint http://DOMAIN.chargify.com/coupons/lookup.xml?code=COUPON&product_family_id=FAMILY_ID when using the gem function Chargify::Coupon.find_by_product_family_id_and_code.

I'm not sure if this is a legacy API endpoint, as the current Chargify docs list an endpoint such as http://DOMAIN.chargify.com/coupons/find.xml?code=COUPON to use instead.

My two main points of curiosity are this:

  1. The lookup method returns a 404: Not found when I lookup a secondary coupon code, whereas the find method returns the valid coupon details.
  2. The lookup method requires a product_family_id while the find method only requires the coupon_code.

I wanted to see if there was a reason for this before I submit a pull request. Thanks!

Migrations do not return error messages

migrate is a method on the Subscription resource. Making a migrate call may fail (422) without a way to get to the underlying error messages.

Migration should probably be a separate resource, and calling subscription.migrate should return an instance of that resource, with any applicable errors.

Internal reference: http://help.chargify.com/tickets/6606

Changing products(within the same product family)

Hi, I'm a new user to this gem. Currently I met a problem about changing products(not migrate to another product but just change non-prorated) and I can't solve it.

I tried to do:

subscription.product = Chargify::Product.find_by_handle("my-handle-name")
subscription.product.save!

and it gives me 403.

also I tried:

subscription.product.handle = "my-handle-name"
subscription.product.save!

It is also not working.

If this is not the correct way to change products then what is the right way?

Thank you very much and expecting your reply!

Customer Metadata?

I can't seem to add/modify Customer Metadata (for a given customer), only Subscription Metadata. Is Customer Metadata not supported yet?

undefined method 'path' for nil:NilClass

Vanilla gem install on rails 3.2, and attempting any operation (e.g. Chargify::Subscription.create()) on the console (or elsewhere) throws this error. Bundle show chargify_api_ares looks correct.

undefined method 'cancel' for Subscription

If you find a subscription through a customer, then methods like cancel, and reactivate won't exist. This is shown through

Chargify::Customer::Subscritpion.instance_methods(false).include?(:cancel) #=> false
Chargify::Subscription.instance_methods(false).include?(:cancel) #=> true

It looks like there are two different Subscription classes due to the scope.

customer = Chargify::Customer.find_by_reference(some_reference_id)
subscription = chargify_customer.subscriptions.first
puts subscription.class #=> Chargify::Customer::Subscription
real_subscription = Chargify::Subscription.find(subscription.id)
puts real_subscription.class #=> Chargify::Subscription

So calling cancel on subscription would throw an error, but calling cancel on real_subscription would work fine.

Locking to ~> 3.0 active support

Howdy,
Just found an issue with credit card details not being accepted as valid thanks to what I'm pretty sure is a bug in the latest active support, probably worth locking down to Active Support ~> 3.0 or something to help prevent others being bitten.

Cheers!

Have a changelog

It is really awesome to have an outline of major changes and bugfixes by version.

Subscriptions without payment profiles

I really want to be able to create subscriptions without any payment profile.

Business Case

  • I want to allow users to sign up quickly (short form)
  • I want to allow them to use the product for x days before requiring CC info
  • After x days require customer to enter CC info in order to continue product usage.

Current State

When I attempted to do this using the Api a validation error was received.

error

   ["Payment profile: cannot be blank."]

Is there any way to get support for this?

Support for Transaction object

I'd love to see support for Transactions. I am trying to keep track of overall revenues from my subscribers so I can build a picture of lifetime value (LTV).

Next_billing_at for subscriptions

Hello @npverni (nathan),

How to use? - next_billing_at (https://docs.chargify.com/api-code) for subscriptions. The app I am working on is giving trial period to users (30 days). If a user subscribes to a plan in the middle of their trial period I want to make sure the billing always occurs when the trial ends.

How to accomplish this?

Thank you,
Gaurav

Gemspec

Gemspec should require ares of the proper version (bundler compatibility)

Can't re-activate a subscription without a "card on file"

This is possible in the Chargify web interface so I'm hoping it's just an oversight on the API side somehow. We've found that we often have people who try out our app, never enter card info and come back a few months later to try it again. We'd prefer to not have to manually reactivate each of these accounts.

Problem

I'm unable to re-activate a subscription if there is no card on file via a reactivate call.

Steps To Reproduce
Attempt to call @subscription.reactivate or @subscription.reactivate(include_true:1, preserve_balance: 0) on a cancelled subscription without a card on file.

Expected Results
Reactivated subscription, and a subscription state change callback.

Actual Results
A subscription error of: "The customer does not have a credit card on file."

Version Numbers
chargify_api_ares: 1.2.1
Rails 4.1.5
Ruby 2.1.2

(cc: @YesThatAllen)

Chargify::Statement and Chargify::Subscription::Statement both exist

I'm wondering if the existence of both classes (it's like this for Transaction, too) is intentional? I can't find a reason why yet am and wondering if it's just a namespace bug.

Not a huge deal for regular gem use, but if you try certain metaprogramming stuff (like a class_eval) it's a bit off.

bank_account payment profile

A subscription's payment profile can now be associated with a bank_account but calling payment_profile on a subscription will only return the credit_card payment profile.

https://github.com/chargify/chargify_api_ares/blob/master/lib/chargify_api_ares/resources/subscription.rb#L37

def payment_profile
  self.respond_to?('credit_card') ? credit_card : nil
end

A subscription can have both a bank_account and a credit_card as a payment profile but the more common case would be a subscription with one payment profile. Credit card is already the existing default so I suppose it would make sense to check for a bank account, if no bank account then look for a card and if nothing then nil. That would fit closest to the current implementation but wanted to get everyone's thoughts and see if another way is preferable.

Getting timeouts

this could be due to the charify api not the gem, but maybe increasing the timeout in here would help. Thanks

Reactivating subscription throws ActiveResource error

Hello,
1.) When Chargify marks a subscription as unpaid, in our app, we trying to reactivate this unpaid subscription. But unfortunately, its throwing an error as:
ActiveResource::ServerError: Failed. Response code = 500. Response message = Internal Server Error. Previously, it used to used as intended but it isnt working.

2.) I used ' .reactivate ' instance method to reactivate a subscription.

3.) Here is the subscription details:
=> #<Chargify::Subscription:0x0000000a5696b8 @attributes={"activated_at"=>2013-06-19 08:52:10 UTC, "balance_in_cents"=>100, "cancel_at_end_of_period"=>false, "canceled_at"=>nil, "cancellation_message"=>nil, "created_at"=>2013-06-19 08:52:09 UTC, "current_period_ends_at"=>2013-07-12 12:40:00 UTC, "expires_at"=>nil, "id"=>3493174, "next_assessment_at"=>2013-07-12 12:44:14 UTC, "payment_collection_method"=>"automatic", "state"=>"unpaid", "trial_ended_at"=>nil, "trial_started_at"=>nil, "updated_at"=>2013-07-11 12:44:14 UTC, "current_period_started_at"=>2013-07-11 12:40:00 UTC, "previous_state"=>"unpaid", "signup_payment_id"=>34842396, "signup_revenue"=>"1.00", "delayed_cancel_at"=>nil, "coupon_code"=>nil, "total_revenue_in_cents"=>2000, "customer"=>#<Chargify::Customer:0x0000000a566008 @attributes={"address"=>nil, "address_2"=>nil, "city"=>nil, "country"=>nil, "created_at"=>2013-06-19 08:52:08 UTC, "email"=>"[email protected]", "first_name"=>"Cancel", "id"=>3345855, "last_name"=>"again", "organization"=>nil, "phone"=>nil, "reference"=>"8429524", "state"=>nil, "updated_at"=>2013-06-19 08:52:08 UTC, "zip"=>nil}, @prefix_options={}, @persisted=false>, "product"=>#<Chargify::Product:0x0000000a4dc1f0 @attributes={"accounting_code"=>"slevel5", "archived_at"=>nil, "created_at"=>2012-12-04 08:36:51 UTC, "description"=>"Please ignore this subscription. Generated to test whether user's subscription get canceled at the end of subscription period.\n- On realvolvebeta.com", "expiration_interval"=>nil, "expiration_interval_unit"=>"never", "handle"=>"slevel5", "id"=>3276893, "initial_charge_in_cents"=>0, "interval"=>1, "interval_unit"=>"day", "name"=>"S-Level 5", "price_in_cents"=>100, "request_credit_card"=>true, "require_credit_card"=>true, "return_params"=>nil, "return_url"=>nil, "trial_interval"=>nil, "trial_interval_unit"=>"month", "trial_price_in_cents"=>nil, "update_return_url"=>nil, "updated_at"=>2013-06-19 08:51:05 UTC, "product_family"=>#<Chargify::ProductFamily:0x0000000a4a6a78 @attributes={"accounting_code"=>nil, "description"=>nil, "handle"=>"singleagent", "id"=>225940, "name"=>"Single Agent"}, @prefix_options={}, @persisted=false>}, @prefix_options={}, @persisted=false>, "credit_card"=>#<Chargify::Subscription::CreditCard:0x0000000a48fc60 @attributes={"type"=>"PaymentProfile", "billing_address"=>"Oberoi Garden", "billing_address_2"=>nil, "billing_city"=>"Mumbai", "billing_country"=>"AU", "billing_state"=>"ACT", "billing_zip"=>"400084", "card_type"=>"american_express", "current_vault"=>"bogus", "customer_id"=>3345855, "customer_vault_token"=>nil, "expiration_month"=>1, "expiration_year"=>2013, "first_name"=>"Cancel", "id"=>2088667, "last_name"=>"again", "masked_card_number"=>"XXXX-XXXX-XXXX-0002", "vault_token"=>"370000000000002"}, @prefix_options={}, @persisted=false>}, @prefix_options={}, @persisted=true>

4.) So here when I call subscription.reactivate, it gives out stack trace:
subs.reactivate
ActiveResource::ServerError: Failed. Response code = 500. Response message = Internal Server Error.
from /app/vendor/bundle/ruby/1.9.1/gems/activeresource-3.2.12/lib/active_resource/connection.rb:148:in handle_response' from /app/vendor/bundle/ruby/1.9.1/gems/activeresource-3.2.12/lib/active_resource/connection.rb:115:inrequest'
from /app/vendor/bundle/ruby/1.9.1/gems/activeresource-3.2.12/lib/active_resource/connection.rb:92:in block in put' from /app/vendor/bundle/ruby/1.9.1/gems/activeresource-3.2.12/lib/active_resource/connection.rb:218:inwith_auth'
from /app/vendor/bundle/ruby/1.9.1/gems/activeresource-3.2.12/lib/active_resource/connection.rb:92:in put' from /app/vendor/bundle/ruby/1.9.1/gems/activeresource-3.2.12/lib/active_resource/custom_methods.rb:102:input'
from /app/vendor/bundle/ruby/1.9.1/gems/chargify_api_ares-0.5.2/lib/chargify_api_ares/resources/subscription.rb:49:in reactivate' from (irb):8 from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/commands/console.rb:47:instart'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/commands/console.rb:8:in start' from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/commands.rb:41:in<top (required)>'
from script/rails:6:in require' from script/rails:6:in

'

Will you please advise what am I doing wrong in this?
Or do I need to use some other method to reactivate a subscription ?

Thanks

misunderstood the calls?

I contributed with the Invoice model a few days ago, my problem now is that maybe i missunderstood the way the model's REST work with the chargify API

in the API it says for example:

  • https://.chargify.com/invoices/<invoice_id>.

then i make:

  • Chargify::Invoice.find(id)

and it returns the Invoice with the correct id
problem comes when i have to make the filtering when not knowing the id of the invoice while working with the webhooks like this:

Chargify::Invoice(:first, params: {subscription_id: subscription_id})

it seems to filter the array of invoice like making the first restfull call:

  • https://.chargify.com/invoices/<invoice_id>.

but returns the last created invoice at chargify

no matter what params or if :first, :last, :all, unless i send the ID it dont do any filtering, even while sending the id, it only filters by id and ignores other params.

this is happening with all models

  • Subscription
  • Customer
  • etc

maybe I missunderstood the way chargify and the gem link but i would be realy gratefull to have some light on this concern.

Product Price Change Affects Existing Customers When It Shouldn't

Updating the price of a product changes the price on existing customer's subscription, when it shouldn't.

To reproduce:

  1. Check price of existing customer's subscription: Chargify::Subscription.find(subscription_id).product.price_in_cents
  2. Change the price of that product.
  3. Re-check price of existing customer's subscription: Chargify::Subscription.find(subscription_id).product.price_in_cents
    Note that the pricing changes for existing customer's subscription.

Here's a live test run that exposes the issue:

irb(main):040:0> Chargify::Subscription.find(2181413).product.price_in_cents
=> 3995
# updated price of the product between these commands in Chargify
irb(main):040:0> Chargify::Subscription.find(2181413).product.price_in_cents
=> 3991

Bump version

You merged a fix 2 months ago (thanks!) but you forgot to bump the version. We would prefer to not have to install the gem through git.

Reconfiguring the subdomain does not work

If you configure the gem initially and then repeat the configuration block, such as:

Chargify.configure do |c|
  c.subdomain = ENV['CHARGIFY_OTHER_SUBDOMAIN']
  c.api_key   = ENV['CHARGIFY_API_KEY']
end

It does not work. Requests still go to the original subdomain.

Internally, the 'site' is cached from the original config, and must be cleared out before you can reconfigure. (Thanks to @moklett for the info.)

Chargify.configure do |c|
  c.site = nil
  c.subdomain = ENV['CHARGIFY_OTHER_SUBDOMAIN']
  c.api_key   = ENV['CHARGIFY_API_KEY']
end

Here is an example of switching sites, with the workaround:
https://github.com/wsmoak/chargify/blob/master/ruby/multiple-sites.rb

Can this be fixed so that reconfiguring is easier?

Saving a customer creates a duplicate record instead of updating the existing one

I was trying to update the customer references in our account via the API and inadvertently ended up creating lots of duplicate records (which sadly also can't be deleted via the API). The following code creates a duplicate customer record rather than updating the existing one:

c = Chargify::Subscription.find(12345).customer
c.reference = "test"
c.save

(I'm also opening up a support request to ask for the records to be deleted.)

ActiveResource 3.2.16 dependency?

Hello!, Is there a specific reason you have ActiveResource locked to version 3.2.16? This version of ActiveResource depends on ActiveModel 3.2.16. Which means I can't use this gem in a Rails 4 app.

# Runtime Dependencies
  s.add_runtime_dependency('activeresource', '~> 3.2.16')
In Gemfile:
    chargify_api_ares (~> 1.1.0) ruby depends on
      activeresource (~> 3.2.16) ruby depends on
        activemodel (= 3.2.16) ruby

    rails (~> 4.0.10) ruby depends on
      activerecord (= 4.0.10) ruby depends on
        activemodel (4.0.10)

Define dummy modules

I cache responses from Chargify to improve performance. I sometimes will get a odd response that is unexpected when one cached part is out of sync with another cached part.

undefined class/module Chargify::Subscription::CreditCard

I believe these classes get defined from AcriveResource when the call is successful, would it be advantageous to have these modules pre-defined to avoid these undefined issues?

Raw cached data

#<ActiveSupport::Cache::Entry:0x007ff8049d8f60 @compressed=false, @expires_in=21600.0, @created_at=1422946568.7772682, @value="\x04\bo:\eChargify::Subscription\b:\x10@attributesC:-ActiveSupport::HashWithIndifferentAccess{#I\"\x11activated_at\x06:\x06EFIu:\tTime\r\x96\xC1\x1C\xC0\x00\x00\xC0)\x06:\tzoneI\"\bUTC\x06;\bTI\"\x15balance_in_cents\x06;\bFi\x00I\"\x1Ccancel_at_end_of_period\x06;\bFTI\"\x10canceled_at\x06;\bF0I\"\x19cancellation_message\x06;\bF0I\"\x0Fcreated_at\x06;\bFIu;\t\r\x96\xC1\x1C\xC0\x00\x00\xB0)\x06;\nI\"\bUTC\x06;\bTI\"\ecurrent_period_ends_at\x06;\bFIu;\t\r\x96\xC5\x1C\xC0\x00\x00\xB0)\x06;\nI\"\bUTC\x06;\bTI\"\x0Fexpires_at\x06;\bF0I\"\aid\x06;\bFi\x03'XrI\"\x17next_assessment_at\x06;\bFIu;\t\r\x96\xC5\x1C\xC0\x00\x00\xB0)\x06;\nI\"\bUTC\x06;\bTI\"\x1Epayment_collection_method\x06;\bFI\"\x0Eautomatic\x06;\bTI\"\rsnap_day\x06;\bF0I\"\nstate\x06;\bFI\"\vactive\x06;\bTI\"\x13trial_ended_at\x06;\bF0I\"\x15trial_started_at\x06;\bF0I\"\x0Fupdated_at\x06;\bFIu;\t\r\x96\xC1\x1C\xC0\x00\x00@E\x06;\nI\"\bUTC\x06;\bTI\"\x1Ecurrent_period_started_at\x06;\bFIu;\t\r\x96\xC1\x1C\xC0\x00\x00\xB0)\x06;\nI\"\bUTC\x06;\bTI\"\x13previous_state\x06;\bFI\"\vactive\x06;\bTI\"\x16signup_payment_id\x06;\bFi\x04\x91y\xD9\x04I\"\x13signup_revenue\x06;\bFI\"\n99.00\x06;\bTI\"\x16delayed_cancel_at\x06;\bFIu;\t\r\x96\xC5\x1C\xC0\x00\x00\xB0)\x06;\nI\"\bUTC\x06;\bTI\"\x10coupon_code\x06;\bF0I\"\etotal_revenue_in_cents\x06;\bFi\x02\xAC&I\"\eproduct_price_in_cents\x06;\bFi\x02\xAC&I\"\eproduct_version_number\x06;\bFi\x06I\"\x11payment_type\x06;\bFI\"\x10credit_card\x06;\bTI\"\x12referral_code\x06;\bF0I\"\rcustomer\x06;\bFo:\x17Chargify::Customer\b;\x06C;\a{\x18I\"\faddress\x06;\bF0I\"\x0Eaddress_2\x06;\bF0I\"\tcity\x06;\bF0I\"\fcountry\x06;\bFI\"\aUS\x06;\bTI\"\x0Fcreated_at\x06;\bFIu;\t\r\x96\xC1\x1C\xC0\x00\x00`)\x06;\nI\"\bUTC\x06;\bTI\"\nemail\x06;\bFI\"\[email protected]\x06;\bTI\"\x0Ffirst_name\x06;\bFI\"\ttest\x06;\bTI\"\aid\x06;\bFi\x03],pI\"\x0Elast_name\x06;\bFI\"\ttest\x06;\bTI\"\x11organization\x06;\bF0I\"\nphone\x06;\bF0I\"\x1Fportal_customer_created_at\x06;\bF0I\"#portal_invite_last_accepted_at\x06;\bF0I\"\x1Fportal_invite_last_sent_at\x06;\bF0I\"\x0Ereference\x06;\bFI\"\a28\x06;\bTI\"\nstate\x06;\bF0I\"\x0Fupdated_at\x06;\bFIu;\t\r\x96\xC1\x1C\xC0\x00\x00`)\x06;\nI\"\bUTC\x06;\bTI\"\rverified\x06;\bFFI\"\bzip\x06;\bFI\"\vM4 123\x06;\bT:\x14@prefix_options{\x00:\x0F@persistedFI\"\fproduct\x06;\bFo:\x16Chargify::Product\b;\x06C;\a{\x1EI\"\x14accounting_code\x06;\bF0I\"\x10archived_at\x06;\bF0I\"\x0Fcreated_at\x06;\bFIu;\t\rT`\x1C\xC0\x00\x00@\xB8\x06;\nI\"\bUTC\x06;\bTI\"\x10description\x06;\bF0I\"\x18expiration_interval\x06;\bF0I\"\x1Dexpiration_interval_unit\x06;\bFI\"\nnever\x06;\bTI\"\vhandle\x06;\bFI\"\x1099usd-novat\x06;\bTI\"\aid\x06;\bFi\x03\xCB\xDB2I\"\x1Cinitial_charge_in_cents\x06;\bF0I\"\rinterval\x06;\bFi\x06I\"\x12interval_unit\x06;\bFI\"\nmonth\x06;\bTI\"\tname\x06;\bFI\"\x18Monthly 99USD NoVAT\x06;\bTI\"\x13price_in_cents\x06;\bFi\x02\xAC&I\"\x18request_credit_card\x06;\bFTI\"\x18require_credit_card\x06;\bFTI\"\x12return_params\x06;\bF0I\"\x0Freturn_url\x06;\bF0I\"\ftaxable\x06;\bFFI\"\x13trial_interval\x06;\bF0I\"\x18trial_interval_unit\x06;\bFI\"\nmonth\x06;\bTI\"\x19trial_price_in_cents\x06;\bF0I\"\x16update_return_url\x06;\bF0I\"\x0Fupdated_at\x06;\bFIu;\t\rk\xAE\x1C\xC0\x00\x00\xA0(\x06;\nI\"\bUTC\x06;\bTI\"\x13product_family\x06;\bFo:\x1CChargify::ProductFamily\b;\x06C;\a{\nI\"\x14accounting_code\x06;\bF0I\"\x10description\x06;\bF0I\"\vhandle\x06;\bFI\"\ttest\x06;\bTI\"\aid\x06;\bFi\x03vp\x05I\"\tname\x06;\bFI\"\x10EasyScraper\x06;\bT;\f{\x00;\rFI\"\x18public_signup_pages\x06;\bF[\x00;\f{\x00;\rFI\"\x10credit_card\x06;\bFo:'Chargify::Subscription::CreditCard\b;\x06C;\a{\x17I\"\x14billing_address\x06;\bF0I\"\x16billing_address_2\x06;\bF0I\"\x11billing_city\x06;\bF0I\"\x14billing_country\x06;\bF0I\"\x12billing_state\x06;\bF0I\"\x10billing_zip\x06;\bF0I\"\x0Ecard_type\x06;\bFI\"\tvisa\x06;\bTI\"\x12current_vault\x06;\bFI\"\nbogus\x06;\bTI\"\x10customer_id\x06;\bFi\x03],pI\"\x19customer_vault_token\x06;\bF0I\"\x15expiration_month\x06;\bFi\x06I\"\x14expiration_year\x06;\bFi\x02\xE1\aI\"\x0Ffirst_name\x06;\bFI\"\ttest\x06;\bTI\"\aid\x06;\bFi\x03p\xBDJI\"\x0Elast_name\x06;\bFI\"\ttest\x06;\bTI\"\x17masked_card_number\x06;\bFI\"\x18XXXX-XXXX-XXXX-1111\x06;\bTI\"\x10vault_token\x06;\bFI\"\x154111111111111111\x06;\bTI\"\x11payment_type\x06;\bFI\"\x10credit_card\x06;\bT;\f{\x00;\rF;\f{\x00;\rT">

Payment Profiles are not scoped by Customer

Here's the issue illustrated in a screen shot:

https://img.skitch.com/20111114-e38dytgymtyej2epc7tat9epnm.jpg

Using ActiveResource::Base.logger = Logger.new(STDERR)

I can see the url is:

https://dealer-ignition-test.chargify.com:443/payment_profiles.xml?customer_id=106826

I edited the gem and set up a prefix and managed to get:

https://dealer-ignition-test.chargify.com:443/customers/1068265/payment_profiles.xml

But this url gives a 404.

How can I get payment profiles scoped by customer? Does the api support this?

Cannot create customer with Subscription in JSON

Code being used:

@subscription = Chargify::Subscription.new(
      product_handle: @plan.chargify_api_handle,
      customer_attributes: {
        first_name: @billing_profile.first_name,
        last_name: @billing_profile.last_name,
        email: @billing_profile.email,
        reference: @account.uid
      },
      coupon_code: @plan_subscription.coupon_code,
      components: component_attributes
    )

@subscription.save!

Response says:

@messages={:base=>["unknown attribute: customer_attributes"]}

As you can see, the customer_attributes argument does not work. The API docs found at https://docs.chargify.com/api-subscriptions#api-usage-json-subscriptions-create indicate it should.

Sorry there is no failing test and pull, but I wasn't sure what the proper fix would be within this gem.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.