Permalink
Browse files

add support for "soft-descritor" field as described in version 2.0.2 …

…of the integration manual
  • Loading branch information...
1 parent c37ebc3 commit 15f1e3647af34ce2c46e65b78e347915271ef058 @rafaelss committed Oct 18, 2012
Showing with 23 additions and 0 deletions.
  1. +1 −0 lib/cielo/order.rb
  2. +13 −0 spec/cielo/order_spec.rb
  3. +9 −0 spec/fixtures/order_2.xml
View
1 lib/cielo/order.rb
@@ -8,5 +8,6 @@ class Order
element :currency, String, :tag => "moeda"
element :time, Time, :tag => "data-hora", :on_save => proc { |value| value.strftime("%Y-%m-%dT%H:%M:%S") }
element :language, String, :tag => "idioma"
+ element :soft_descriptor, String, :tag => "soft-descriptor"
end
end
View
13 spec/cielo/order_spec.rb
@@ -21,4 +21,17 @@
xml.should == File.read(File.expand_path("../../fixtures/order.xml", __FILE__))
end
+
+ describe "with soft descriptor" do
+ it "#to_xml" do
+ subject.number = 285813768
+ subject.total = 1
+ subject.currency = 986
+ subject.time = Time.now
+ subject.language = "PT"
+ subject.soft_descriptor = "CieloX Store"
+
+ expect(subject.to_xml).to eq(File.read(File.expand_path("../../fixtures/order_2.xml", __FILE__)))
+ end
+ end
end
View
9 spec/fixtures/order_2.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<dados-pedido>
+ <numero>285813768</numero>
+ <valor>100</valor>
+ <moeda>986</moeda>
+ <data-hora>2010-07-14T13:56:12</data-hora>
+ <idioma>PT</idioma>
+ <soft-descriptor>CieloX Store</soft-descriptor>
+</dados-pedido>

0 comments on commit 15f1e36

Please sign in to comment.