Skip to content

Commit

Permalink
Merge pull request #104 from tungleduyxyz/issue_88_add_new_subscripti…
Browse files Browse the repository at this point in the history
…on_apis

Issue 88 Sync with Killbill Subscriptions APIs
  • Loading branch information
reshmabidikar authored Apr 5, 2024
2 parents 6d91054 + 4e9970a commit 2858fbd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/killbill_client/models/gen/subscription_attributes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class SubscriptionAttributes < Resource
attribute :price_overrides
attribute :prices
attribute :audit_logs
attribute :quantity
end
end
end
18 changes: 18 additions & 0 deletions lib/killbill_client/models/subscription.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Subscription < SubscriptionAttributes

has_many :events, KillBillClient::Model::EventSubscription
has_many :price_overrides, KillBillClient::Model::PhasePriceAttributes
has_many :audit_logs, KillBillClient::Model::AuditLog

has_custom_fields KILLBILL_API_ENTITLEMENT_PREFIX, :subscription_id
has_tags KILLBILL_API_ENTITLEMENT_PREFIX, :subscription_id
Expand Down Expand Up @@ -220,6 +221,23 @@ def undo_change_plan(user = nil, reason = nil, comment = nil, options = {})
}.merge(options)
end

#
# Update Subscription Quantity
#
def update_quantity(user = nil, reason = nil, comment = nil, effective_from_date = nil, force_new_quantity_with_past_effective_date = nil, options = {})
params = {}
params[:effectiveFromDate] = effective_from_date unless effective_from_date.nil?
params[:forceNewQuantityWithPastEffectiveDate] = force_new_quantity_with_past_effective_date unless force_new_quantity_with_past_effective_date.nil?

return self.class.put "#{KILLBILL_API_ENTITLEMENT_PREFIX}/#{subscription_id}/quantity",
self.to_json,
params,
{
:user => user,
:reason => reason,
:comment => comment,
}.merge(options)
end
end
end
end

0 comments on commit 2858fbd

Please sign in to comment.