Class: ProcessingKz::GetTransaction
- Inherits:
-
Object
- Object
- ProcessingKz::GetTransaction
- Defined in:
- lib/processing_kz/get_transaction.rb
Instance Attribute Summary collapse
-
#amount_authorized ⇒ Object
readonly
Returns the value of attribute amount_authorized.
-
#amount_refunded ⇒ Object
readonly
Returns the value of attribute amount_refunded.
-
#amount_requested ⇒ Object
readonly
Returns the value of attribute amount_requested.
-
#auth_code ⇒ Object
readonly
Returns the value of attribute auth_code.
-
#customer_reference ⇒ Object
readonly
Returns the value of attribute customer_reference.
-
#goods ⇒ Object
Returns the value of attribute goods.
-
#merchant_id ⇒ Object
readonly
Returns the value of attribute merchant_id.
-
#merchant_local_date_time ⇒ Object
readonly
Returns the value of attribute merchant_local_date_time.
-
#merchant_online_address ⇒ Object
readonly
Returns the value of attribute merchant_online_address.
-
#purchaser_email ⇒ Object
readonly
Returns the value of attribute purchaser_email.
-
#purchaser_name ⇒ Object
readonly
Returns the value of attribute purchaser_name.
-
#purchaser_phone ⇒ Object
readonly
Returns the value of attribute purchaser_phone.
-
#transaction_currency_code ⇒ Object
readonly
Returns the value of attribute transaction_currency_code.
-
#transaction_status ⇒ Object
readonly
Returns the value of attribute transaction_status.
Instance Method Summary collapse
- #hashed_goods_list ⇒ Object
-
#initialize(args = {}) ⇒ GetTransaction
constructor
A new instance of GetTransaction.
- #request! ⇒ Object
- #response(args = {}) ⇒ Object
- #status ⇒ Object
- #total_amount ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ GetTransaction
Returns a new instance of GetTransaction.
21 22 23 24 25 |
# File 'lib/processing_kz/get_transaction.rb', line 21 def initialize(args= {}) @merchant_id = args[:merchant_id] || Config.merchant_id @customer_reference = args[:customer_reference] request! end |
Instance Attribute Details
#amount_authorized ⇒ Object (readonly)
Returns the value of attribute amount_authorized.
6 7 8 |
# File 'lib/processing_kz/get_transaction.rb', line 6 def end |
#amount_refunded ⇒ Object (readonly)
Returns the value of attribute amount_refunded.
6 7 8 |
# File 'lib/processing_kz/get_transaction.rb', line 6 def amount_refunded @amount_refunded end |
#amount_requested ⇒ Object (readonly)
Returns the value of attribute amount_requested.
6 7 8 |
# File 'lib/processing_kz/get_transaction.rb', line 6 def amount_requested @amount_requested end |
#auth_code ⇒ Object (readonly)
Returns the value of attribute auth_code.
6 7 8 |
# File 'lib/processing_kz/get_transaction.rb', line 6 def auth_code @auth_code end |
#customer_reference ⇒ Object (readonly)
Returns the value of attribute customer_reference.
6 7 8 |
# File 'lib/processing_kz/get_transaction.rb', line 6 def customer_reference @customer_reference end |
#goods ⇒ Object
Returns the value of attribute goods.
6 7 8 |
# File 'lib/processing_kz/get_transaction.rb', line 6 def goods @goods end |
#merchant_id ⇒ Object (readonly)
Returns the value of attribute merchant_id.
6 7 8 |
# File 'lib/processing_kz/get_transaction.rb', line 6 def merchant_id @merchant_id end |
#merchant_local_date_time ⇒ Object (readonly)
Returns the value of attribute merchant_local_date_time.
6 7 8 |
# File 'lib/processing_kz/get_transaction.rb', line 6 def merchant_local_date_time @merchant_local_date_time end |
#merchant_online_address ⇒ Object (readonly)
Returns the value of attribute merchant_online_address.
6 7 8 |
# File 'lib/processing_kz/get_transaction.rb', line 6 def merchant_online_address @merchant_online_address end |
#purchaser_email ⇒ Object (readonly)
Returns the value of attribute purchaser_email.
6 7 8 |
# File 'lib/processing_kz/get_transaction.rb', line 6 def purchaser_email @purchaser_email end |
#purchaser_name ⇒ Object (readonly)
Returns the value of attribute purchaser_name.
6 7 8 |
# File 'lib/processing_kz/get_transaction.rb', line 6 def purchaser_name @purchaser_name end |
#purchaser_phone ⇒ Object (readonly)
Returns the value of attribute purchaser_phone.
6 7 8 |
# File 'lib/processing_kz/get_transaction.rb', line 6 def purchaser_phone @purchaser_phone end |
#transaction_currency_code ⇒ Object (readonly)
Returns the value of attribute transaction_currency_code.
6 7 8 |
# File 'lib/processing_kz/get_transaction.rb', line 6 def transaction_currency_code @transaction_currency_code end |
#transaction_status ⇒ Object (readonly)
Returns the value of attribute transaction_status.
6 7 8 |
# File 'lib/processing_kz/get_transaction.rb', line 6 def transaction_status @transaction_status end |
Instance Method Details
#hashed_goods_list ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/processing_kz/get_transaction.rb', line 45 def hashed_goods_list hash = [] goods_list.each do |good| hash << good.to_hash end hash end |
#request! ⇒ Object
53 54 55 56 57 58 59 60 61 |
# File 'lib/processing_kz/get_transaction.rb', line 53 def request! client = Savon.client(wsdl: Config.wsdl, endpoint: Config.host) response = client.call(:get_transaction_status, message: { merchant_id: merchant_id, reference_nr: customer_reference } ) response(response.body[:get_transaction_status_response][:return]) end |
#response(args = {}) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/processing_kz/get_transaction.rb', line 63 def response(args = {}) @transaction_status = args[:transaction_status] @transaction_currency_code = args[:currency_code] || Config.currency_code @amount_requested = args[:amount_requested] = args[:amount_authorized] @amount_refunded = args[:amount_refunded] @auth_code = args[:auth_code] @purchaser_name = args[:purchaser_name] @purchaser_email = args[:purchaser_email] @purchaser_phone = args[:purchaser_phone] @merchant_online_address = args[:merchant_online_address] @merchant_local_date_time = args[:merchant_local_date_time] || Time.now self.goods = args[:goods_list] end |
#status ⇒ Object
27 28 29 |
# File 'lib/processing_kz/get_transaction.rb', line 27 def status @transaction_status end |
#total_amount ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/processing_kz/get_transaction.rb', line 36 def total_amount raise NoGoodsError unless goods_list total = 0 goods_list.each do |good| total += good.amount end total end |