Class: Jpay::PaymentRequest
- Inherits:
-
Object
- Object
- Jpay::PaymentRequest
- Defined in:
- lib/jpay/payment_request.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#order_id ⇒ Object
Returns the value of attribute order_id.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ PaymentRequest
constructor
A new instance of PaymentRequest.
- #pay ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ PaymentRequest
Note:
A hash of parametes should be send to this class
Returns a new instance of PaymentRequest.
19 20 21 22 23 24 25 26 27 |
# File 'lib/jpay/payment_request.rb', line 19 def initialize(args = {}) @api = args[:api] || Jpay.configuration.api @amount = args[:amount] @callback_url = args[:callback_url] || Jpay.configuration.callback_url @order_id = args[:order_id] @text = args[:text] @client ||= Savon.client(wsdl: Jpay.configuration.client, pretty_print_xml: true) @response = Response.new end |
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
6 7 8 |
# File 'lib/jpay/payment_request.rb', line 6 def amount @amount end |
#order_id ⇒ Object
Returns the value of attribute order_id.
6 7 8 |
# File 'lib/jpay/payment_request.rb', line 6 def order_id @order_id end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
7 8 9 |
# File 'lib/jpay/payment_request.rb', line 7 def response @response end |
#text ⇒ Object
Returns the value of attribute text.
6 7 8 |
# File 'lib/jpay/payment_request.rb', line 6 def text @text end |
Instance Method Details
#pay ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/jpay/payment_request.rb', line 29 def pay response = @client.call :requestpayment, message: { 'api' => @api, 'amount' => @amount, 'callback' => @callback_url, 'orderid' => @order_id, 'txt' => @text } @response.validate(response.body) end |