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,282 +1,99 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
1
2
|
<transaction>
|
2
3
|
<data_response>
|
3
|
-
<payment>
|
4
|
-
<number_of_voucher_sales></number_of_voucher_sales>
|
5
|
-
<number_proccess type="integer">721</number_proccess>
|
6
|
-
<payment_method_name>Boleto Bancario</payment_method_name>
|
7
|
-
<selling_message></selling_message>
|
8
|
-
<payment_response></payment_response>
|
9
|
-
<date_payment></date_payment>
|
10
|
-
<url_payment>http://checkout.sandbox.tray.com.br/payment/billet/u84uu45u1uuuu7uuu80u2uuu3u5831u8</url_payment>
|
11
|
-
<payment_method_id type="integer">6</payment_method_id>
|
12
|
-
<split type="integer">1</split>
|
13
|
-
<date_approval></date_approval>
|
14
|
-
<card_id></card_id>
|
15
|
-
<price_payment type="decimal">213.21</price_payment>
|
16
|
-
<linha_digitavel>34191.76007 00072.101140 53021.450001 4 55420000021321</linha_digitavel>
|
17
|
-
</payment>
|
18
|
-
<session_id nil="true"></session_id>
|
19
4
|
<transaction>
|
20
|
-
<
|
5
|
+
<transaction_token>db9b3265af6e7e19af8dd70e00d77383x</transaction_token>
|
6
|
+
<transaction_id type="integer">530</transaction_id>
|
21
7
|
<status_id type="integer">4</status_id>
|
22
|
-
<
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
<price_payment type="decimal">213.21</price_payment>
|
35
|
-
</payment>
|
36
|
-
<payment_method_name>Boleto Bancario</payment_method_name>
|
37
|
-
<price_seller type="decimal">199.19</price_seller>
|
38
|
-
<url_stock nil="true"></url_stock>
|
39
|
-
<date_transaction>2012-12-03T18:08:37</date_transaction>
|
40
|
-
<order_number>R1240</order_number>
|
8
|
+
<status_name>Aguardando Pagamento</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>
|
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">1</split>
|
18
|
+
<date_transaction>2012-12-13T02:49:42</date_transaction>
|
19
|
+
<date_payment></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">6</payment_method_id>
|
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></date_approval>
|
61
|
+
<date_payment></date_payment>
|
62
|
+
<tid></tid>
|
63
|
+
<payment_response></payment_response>
|
64
|
+
<card_id nil="true"></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">1</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>u1244u7uu6bu20123uu342uu87u0uuu5</transaction_token>
|
118
|
-
<price_payment type="decimal">213.21</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
|
-
<completion></completion>
|
213
|
-
<city>São Paulo</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
76
|
<completion></completion>
|
225
|
-
<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
|
-
</address>
|
234
|
-
<address>
|
235
|
-
<number>123</number>
|
236
|
-
<completion></completion>
|
237
|
-
<city>São Paulo</city>
|
238
|
-
<person_address_id type="integer">342</person_address_id>
|
239
|
-
<postal_code>04094050</postal_code>
|
240
|
-
<state>SP</state>
|
241
|
-
<primary type="boolean">false</primary>
|
242
|
-
<street>Avenida Pedro Alvares Cabral</street>
|
243
|
-
<neighborhood>Parque Ibirapuera</neighborhood>
|
244
|
-
<type_address>B</type_address>
|
245
79
|
</address>
|
246
80
|
</addresses>
|
247
|
-
<email>pedro@bo.com.br</email>
|
248
81
|
<contacts type="array">
|
249
82
|
<contact>
|
250
|
-
<
|
83
|
+
<contact_id type="integer">345</contact_id>
|
251
84
|
<value>1137654321</value>
|
252
|
-
<primary type="boolean">true</primary>
|
253
85
|
<type_contact>H</type_contact>
|
86
|
+
<primary type="boolean">true</primary>
|
254
87
|
</contact>
|
255
88
|
<contact>
|
256
|
-
<
|
257
|
-
<value>
|
258
|
-
<
|
259
|
-
<type_contact>E</type_contact>
|
260
|
-
</contact>
|
261
|
-
<contact>
|
262
|
-
<person_contact_id type="integer">348</person_contact_id>
|
263
|
-
<value>1147654321</value>
|
89
|
+
<contact_id type="integer">348</contact_id>
|
90
|
+
<value>11987654321</value>
|
91
|
+
<type_contact>M</type_contact>
|
264
92
|
<primary type="boolean">false</primary>
|
265
|
-
<type_contact>H</type_contact>
|
266
|
-
</contact>
|
267
|
-
<contact>
|
268
|
-
<person_contact_id type="integer">361</person_contact_id>
|
269
|
-
<value>1142360873</value>
|
270
|
-
<primary type="boolean">false</primary>
|
271
|
-
<type_contact>H</type_contact>
|
272
93
|
</contact>
|
273
94
|
</contacts>
|
274
|
-
|
275
|
-
|
276
|
-
<gender>M</gender>
|
277
|
-
<type_person_id>1</type_person_id>
|
278
|
-
</person>
|
279
|
-
</customer>
|
95
|
+
</customer>
|
96
|
+
</transaction>
|
280
97
|
</data_response>
|
281
98
|
<message_response>
|
282
99
|
<message>success</message>
|