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 70 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 179 def acknowledge(authcode = nil) checksum_ok? end
amount()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 121 def amount Money.from_amount(BigDecimal(gross), currency) end
amount_ok?(order_amount)
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 98 def amount_ok?(order_amount) amount == Money.from_amount(order_amount, currency) end
authidcode()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 133 def authidcode params['authIdCode'] end
checksum()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 141 def checksum params['signature'] end
checksum_ok?()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 183 def checksum_ok? fields = [invoice, transaction_status, sprintf('%.2f', amount), 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 75 def complete? status == "Completed" || status == 'Canceled' end
currency()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 149 def currency params['currency'] end
customer_address()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 169 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 153 def customer_email params['email'] end
customer_first_name()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 161 def customer_first_name params['firstName'] end
customer_last_name()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 165 def customer_last_name params['lastName'] end
customer_phone()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 157 def customer_phone params['mobileNo'] end
gross()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 117 def gross params['amount'] end
invoice()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 106 def invoice item_id end
invoice_ok?( order_id )
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 94 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 129 def issuerrefno params['issuerRefNo'] end
item_id()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 102 def item_id params['TxId'] end
message()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 175 def message @message || params['TxMsg'] end
paymentmode()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 145 def paymentmode params['paymentMode'] end
pgrespcode()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 137 def pgrespcode params['pgRespCode'] end
status()
click to toggle source
# File lib/offsite_payments/integrations/citrus.rb, line 79 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 125 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 113 def transaction_status params['TxStatus'] end