Class: PayU::Client
- Inherits:
-
Object
- Object
- PayU::Client
- Defined in:
- lib/pay_u/client.rb
Instance Method Summary collapse
- #authorize ⇒ Object
- #cancel_order(order_id) ⇒ Object
-
#initialize(configuration, http_client) ⇒ Client
constructor
A new instance of Client.
- #place_order(buyer, products, total_amount, meta = {}) ⇒ Object
- #refund_order(order_id, amount = nil) ⇒ Object
Constructor Details
#initialize(configuration, http_client) ⇒ Client
Returns a new instance of Client.
9 10 11 12 |
# File 'lib/pay_u/client.rb', line 9 def initialize(configuration, http_client) @configuration = configuration @http_client = http_client end |
Instance Method Details
#authorize ⇒ Object
14 15 16 |
# File 'lib/pay_u/client.rb', line 14 def . end |
#cancel_order(order_id) ⇒ Object
32 33 34 |
# File 'lib/pay_u/client.rb', line 32 def cancel_order(order_id) orders_service.cancel_order(order_id, PayU::BaseRequest.new(headers)) end |
#place_order(buyer, products, total_amount, meta = {}) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/pay_u/client.rb', line 18 def place_order(buyer, products, total_amount, = {}) request_hash = ().merge({ buyer: buyer, products: products, total_amount: total_amount }) request = PayU::BaseRequest.new(headers, request_hash) orders_service.place_order(request) end |
#refund_order(order_id, amount = nil) ⇒ Object
27 28 29 30 |
# File 'lib/pay_u/client.rb', line 27 def refund_order(order_id, amount = nil) request_hash = { refund: { description: "Refund" } }.merge(refund_amount(amount)) orders_service.refund_order(order_id, PayU::BaseRequest.new(headers, request_hash)) end |