Module: STP::PaymentOrder

Defined in:
lib/stp/payment_order.rb

Class Method Summary collapse

Class Method Details

.create(payment_order) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/stp/payment_order.rb', line 3

def self.create(payment_order)
  payment_order.signature = Crypto::Commons.rsa_seal(STP.private_key, STP.private_key_password, payment_order.original_chain)
  connection = Faraday.new(url: "#{STP.api_uri}/ordenPago/registra")
  response = connection.put do |req|
    req.url ''
    req.headers['Content-Type'] = 'application/json'
    req.body = payment_order.to_json
  end
  hash = JSON.parse(response.body)
  hash['resultado']
end