Skip to content

Commit

Permalink
- Revert overriden validations from upstream
Browse files Browse the repository at this point in the history
- Update validations for attributes with changed datatype. `(i.e Datetime to date)`
  • Loading branch information
banjoko01 committed Jun 25, 2024
1 parent 48578b7 commit 04f281f
Show file tree
Hide file tree
Showing 13 changed files with 89 additions and 89 deletions.
32 changes: 16 additions & 16 deletions lib/zuora/objects/amendment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ module Zuora::Objects
class Amendment < Base
belongs_to :subscription

validates_presence_of :subscription_id, :name
validates_length_of :name, :maximum => 100
validates_inclusion_of :auto_renew, :in => [true, false], :allow_nil => true
validates_length_of :code, :maximum => 50, :allow_nil => true
validates_datetime_of :contract_effective_date, :allow_nil => true
validates_datetime_of :customer_acceptance_date, :allow_nil => true
validates_datetime_of :effective_date, :allow_nil => true
validates_datetime_of :service_activation_date, :if => Proc.new { |a| a.status == 'PendingAcceptance' }
validates_length_of :description, :maximum => 500, :allow_nil => true
validates_presence_of :subscription_id, :name
validates_length_of :name, :maximum => 100
validates_inclusion_of :auto_renew, :in => [true, false], :allow_nil => true
validates_length_of :code, :maximum => 50, :allow_nil => true
validates_date_of :contract_effective_date, :allow_nil => true
validates_date_of :customer_acceptance_date, :allow_nil => true
validates_date_of :effective_date, :allow_nil => true
validates_date_of :service_activation_date, :if => Proc.new { |a| a.status == 'PendingAcceptance' }
validates_length_of :description, :maximum => 500, :allow_nil => true
validates_numericality_of :initial_term, :if => Proc.new { |a| a.type == 'TermsAndConditions' }
validates_numericality_of :renewal_term, :if => Proc.new { |a| a.type == 'TermsAndConditions' }
validates_date_of :term_start_date, :if => Proc.new { |a| a.type == 'TermsAndConditions' }
validates_presence_of :destination_account_id, :if => Proc.new {|a| a.type == 'OwnerTransfer' }
validates_presence_of :destination_invoice_owner_id, :if => Proc.new {|a| a.type == 'OwnerTransfer' }
validates_inclusion_of :status, :in => ["Completed", "Cancelled", "Draft", "Pending Acceptance", "Pending Activation"]
validates_inclusion_of :term_type, :in => ['TERMED', 'EVERGREEN'], :allow_nil => true
validates_inclusion_of :type, :in => ['Cancellation', 'NewProduct', 'OwnerTransfer', 'RemoveProduct', 'Renewal', 'UpdateProduct', 'TermsAndConditions']
validates_presence_of :rate_plan_data, :if => Proc.new { |a| ['NewProduct', 'RemoveProduct', 'UpdateProduct'].include?(a.type) }, :only => :apply_percentage_discount
validates_date_of :term_start_date, :if => Proc.new { |a| a.type == 'TermsAndConditions' }
validates_presence_of :destination_account_id, :if => Proc.new {|a| a.type == 'OwnerTransfer' }
validates_presence_of :destination_invoice_owner_id, :if => Proc.new {|a| a.type == 'OwnerTransfer' }
validates_inclusion_of :status, :in => ["Completed", "Cancelled", "Draft", "Pending Acceptance", "Pending Activation"]
validates_inclusion_of :term_type, :in => ['TERMED', 'EVERGREEN'], :allow_nil => true
validates_inclusion_of :type, :in => ['Cancellation', 'NewProduct', 'OwnerTransfer', 'RemoveProduct', 'Renewal', 'UpdateProduct', 'TermsAndConditions']
validates_presence_of :rate_plan_data, :if => Proc.new { |a| ['NewProduct', 'RemoveProduct', 'UpdateProduct'].include?(a.type) }, :only => :apply_percentage_discount

attr_accessor :amendment_ids
attr_accessor :invoice_id
Expand Down
12 changes: 6 additions & 6 deletions lib/zuora/objects/invoice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ class Invoice < Base
validates_numericality_of :amount
validates_numericality_of :balance, :allow_nil => true
validates_length_of :comments, :maximum => 255
validates_datetime_of :due_date
validates_datetime_of :invoice_date
validates_date_of :due_date
validates_date_of :invoice_date
validates_inclusion_of :includes_one_time, :in => [true, false]
validates_inclusion_of :includes_recurring, :in => [true, false]
validates_inclusion_of :includes_usage, :in => [true, false]
validates_length_of :invoice_number, :maximum => 255 # String
# validates_datetime_of :last_email_sent_date, :allow_nil => true
validates_datetime_of :last_email_sent_date, :allow_nil => true
validates_numericality_of :payment_amount, :allow_nil => true
# validates_datetime_of :posted_date, :allow_nil => true
validates_datetime_of :posted_date, :allow_nil => true
validates_numericality_of :refund_amount, :allow_nil => true
validates_inclusion_of :status, :in => %w(Canceled Draft Error Posted), :allow_nil => true
# validates_datetime_of :target_date
validates_date_of :target_date
validates_inclusion_of :transferred_to_accounting, :in => %w(Processing Yes Error Ignore), :allow_nil => true
# validates_datetime_of :updated_date
validates_datetime_of :updated_date

define_attributes do
read_only(
Expand Down
8 changes: 4 additions & 4 deletions lib/zuora/objects/invoice_adjustment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ class InvoiceAdjustment < Base
validates_presence_of :amount, :type

validates_length_of :accounting_code, :maximum => 100
# validates_datetime_of :adjustment_date, :allow_nil => true
validates_datetime_of :adjustment_date, :allow_nil => true
validates_length_of :adjustment_number, :maximum => 50
validates_numericality_of :amount
validates_length_of :cancelled_by_id, :maximum => 32
# validates_datetime_of :cancelled_on, :allow_nil => true
validates_datetime_of :cancelled_on, :allow_nil => true
validates_length_of :comments, :maximum => 255
validates_length_of :created_by_id, :maximum => 32
# validates_datetime_of :created_date, :allow_nil => true
validates_datetime_of :created_date, :allow_nil => true
validates_length_of :customer_name, :maximum => 50, :allow_nil => true
validates_length_of :customer_number, :maximum => 70, :allow_nil => true
validates_presence_of :invoice_id, :if => Proc.new { |ia| ia.invoice_number.nil? }
Expand All @@ -23,7 +23,7 @@ class InvoiceAdjustment < Base
validates_inclusion_of :transferred_to_accounting, :in => %w(Processing Yes Error Ignore), :allow_nil => true
validates_inclusion_of :type, :in => %w(Credit Charge)
validates_length_of :updated_by_id, :maximum => 32, :allow_nil => true
# validates_datetime_of :updated_date
validates_datetime_of :updated_date

define_attributes do
read_only(
Expand Down
28 changes: 14 additions & 14 deletions lib/zuora/objects/invoice_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ class InvoiceItem < Base
validates_presence_of :charge_amount, :charge_date, :charge_number, :invoice_id, :product_id,
:product_name, :rate_plan_charge_id, :service_start_date, :subscription_id, :unit_price

validates_length_of :accounting_code, :maximum => 255, :allow_nil => true
validates_length_of :accounting_code, :maximum => 255, :allow_nil => true
validates_numericality_of :charge_amount
# validates_datetime_of :charge_date
validates_length_of :charge_name, :maximum => 50, :allow_nil => true
validates_length_of :created_by_id, :maximum => 32, :allow_nil => true
validates_inclusion_of :processing_type, :in => [0,1,2,3], :allow_nil => true
validates_length_of :product_description, :maximum => 255, :allow_nil => true
validates_length_of :product_name, :maximum => 255
validates_datetime_of :charge_date
validates_length_of :charge_name, :maximum => 50, :allow_nil => true
validates_length_of :created_by_id, :maximum => 32, :allow_nil => true
validates_inclusion_of :processing_type, :in => [0,1,2,3], :allow_nil => true
validates_length_of :product_description, :maximum => 255, :allow_nil => true
validates_length_of :product_name, :maximum => 255
validates_numericality_of :quantity, :allow_nil => true
validates_length_of :rev_rec_code, :maximum => 70
# validates_datetime_of :rev_rec_start_date, :allow_nil => true
# validates_datetime_of :service_end_date, :allow_nil => true
# validates_datetime_of :service_start_date
validates_length_of :sku, :maximum => 255
validates_length_of :rev_rec_code, :maximum => 70
validates_date_of :rev_rec_start_date, :allow_nil => true
validates_date_of :service_end_date, :allow_nil => true
validates_date_of :service_start_date
validates_length_of :sku, :maximum => 255
validates_numericality_of :unit_price
validates_length_of :uom, :maximum => 255
validates_length_of :updated_by_id, :maximum => 32
validates_length_of :uom, :maximum => 255
validates_length_of :updated_by_id, :maximum => 32

define_attributes do
read_only :charge_description, :charge_name, :charge_number, :created_by_id, :created_date,
Expand Down
12 changes: 6 additions & 6 deletions lib/zuora/objects/invoice_item_adjustment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ class InvoiceItemAdjustment < Base
validates_presence_of :amount, :type

validates_length_of :accounting_code, :maximum => 100
# validates_datetime_of :adjustment_date, :allow_nil => true
validates_date_of :adjustment_date, :allow_nil => true
validates_length_of :adjustment_number, :maximum => 50
validates_numericality_of :amount
validates_length_of :cancelled_by_id, :maximum => 32
# validates_datetime_of :cancelled_on, :allow_nil => true
validates_datetime_of :cancelled_on, :allow_nil => true
validates_length_of :comments, :maximum => 255
validates_length_of :created_by_id, :maximum => 32
# validates_datetime_of :created_date, :allow_nil => true
validates_datetime_of :created_date, :allow_nil => true
validates_length_of :customer_name, :maximum => 50, :allow_nil => true
validates_length_of :customer_number, :maximum => 70, :allow_nil => true
validates_numericality_of :impact_amount
Expand All @@ -22,15 +22,15 @@ class InvoiceItemAdjustment < Base
validates_presence_of :invoice_number, :if => Proc.new { |ia| ia.invoice_id.nil? }
validates_length_of :invoice_number, :maximum => 255
validates_length_of :reference_id, :maximum => 60, :allow_nil => true
# validates_datetime_of :service_end_date
# validates_datetime_of :service_start_date
validates_date_of :service_end_date
validates_date_of :service_start_date
validates_length_of :source_id, :maximum => 32, :allow_nil => true
validates_inclusion_of :source_type, :in => %w(InvoiceDetail Tax)
validates_inclusion_of :status, :in => %w(Canceled Processed)
validates_inclusion_of :transferred_to_accounting, :in => %w(Processing Yes Error Ignore), :allow_nil => true
validates_inclusion_of :type, :in => %w(Credit Charge)
validates_length_of :updated_by_id, :maximum => 32, :allow_nil => true
# validates_datetime_of :updated_date
validates_datetime_of :updated_date

define_attributes do
read_only(
Expand Down
44 changes: 22 additions & 22 deletions lib/zuora/objects/payment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,32 @@ class Payment < Base
validates_presence_of :account_id, :amount, :effective_date, :gateway_state,
:payment_method_id, :status, :type

validates_length_of :accounting_code, :maximum => 100, :allow_nil => true
validates_length_of :accounting_code, :maximum => 100, :allow_nil => true
validates_numericality_of :amount
validates_numericality_of :applied_credit_balance_amount
validates_numericality_of :applied_invoice_amount
validates_length_of :auth_transaction_id, :maximum => 50, :allow_nil => true
validates_length_of :bank_identification_number, :maximum => 6, :allow_nil => true
# validates_date_of :cancelled_on, :allow_nil => true
validates_length_of :comment, :maximum => 255, :allow_nil => true
validates_length_of :created_by_id, :maximum => 32, :allow_nil => true
# validates_datetime_of :effective_date
validates_length_of :gateway_order_id, :maximum => 70, :allow_nil => true
validates_inclusion_of :gateway_state, :in => %w(NotSubmitted Submitted Settled MarkedForSubmission)
# validates_datetime_of :marked_for_submission_on, :allow_nil => true
validates_length_of :payment_number, :maximum => 32, :allow_nil => true
validates_length_of :reference_id, :maximum => 30, :allow_nil => true
validates_length_of :auth_transaction_id, :maximum => 50, :allow_nil => true
validates_length_of :bank_identification_number, :maximum => 6, :allow_nil => true
# validates_date_of :cancelled_on, :allow_nil => true
validates_length_of :comment, :maximum => 255, :allow_nil => true
validates_length_of :created_by_id, :maximum => 32, :allow_nil => true
validates_date_of :effective_date
validates_length_of :gateway_order_id, :maximum => 70, :allow_nil => true
validates_inclusion_of :gateway_state, :in => %w(NotSubmitted Submitted Settled MarkedForSubmission)
# validates_datetime_of :marked_for_submission_on, :allow_nil => true
validates_length_of :payment_number, :maximum => 32, :allow_nil => true
validates_length_of :reference_id, :maximum => 30, :allow_nil => true
validates_numericality_of :refund_amount, :allow_nil => true
validates_length_of :second_payment_reference_id, :maximum => 60, :allow_nil => true
# validates_date_of :settled_on, :allow_nil => true
validates_length_of :soft_descriptor, :maximum => 35, :allow_nil => true
validates_length_of :soft_descriptor_phone, :maximum => 20, :allow_nil => true
validates_inclusion_of :status, :in => %w(Canceled Draft Error Posted Processing Processed Voided)
# validates_date_of :submitted_on, :allow_nil => true
validates_inclusion_of :transferred_to_accouning, :allow_nil => true, :in => %w(Processing Yes Error Ignore)
validates_inclusion_of :type, :in => %w(External Electronic)
validates_length_of :updated_by_id, :maximum => 32
# validates_datetime_of :updated_date
validates_length_of :second_payment_reference_id, :maximum => 60, :allow_nil => true
# validates_date_of :settled_on, :allow_nil => true
validates_length_of :soft_descriptor, :maximum => 35, :allow_nil => true
validates_length_of :soft_descriptor_phone, :maximum => 20, :allow_nil => true
validates_inclusion_of :status, :in => %w(Canceled Draft Error Posted Processing Processed Voided)
# validates_date_of :submitted_on, :allow_nil => true
validates_inclusion_of :transferred_to_accouning, :allow_nil => true, :in => %w(Processing Yes Error Ignore)
validates_inclusion_of :type, :in => %w(External Electronic)
validates_length_of :updated_by_id, :maximum => 32
# validates_datetime_of :updated_date

define_attributes do
read_only :bank_identification_number, :created_by_id, :created_date, :gateway_response,
Expand Down
8 changes: 4 additions & 4 deletions lib/zuora/objects/product.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ class Product < Base
has_many :product_rate_plans

validates_inclusion_of :category, :in => ['DefaultCatalog'], :allow_nil => true
validates_length_of :description, :maximum => 500, :allow_nil => true
validates_length_of :description, :maximum => 500, :allow_nil => true

# validates_date_of :effective_start_date, :effective_end_date
validates_length_of :name, :maximum => 100, :allow_nil => true
validates_length_of :sku, :maximum => 50, :allow_nil => true
validates_date_of :effective_start_date, :effective_end_date
validates_length_of :name, :maximum => 100, :allow_nil => true
validates_length_of :sku, :maximum => 50, :allow_nil => true

define_attributes do
read_only :created_by_id, :created_date, :updated_by_id, :updated_date
Expand Down
2 changes: 1 addition & 1 deletion lib/zuora/objects/product_rate_plan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class ProductRatePlan < Base
has_many :product_rate_plan_charges

validates_length_of :description, :maximum => 500, :allow_nil => true
# validates_datetime_of :effective_start_date, :effective_end_date
validates_date_of :effective_start_date, :effective_end_date
validates_length_of :name, :maximum => 100, :allow_nil => true

define_attributes do
Expand Down
2 changes: 1 addition & 1 deletion lib/zuora/objects/product_rate_plan_charge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ProductRatePlanCharge < Base
INCLUDED_UNITS = ['Tiered Pricing','Tiered with Overage Pricing','Volume Pricing']
OVERAGE_CALCULATION_OPTIONS = %w(EndOfSmoothingPeriod PerBillingPeriod)
OVERAGE_UNUSED_UNITS_CREDIT_OPTIONS = %w(NoCredit CreditBySpecificRate)
# PRICE_INCREASE_OPTIONS = %w(FromTenantPercentageValue SpecificPercentageValue)
PRICE_INCREASE_OPTIONS = %w(FromTenantPercentageValue SpecificPercentageValue)
REV_REC_TRIGGER_CONDITIONS = %w(ContractEffectiveDate ServiceActivationDate CustomerAcceptanceDate)
SMOOTHING_MODELS = %w(RollingWindow Rollover)

Expand Down
10 changes: 5 additions & 5 deletions lib/zuora/objects/rate_plan_charge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class RatePlanCharge < Base
validates_numericality_of :bill_cycle_day, :only_integer => true, :greater_than_or_equal_to => 0, :less_than_or_equal_to => 31, :allow_nil => true
validates_inclusion_of :bill_cycle_type, :allow_nil => true, :in => %w(DefaultFromCustomer SpecificDayofMonth SubscriptionStartDay ChargeTriggerDay)
validates_inclusion_of :billing_period_alignment, :allow_nil => true, :in => %w(AlignToCharge AlignToSubscriptionStart AlignToTermStart)
# validates_datetime_of :charged_through_date, :allow_nil => true
validates_date_of :charged_through_date, :allow_nil => true
validates_inclusion_of :charge_model, :allow_nil => true, :in => CHARGE_MODELS
validates_length_of :charge_number, :maximum => 50 # String
validates_inclusion_of :charge_type, :in => %w(OneTime Recurring Usage)
Expand All @@ -41,8 +41,8 @@ class RatePlanCharge < Base
validates_numericality_of :discount_percentage, :allow_nil => true, :greater_than => 0
validates_numericality_of :dmrc, :allow_nil => true
validates_numericality_of :dtcv, :allow_nil => true
# validates_datetime_of :effective_end_date
# validates_datetime_of :effective_start_date
validates_date_of :effective_end_date
validates_date_of :effective_start_date
validates_numericality_of :included_units, :greater_than => 0, :if => Proc.new { |rpc| ['Overage','Tiered with Overage Pricing'].include?(rpc.charge_model) }
validates_inclusion_of :is_last_segment, :in => [true, false], :allow_nil => true
validates_numericality_of :mrr, :allow_nil => true
Expand All @@ -54,12 +54,12 @@ class RatePlanCharge < Base
validates_inclusion_of :overage_unused_units_credit_option, :allow_nil => true, :in => %w(NoCredit CreditBySpecificRate), :if => Proc.new { |rpc| ['Overage','Tiered with Overage Pricing'].include?(rpc.charge_model) }
validates_numericality_of :price, :allow_nil => true
validates_numericality_of :price_increase_percentage, :less_than_or_equal_to => 100, :greater_than_or_equal_to => -100, :allow_nil => true
# validates_datetime_of :processed_through_date, :allow_nil => true
validates_date_of :processed_through_date, :allow_nil => true
validates_numericality_of :quantity, :allow_nil => true, :greater_than_or_equal_to => 0
validates_numericality_of :rollover_balance, :allow_nil => true
validates_numericality_of :segment, :integer_only => true, :greater_than_or_equal_to => 1
validates_numericality_of :tcv
# validates_datetime_of :trigger_date, :allow_nil => true
validates_date_of :trigger_date, :allow_nil => true
validates_inclusion_of :trigger_event, :in => %w(ContractEffective CustomerAcceptance ServiceActivation SpecificDate)
validates_numericality_of :unused_units_credit_rates, :if => Proc.new { |rpc| ['Overage','Tiered with Overage Pricing'].include?(rpc.charge_model) }
validates_numericality_of :up_to_periods, :integer_only => true, :allow_nil => true
Expand Down
Loading

0 comments on commit 04f281f

Please sign in to comment.