Class: Moka::Payment
- Inherits:
-
Object
- Object
- Moka::Payment
- Defined in:
- lib/moka/model/payment.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#buyer ⇒ Object
Returns the value of attribute buyer.
-
#card_holder_full_name ⇒ Object
Returns the value of attribute card_holder_full_name.
-
#card_number ⇒ Object
Returns the value of attribute card_number.
-
#card_token ⇒ Object
Returns the value of attribute card_token.
-
#client_ip ⇒ Object
Returns the value of attribute client_ip.
-
#credit_card ⇒ Object
Returns the value of attribute credit_card.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#cvc_number ⇒ Object
Returns the value of attribute cvc_number.
-
#description ⇒ Object
Returns the value of attribute description.
-
#exp_month ⇒ Object
Returns the value of attribute exp_month.
-
#exp_year ⇒ Object
Returns the value of attribute exp_year.
-
#installment_number ⇒ Object
Returns the value of attribute installment_number.
-
#integrator_id ⇒ Object
Returns the value of attribute integrator_id.
-
#is_pool_payment ⇒ Object
Returns the value of attribute is_pool_payment.
-
#is_pre_auth ⇒ Object
Returns the value of attribute is_pre_auth.
-
#other_trx_code ⇒ Object
Returns the value of attribute other_trx_code.
-
#redirect_type ⇒ Object
Returns the value of attribute redirect_type.
-
#redirect_url ⇒ Object
Returns the value of attribute redirect_url.
-
#refund_request_id ⇒ Object
Returns the value of attribute refund_request_id.
-
#response ⇒ Object
Returns the value of attribute response.
-
#result_code ⇒ Object
Returns the value of attribute result_code.
-
#software ⇒ Object
Returns the value of attribute software.
-
#virtual_pos_order_id ⇒ Object
Returns the value of attribute virtual_pos_order_id.
-
#void_refund_reason ⇒ Object
Returns the value of attribute void_refund_reason.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Payment
constructor
A new instance of Payment.
- #pay ⇒ Object
- #pay_three_d ⇒ Object
- #refund ⇒ Object
- #success? ⇒ Boolean
- #void ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Payment
Returns a new instance of Payment.
13 14 15 16 17 |
# File 'lib/moka/model/payment.rb', line 13 def initialize(opts = {}) opts.each do |o| send("#{o.first.to_s}=".to_sym, o.last) end end |
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
3 4 5 |
# File 'lib/moka/model/payment.rb', line 3 def amount @amount end |
#buyer ⇒ Object
Returns the value of attribute buyer.
3 4 5 |
# File 'lib/moka/model/payment.rb', line 3 def buyer @buyer end |
#card_holder_full_name ⇒ Object
Returns the value of attribute card_holder_full_name.
3 4 5 |
# File 'lib/moka/model/payment.rb', line 3 def card_holder_full_name @card_holder_full_name end |
#card_number ⇒ Object
Returns the value of attribute card_number.
3 4 5 |
# File 'lib/moka/model/payment.rb', line 3 def card_number @card_number end |
#card_token ⇒ Object
Returns the value of attribute card_token.
3 4 5 |
# File 'lib/moka/model/payment.rb', line 3 def card_token @card_token end |
#client_ip ⇒ Object
Returns the value of attribute client_ip.
3 4 5 |
# File 'lib/moka/model/payment.rb', line 3 def client_ip @client_ip end |
#credit_card ⇒ Object
Returns the value of attribute credit_card.
3 4 5 |
# File 'lib/moka/model/payment.rb', line 3 def credit_card @credit_card end |
#currency ⇒ Object
Returns the value of attribute currency.
3 4 5 |
# File 'lib/moka/model/payment.rb', line 3 def currency @currency end |
#cvc_number ⇒ Object
Returns the value of attribute cvc_number.
3 4 5 |
# File 'lib/moka/model/payment.rb', line 3 def cvc_number @cvc_number end |
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/moka/model/payment.rb', line 3 def description @description end |
#exp_month ⇒ Object
Returns the value of attribute exp_month.
3 4 5 |
# File 'lib/moka/model/payment.rb', line 3 def exp_month @exp_month end |
#exp_year ⇒ Object
Returns the value of attribute exp_year.
3 4 5 |
# File 'lib/moka/model/payment.rb', line 3 def exp_year @exp_year end |
#installment_number ⇒ Object
Returns the value of attribute installment_number.
3 4 5 |
# File 'lib/moka/model/payment.rb', line 3 def installment_number @installment_number end |
#integrator_id ⇒ Object
Returns the value of attribute integrator_id.
3 4 5 |
# File 'lib/moka/model/payment.rb', line 3 def integrator_id @integrator_id end |
#is_pool_payment ⇒ Object
Returns the value of attribute is_pool_payment.
3 4 5 |
# File 'lib/moka/model/payment.rb', line 3 def is_pool_payment @is_pool_payment end |
#is_pre_auth ⇒ Object
Returns the value of attribute is_pre_auth.
3 4 5 |
# File 'lib/moka/model/payment.rb', line 3 def is_pre_auth @is_pre_auth end |
#other_trx_code ⇒ Object
Returns the value of attribute other_trx_code.
3 4 5 |
# File 'lib/moka/model/payment.rb', line 3 def other_trx_code @other_trx_code end |
#redirect_type ⇒ Object
Returns the value of attribute redirect_type.
3 4 5 |
# File 'lib/moka/model/payment.rb', line 3 def redirect_type @redirect_type end |
#redirect_url ⇒ Object
Returns the value of attribute redirect_url.
3 4 5 |
# File 'lib/moka/model/payment.rb', line 3 def redirect_url @redirect_url end |
#refund_request_id ⇒ Object
Returns the value of attribute refund_request_id.
3 4 5 |
# File 'lib/moka/model/payment.rb', line 3 def refund_request_id @refund_request_id end |
#response ⇒ Object
Returns the value of attribute response.
3 4 5 |
# File 'lib/moka/model/payment.rb', line 3 def response @response end |
#result_code ⇒ Object
Returns the value of attribute result_code.
3 4 5 |
# File 'lib/moka/model/payment.rb', line 3 def result_code @result_code end |
#software ⇒ Object
Returns the value of attribute software.
3 4 5 |
# File 'lib/moka/model/payment.rb', line 3 def software @software end |
#virtual_pos_order_id ⇒ Object
Returns the value of attribute virtual_pos_order_id.
3 4 5 |
# File 'lib/moka/model/payment.rb', line 3 def virtual_pos_order_id @virtual_pos_order_id end |
#void_refund_reason ⇒ Object
Returns the value of attribute void_refund_reason.
3 4 5 |
# File 'lib/moka/model/payment.rb', line 3 def void_refund_reason @void_refund_reason end |
Instance Method Details
#pay ⇒ Object
19 20 21 22 23 24 |
# File 'lib/moka/model/payment.rb', line 19 def pay response = RestClient.post Moka.endpoints.direct_payment, payment_hash self.response = JSON.parse(response.body) self.result_code = self.response['ResultCode'] self.response end |
#pay_three_d ⇒ Object
26 27 28 29 30 31 |
# File 'lib/moka/model/payment.rb', line 26 def pay_three_d response = RestClient.post Moka.endpoints.direct_payment_three_d, three_d_payment_hash self.response = JSON.parse(response.body) self.result_code = self.response['ResultCode'] self.response end |
#refund ⇒ Object
40 41 42 43 44 45 |
# File 'lib/moka/model/payment.rb', line 40 def refund response = RestClient.post Moka.endpoints.refund, refund_hash self.response = JSON.parse(response.body) self.result_code = self.response['ResultCode'] self.response end |
#success? ⇒ Boolean
47 48 49 |
# File 'lib/moka/model/payment.rb', line 47 def success? response && response['ResultCode'] == 'Success' && response['Data']['IsSuccessful'] == true end |