class OffsitePayments::Integrations::Citrus::Notification
Public Class Methods
new(post, options = {})
click to toggle source
Calls superclass method
OffsitePayments::Notification::new
# File lib/offsite_payments/integrations/citrus.rb, line 71 def initialize(post, options = {}) super(post, options) @secret_key = options[:credential2] end
Public Instance Methods
acknowledge(authcode = nil)
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 180 def acknowledge(authcode = nil) checksum_ok? end
amount()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 122 def amount gross end
amount_ok?( order_amount )
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 99 def amount_ok?( order_amount ) BigDecimal.new( amount ) == order_amount end
authidcode()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 134 def authidcode params['authIdCode'] end
checksum()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 142 def checksum params['signature'] end
checksum_ok?()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 184 def checksum_ok? fields = [invoice, transaction_status, amount.to_s, transaction_id, issuerrefno, authidcode, customer_first_name, customer_last_name, pgrespcode, customer_address[:zip]].join unless Citrus.checksum(@secret_key, fields ) == checksum @message = 'checksum mismatch...' return false end true end
complete?()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 76 def complete? status == "Completed" || status == 'Canceled' end
currency()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 150 def currency params['currency'] end
customer_address()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 170 def customer_address { :address1 => params['addressStreet1'], :address2 => params['addressStreet2'], :city => params['addressCity'], :state => params['addressState'], :country => params['addressCountry'], :zip => params['addressZip'] } end
customer_email()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 154 def customer_email params['email'] end
customer_first_name()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 162 def customer_first_name params['firstName'] end
customer_last_name()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 166 def customer_last_name params['lastName'] end
customer_phone()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 158 def customer_phone params['mobileNo'] end
gross()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 118 def gross params['amount'] end
invoice()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 107 def invoice item_id end
invoice_ok?( order_id )
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 95 def invoice_ok?( order_id ) order_id.to_s == invoice.to_s end
issuerrefno()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 130 def issuerrefno params['issuerRefNo'] end
item_id()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 103 def item_id params['TxId'] end
message()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 176 def message @message || params['TxMsg'] end
paymentmode()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 146 def paymentmode params['paymentMode'] end
pgrespcode()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 138 def pgrespcode params['pgRespCode'] end
status()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 80 def status @status ||= if checksum_ok? if transaction_id.blank? 'Invalid' else case transaction_status.downcase when 'success' then 'Completed' when 'canceled' then 'Failed' end end else 'Tampered' end end
transaction_id()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 126 def transaction_id params['pgTxnNo'] end
transaction_status()
click to toggle source
Status of transaction return from the Citrus
. List of possible values:
SUCCESS
CANCELED
# File lib/offsite_payments/integrations/citrus.rb, line 114 def transaction_status params['TxStatus'] end