active_zuora 1.4.5 → 1.4.6

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.4
1
+ 1.4.6
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "active_zuora"
8
- s.version = "1.4.5"
8
+ s.version = "1.4.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andy Fleener", "Ed Lebert", "Nate Greene"]
@@ -1,12 +1,28 @@
1
1
  module Zuora
2
2
  class RatePlanCharge < ZObject
3
3
 
4
- exclude_query_attributes :overagePrice, :includedUnits, :discountAmount, :discountPercentage
4
+ exclude_query_attributes :overagePrice, :includedUnits, :discountAmount, :discountPercentage, :price
5
5
 
6
6
  def rate_plan
7
7
  @rate_plan ||= RatePlan.find(self.ratePlanId)
8
8
  end
9
9
 
10
+ def rate_plan_charge_tier
11
+ query = charge_tier_query("ratePlanChargeId", id)
12
+ @rate_plan_charge_tier ||= RatePlanChargeTier.where(query).first
13
+ end
14
+
15
+ def product_rate_plan_charge_tier
16
+ query = charge_tier_query("productRatePlanChargeId", productRatePlanChargeId)
17
+ @product_rate_plan_charge_tier ||= ProductRatePlanChargeTier.where(query).first
18
+ end
19
+
20
+ def charge_model_query(identifier_name, identifier_value)
21
+ query = "#{identifier_name} = '#{identifier_value}'"
22
+ query += " and endingUnit >= #{charge_quantity} and startingUnit <= #{charge_quantity}" if chargeModel == "Volume Pricing"
23
+ query
24
+ end
25
+
10
26
  def product_rate_plan_charge
11
27
  @product_rate_plan_charge ||= ProductRatePlanCharge.find(self.productRatePlanChargeId)
12
28
  end
@@ -20,16 +36,24 @@ module Zuora
20
36
  self
21
37
  end
22
38
 
39
+ def charge_quantity
40
+ quantity || 1
41
+ end
42
+
43
+ def price
44
+ rate_plan_charge_tier.price
45
+ end
46
+
23
47
  def total_price
24
- (quantity || 1) * price
48
+ charge_quantity * price
25
49
  end
26
50
 
27
51
  def list_price
28
- product_rate_plan_charge.product_rate_plan_charge_tiers.first.price
52
+ product_rate_plan_charge_tier.price
29
53
  end
30
54
 
31
55
  def total_list_price
32
- (quantity || 1) * list_price
56
+ charge_quantity * list_price
33
57
  end
34
58
 
35
59
  def discount?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_zuora
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.5
4
+ version: 1.4.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -173,7 +173,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
173
173
  version: '0'
174
174
  segments:
175
175
  - 0
176
- hash: 2769639254206594303
176
+ hash: -1373981817306604645
177
177
  required_rubygems_version: !ruby/object:Gem::Requirement
178
178
  none: false
179
179
  requirements: