def post_xml(action, xml)
apiclient_cert = cert_pem_to_x509(self.api_client_cert)
apiclient_key = key_pem_to_rsa(self.api_client_key)
conn = Faraday.new(ssl: {client_cert: apiclient_cert, client_key: apiclient_key}, headers: {'Content-Type' => 'application/xml'}) do |faraday|
faraday.adapter Faraday.default_adapter
end
res = conn.post(pay_url(action), xml, {'Content-Type' => 'application/xml'})
res
end
def cert_pem_to_x509(cert_pem)
cert_x509 = OpenSSL::X509::Certificate.new cert_pem
end
def key_pem_to_rsa(key_pem)
key_rsa = OpenSSL::PKey::RSA.new key_pem
end