Class: OffsitePayments::Integrations::Citrus::Return

Inherits:
Return
  • Object
show all
Defined in:
lib/offsite_payments/integrations/citrus.rb

Instance Attribute Summary

Attributes inherited from Return

#notification, #params

Instance Method Summary collapse

Methods inherited from Return

#parse

Constructor Details

#initialize(query_string, options = {}) ⇒ Return

Returns a new instance of Return.



195
196
197
198
# File 'lib/offsite_payments/integrations/citrus.rb', line 195

def initialize(query_string, options = {})
  super
  @notification = Notification.new(query_string, options)
end

Instance Method Details

#cancelled?Boolean

Returns:

  • (Boolean)


220
221
222
# File 'lib/offsite_payments/integrations/citrus.rb', line 220

def cancelled?
  @notification.status == 'Failed'
end

#messageObject



216
217
218
# File 'lib/offsite_payments/integrations/citrus.rb', line 216

def message
  @notification.message
end

#status(order_id, order_amount) ⇒ Object



204
205
206
207
208
209
210
# File 'lib/offsite_payments/integrations/citrus.rb', line 204

def status( order_id, order_amount )
  if @notification.invoice_ok?( order_id ) && @notification.amount_ok?(BigDecimal(order_amount))
    @notification.status
  else
    'Mismatch'
  end
end

#success?Boolean

Returns:

  • (Boolean)


212
213
214
# File 'lib/offsite_payments/integrations/citrus.rb', line 212

def success?
  status( @params['TxId'], @params['amount'] ) == 'Completed'
end

#transaction_idObject



200
201
202
# File 'lib/offsite_payments/integrations/citrus.rb', line 200

def transaction_id
  @notification.transaction_id
end