diff --git a/lib/zuora/objects/amendment.rb b/lib/zuora/objects/amendment.rb index f8bd5b7..fd806eb 100644 --- a/lib/zuora/objects/amendment.rb +++ b/lib/zuora/objects/amendment.rb @@ -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 diff --git a/lib/zuora/objects/invoice.rb b/lib/zuora/objects/invoice.rb index f953895..c94f019 100644 --- a/lib/zuora/objects/invoice.rb +++ b/lib/zuora/objects/invoice.rb @@ -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( diff --git a/lib/zuora/objects/invoice_adjustment.rb b/lib/zuora/objects/invoice_adjustment.rb index 858dcc0..3ae3e73 100644 --- a/lib/zuora/objects/invoice_adjustment.rb +++ b/lib/zuora/objects/invoice_adjustment.rb @@ -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? } @@ -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( diff --git a/lib/zuora/objects/invoice_item.rb b/lib/zuora/objects/invoice_item.rb index 204aa17..47b9be0 100644 --- a/lib/zuora/objects/invoice_item.rb +++ b/lib/zuora/objects/invoice_item.rb @@ -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, diff --git a/lib/zuora/objects/invoice_item_adjustment.rb b/lib/zuora/objects/invoice_item_adjustment.rb index fdff9da..11126d9 100644 --- a/lib/zuora/objects/invoice_item_adjustment.rb +++ b/lib/zuora/objects/invoice_item_adjustment.rb @@ -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 @@ -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( diff --git a/lib/zuora/objects/payment.rb b/lib/zuora/objects/payment.rb index 5f3faa7..f7ae432 100644 --- a/lib/zuora/objects/payment.rb +++ b/lib/zuora/objects/payment.rb @@ -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, diff --git a/lib/zuora/objects/product.rb b/lib/zuora/objects/product.rb index 7679714..5e4ec64 100644 --- a/lib/zuora/objects/product.rb +++ b/lib/zuora/objects/product.rb @@ -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 diff --git a/lib/zuora/objects/product_rate_plan.rb b/lib/zuora/objects/product_rate_plan.rb index 097496e..401d580 100644 --- a/lib/zuora/objects/product_rate_plan.rb +++ b/lib/zuora/objects/product_rate_plan.rb @@ -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 diff --git a/lib/zuora/objects/product_rate_plan_charge.rb b/lib/zuora/objects/product_rate_plan_charge.rb index 5bbb90b..7dd9904 100644 --- a/lib/zuora/objects/product_rate_plan_charge.rb +++ b/lib/zuora/objects/product_rate_plan_charge.rb @@ -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) diff --git a/lib/zuora/objects/rate_plan_charge.rb b/lib/zuora/objects/rate_plan_charge.rb index 63b4c1d..18b212e 100644 --- a/lib/zuora/objects/rate_plan_charge.rb +++ b/lib/zuora/objects/rate_plan_charge.rb @@ -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) @@ -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 @@ -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 diff --git a/lib/zuora/objects/refund.rb b/lib/zuora/objects/refund.rb index 4ee1d96..5c83cb0 100644 --- a/lib/zuora/objects/refund.rb +++ b/lib/zuora/objects/refund.rb @@ -15,7 +15,7 @@ class Refund < Base validates_length_of :gateway_response_code, :maximum => 20 validates_inclusion_of :method_type, :in => %w(ACH Cash Check CreditCard Other PayPal WireTransfer DebitCard CreditCardReferenceTransaction) validates_length_of :payment_method_id, :maximum => 60 - # validates_datetime_of :refund_date + validates_date_of :refund_date # validates_datetime_of :refund_transaction_time, :allow_nil => true validates_length_of :soft_descriptor, :maximum => 35, :allow_nil => true validates_length_of :soft_descriptor_phone, :maximum => 20, :allow_nil => true diff --git a/lib/zuora/objects/subscription.rb b/lib/zuora/objects/subscription.rb index 034edbd..e3e4eb3 100644 --- a/lib/zuora/objects/subscription.rb +++ b/lib/zuora/objects/subscription.rb @@ -12,18 +12,18 @@ class Subscription < Base :renewal_term validates_inclusion_of :auto_renew, :in => [true, false] - # validates_datetime_of :cancelled_date, :allow_nil => true - # validates_datetime_of :contract_acceptance_date, :allow_nil => true - # validates_datetime_of :contract_effective_date + validates_date_of :cancelled_date, :allow_nil => true + validates_date_of :contract_acceptance_date, :allow_nil => true + validates_date_of :contract_effective_date validates_numericality_of :initial_term, :only_integer => true, :minimum => 1 validates_inclusion_of :is_invoice_separate, :in => [true, false], :allow_nil => true validates_length_of :name, :maximum => 100 validates_length_of :notes, :maximum => 500, :allow_nil => true - # validates_datetime_of :original_created_date, :allow_nil => true + validates_datetime_of :original_created_date, :allow_nil => true validates_numericality_of :renewal_term, :only_integer => true - # validates_datetime_of :service_activation_date, :allow_nil => true - # validates_datetime_of :term_end_date, :allow_nil => true - # validates_datetime_of :term_start_date + validates_date_of :service_activation_date, :allow_nil => true + validates_date_of :term_end_date, :allow_nil => true + validates_date_of :term_start_date validates_inclusion_of :term_type, :in => ['TERMED', 'EVERGREEN'], :allow_nil => true define_attributes do diff --git a/lib/zuora/objects/usage.rb b/lib/zuora/objects/usage.rb index d4fbef2..fd9082a 100644 --- a/lib/zuora/objects/usage.rb +++ b/lib/zuora/objects/usage.rb @@ -13,8 +13,8 @@ class Usage < Base validates_presence_of :subscription_id, :unless => :subscription_number validates_length_of :subscription_number, :maximum => 255, :unless => :subscription_id - # validates_datetime_of :start_date_time, :allow_nil => true - # validates_datetime_of :end_date_time, :allow_nil => true + validates_datetime_of :start_date_time, :allow_nil => true + validates_datetime_of :end_date_time, :allow_nil => true validates_presence_of :description, :maximum => 255, :allow_nil => true validates_numericality_of :quantity