tray-checkout 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. data/README.rdoc +123 -141
  2. data/lib/tray/checkout/base_transaction.rb +25 -0
  3. data/lib/tray/checkout/config.rb +10 -2
  4. data/lib/tray/checkout/response_parser.rb +22 -14
  5. data/lib/tray/checkout/temp_transaction.rb +22 -0
  6. data/lib/tray/checkout/transaction.rb +8 -18
  7. data/lib/tray/checkout/transaction_params_parser.rb +1 -0
  8. data/lib/tray/checkout/version.rb +1 -1
  9. data/lib/tray-checkout.rb +2 -0
  10. data/spec/spec_helper.rb +1 -2
  11. data/spec/support/mock_request.rb +2 -1
  12. data/spec/support/responses/create_failure_validation_errors.xml +10 -48
  13. data/spec/support/responses/create_success_boleto.xml +35 -75
  14. data/spec/support/responses/create_temp_transaction_with_token.xml +28 -0
  15. data/spec/support/responses/get_failure_not_found.xml +4 -4
  16. data/spec/support/responses/get_success_boleto.xml +36 -76
  17. data/spec/support/responses/get_success_boleto_without_contacts.xml +37 -67
  18. data/spec/support/responses/get_success_mastercard.xml +36 -76
  19. data/spec/support/vcr/model/create_cart.yml +59 -0
  20. data/spec/support/vcr/model/create_failure_validation_errors.yml +75 -0
  21. data/spec/support/vcr/model/create_success_boleto.yml +93 -0
  22. data/spec/support/vcr/model/create_success_mastercard.yml +90 -0
  23. data/spec/support/vcr/model/get_failure_not_found.yml +72 -0
  24. data/spec/support/vcr/model/get_success_boleto.yml +114 -0
  25. data/spec/support/vcr/model/update_cart.yml +59 -0
  26. data/spec/support/vcr_setup.rb +7 -0
  27. data/spec/tray/checkout/parser_spec.rb +1 -1
  28. data/spec/tray/checkout/response_parser_spec.rb +83 -67
  29. data/spec/tray/checkout/temp_transaction_spec.rb +94 -0
  30. data/spec/tray/checkout/transaction_spec.rb +146 -23
  31. data/spec/tray/checkout_spec.rb +2 -2
  32. data/tray-checkout.gemspec +1 -0
  33. metadata +77 -14
@@ -1,95 +1,55 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <transaction>
2
+ <response>
3
3
  <data_response>
4
4
  <transaction>
5
- <transaction_token>db9b3265af6e7e19af8dd70e00d77383x</transaction_token>
6
- <transaction_id type="integer">530</transaction_id>
5
+ <order_number>1234567</order_number>
6
+ <free>Texto Interno</free>
7
+ <transaction_id type="integer">3856</transaction_id>
8
+ <status_name>Em Recupera\xC3\xA7\xC3\xA3o</status_name>
7
9
  <status_id type="integer">4</status_id>
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>
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>
10
+ <token_transaction>4761d2e198ba6b60b45900a4d95482d5</token_transaction>
52
11
  <payment>
12
+ <price_original type="decimal">2199.99</price_original>
13
+ <price_payment type="decimal">2199.99</price_payment>
14
+ <payment_response></payment_response>
15
+ <url_payment>http://gtw.sandbox.checkout.tray.com.br/api/print/0b525e9dbef558690477b815118aa033</url_payment>
16
+ <tid nil="true"/>
17
+ <split type="integer">1</split>
53
18
  <payment_method_id type="integer">6</payment_method_id>
54
19
  <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>
20
+ <linha_digitavel>34191.76007 00536.260144 50565.600009 6 58630000219999</linha_digitavel>
65
21
  </payment>
66
22
  <customer>
67
- <name>Pedro Bonamides</name>
68
- <email>pedro@bo.com.br</email>
69
- <cpf>18565842673</cpf>
23
+ <name>Nome do Cliente</name>
24
+ <cpf>98489882380</cpf>
25
+ <email>emaildo@cliente.com.br</email>
26
+ <company_name></company_name>
27
+ <trade_name></trade_name>
28
+ <cnpj></cnpj>
70
29
  <addresses type="array">
71
30
  <address>
72
- <street>Avenida Pedro Alvares Cabral</street>
73
- <number>123</number>
74
- <neighborhood>Parque Ibirapuera</neighborhood>
75
- <postal_code>04094050</postal_code>
31
+ <street>Av Paulista</street>
32
+ <number>1001</number>
33
+ <neighborhood>Centro</neighborhood>
34
+ <postal_code>04001001</postal_code>
35
+ <completion></completion>
36
+ <city>S\xC3\xA3o Paulo</city>
37
+ <state>SP</state>
38
+ </address>
39
+ <address>
40
+ <street>Av Paulista</street>
41
+ <number>1001</number>
42
+ <neighborhood>Centro</neighborhood>
43
+ <postal_code>04001001</postal_code>
76
44
  <completion></completion>
77
- <city>São Paulo</city>
45
+ <city>S\xC3\xA3o Paulo</city>
78
46
  <state>SP</state>
79
47
  </address>
80
48
  </addresses>
81
49
  <contacts type="array">
82
50
  <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>
51
+ <value>11998761234</value>
91
52
  <type_contact>M</type_contact>
92
- <primary type="boolean">false</primary>
93
53
  </contact>
94
54
  </contacts>
95
55
  </customer>
@@ -98,4 +58,4 @@
98
58
  <message_response>
99
59
  <message>success</message>
100
60
  </message_response>
101
- </transaction>
61
+ </response>
@@ -0,0 +1,28 @@
1
+ <tmp_transaction>
2
+ <script id="tinyhippos-injected"/>
3
+ <message_response>
4
+ <message>success</message>
5
+ </message_response>
6
+ <data_response>
7
+ <token_transaction>a906bf32cb59060dfc90769524f99d5a</token_transaction>
8
+ <url_car>
9
+ http://checkout.sandbox.tray.com.br/payment/car/v1/
10
+ </url_car>
11
+ <transaction_products type="array">
12
+ <transaction_product>
13
+ <code>teste</code>
14
+ <img>
15
+ http://catnross.com/wp-content/uploads/2011/08/product1.jpg
16
+ </img>
17
+ <sku_code nil="true"/>
18
+ <description>produto teste</description>
19
+ <extra nil="true"/>
20
+ <price_unit type="decimal">10.0</price_unit>
21
+ <quantity type="decimal">5.0</quantity>
22
+ <weight type="decimal">300.0</weight>
23
+ <id type="integer">4502</id>
24
+ <type_product nil="true"/>
25
+ </transaction_product>
26
+ </transaction_products>
27
+ </data_response>
28
+ </tmp_transaction>
@@ -1,14 +1,14 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <transaction>
2
+ <response>
3
3
  <error_response>
4
4
  <errors type="array">
5
5
  <error>
6
- <code>003042</code>
7
- <message>Transa&#231;&#227;o n&#227;o encontrada</message>
6
+ <message>Token inv&aacute;lido ou n&atilde;o encontrado</message>
7
+ <code>001001</code>
8
8
  </error>
9
9
  </errors>
10
10
  </error_response>
11
11
  <message_response>
12
12
  <message>error</message>
13
13
  </message_response>
14
- </transaction>
14
+ </response>
@@ -1,95 +1,55 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <transaction>
2
+ <response>
3
3
  <data_response>
4
4
  <transaction>
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>
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>
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>
5
+ <order_number>1234567</order_number>
6
+ <free>Texto Interno</free>
7
+ <transaction_id type="integer">3856</transaction_id>
8
+ <status_name>Em Recupera\xC3\xA7\xC3\xA3o</status_name>
9
+ <status_id type="integer">88</status_id>
10
+ <token_transaction>4761d2e198ba6b60b45900a4d95482d5</token_transaction>
52
11
  <payment>
12
+ <price_original type="decimal">2199.99</price_original>
13
+ <price_payment type="decimal">2199.99</price_payment>
14
+ <payment_response></payment_response>
15
+ <url_payment>http://gtw.sandbox.checkout.tray.com.br/api/print/0b525e9dbef558690477b815118aa033</url_payment>
16
+ <tid nil="true"/>
17
+ <split type="integer">1</split>
53
18
  <payment_method_id type="integer">6</payment_method_id>
54
19
  <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>
20
+ <linha_digitavel>34191.76007 00536.260144 50565.600009 6 58630000219999</linha_digitavel>
65
21
  </payment>
66
22
  <customer>
67
- <name>Pedro Bonamides</name>
68
- <email>pedro@bo.com.br</email>
69
- <cpf>18565842673</cpf>
23
+ <name>Nome do Cliente</name>
24
+ <cpf>98489882380</cpf>
25
+ <email>emaildo@cliente.com.br</email>
26
+ <company_name></company_name>
27
+ <trade_name></trade_name>
28
+ <cnpj></cnpj>
70
29
  <addresses type="array">
71
30
  <address>
72
- <street>Avenida Pedro Alvares Cabral</street>
73
- <number>123</number>
74
- <neighborhood>Parque Ibirapuera</neighborhood>
75
- <postal_code>04094050</postal_code>
31
+ <street>Av Paulista</street>
32
+ <number>1001</number>
33
+ <neighborhood>Centro</neighborhood>
34
+ <postal_code>04001001</postal_code>
35
+ <completion></completion>
36
+ <city>S\xC3\xA3o Paulo</city>
37
+ <state>SP</state>
38
+ </address>
39
+ <address>
40
+ <street>Av Paulista</street>
41
+ <number>1001</number>
42
+ <neighborhood>Centro</neighborhood>
43
+ <postal_code>04001001</postal_code>
76
44
  <completion></completion>
77
- <city>São Paulo</city>
45
+ <city>S\xC3\xA3o Paulo</city>
78
46
  <state>SP</state>
79
47
  </address>
80
48
  </addresses>
81
49
  <contacts type="array">
82
50
  <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>
51
+ <value>11998761234</value>
91
52
  <type_contact>M</type_contact>
92
- <primary type="boolean">false</primary>
93
53
  </contact>
94
54
  </contacts>
95
55
  </customer>
@@ -98,4 +58,4 @@
98
58
  <message_response>
99
59
  <message>success</message>
100
60
  </message_response>
101
- </transaction>
61
+ </response>
@@ -1,87 +1,57 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <transaction>
2
+ <response>
3
3
  <data_response>
4
4
  <transaction>
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>
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>
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>
5
+ <order_number>1234567</order_number>
6
+ <free>Texto Interno</free>
7
+ <transaction_id type="integer">3856</transaction_id>
8
+ <status_name>Em Recupera\xC3\xA7\xC3\xA3o</status_name>
9
+ <status_id type="integer">88</status_id>
10
+ <token_transaction>4761d2e198ba6b60b45900a4d95482d5</token_transaction>
52
11
  <payment>
12
+ <price_original type="decimal">2199.99</price_original>
13
+ <price_payment type="decimal">2199.99</price_payment>
14
+ <payment_response></payment_response>
15
+ <url_payment>http://gtw.sandbox.checkout.tray.com.br/api/print/c3cc28c28858b2e29d2b4c2a38a85e0b</url_payment>
16
+ <tid nil="true"/>
17
+ <split type="integer">1</split>
53
18
  <payment_method_id type="integer">6</payment_method_id>
54
19
  <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>
20
+ <linha_digitavel>34191.76007 00534.020144 50565.600009 6 58600000219999</linha_digitavel>
65
21
  </payment>
66
22
  <customer>
67
- <name>Pedro Bonamides</name>
68
- <email>pedro@bo.com.br</email>
69
- <cpf>18565842673</cpf>
23
+ <name>Nome do Cliente</name>
24
+ <cpf>98489882380</cpf>
25
+ <email>emaildo@cliente.com.br</email>
26
+ <company_name></company_name>
27
+ <trade_name></trade_name>
28
+ <cnpj></cnpj>
70
29
  <addresses type="array">
71
30
  <address>
72
- <street>Avenida Pedro Alvares Cabral</street>
73
- <number>123</number>
74
- <neighborhood>Parque Ibirapuera</neighborhood>
75
- <postal_code>04094050</postal_code>
31
+ <street>Av Paulista</street>
32
+ <number>1001</number>
33
+ <neighborhood>Centro</neighborhood>
34
+ <postal_code>04001001</postal_code>
35
+ <completion></completion>
36
+ <city>S\xC3\xA3o Paulo</city>
37
+ <state>SP</state>
38
+ </address>
39
+ <address>
40
+ <street>Av Paulista</street>
41
+ <number>1001</number>
42
+ <neighborhood>Centro</neighborhood>
43
+ <postal_code>04001001</postal_code>
76
44
  <completion></completion>
77
- <city>São Paulo</city>
45
+ <city>S\xC3\xA3o Paulo</city>
78
46
  <state>SP</state>
79
47
  </address>
80
48
  </addresses>
49
+ <contacts type="array">
50
+ </contacts>
81
51
  </customer>
82
52
  </transaction>
83
53
  </data_response>
84
54
  <message_response>
85
55
  <message>success</message>
86
56
  </message_response>
87
- </transaction>
57
+ </response>
@@ -1,95 +1,55 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <transaction>
2
+ <response>
3
3
  <data_response>
4
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>
5
+ <order_number>1234567</order_number>
6
+ <free>Texto Interno</free>
7
+ <transaction_id type="integer">3856</transaction_id>
8
+ <status_name>Em Recupera\xC3\xA7\xC3\xA3o</status_name>
9
+ <status_id type="integer">88</status_id>
10
+ <token_transaction>4761d2e198ba6b60b45900a4d95482d5</token_transaction>
52
11
  <payment>
12
+ <price_original type="decimal">2199.99</price_original>
13
+ <price_payment type="decimal">2786.84</price_payment>
14
+ <payment_response>Mensagem de venda fake</payment_response>
15
+ <url_payment></url_payment>
16
+ <tid>1233</tid>
17
+ <split type="integer">12</split>
53
18
  <payment_method_id type="integer">4</payment_method_id>
54
19
  <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>
20
+ <linha_digitavel nil="true"/>
65
21
  </payment>
66
22
  <customer>
67
- <name>Pedro Bonamides</name>
68
- <email>pedro@bo.com.br</email>
69
- <cpf>18565842673</cpf>
23
+ <name>Nome do Cliente</name>
24
+ <cpf>98489882380</cpf>
25
+ <email>emaildo@cliente.com.br</email>
26
+ <company_name></company_name>
27
+ <trade_name></trade_name>
28
+ <cnpj></cnpj>
70
29
  <addresses type="array">
71
30
  <address>
72
- <street>Avenida Pedro Alvares Cabral</street>
73
- <number>123</number>
74
- <neighborhood>Parque Ibirapuera</neighborhood>
75
- <postal_code>04094050</postal_code>
31
+ <street>Av Paulista</street>
32
+ <number>1001</number>
33
+ <neighborhood>Centro</neighborhood>
34
+ <postal_code>04001001</postal_code>
35
+ <completion></completion>
36
+ <city>S\xC3\xA3o Paulo</city>
37
+ <state>SP</state>
38
+ </address>
39
+ <address>
40
+ <street>Av Paulista</street>
41
+ <number>1001</number>
42
+ <neighborhood>Centro</neighborhood>
43
+ <postal_code>04001001</postal_code>
76
44
  <completion></completion>
77
- <city>São Paulo</city>
45
+ <city>S\xC3\xA3o Paulo</city>
78
46
  <state>SP</state>
79
47
  </address>
80
48
  </addresses>
81
49
  <contacts type="array">
82
50
  <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>
51
+ <value>11998761234</value>
91
52
  <type_contact>M</type_contact>
92
- <primary type="boolean">false</primary>
93
53
  </contact>
94
54
  </contacts>
95
55
  </customer>
@@ -98,4 +58,4 @@
98
58
  <message_response>
99
59
  <message>success</message>
100
60
  </message_response>
101
- </transaction>
61
+ </response>
@@ -0,0 +1,59 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://api.sandbox.traycheckout.com.br//v1/tmp_transactions/create
6
+ body:
7
+ encoding: US-ASCII
8
+ string: postal_code_seller=18523698&token_account=8bfe5ddcb77207b&transaction%5Bfree%5D=Texto+Interno&transaction%5Border_number%5D=1234567&transaction%5Burl_notification%5D=http%3A%2F%2Fprodis.blog.br%2Ftray_notification&transaction_product%5B%5D%5Bcode%5D=teste&transaction_product%5B%5D%5Bdescription%5D=Notebook+Branco&transaction_product%5B%5D%5Bprice_unit%5D=2199.99&transaction_product%5B%5D%5Bquantity%5D=1&transaction_product%5B%5D%5Burl_img%5D=http%3A%2F%2Fcatnross.com%2Fwp-content%2Fuploads%2F2011%2F08%2Fproduct1.jpg&transaction_product%5B%5D%5Bweight%5D=300
9
+ headers:
10
+ Accept:
11
+ - ! '*/*'
12
+ User-Agent:
13
+ - Ruby
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ Server:
20
+ - nginx/1.4.1
21
+ Date:
22
+ - Mon, 21 Oct 2013 19:19:29 GMT
23
+ Content-Type:
24
+ - application/xml; charset=utf-8
25
+ Transfer-Encoding:
26
+ - chunked
27
+ Connection:
28
+ - keep-alive
29
+ Status:
30
+ - 200 OK
31
+ X-Ua-Compatible:
32
+ - IE=Edge,chrome=1
33
+ Etag:
34
+ - ! '"29c4801c906d659067301dcab636c8ff"'
35
+ Cache-Control:
36
+ - max-age=0, private, must-revalidate
37
+ X-Request-Id:
38
+ - 63f9d2053f9bfbc00914166b68174aa4
39
+ X-Runtime:
40
+ - '0.080716'
41
+ X-Rack-Cache:
42
+ - invalidate, pass
43
+ X-Powered-By:
44
+ - Phusion Passenger 4.0.14
45
+ body:
46
+ encoding: US-ASCII
47
+ string: ! "<tmp_transaction>\n <message_response>\n <message>success</message>\n
48
+ \ </message_response>\n <data_response>\n <token_transaction>31d7b7f786b6aa5749e8358374b7068f</token_transaction>\n
49
+ \ <url_car>http://checkout.sandbox.tray.com.br/payment/car/v1/</url_car>\n
50
+ \ <transaction_products type=\"array\">\n <transaction_product>\n <code>teste</code>\n
51
+ \ <img>http://catnross.com/wp-content/uploads/2011/08/product1.jpg</img>\n
52
+ \ <sku_code nil=\"true\"/>\n <description>Notebook Branco</description>\n
53
+ \ <extra nil=\"true\"/>\n <price_unit type=\"decimal\">2199.99</price_unit>\n
54
+ \ <quantity type=\"decimal\">1.0</quantity>\n <weight type=\"decimal\">300.0</weight>\n
55
+ \ <id type=\"integer\">4526</id>\n <type_product nil=\"true\"/>\n
56
+ \ </transaction_product>\n </transaction_products>\n </data_response>\n</tmp_transaction>\n"
57
+ http_version:
58
+ recorded_at: Mon, 21 Oct 2013 19:19:29 GMT
59
+ recorded_with: VCR 2.6.0