Class: QiwiPay::Api::PaymentOperation

Inherits:
PaymentOperation show all
Defined in:
lib/qiwi-pay/api/payment_operation.rb

Overview

General QiwiPay API payment operation request

Direct Known Subclasses

ReversalOperation

Constant Summary

Constants inherited from PaymentOperation

PaymentOperation::ATTRIBUTES

Instance Method Summary collapse

Methods inherited from PaymentOperation

#amount, #callback_url=, description, #description, #initialize, #opcode, opcode, #order_expire=

Constructor Details

This class inherits a constructor from QiwiPay::PaymentOperation

Instance Method Details

#performResponse

Returns:



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/qiwi-pay/api/payment_operation.rb', line 9

def perform
  res = RestClient::Resource.new(
    url,
    ssl_client_cert: credentials.certificate,
    ssl_client_key:  credentials.key,
    verify_ssl:      OpenSSL::SSL::VERIFY_PEER
  ).post(request_params.to_json)

  Response.new res.code, res.body
rescue RestClient::Unauthorized, RestClient::Forbidden
  Response.new 403, 'Access denied'
rescue RestClient::ExceptionWithResponse => e
  Response.new e.response && e.response.code,
               e.response ? e.response.body : e.to_s
end