Class: BanorteTransaction
- Inherits:
-
Object
- Object
- BanorteTransaction
- Defined in:
- lib/banorte_payworks/banorte_transaction.rb
Instance Attribute Summary collapse
-
#_original_post ⇒ Object
Returns the value of attribute _original_post.
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#authnum ⇒ Object
Returns the value of attribute authnum.
-
#card_number ⇒ Object
Returns the value of attribute card_number.
-
#card_type ⇒ Object
Returns the value of attribute card_type.
-
#cvv ⇒ Object
Returns the value of attribute cvv.
-
#e ⇒ Object
Returns the value of attribute e.
-
#error_code ⇒ Object
Returns the value of attribute error_code.
-
#exp_date ⇒ Object
Returns the value of attribute exp_date.
-
#issuing_bank ⇒ Object
Returns the value of attribute issuing_bank.
-
#message ⇒ Object
Returns the value of attribute message.
-
#order_id ⇒ Object
Returns the value of attribute order_id.
-
#time_in ⇒ Object
Returns the value of attribute time_in.
-
#time_out ⇒ Object
Returns the value of attribute time_out.
-
#transaction_status ⇒ Object
Returns the value of attribute transaction_status.
-
#transaction_type ⇒ Object
Returns the value of attribute transaction_type.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#_original_post ⇒ Object
Returns the value of attribute _original_post.
2 3 4 |
# File 'lib/banorte_payworks/banorte_transaction.rb', line 2 def _original_post @_original_post end |
#amount ⇒ Object
Returns the value of attribute amount.
2 3 4 |
# File 'lib/banorte_payworks/banorte_transaction.rb', line 2 def amount @amount end |
#authnum ⇒ Object
Returns the value of attribute authnum.
2 3 4 |
# File 'lib/banorte_payworks/banorte_transaction.rb', line 2 def authnum @authnum end |
#card_number ⇒ Object
Returns the value of attribute card_number.
2 3 4 |
# File 'lib/banorte_payworks/banorte_transaction.rb', line 2 def card_number @card_number end |
#card_type ⇒ Object
Returns the value of attribute card_type.
2 3 4 |
# File 'lib/banorte_payworks/banorte_transaction.rb', line 2 def card_type @card_type end |
#cvv ⇒ Object
Returns the value of attribute cvv.
2 3 4 |
# File 'lib/banorte_payworks/banorte_transaction.rb', line 2 def cvv @cvv end |
#e ⇒ Object
Returns the value of attribute e.
2 3 4 |
# File 'lib/banorte_payworks/banorte_transaction.rb', line 2 def e @e end |
#error_code ⇒ Object
Returns the value of attribute error_code.
2 3 4 |
# File 'lib/banorte_payworks/banorte_transaction.rb', line 2 def error_code @error_code end |
#exp_date ⇒ Object
Returns the value of attribute exp_date.
2 3 4 |
# File 'lib/banorte_payworks/banorte_transaction.rb', line 2 def exp_date @exp_date end |
#issuing_bank ⇒ Object
Returns the value of attribute issuing_bank.
2 3 4 |
# File 'lib/banorte_payworks/banorte_transaction.rb', line 2 def issuing_bank @issuing_bank end |
#message ⇒ Object
Returns the value of attribute message.
2 3 4 |
# File 'lib/banorte_payworks/banorte_transaction.rb', line 2 def @message end |
#order_id ⇒ Object
Returns the value of attribute order_id.
2 3 4 |
# File 'lib/banorte_payworks/banorte_transaction.rb', line 2 def order_id @order_id end |
#time_in ⇒ Object
Returns the value of attribute time_in.
2 3 4 |
# File 'lib/banorte_payworks/banorte_transaction.rb', line 2 def time_in @time_in end |
#time_out ⇒ Object
Returns the value of attribute time_out.
2 3 4 |
# File 'lib/banorte_payworks/banorte_transaction.rb', line 2 def time_out @time_out end |
#transaction_status ⇒ Object
Returns the value of attribute transaction_status.
2 3 4 |
# File 'lib/banorte_payworks/banorte_transaction.rb', line 2 def transaction_status @transaction_status end |
#transaction_type ⇒ Object
Returns the value of attribute transaction_type.
2 3 4 |
# File 'lib/banorte_payworks/banorte_transaction.rb', line 2 def transaction_type @transaction_type end |
Class Method Details
.from_post(post) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/banorte_payworks/banorte_transaction.rb', line 7 def self.from_post(post) #TODO this big huge method needs to be abstracted to an a class and we need to cas the proper primitive types parsed_post = CGI::parse(post) create_with_properties self do |transaction| transaction._original_post = post transaction.error_code = parsed_post['CcErrCode'][0] transaction. = parsed_post['Text'][0] transaction.authnum = parsed_post['AuthCode'][0] transaction.order_id = parsed_post['OrderId'][0] transaction.amount = parsed_post['Total'][0] transaction.time_in = parsed_post['TimeIn'][0] transaction.time_out = parsed_post['TimeOut'][0] transaction.e = [parsed_post['E1'][0], parsed_post['E2'][0], parsed_post['E3'][0]] transaction.card_type = parsed_post['CardType'][0] transaction.issuing_bank = parsed_post['IssuingBank'][0] transaction.transaction_type = parsed_post['TransType'][0] transaction.transaction_status = parsed_post['TransStat'][0] transaction.card_number = parsed_post['Number'][0] end end |
Instance Method Details
#valid? ⇒ Boolean
33 34 35 |
# File 'lib/banorte_payworks/banorte_transaction.rb', line 33 def valid? error_code.eql? '1' end |
#validate! ⇒ Object
37 38 39 |
# File 'lib/banorte_payworks/banorte_transaction.rb', line 37 def validate! raise BpayworksException.new("Error::#{error_code}: #{}") unless valid? end |