lib/pagseguro_client/order.rb in pagseguro_client-0.1.1 vs lib/pagseguro_client/order.rb in pagseguro_client-0.2.0
- old
+ new
@@ -16,15 +16,12 @@
def add(options)
products.push(options)
end
def data
- data = {
- email: PagseguroClient.email,
- token: PagseguroClient.token,
- currency: "BRL",
- reference: id
- }
+ data = { email: PagseguroClient.email, token: PagseguroClient.token, currency: "BRL", reference: id }
+ data["redirectURL"] = PagseguroClient.redirect_url if PagseguroClient.redirect?
+
products.each_with_index do |item, index|
index += 1
data["itemId#{index}"] = item[:id]
data["itemDescription#{index}"] = item[:description].to_s.unpack("U*").pack("C*")
data["itemAmount#{index}"] = item[:amount]