class Express::Payment::Recurring::Billing
Attributes
amount[RW]
trial[RW]
Public Class Methods
new(attributes = {})
click to toggle source
Calls superclass method
Express::Base::new
# File lib/express/payment/recurring/billing.rb, line 7 def initialize(attributes = {}) @amount = if attributes[:amount].is_a?(Common::Amount) attributes[:amount] else Common::Amount.new( :total => attributes[:amount], :tax => attributes[:tax_amount], :shipping => attributes[:shipping_amount] ) end @trial = Recurring::Billing.new(attributes[:trial]) if attributes[:trial].present? super end
Public Instance Methods
to_params()
click to toggle source
# File lib/express/payment/recurring/billing.rb, line 21 def to_params trial_params = (trial.try(:to_params) || {}).inject({}) do |trial_params, (key, value)| trial_params.merge( :"TRIAL#{key}" => value ) end trial_params.merge( :BILLINGPERIOD => self.period, :BILLINGFREQUENCY => self.frequency, :TOTALBILLINGCYCLES => self.total_cycles, :AMT => Util.formatted_amount(self.amount.total), :CURRENCYCODE => self.currency_code, :SHIPPINGAMT => Util.formatted_amount(self.amount.shipping), :TAXAMT => Util.formatted_amount(self.amount.tax) ) end