Skip to content

Commit

Permalink
amend request takes a rate plan with either the product rate plan id …
Browse files Browse the repository at this point in the history
…or the amendment rate plan id set
  • Loading branch information
mdemin914 committed Oct 17, 2012
1 parent 7783fd6 commit 4be0b89
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/zuora/objects/amend_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ def generate_rate_plan_data(builder)

builder.__send__(ons, :RatePlanData) do |rpd|
rpd.__send__(zns, :RatePlan) do |rp|
rp.__send__(ons, :ProductRatePlanId, rate_plan.id)
rate_plan.to_hash.each do |k,v|
rp.__send__(ons, k.to_s.zuora_camelize.to_sym, v) unless v.nil?
end
end
charges.each do |charge|
rpd.__send__(zns, :RatePlanChargeData) do |rpcd|
Expand Down
7 changes: 6 additions & 1 deletion spec/zuora/objects/amend_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@
@amendment = FactoryGirl.build(:amendment)
@amendment.subscription_id = subscription.id
MockResponse.responds_with(:payment_method_credit_card_find_success) do
@product_rate_plans = [Zuora::Objects::ProductRatePlan.find('stub')]
product_rate_plans = [Zuora::Objects::ProductRatePlan.find('stub')]

@prps = Zuora::Objects::RatePlan.new
@prps.product_rate_plan_id = product_rate_plans[0].id
@product_rate_plans = [@prps]
end
end

it "provides properly formatted xml when using existing objects" do
MockResponse.responds_with(:amend_request_success) do
subject.amendment = @amendment

subject.plans_and_charges = Array.new << { rate_plan: @product_rate_plans[0], charges: nil }
amnd_resp = subject.create
amnd_resp[:success].should == true
Expand Down

0 comments on commit 4be0b89

Please sign in to comment.