Class: ActiveMerchant::Billing::Integrations::Ebs::Notification
- Inherits:
-
Notification
- Object
- Notification
- ActiveMerchant::Billing::Integrations::Ebs::Notification
- Defined in:
- lib/active_merchant_ebs/notification.rb
Constant Summary collapse
- NECESSARY =
Necessary parameters in the :DR returned by ebs
[ "Mode", "PaymentID", "DateCreated", "MerchantRefNo", "Amount", "TransactionID", "ResponseCode", "ResponseMessage" ]
Instance Attribute Summary collapse
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
- #complete? ⇒ Boolean
- #ebsin_decode(data, key) ⇒ Object
-
#gross ⇒ Object
the money amount we received in X.2 decimal.
-
#parse(post) ⇒ Object
processing geteway returned data.
- #payment_id ⇒ Object
- #secret_key ⇒ Object
- #status ⇒ Object
- #successful? ⇒ Boolean
- #transaction_id ⇒ Object
- #valid? ⇒ Boolean
Instance Attribute Details
#params ⇒ Object
Returns the value of attribute params.
9 10 11 |
# File 'lib/active_merchant_ebs/notification.rb', line 9 def params @params end |
Instance Method Details
#complete? ⇒ Boolean
56 57 58 |
# File 'lib/active_merchant_ebs/notification.rb', line 56 def complete? 'Y' == self.status end |
#ebsin_decode(data, key) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/active_merchant_ebs/notification.rb', line 33 def ebsin_decode(data, key) rc4 = RubyRc4.new(key) params = (Hash[ rc4.encrypt(Base64.decode64(data.gsub(/ /,'+'))).split('&').map { |x| x.split("=") } ]).slice(* NECESSARY ) params end |
#gross ⇒ Object
the money amount we received in X.2 decimal.
73 74 75 |
# File 'lib/active_merchant_ebs/notification.rb', line 73 def gross params['Amount'] end |
#parse(post) ⇒ Object
processing geteway returned data
25 26 27 28 29 30 31 |
# File 'lib/active_merchant_ebs/notification.rb', line 25 def parse(post) rc4 = RubyRc4.new(self.secret_key) params = (Hash[ rc4.encrypt(Base64.decode64(post.gsub(/ /,'+'))).split('&').map { |x| x.split("=") } ]).slice(* NECESSARY ) self.params = params end |
#payment_id ⇒ Object
60 61 62 |
# File 'lib/active_merchant_ebs/notification.rb', line 60 def payment_id params['PaymentID'] end |
#secret_key ⇒ Object
68 69 70 |
# File 'lib/active_merchant_ebs/notification.rb', line 68 def secret_key ActiveMerchant::Billing::Integrations::Ebs.secret_key end |
#status ⇒ Object
77 78 79 |
# File 'lib/active_merchant_ebs/notification.rb', line 77 def status params['ResponseMessage'] end |
#successful? ⇒ Boolean
40 41 42 |
# File 'lib/active_merchant_ebs/notification.rb', line 40 def successful? "Transaction Successful" == self.status end |
#transaction_id ⇒ Object
64 65 66 |
# File 'lib/active_merchant_ebs/notification.rb', line 64 def transaction_id params['TransactionID'] end |
#valid? ⇒ Boolean
44 45 46 47 48 49 50 51 52 |
# File 'lib/active_merchant_ebs/notification.rb', line 44 def valid? verify_checksum( ActiveMerchant::Billing::Integrations::Ebs.account_id, self.payment_id, self.gross, self.status, ActiveMerchant::Billing::Integrations::Ebs.secret_key ) end |