Class: OffsitePayments::Integrations::RealexOffsite::Notification
- Inherits:
-
Notification
- Object
- Notification
- OffsitePayments::Integrations::RealexOffsite::Notification
show all
- Includes:
- Common
- Defined in:
- lib/offsite_payments/integrations/realex_offsite.rb
Constant Summary
Constants included
from Common
Common::CANADIAN_STATES, Common::COUNTRY_PHONE_NUMBERS, Common::CURRENCY_SPECIAL_MINOR_UNITS, Common::US_STATES
Instance Attribute Summary
Attributes inherited from Notification
#params, #raw
Instance Method Summary
collapse
Methods included from Common
#add_field, #adjust_phone_number_length, #copy_billing_address, #create_signature, #extract_address_match_indicator, #extract_avs_code, #extract_digits, #format_amount, #format_amount_as_float, #format_phone_number, #get_message, #get_pattern, #lookup_state_code, #validate
#amount, #empty!, #gross_cents, #iso_currency, #valid_sender?
Constructor Details
#initialize(post, options = {}) ⇒ Notification
Returns a new instance of Notification.
726
727
728
729
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 726
def initialize(post, options={})
super
@secret = options[:credential3]
end
|
Instance Method Details
#acknowledge(authcode = nil) ⇒ Object
Required Notification methods to define
732
733
734
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 732
def acknowledge(authcode = nil)
verified?
end
|
#authcode ⇒ Object
795
796
797
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 795
def authcode
params['AUTHCODE']
end
|
#avs_address_result ⇒ Object
821
822
823
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 821
def avs_address_result
params['AVSADDRESSRESULT']
end
|
#avs_postcode_result ⇒ Object
817
818
819
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 817
def avs_postcode_result
params['AVSPOSTCODERESULT']
end
|
#calculated_signature ⇒ Object
803
804
805
806
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 803
def calculated_signature
fields = [timestamp, merchant_id, order_id, result, message, pasref, authcode]
create_signature(fields, @secret)
end
|
#cavv ⇒ Object
833
834
835
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 833
def cavv
params['CAVV']
end
|
#checkout_id ⇒ Object
779
780
781
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 779
def checkout_id
params['CHECKOUT_ID']
end
|
#complete? ⇒ Boolean
766
767
768
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 766
def complete?
verified? && status == 'Completed'
end
|
#currency ⇒ Object
Realex does not send back the currency param by default we have sent this additional parameter
758
759
760
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 758
def currency
params['X-CURRENCY']
end
|
#cvn_result ⇒ Object
Extra data (available from Realex)
813
814
815
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 813
def cvn_result
params['CVNRESULT']
end
|
#eci ⇒ Object
829
830
831
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 829
def eci
params['ECI']
end
|
#gross ⇒ Object
762
763
764
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 762
def gross
format_amount_as_float(params['AMOUNT'], currency)
end
|
#item_id ⇒ Object
736
737
738
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 736
def item_id
checkout_id
end
|
#merchant_id ⇒ Object
775
776
777
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 775
def merchant_id
params['MERCHANT_ID']
end
|
#message ⇒ Object
791
792
793
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 791
def message
params['MESSAGE']
end
|
#order_id ⇒ Object
783
784
785
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 783
def order_id
params['ORDER_ID']
end
|
#pasref ⇒ Object
825
826
827
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 825
def pasref
params['PASREF']
end
|
#result ⇒ Object
787
788
789
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 787
def result
params['RESULT']
end
|
#signature ⇒ Object
799
800
801
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 799
def signature
params['SHA1HASH']
end
|
#status ⇒ Object
748
749
750
751
752
753
754
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 748
def status
if result == '00'
'Completed'
else
'Invalid'
end
end
|
#test? ⇒ Boolean
744
745
746
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 744
def test?
params['X-TEST']
end
|
#timestamp ⇒ Object
Fields for Realex signature verification
771
772
773
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 771
def timestamp
params['TIMESTAMP']
end
|
#transaction_id ⇒ Object
740
741
742
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 740
def transaction_id
pasref
end
|
#verified? ⇒ Boolean
808
809
810
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 808
def verified?
signature == calculated_signature
end
|
#xid ⇒ Object
837
838
839
|
# File 'lib/offsite_payments/integrations/realex_offsite.rb', line 837
def xid
params['XID']
end
|