pagseguro / pagseguro-sdk-ruby Goto Github PK
View Code? Open in Web Editor NEWBiblioteca de integração em Ruby
Biblioteca de integração em Ruby
How can I avoid duplicate transactions for same order.
Este relatório deve ser usado APENAS para reportar bugs
The method should return transaction data
I get a message error:
I, [2019-01-15T15:08:20.182851 #19753] INFO -- : Started POST "/notifications?notificationCode=DE26F9-5D0E0F0E0F12-5BB4825F8B7B-70A25A¬ificationType=transaction" for 187.115.6$ I, [2019-01-15T15:08:20.186399 #19753] INFO -- : Processing by NotificationsController#create as */* I, [2019-01-15T15:08:20.186599 #19753] INFO -- : Parameters: {"notificationCode"=>"DE26F9-5D0E0F0E0F12-5BB4825F8B7B-70A25A", "notificationType"=>"transaction"} I, [2019-01-15T15:08:20.188627 #19753] INFO -- : Notifications I, [2019-01-15T15:08:20.470655 #19753] INFO -- : Completed 500 Internal Server Error in 284ms (ActiveRecord: 0.0ms) F, [2019-01-15T15:08:20.471845 #19753] FATAL -- : F, [2019-01-15T15:08:20.471932 #19753] FATAL -- : ArgumentError (invalid value for BigDecimal(): ""): F, [2019-01-15T15:08:20.471996 #19753] FATAL -- : F, [2019-01-15T15:08:20.472058 #19753] FATAL -- : app/controllers/notifications_controller.rb:8:in
create'`
Estou usando a gem para fazer a integração com a api de pagamentos, entretanto, estou recebendo erro "Unauthorized" com minhas credenciais configuradas.
Já fiz vários testes e parece que o problema ocorre somente com a gem (suspeito que seja com o Aitch).
Fiz o mesmo request (com todos os mesmos parâmetros) usando um REST Client e funcionou corretamente. Tentei, também, com o HTTParty e funcionou normalmente, o problema parece ocorrer quando a gem tenta fazer o post.
require 'httparty'
require 'aitch'
url = "https://ws.pagseguro.uol.com.br/v2/checkout"
headers = {"Accept-Charset"=>"UTF-8",
"Content-Type"=>"application/x-www-form-urlencoded; charset=UTF-8"}
body = {:currency=>"BRL",
:reference=>6,
:redirectURL=>"http://url.com/redirect/pagseguro",
:notificationURL=> "http://url.com/redirect/pagseguro",
"itemId1"=>15,
"itemDescription1"=>"Acesso por 1 ano",
"itemAmount1"=>"50.00",
"itemQuantity1"=>1,
"itemWeight1"=>0,
:email=>"[email protected]",
:token=>"NUMERODATOKEN",
:charset=>"UTF-8"}
HTTParty.post(url, {body: body, headers: headers})
=> #<HTTParty::Response:0x7ff6d41370b8 parsed_response={"checkout"=>{"code"=>"NUMEROCODE", "date"=>"2013-09-08T21:25:55.000-03:00"}}, @response=#<Net::HTTPOK 200 OK readbody=true>, @headers={"date"=>["Mon, 09 Sep 2013 00:25:54 GMT"], "server"=>["Apache-Coyote/1.1"], "content-type"=>["application/xml;charset=ISO-8859-1"], "cache-control"=>["max-age=180"], "expires"=>["Mon, 09 Sep 2013 00:28:54 GMT"], "vary"=>["User-Agent"], "connection"=>["close"], "transfer-encoding"=>["chunked"]}>
Aitch.post(url, body, headers, {})
=> #<Aitch::Response:0x007fdea39cf2f0 @config=#<Aitch::Configuration:0x007fdea3ac4188 @timeout=10, @redirect_limit=5, @follow_redirect=true, @user_agent="Aitch/0.1.4 (http://rubygems.org/gems/aitch)", @default_headers={}, @json_parser=JSON, @xml_parser=Aitch::XMLParser, @html_parser=Aitch::HTMLParser>, @http_response=#<Net::HTTPUnauthorized 401 Unauthorized readbody=true>>
Primeiramente pensei que poderia ser algo com o user agent do Aitch, mas isso não se confirmou.
Identifiquei a chamada (e todos os parâmetros utilizados para realizar o request) neste arquivo: https://github.com/pagseguro/ruby/blob/master/lib/pagseguro/request.rb#L32
A chamada acontece em PaymentRequest#register
Opa, estou tendo problemas com o retorno das notificações. Estou recebendo o erro:
PagSeguro::Shipping::InvalidShippingTypeError (invalid "" type id)
Vejo que o shipping type está vindo preenchido no XML, mas por algum motivo o parser não está puxando. Alguém tem alguma idéia?
abaixo segue o XML do retorno:
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<transaction>
<date>2013-10-08T20:48:03.000-03:00</date>
<code>0B9A4CD5-8946-4591-B29B-51A3EAA8FCB5</code>
<reference>52535cc272ac26fa1f000001</reference>
<type>1</type>
<status>7</status>
<cancellationSource>INTERNAL</cancellationSource>
<lastEventDate>2013-10-08T20:49:13.000-03:00</lastEventDate>
<paymentMethod>
<type>1</type>
<code>101</code>
</paymentMethod>
<grossAmount>1.95</grossAmount>
<discountAmount>0.00</discountAmount>
<feeAmount>0.50</feeAmount>
<netAmount>1.45</netAmount>
<extraAmount>0.00</extraAmount>
<installmentCount>1</installmentCount>
<itemCount>1</itemCount>
<items>
<item>
<id>1</id>
<description>Produto teste</description>
<quantity>1</quantity>
<amount>1.95</amount>
</item>
</items>
<sender>
<name>Gastao B Brun</name>
<email>[email protected]</email>
<phone>
<areaCode>21</areaCode>
<number>xxxxxxxxx</number>
</phone>
</sender>
<shipping>
<address>
<street>RUA xxxxxxxxx</street>
<number>104</number>
<complement>xxxx</complement>
<district>xxxxxx</district>
<city>RIO DE JANEIRO</city>
<state>RJ</state>
<country>BRA</country>
<postalCode>xxxxxxx</postalCode>
</address>
<type>2</type>
<cost>0.00</cost>
</shipping>
</transaction>
Estou tentando simular uma compra e, quando a compra não é finalizada ainda (por exemplo, estou gerando o boleto), eu posso prosseguir com o meu método sem problemas. Ontem tentei fazer uma compra real, e este erro apareceu:
NoMethodError (undefined method `escrow_end_date=' for #PagSeguro::Transaction:0x007ff6f4377c40)
O que isso quer dizer? Eu não estou utilizando a propriedade de escrow_end_date de forma alguma!
I noticed the last release 2.6.1
release was made in Aug 27, 2018. However, there are several updates to this library that are useful to us. Would it be possible to make a more recent release of the Gem?
We are currently installing this in our Gemfile using a ref
to a more recent commit but that is a bit hacky.
https://github.com/pagseguro/ruby/blob/master/docs/transparent_checkout.md
os links não estao funcionando!
Hello!
I'm working with a web app thats sells a service, so i won't use the shippingAddress. But in the request_serializer.rb there's missing parse to the shipping: addressRequired variable present in Pagseguro documentation. I checked in request_serializer.rb, method serialize_shipping and i didn't find it. There's another way to solve that?
Thanks in advance!
I know this isn't released yet, but is there a sandbox mode for testing integrations?
Why this gem is not available on RubyGems?
in order to get:
gem install pagseguro-oficial
or
# Gemfile
gem 'pagseguro-oficial', '2.0.4'
Estou implementando a integração com o pagseguro aqui, ainda em ambiente de desenvolvimento, mas estou tendo problema de Bad Request quando tento consultar uma transação que fiz de teste.
O que fiz foi uma compra pela minha ferramenta de R$ 1,00 e efetuei o pagamento dela, agora eu queria pelo rails console encontrar a transação pelo código que me retornou (C16073A1-9A8C-4D05-8025-9993E2BC78F9). Assim:
transaction = PagSeguro::Transaction.find_by_code("C16073A1-9A8C-4D05-8025-9993E2BC78F9")
E obtenho esse erro:
=> #<PagSeguro::Transaction::Response:0x007ff6a6e31ff8 @errors=#<PagSeguro::Errors:0x007ff6a9de3b48 @response=#<Aitch::Response 400 Bad Request (application/xml)>, @messages=["O código de notificação informado é inválido."]>>
Daí usei o exemplo do README para listar as transações pela data, e obtive este resultado:
== Page 1
Report created on 2013-11-18 13:48:53 -0200
=> Transaction
created_at: 2013-11-18 13:31:58 -0200
code: C16073A1-9A8C-4D05-8025-9993E2BC78F9
gross amount: 1.0
updated at: 2013-11-18 13:40:21 -0200
Estou usando a gem pagseguro-oficial (2.0.2)
no Rails 3.2.14, ruby 1.9.3p429
Poderiam me ajudar a resolver isto?
How i can send payment pagseguro account to pagseguro account like email to email using apis?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.