- Added cancellation message option for subscription canceling
- restore 1.8.7 style hash syntax
- Add metafields and metadata
- Remove 'bank_account' attribute from subscription upon save
- Update Gemfile source to https://rubygems.org due to Bundler deprecation
- Update payment_profile on subscriptions to return credit_card or bank_account
Chargify::Subscription
methods no longer raise exception when there is a validation error. Now you must inspect the subscription object for errors. eg:
subscription.reactivate
if subscription.errors.any?
# handle errors
end
-
Chargify::Subscription.charge
now returns an ActiveResourceCharge
object. In the case of an error, theCharge
object will haveerrors
, and you will not have to rescue an HTTP422
. -
Adds new
Chargify::Migration
andChargify::Migration::Preview
resources. These can be used as follows:
subscription = Chargify::Subscription.find_by_customer_reference('marky-mark')
# Chargify::Migration
migration = subscription.migrate(:product_handle => "basic-plan")
migration = Chargify::Migration.create(:subscription_id => subscription.id, :product_handle => "basic-plan")
# Chargify::Migration::Preview
preview = Chargify::Migration::Preview.create(:subscription_id => subscription.id, :product_handle => "basic-plan")
preview = Chargify::Migration.preview(:subscription_id => subscription.id, :product_handle => "basic-plan")
Error handling looks like:
migration = subscription.migrate(:product_handle => "non-existent-plan")
migration.errors.full_messages
# => ["Invalid Product"]
preview = Chargify::Migration.preview(:subscription_id => subscription.id, :product_handle => "non-existent-plan")
preview.errors.full_messages
# => ["Product must be specified"]
See examples/migrations.rb
and specs for more details.