tray-checkout 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +4 -0
- data/README.rdoc +77 -49
- data/lib/tray/checkout/hash.rb +9 -15
- data/lib/tray/checkout/parser.rb +5 -88
- data/lib/tray/checkout/response.rb +19 -0
- data/lib/tray/checkout/response_parser.rb +114 -0
- data/lib/tray/checkout/transaction.rb +9 -5
- data/lib/tray/checkout/transaction_params_parser.rb +55 -0
- data/lib/tray/checkout/version.rb +1 -1
- data/lib/tray-checkout.rb +3 -0
- data/spec/support/mock_request.rb +1 -0
- data/spec/support/responses/create_failure_validation_errors.xml +1 -0
- data/spec/support/responses/create_success_boleto.xml +53 -236
- data/spec/support/responses/create_success_mastercard.xml +53 -224
- data/spec/support/responses/get_success_boleto.xml +56 -66
- data/spec/support/responses/get_success_mastercard.xml +101 -0
- data/spec/tray/checkout/hash_spec.rb +10 -9
- data/spec/tray/checkout/parser_spec.rb +29 -179
- data/spec/tray/checkout/response_parser_spec.rb +187 -0
- data/spec/tray/checkout/response_spec.rb +16 -0
- data/spec/tray/checkout/transaction_params_parser_spec.rb +126 -0
- data/spec/tray/checkout/transaction_spec.rb +34 -20
- metadata +24 -13
@@ -1,270 +1,99 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
1
2
|
<transaction>
|
2
3
|
<data_response>
|
3
|
-
<payment>
|
4
|
-
<number_of_voucher_sales>1233</number_of_voucher_sales>
|
5
|
-
<number_proccess type="integer">720</number_proccess>
|
6
|
-
<payment_method_name>Mastercard</payment_method_name>
|
7
|
-
<selling_message>Mensagem de venda fake</selling_message>
|
8
|
-
<payment_response></payment_response>
|
9
|
-
<date_payment>04/12/2012</date_payment>
|
10
|
-
<url_payment></url_payment>
|
11
|
-
<payment_method_id type="integer">4</payment_method_id>
|
12
|
-
<split type="integer">3</split>
|
13
|
-
<date_approval></date_approval>
|
14
|
-
<card_id type="integer">209</card_id>
|
15
|
-
<price_payment type="decimal">226.19</price_payment>
|
16
|
-
<linha_digitavel nil="true"></linha_digitavel>
|
17
|
-
</payment>
|
18
|
-
<session_id nil="true"></session_id>
|
19
4
|
<transaction>
|
20
|
-
<
|
5
|
+
<transaction_token>fc739f786425e34010481dcc2939e4bdx</transaction_token>
|
6
|
+
<transaction_id type="integer">540</transaction_id>
|
21
7
|
<status_id type="integer">6</status_id>
|
22
|
-
<
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
<price_payment type="decimal">226.19</price_payment>
|
35
|
-
</payment>
|
36
|
-
<payment_method_name>Mastercard</payment_method_name>
|
37
|
-
<price_seller type="decimal">199.19</price_seller>
|
38
|
-
<url_stock nil="true"></url_stock>
|
39
|
-
<date_transaction>2012-12-04T17:30:52</date_transaction>
|
40
|
-
<order_number>R1245</order_number>
|
8
|
+
<status_name>Aprovada</status_name>
|
9
|
+
<order_number>F2457</order_number>
|
10
|
+
<price_original type="decimal">33.21</price_original>
|
11
|
+
<price_payment type="decimal">35.23</price_payment>
|
12
|
+
<price_seller type="decimal">30.69</price_seller>
|
13
|
+
<price_additional type="decimal">0.0</price_additional>
|
14
|
+
<price_discount type="decimal">0.0</price_discount>
|
15
|
+
<shipping_type>Sedex</shipping_type>
|
16
|
+
<shipping_price type="decimal">1.23</shipping_price>
|
17
|
+
<split type="integer">3</split>
|
18
|
+
<date_transaction>2012-12-13T12:35:30</date_transaction>
|
19
|
+
<date_payment>2012-12-13T12:35:31</date_payment>
|
41
20
|
<url_notification>http://prodis.blog.br/tray_notification</url_notification>
|
42
|
-
<free nil="true"></free>
|
43
21
|
<url_cancel nil="true"></url_cancel>
|
44
|
-
<
|
45
|
-
<
|
46
|
-
<shipping_price type="decimal">1.23</shipping_price>
|
22
|
+
<url_css nil="true"></url_css>
|
23
|
+
<url_process nil="true"></url_process>
|
47
24
|
<url_shipping nil="true"></url_shipping>
|
48
|
-
<
|
25
|
+
<url_stock nil="true"></url_stock>
|
26
|
+
<url_success nil="true"></url_success>
|
27
|
+
<available_payment_methods nil="true"></available_payment_methods>
|
28
|
+
<free nil="true"></free>
|
29
|
+
<schedule_credit></schedule_credit>
|
30
|
+
<sub_store nil="true"></sub_store>
|
31
|
+
<transaction_affiliates type="array"/>
|
49
32
|
<products type="array">
|
50
33
|
<product>
|
51
34
|
<code>LOGO-8278</code>
|
52
|
-
<url_img nil="true"></url_img>
|
53
35
|
<quantity type="decimal">2.0</quantity>
|
36
|
+
<sku_code nil="true"></sku_code>
|
37
|
+
<price_unit type="decimal">10.99</price_unit>
|
38
|
+
<url_img nil="true"></url_img>
|
54
39
|
<description>Logo Prodis</description>
|
55
40
|
<extra nil="true"></extra>
|
56
|
-
<sku_code nil="true"></sku_code>
|
57
|
-
<price_unit type="decimal">100.99</price_unit>
|
58
41
|
</product>
|
59
42
|
<product>
|
60
43
|
<code>877</code>
|
61
|
-
<url_img nil="true"></url_img>
|
62
44
|
<quantity type="decimal">1.0</quantity>
|
63
|
-
<description>Outro produto</description>
|
64
|
-
<extra nil="true"></extra>
|
65
45
|
<sku_code nil="true"></sku_code>
|
66
46
|
<price_unit type="decimal">10.0</price_unit>
|
47
|
+
<url_img nil="true"></url_img>
|
48
|
+
<description>Outro produto</description>
|
49
|
+
<extra nil="true"></extra>
|
67
50
|
</product>
|
68
51
|
</products>
|
69
|
-
<
|
70
|
-
<
|
71
|
-
<
|
72
|
-
<
|
73
|
-
<
|
74
|
-
<
|
75
|
-
<
|
76
|
-
<
|
77
|
-
<
|
78
|
-
<
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
<transaction_affiliates type="array"/>
|
84
|
-
<shipping_type>Sedex</shipping_type>
|
85
|
-
<payment_method_id type="integer">4</payment_method_id>
|
52
|
+
<payment>
|
53
|
+
<payment_method_id type="integer">4</payment_method_id>
|
54
|
+
<payment_method_name>Mastercard</payment_method_name>
|
55
|
+
<price_payment type="decimal">35.23</price_payment>
|
56
|
+
<split type="integer">3</split>
|
57
|
+
<number_proccess type="integer">760</number_proccess>
|
58
|
+
<url_payment></url_payment>
|
59
|
+
<linha_digitavel nil="true"></linha_digitavel>
|
60
|
+
<date_approval>2012-12-13T12:35:31</date_approval>
|
61
|
+
<date_payment>2012-12-13T12:35:31</date_payment>
|
62
|
+
<tid>1355409331</tid>
|
63
|
+
<payment_response>Mensagem de venda fake</payment_response>
|
64
|
+
<card_id type="integer">211</card_id>
|
65
|
+
</payment>
|
86
66
|
<customer>
|
87
|
-
<address>
|
88
|
-
<number>123</number>
|
89
|
-
<completion></completion>
|
90
|
-
<city>São Paulo</city>
|
91
|
-
<postal_code>04094050</postal_code>
|
92
|
-
<state>SP</state>
|
93
|
-
<street>Avenida Pedro Alvares Cabral</street>
|
94
|
-
<neighborhood>Parque Ibirapuera</neighborhood>
|
95
|
-
</address>
|
96
|
-
<cpf>18565842673</cpf>
|
97
|
-
<addresses type="array">
|
98
|
-
<address>
|
99
|
-
<number>123</number>
|
100
|
-
<completion></completion>
|
101
|
-
<city>São Paulo</city>
|
102
|
-
<postal_code>04094050</postal_code>
|
103
|
-
<state>SP</state>
|
104
|
-
<street>Avenida Pedro Alvares Cabral</street>
|
105
|
-
<neighborhood>Parque Ibirapuera</neighborhood>
|
106
|
-
</address>
|
107
|
-
</addresses>
|
108
|
-
<email>pedro@bo.com.br</email>
|
109
|
-
<token>6baa8f3cc85c567</token>
|
110
67
|
<name>Pedro Bonamides</name>
|
111
|
-
|
112
|
-
<price_additional type="decimal">0.0</price_additional>
|
113
|
-
<split type="integer">3</split>
|
114
|
-
<price_discount type="decimal">0.0</price_discount>
|
115
|
-
<schedule_credit></schedule_credit>
|
116
|
-
<url_success nil="true"></url_success>
|
117
|
-
<transaction_token>u522169ce59763uu717160u4u1183u43</transaction_token>
|
118
|
-
<price_payment type="decimal">226.19</price_payment>
|
119
|
-
<url_css nil="true"></url_css>
|
120
|
-
<available_payment_methods nil="true"></available_payment_methods>
|
121
|
-
</transaction>
|
122
|
-
<customer>
|
123
|
-
<company>
|
124
|
-
</company>
|
125
|
-
<account>
|
126
|
-
<payment_tax_id type="integer">1</payment_tax_id>
|
127
|
-
<url_notification nil="true"></url_notification>
|
128
|
-
<available_balance type="decimal">0.0</available_balance>
|
129
|
-
<token>6baa8f3cc85c567</token>
|
130
|
-
<name>Principal</name>
|
131
|
-
<balance type="decimal">0.0</balance>
|
132
|
-
</account>
|
133
|
-
<person>
|
134
|
-
<birth_date type="date">1975-05-19</birth_date>
|
135
|
-
<person_id type="integer">157</person_id>
|
68
|
+
<email>pedro@bo.com.br</email>
|
136
69
|
<cpf>18565842673</cpf>
|
137
70
|
<addresses type="array">
|
138
71
|
<address>
|
139
|
-
<number>123</number>
|
140
|
-
<completion>Bloco II</completion>
|
141
|
-
<city>São Paulo</city>
|
142
|
-
<person_address_id type="integer">324</person_address_id>
|
143
|
-
<postal_code>04094050</postal_code>
|
144
|
-
<state>SP</state>
|
145
|
-
<primary type="boolean">true</primary>
|
146
|
-
<street>Avenida Pedro Álvares Cabral</street>
|
147
|
-
<neighborhood>Parque Ibirapuera</neighborhood>
|
148
|
-
<type_address>B</type_address>
|
149
|
-
</address>
|
150
|
-
<address>
|
151
|
-
<number>123</number>
|
152
|
-
<completion>Bloco II</completion>
|
153
|
-
<city>São Paulo</city>
|
154
|
-
<person_address_id type="integer">328</person_address_id>
|
155
|
-
<postal_code>04094050</postal_code>
|
156
|
-
<state>SP</state>
|
157
|
-
<primary type="boolean">false</primary>
|
158
|
-
<street>Avenida Pedro Álvares Cabral</street>
|
159
|
-
<neighborhood>Parque Ibirapuera</neighborhood>
|
160
|
-
<type_address>B</type_address>
|
161
|
-
</address>
|
162
|
-
<address>
|
163
|
-
<number>123</number>
|
164
|
-
<completion></completion>
|
165
|
-
<city>São Paulo</city>
|
166
|
-
<person_address_id type="integer">331</person_address_id>
|
167
|
-
<postal_code>04094050</postal_code>
|
168
|
-
<state>SP</state>
|
169
|
-
<primary type="boolean">false</primary>
|
170
|
-
<street>Avenida Pedro Álvares Cabral</street>
|
171
|
-
<neighborhood>Parque Ibirapuera</neighborhood>
|
172
|
-
<type_address>B</type_address>
|
173
|
-
</address>
|
174
|
-
<address>
|
175
|
-
<number>123</number>
|
176
|
-
<completion></completion>
|
177
|
-
<city>São Paulo</city>
|
178
|
-
<person_address_id type="integer">337</person_address_id>
|
179
|
-
<postal_code>04094050</postal_code>
|
180
|
-
<state>SP</state>
|
181
|
-
<primary type="boolean">false</primary>
|
182
72
|
<street>Avenida Pedro Alvares Cabral</street>
|
183
|
-
<neighborhood>Parque Ibirapuera</neighborhood>
|
184
|
-
<type_address>B</type_address>
|
185
|
-
</address>
|
186
|
-
<address>
|
187
73
|
<number>123</number>
|
188
|
-
<completion></completion>
|
189
|
-
<city>São Paulo</city>
|
190
|
-
<person_address_id type="integer">338</person_address_id>
|
191
|
-
<postal_code>04094050</postal_code>
|
192
|
-
<state>SP</state>
|
193
|
-
<primary type="boolean">false</primary>
|
194
|
-
<street>Avenida Pedro Alvares Cabral</street>
|
195
74
|
<neighborhood>Parque Ibirapuera</neighborhood>
|
196
|
-
<type_address>B</type_address>
|
197
|
-
</address>
|
198
|
-
<address>
|
199
|
-
<number>123</number>
|
200
|
-
<completion></completion>
|
201
|
-
<city>São Paulo</city>
|
202
|
-
<person_address_id type="integer">339</person_address_id>
|
203
75
|
<postal_code>04094050</postal_code>
|
204
|
-
<state>SP</state>
|
205
|
-
<primary type="boolean">false</primary>
|
206
|
-
<street>Avenida Pedro Alvares Cabral</street>
|
207
|
-
<neighborhood>Parque Ibirapuera</neighborhood>
|
208
|
-
<type_address>B</type_address>
|
209
|
-
</address>
|
210
|
-
<address>
|
211
|
-
<number>123</number>
|
212
76
|
<completion></completion>
|
213
|
-
<city>
|
214
|
-
<person_address_id type="integer">340</person_address_id>
|
215
|
-
<postal_code>04094050</postal_code>
|
216
|
-
<state>SP</state>
|
217
|
-
<primary type="boolean">false</primary>
|
218
|
-
<street>Avenida Pedro Alvares Cabral</street>
|
219
|
-
<neighborhood>Parque Ibirapuera</neighborhood>
|
220
|
-
<type_address>B</type_address>
|
221
|
-
</address>
|
222
|
-
<address>
|
223
|
-
<number>123</number>
|
224
|
-
<completion></completion>
|
225
|
-
<city>São Paulo</city>
|
226
|
-
<person_address_id type="integer">341</person_address_id>
|
227
|
-
<postal_code>04094050</postal_code>
|
77
|
+
<city>São Paulo</city>
|
228
78
|
<state>SP</state>
|
229
|
-
<primary type="boolean">false</primary>
|
230
|
-
<street>Avenida Pedro Alvares Cabral</street>
|
231
|
-
<neighborhood>Parque Ibirapuera</neighborhood>
|
232
|
-
<type_address>B</type_address>
|
233
79
|
</address>
|
234
80
|
</addresses>
|
235
|
-
<email>pedro@bo.com.br</email>
|
236
81
|
<contacts type="array">
|
237
82
|
<contact>
|
238
|
-
<
|
83
|
+
<contact_id type="integer">345</contact_id>
|
239
84
|
<value>1137654321</value>
|
240
|
-
<primary type="boolean">true</primary>
|
241
|
-
<type_contact>H</type_contact>
|
242
|
-
</contact>
|
243
|
-
<contact>
|
244
|
-
<person_contact_id type="integer">346</person_contact_id>
|
245
|
-
<value>pedro@bo.com.br</value>
|
246
|
-
<primary type="boolean">false</primary>
|
247
|
-
<type_contact>E</type_contact>
|
248
|
-
</contact>
|
249
|
-
<contact>
|
250
|
-
<person_contact_id type="integer">348</person_contact_id>
|
251
|
-
<value>1147654321</value>
|
252
|
-
<primary type="boolean">false</primary>
|
253
85
|
<type_contact>H</type_contact>
|
86
|
+
<primary type="boolean">true</primary>
|
254
87
|
</contact>
|
255
88
|
<contact>
|
256
|
-
<
|
257
|
-
<value>
|
89
|
+
<contact_id type="integer">348</contact_id>
|
90
|
+
<value>11987654321</value>
|
91
|
+
<type_contact>M</type_contact>
|
258
92
|
<primary type="boolean">false</primary>
|
259
|
-
<type_contact>H</type_contact>
|
260
93
|
</contact>
|
261
94
|
</contacts>
|
262
|
-
|
263
|
-
|
264
|
-
<gender>M</gender>
|
265
|
-
<type_person_id>1</type_person_id>
|
266
|
-
</person>
|
267
|
-
</customer>
|
95
|
+
</customer>
|
96
|
+
</transaction>
|
268
97
|
</data_response>
|
269
98
|
<message_response>
|
270
99
|
<message>success</message>
|
@@ -2,106 +2,96 @@
|
|
2
2
|
<transaction>
|
3
3
|
<data_response>
|
4
4
|
<transaction>
|
5
|
-
<transaction_token>
|
6
|
-
<transaction_id type="integer">
|
7
|
-
<
|
8
|
-
<
|
9
|
-
<
|
10
|
-
<
|
11
|
-
<
|
12
|
-
<
|
13
|
-
<price_payment type="decimal">213.21</price_payment>
|
14
|
-
<price_seller type="decimal">199.19</price_seller>
|
5
|
+
<transaction_token>db9b3265af6e7e19af8dd70e00d77383x</transaction_token>
|
6
|
+
<transaction_id type="integer">530</transaction_id>
|
7
|
+
<status_id type="integer">6</status_id>
|
8
|
+
<status_name>Aprovada</status_name>
|
9
|
+
<order_number>F2456</order_number>
|
10
|
+
<price_original type="decimal">33.21</price_original>
|
11
|
+
<price_payment type="decimal">33.21</price_payment>
|
12
|
+
<price_seller type="decimal">30.69</price_seller>
|
15
13
|
<price_additional type="decimal">0.0</price_additional>
|
16
14
|
<price_discount type="decimal">0.0</price_discount>
|
17
15
|
<shipping_type>Sedex</shipping_type>
|
18
16
|
<shipping_price type="decimal">1.23</shipping_price>
|
19
17
|
<split type="integer">1</split>
|
20
|
-
<date_transaction>2012-12-
|
18
|
+
<date_transaction>2012-12-13T02:49:42</date_transaction>
|
19
|
+
<date_payment></date_payment>
|
21
20
|
<url_notification>http://prodis.blog.br/tray_notification</url_notification>
|
22
|
-
<seller_token>949u5uu9ef36f7u</seller_token>
|
23
|
-
<free nil="true"></free>
|
24
|
-
<date_payment>xxx</date_payment>
|
25
|
-
<transaction_affiliates type="array"/>
|
26
|
-
<schedule_credit></schedule_credit>
|
27
|
-
<url_shipping nil="true"></url_shipping>
|
28
|
-
<url_process nil="true"></url_process>
|
29
21
|
<url_cancel nil="true"></url_cancel>
|
22
|
+
<url_css nil="true"></url_css>
|
23
|
+
<url_process nil="true"></url_process>
|
24
|
+
<url_shipping nil="true"></url_shipping>
|
30
25
|
<url_stock nil="true"></url_stock>
|
31
26
|
<url_success nil="true"></url_success>
|
32
|
-
<url_css nil="true"></url_css>
|
33
27
|
<available_payment_methods nil="true"></available_payment_methods>
|
28
|
+
<free nil="true"></free>
|
29
|
+
<schedule_credit></schedule_credit>
|
34
30
|
<sub_store nil="true"></sub_store>
|
35
|
-
<
|
36
|
-
<payment_method_id type="integer">6</payment_method_id>
|
37
|
-
<payment_method_name>Boleto Bancario</payment_method_name>
|
38
|
-
<price_payment type="decimal">213.21</price_payment>
|
39
|
-
<split type="integer">1</split>
|
40
|
-
<number_proccess type="integer">718</number_proccess>
|
41
|
-
<url_payment>http://checkout.sandbox.tray.com.br/payment/billet/u9uuu8731319u59u3073u9011uu6u6uu</url_payment>
|
42
|
-
<date_approval>2012-12-04T00:55:15</date_approval>
|
43
|
-
<selling_message></selling_message>
|
44
|
-
<payment_response></payment_response>
|
45
|
-
<date_payment>xxx</date_payment>
|
46
|
-
<number_of_voucher_sales></number_of_voucher_sales>
|
47
|
-
<card_id nil="true"></card_id>
|
48
|
-
</payment>
|
31
|
+
<transaction_affiliates type="array"/>
|
49
32
|
<products type="array">
|
50
33
|
<product>
|
51
34
|
<code>LOGO-8278</code>
|
52
|
-
<url_img nil="true"></url_img>
|
53
35
|
<quantity type="decimal">2.0</quantity>
|
36
|
+
<sku_code nil="true"></sku_code>
|
37
|
+
<price_unit type="decimal">10.99</price_unit>
|
38
|
+
<url_img nil="true"></url_img>
|
54
39
|
<description>Logo Prodis</description>
|
55
40
|
<extra nil="true"></extra>
|
56
|
-
<sku_code nil="true"></sku_code>
|
57
|
-
<price_unit type="decimal">100.99</price_unit>
|
58
41
|
</product>
|
59
42
|
<product>
|
60
43
|
<code>877</code>
|
61
|
-
<url_img nil="true"></url_img>
|
62
44
|
<quantity type="decimal">1.0</quantity>
|
63
|
-
<description>Outro produto</description>
|
64
|
-
<extra nil="true"></extra>
|
65
45
|
<sku_code nil="true"></sku_code>
|
66
46
|
<price_unit type="decimal">10.0</price_unit>
|
47
|
+
<url_img nil="true"></url_img>
|
48
|
+
<description>Outro produto</description>
|
49
|
+
<extra nil="true"></extra>
|
67
50
|
</product>
|
68
51
|
</products>
|
69
|
-
<
|
70
|
-
<
|
71
|
-
<
|
72
|
-
<
|
73
|
-
<
|
74
|
-
<
|
75
|
-
<
|
76
|
-
<
|
77
|
-
<
|
78
|
-
<
|
79
|
-
|
52
|
+
<payment>
|
53
|
+
<payment_method_id type="integer">6</payment_method_id>
|
54
|
+
<payment_method_name>Boleto Bancario</payment_method_name>
|
55
|
+
<price_payment type="decimal">33.21</price_payment>
|
56
|
+
<split type="integer">1</split>
|
57
|
+
<number_proccess type="integer">750</number_proccess>
|
58
|
+
<url_payment>http://checkout.sandbox.tray.com.br/payment/billet/d2baa84c13f23addde401c8e1426396e</url_payment>
|
59
|
+
<linha_digitavel>34191.76007 00075.091140 53021.450001 1 55510000003321</linha_digitavel>
|
60
|
+
<date_approval>2012-12-15T15:24:38</date_approval>
|
61
|
+
<date_payment>2012-12-15T15:23:05</date_payment>
|
62
|
+
<tid></tid>
|
63
|
+
<payment_response>Texto de resposta fake.</payment_response>
|
64
|
+
<card_id nil="true"></card_id>
|
65
|
+
</payment>
|
80
66
|
<customer>
|
81
|
-
<
|
82
|
-
|
83
|
-
<completion></completion>
|
84
|
-
<city>São Paulo</city>
|
85
|
-
<postal_code>04094050</postal_code>
|
86
|
-
<state>SP</state>
|
87
|
-
<street>Avenida Pedro Alvares Cabral</street>
|
88
|
-
<neighborhood>Parque Ibirapuera</neighborhood>
|
89
|
-
</address>
|
67
|
+
<name>Pedro Bonamides</name>
|
68
|
+
<email>pedro@bo.com.br</email>
|
90
69
|
<cpf>18565842673</cpf>
|
91
70
|
<addresses type="array">
|
92
71
|
<address>
|
72
|
+
<street>Avenida Pedro Alvares Cabral</street>
|
93
73
|
<number>123</number>
|
94
|
-
<
|
95
|
-
<city>São Paulo</city>
|
74
|
+
<neighborhood>Parque Ibirapuera</neighborhood>
|
96
75
|
<postal_code>04094050</postal_code>
|
76
|
+
<completion></completion>
|
77
|
+
<city>São Paulo</city>
|
97
78
|
<state>SP</state>
|
98
|
-
<street>Avenida Pedro Alvares Cabral</street>
|
99
|
-
<neighborhood>Parque Ibirapuera</neighborhood>
|
100
79
|
</address>
|
101
80
|
</addresses>
|
102
|
-
<
|
103
|
-
|
104
|
-
|
81
|
+
<contacts type="array">
|
82
|
+
<contact>
|
83
|
+
<contact_id type="integer">345</contact_id>
|
84
|
+
<value>1137654321</value>
|
85
|
+
<type_contact>H</type_contact>
|
86
|
+
<primary type="boolean">true</primary>
|
87
|
+
</contact>
|
88
|
+
<contact>
|
89
|
+
<contact_id type="integer">348</contact_id>
|
90
|
+
<value>11987654321</value>
|
91
|
+
<type_contact>M</type_contact>
|
92
|
+
<primary type="boolean">false</primary>
|
93
|
+
</contact>
|
94
|
+
</contacts>
|
105
95
|
</customer>
|
106
96
|
</transaction>
|
107
97
|
</data_response>
|
@@ -0,0 +1,101 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<transaction>
|
3
|
+
<data_response>
|
4
|
+
<transaction>
|
5
|
+
<transaction_token>fc739f786425e34010481dcc2939e4bdx</transaction_token>
|
6
|
+
<transaction_id type="integer">540</transaction_id>
|
7
|
+
<status_id type="integer">6</status_id>
|
8
|
+
<status_name>Aprovada</status_name>
|
9
|
+
<order_number>F2457</order_number>
|
10
|
+
<price_original type="decimal">33.21</price_original>
|
11
|
+
<price_payment type="decimal">35.23</price_payment>
|
12
|
+
<price_seller type="decimal">30.69</price_seller>
|
13
|
+
<price_additional type="decimal">0.0</price_additional>
|
14
|
+
<price_discount type="decimal">0.0</price_discount>
|
15
|
+
<shipping_type>Sedex</shipping_type>
|
16
|
+
<shipping_price type="decimal">1.23</shipping_price>
|
17
|
+
<split type="integer">3</split>
|
18
|
+
<date_transaction>2012-12-13T12:35:30</date_transaction>
|
19
|
+
<date_payment>2012-12-13T12:35:31</date_payment>
|
20
|
+
<url_notification>http://prodis.blog.br/tray_notification</url_notification>
|
21
|
+
<url_cancel nil="true"></url_cancel>
|
22
|
+
<url_css nil="true"></url_css>
|
23
|
+
<url_process nil="true"></url_process>
|
24
|
+
<url_shipping nil="true"></url_shipping>
|
25
|
+
<url_stock nil="true"></url_stock>
|
26
|
+
<url_success nil="true"></url_success>
|
27
|
+
<available_payment_methods nil="true"></available_payment_methods>
|
28
|
+
<free nil="true"></free>
|
29
|
+
<schedule_credit></schedule_credit>
|
30
|
+
<sub_store nil="true"></sub_store>
|
31
|
+
<transaction_affiliates type="array"/>
|
32
|
+
<products type="array">
|
33
|
+
<product>
|
34
|
+
<code>LOGO-8278</code>
|
35
|
+
<quantity type="decimal">2.0</quantity>
|
36
|
+
<sku_code nil="true"></sku_code>
|
37
|
+
<price_unit type="decimal">10.99</price_unit>
|
38
|
+
<url_img nil="true"></url_img>
|
39
|
+
<description>Logo Prodis</description>
|
40
|
+
<extra nil="true"></extra>
|
41
|
+
</product>
|
42
|
+
<product>
|
43
|
+
<code>877</code>
|
44
|
+
<quantity type="decimal">1.0</quantity>
|
45
|
+
<sku_code nil="true"></sku_code>
|
46
|
+
<price_unit type="decimal">10.0</price_unit>
|
47
|
+
<url_img nil="true"></url_img>
|
48
|
+
<description>Outro produto</description>
|
49
|
+
<extra nil="true"></extra>
|
50
|
+
</product>
|
51
|
+
</products>
|
52
|
+
<payment>
|
53
|
+
<payment_method_id type="integer">4</payment_method_id>
|
54
|
+
<payment_method_name>Mastercard</payment_method_name>
|
55
|
+
<price_payment type="decimal">35.23</price_payment>
|
56
|
+
<split type="integer">3</split>
|
57
|
+
<number_proccess type="integer">760</number_proccess>
|
58
|
+
<url_payment></url_payment>
|
59
|
+
<linha_digitavel nil="true"></linha_digitavel>
|
60
|
+
<date_approval>2012-12-13T12:35:31</date_approval>
|
61
|
+
<date_payment>2012-12-13T12:35:31</date_payment>
|
62
|
+
<tid>1355409331</tid>
|
63
|
+
<payment_response>Mensagem de venda fake</payment_response>
|
64
|
+
<card_id type="integer">211</card_id>
|
65
|
+
</payment>
|
66
|
+
<customer>
|
67
|
+
<name>Pedro Bonamides</name>
|
68
|
+
<email>pedro@bo.com.br</email>
|
69
|
+
<cpf>18565842673</cpf>
|
70
|
+
<addresses type="array">
|
71
|
+
<address>
|
72
|
+
<street>Avenida Pedro Alvares Cabral</street>
|
73
|
+
<number>123</number>
|
74
|
+
<neighborhood>Parque Ibirapuera</neighborhood>
|
75
|
+
<postal_code>04094050</postal_code>
|
76
|
+
<completion></completion>
|
77
|
+
<city>São Paulo</city>
|
78
|
+
<state>SP</state>
|
79
|
+
</address>
|
80
|
+
</addresses>
|
81
|
+
<contacts type="array">
|
82
|
+
<contact>
|
83
|
+
<contact_id type="integer">345</contact_id>
|
84
|
+
<value>1137654321</value>
|
85
|
+
<type_contact>H</type_contact>
|
86
|
+
<primary type="boolean">true</primary>
|
87
|
+
</contact>
|
88
|
+
<contact>
|
89
|
+
<contact_id type="integer">348</contact_id>
|
90
|
+
<value>11987654321</value>
|
91
|
+
<type_contact>M</type_contact>
|
92
|
+
<primary type="boolean">false</primary>
|
93
|
+
</contact>
|
94
|
+
</contacts>
|
95
|
+
</customer>
|
96
|
+
</transaction>
|
97
|
+
</data_response>
|
98
|
+
<message_response>
|
99
|
+
<message>success</message>
|
100
|
+
</message_response>
|
101
|
+
</transaction>
|
@@ -2,11 +2,10 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
4
|
describe Hash do
|
5
|
-
describe "#symbolize_all_keys
|
5
|
+
describe "#symbolize_all_keys" do
|
6
6
|
it "symbolize keys" do
|
7
7
|
hash = { "text" => "Um texto", "number" => 456 }
|
8
|
-
hash.symbolize_all_keys
|
9
|
-
hash.should == { text: "Um texto", number: 456 }
|
8
|
+
hash.symbolize_all_keys.should == { text: "Um texto", number: 456 }
|
10
9
|
end
|
11
10
|
|
12
11
|
context "when hash has nested hashes" do
|
@@ -24,8 +23,7 @@ describe Hash do
|
|
24
23
|
},
|
25
24
|
}
|
26
25
|
}
|
27
|
-
hash.symbolize_all_keys
|
28
|
-
hash.should == {
|
26
|
+
hash.symbolize_all_keys.should == {
|
29
27
|
customer: {
|
30
28
|
name: "Pedro Bonamides",
|
31
29
|
email: "pedro@bo.com.br",
|
@@ -48,16 +46,19 @@ describe Hash do
|
|
48
46
|
"errors" => [
|
49
47
|
{ "code" => 3042, "message" => "Transação não encontrada" },
|
50
48
|
{ "code" => 9999, "message" => "Qualquer outra mensagem" }
|
51
|
-
]
|
49
|
+
],
|
50
|
+
"numbers" => [0, 1, 2, 3, 4, 5],
|
51
|
+
"texts" => ["Akira", "Fernando", "José"]
|
52
52
|
}
|
53
53
|
}
|
54
|
-
hash.symbolize_all_keys
|
55
|
-
hash.should == {
|
54
|
+
hash.symbolize_all_keys.should == {
|
56
55
|
error_response: {
|
57
56
|
errors: [
|
58
57
|
{ code: 3042, message: "Transação não encontrada" },
|
59
58
|
{ code: 9999, message: "Qualquer outra mensagem" }
|
60
|
-
]
|
59
|
+
],
|
60
|
+
numbers: [0, 1, 2, 3, 4, 5],
|
61
|
+
texts: ["Akira", "Fernando", "José"]
|
61
62
|
}
|
62
63
|
}
|
63
64
|
end
|