openpayu 0.0.2 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +5 -13
  2. data/README.md +26 -21
  3. data/doc/EmptyResponseError.html +4 -4
  4. data/doc/HttpStatusException.html +4 -4
  5. data/doc/NotImplementedException.html +4 -4
  6. data/doc/OpenPayU.html +13 -13
  7. data/doc/OpenPayU/Configuration.html +19 -17
  8. data/doc/OpenPayU/Connection.html +35 -43
  9. data/doc/OpenPayU/Document.html +24 -228
  10. data/doc/OpenPayU/Documents.html +4 -4
  11. data/doc/OpenPayU/Documents/Request.html +5 -5
  12. data/doc/OpenPayU/Documents/Response.html +72 -120
  13. data/doc/OpenPayU/Models.html +5 -5
  14. data/doc/OpenPayU/Models/Address.html +5 -6
  15. data/doc/OpenPayU/Models/Buyer.html +5 -6
  16. data/doc/OpenPayU/Models/Buyer/Delivery.html +5 -6
  17. data/doc/OpenPayU/Models/Card.html +5 -6
  18. data/doc/OpenPayU/Models/Fee.html +5 -6
  19. data/doc/OpenPayU/Models/Model.html +122 -207
  20. data/doc/OpenPayU/Models/NotifyResponse.html +5 -6
  21. data/doc/OpenPayU/Models/Order.html +8 -9
  22. data/doc/OpenPayU/Models/PayMethod.html +5 -6
  23. data/doc/OpenPayU/Models/Product.html +5 -6
  24. data/doc/OpenPayU/Models/Refund.html +13 -102
  25. data/doc/OpenPayU/Models/ShippingMethod.html +13 -14
  26. data/doc/OpenPayU/Models/StatusUpdate.html +5 -6
  27. data/doc/OpenPayU/Models/Token.html +5 -6
  28. data/doc/OpenPayU/Order.html +53 -89
  29. data/doc/OpenPayU/Refund.html +6 -18
  30. data/doc/OpenPayU/Token.html +4 -4
  31. data/doc/WrongConfigurationError.html +4 -4
  32. data/doc/WrongNotifyRequest.html +4 -4
  33. data/doc/WrongOrderParameters.html +4 -4
  34. data/doc/WrongSignatureException.html +4 -4
  35. data/doc/_index.html +13 -31
  36. data/doc/class_list.html +1 -1
  37. data/doc/css/style.css +2 -1
  38. data/doc/file.README.html +38 -30
  39. data/doc/frames.html +1 -1
  40. data/doc/index.html +38 -30
  41. data/doc/js/app.js +7 -2
  42. data/doc/method_list.html +78 -120
  43. data/doc/top-level-namespace.html +4 -4
  44. data/lib/openpayu.rb +0 -1
  45. data/lib/openpayu/configuration.rb +1 -0
  46. data/lib/openpayu/connection.rb +28 -19
  47. data/lib/openpayu/document.rb +2 -38
  48. data/lib/openpayu/documents/response.rb +9 -20
  49. data/lib/openpayu/models/model.rb +4 -25
  50. data/lib/openpayu/models/order.rb +0 -1
  51. data/lib/openpayu/models/refund.rb +5 -27
  52. data/lib/openpayu/models/shipping_method.rb +2 -2
  53. data/lib/openpayu/order.rb +7 -25
  54. data/lib/openpayu/refund.rb +1 -7
  55. data/lib/openpayu/version.rb +1 -1
  56. data/openpayu_ruby.gemspec +0 -4
  57. data/spec/cassettes/cancel_order.yml +17 -26
  58. data/spec/cassettes/create_order.yml +19 -29
  59. data/spec/cassettes/retrieve_order.yml +18 -27
  60. data/spec/cassettes/update_order.yml +19 -28
  61. data/spec/integration/order_spec.rb +65 -78
  62. data/spec/openpayu.yml +2 -2
  63. data/spec/spec_helper.rb +5 -5
  64. data/spec/test_objects/order.rb +31 -56
  65. data/spec/unit/configuration_spec.rb +1 -1
  66. data/spec/unit/models/order_spec.rb +4 -34
  67. data/spec/unit/openpayu_spec.rb +2 -5
  68. metadata +55 -87
  69. data/lib/openpayu/xml_builder.rb +0 -23
  70. data/spec/cassettes/refund_order.yml +0 -100
@@ -2,17 +2,17 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: delete
5
- uri: http://platnosci-dev5.dc2/api/v2/order/28161ZT5TF131121GUEST000P01.json
5
+ uri: https://114207:1f9fd7298097b9414db5d1bfd1204d20@secure.payu.com/api/v2/orders/VQWQ6XMVKR140415GUEST000P01
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
9
9
  headers:
10
- openpayu-signature:
11
- - sender=45654;signature=69c369ae89fba8f8183f6534a1410b1b;algorithm=MD5
12
10
  accept:
13
- - ! '*/*'
11
+ - '*/*'
14
12
  user-agent:
15
13
  - Ruby
14
+ authorization:
15
+ - Basic MTE0MjA3OjFmOWZkNzI5ODA5N2I5NDE0ZGI1ZDFiZmQxMjA0ZDIw
16
16
  content-type:
17
17
  - application/json
18
18
  response:
@@ -20,31 +20,22 @@ http_interactions:
20
20
  code: 200
21
21
  message: OK
22
22
  headers:
23
- date:
24
- - Thu, 21 Nov 2013 14:32:35 GMT
25
23
  server:
26
- - Apache/2.2.17 (Unix) DAV/2 mod_ssl/2.2.17 OpenSSL/1.0.0c mod_jk/1.2.31 PHP/5.3.5
27
- mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1
28
- openpayu-signature:
29
- - signature=06227acee76617a610039a273faed13f;algorithm=MD5;sender=checkout;content=DOCUMENT;
30
- x-openpayu-signature:
31
- - signature=06227acee76617a610039a273faed13f;algorithm=MD5;sender=checkout;content=DOCUMENT;
32
- content-language:
33
- - pl
34
- content-length:
35
- - '166'
36
- set-cookie:
37
- - payu_persistent=mobile_agent-false#; Expires=Sun, 16-Nov-2014 14:32:35 GMT;
38
- Path=/
39
- - CSESSIONID=90F64A8F648CF038A543C0A68BDD3804.01; Path=/pl/standard/co
24
+ - nginx
25
+ date:
26
+ - Wed, 28 May 2014 08:25:01 GMT
27
+ content-type:
28
+ - application/json
29
+ transfer-encoding:
30
+ - chunked
40
31
  connection:
41
32
  - close
42
- content-type:
43
- - application/json;charset=UTF-8
33
+ expires:
34
+ - '-1'
44
35
  body:
45
36
  encoding: US-ASCII
46
- string: ! '{"OpenPayU":{"OrderCancelResponse":{"Status":{"StatusCode":"SUCCESS","StatusDesc":"Request
47
- successful"},"ExtOrderId":"1342","OrderId":"28161ZT5TF131121GUEST000P01"}}}'
37
+ string: '{"extOrderId":"1342","orderId":"VQWQ6XMVKR140415GUEST000P01","version":"2.0","redirectUri":null,"status":{"code":null,"codeLiteral":null,"statusCode":"SUCCESS","statusDesc":"Request
38
+ processing successful","severity":null,"location":null},"resId":null,"properties":null}'
48
39
  http_version: '1.1'
49
- recorded_at: Thu, 21 Nov 2013 14:32:35 GMT
50
- recorded_with: VCR 2.6.0
40
+ recorded_at: Wed, 28 May 2014 08:25:01 GMT
41
+ recorded_with: VCR 2.9.2
@@ -2,50 +2,40 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: post
5
- uri: http://platnosci-dev5.dc2/api/v2/order.json
5
+ uri: https://114207:1f9fd7298097b9414db5d1bfd1204d20@secure.payu.com/api/v2/orders
6
6
  body:
7
- encoding: US-ASCII
8
- string: ! '{"OpenPayU":{"OrderCreateRequest":{"merchant_pos_id":"45654","customer_ip":"127.0.0.1","ext_order_id":1342,"order_url":"http://localhost/","description":"New
9
- order","currency_code":"PLN","total_amount":10000,"notify_url":"http://localhost/","continue_url":"http://localhost/","validity_time":"48000","buyer":{"email":"dd@ddd.pl","phone":"123123123","first_name":"Jan","last_name":"Kowalski","language":"pl_PL","NIN":"123456","validation_context":null,"errors":{}},"products":[{"name":"Mouse","unit_price":10000,"quantity":1,"all_errors":{},"validation_context":null,"errors":{}}],"pay_methods":[{"type":"CARD_TOKEN","value":"TOK_1HPPNU4HIOWT180pPDWhuhAmM3ym","all_errors":{},"validation_context":null,"errors":{}}],"req_id":"{a746b206-b72e-4302-b623-1c519bb32bdd}","all_errors":{},"validation_context":null,"errors":{},"MerchantPosId":"45654","CustomerIp":"127.0.0.1","ExtOrderId":1342,"OrderUrl":"http://localhost/","Description":"New
10
- order","CurrencyCode":"PLN","TotalAmount":10000,"NotifyUrl":"http://localhost/","ContinueUrl":"http://localhost/","ValidityTime":"48000","Buyer":{"Email":"dd@ddd.pl","Phone":"123123123","FirstName":"Jan","LastName":"Kowalski","Language":"pl_PL","NIN":"123456"},"Products":[{"Product":{"Name":"Mouse","UnitPrice":10000,"Quantity":1}}],"PayMethods":[{"PayMethod":{"Type":"CARD_TOKEN","Value":"TOK_1HPPNU4HIOWT180pPDWhuhAmM3ym"}}],"ReqId":"{a746b206-b72e-4302-b623-1c519bb32bdd}"}}}'
7
+ encoding: UTF-8
8
+ string: '{"currencyCode":"PLN","validityTime":"48000","reqId":"{4911fcac-8702-4d77-8fa6-da2af7a064cc}","merchantPosId":"114207","continueUrl":"http://localhost/","buyer":{"lastName":"Kowalski","email":"dd@ddd.pl","firstName":"Jan","phone":"123123123"},"totalAmount":100,"notifyUrl":"http://localhost/","products":{"products":[{"name":"Mouse","quantity":1,"unitPrice":100}]},"orderUrl":"http://localhost/","extOrderId":1342,"customerIp":"127.0.0.1","description":"New
9
+ order"}'
11
10
  headers:
12
11
  accept:
13
- - ! '*/*'
12
+ - '*/*'
14
13
  user-agent:
15
14
  - Ruby
15
+ authorization:
16
+ - Basic MTE0MjA3OjFmOWZkNzI5ODA5N2I5NDE0ZGI1ZDFiZmQxMjA0ZDIw
16
17
  content-type:
17
18
  - application/json
18
- openpayu-signature:
19
- - sender=45654;signature=2a4046802854830e9bd2b27541ef977a;algorithm=MD5
20
19
  response:
21
20
  status:
22
21
  code: 200
23
22
  message: OK
24
23
  headers:
25
- date:
26
- - Thu, 21 Nov 2013 14:32:33 GMT
27
24
  server:
28
- - Apache/2.2.17 (Unix) DAV/2 mod_ssl/2.2.17 OpenSSL/1.0.0c mod_jk/1.2.31 PHP/5.3.5
29
- mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1
30
- openpayu-signature:
31
- - signature=e15c458b67bd01c2a170b55033f59507;algorithm=MD5;sender=checkout;content=DOCUMENT;
32
- x-openpayu-signature:
33
- - signature=e15c458b67bd01c2a170b55033f59507;algorithm=MD5;sender=checkout;content=DOCUMENT;
34
- content-language:
35
- - pl
36
- content-length:
37
- - '337'
38
- set-cookie:
39
- - payu_persistent=mobile_agent-false#; Expires=Sun, 16-Nov-2014 14:32:33 GMT;
40
- Path=/
41
- - CSESSIONID=06B5736A0A8FA9D394730EDF27EB05A0.01; Path=/pl/standard/co
25
+ - nginx
26
+ date:
27
+ - Wed, 28 May 2014 12:21:23 GMT
28
+ content-type:
29
+ - application/json
30
+ transfer-encoding:
31
+ - chunked
42
32
  connection:
43
33
  - close
44
- content-type:
45
- - application/json;charset=UTF-8
34
+ expires:
35
+ - '-1'
46
36
  body:
47
37
  encoding: US-ASCII
48
- string: ! '{"OpenPayU":{"OrderCreateResponse":{"Status":{"StatusCode":"SUCCESS"},"OrderId":"28161ZT5TF131121GUEST000P01","ResId":"{a746b206-b72e-4302-b623-1c519bb32bdd}","PayMethods":{"PayMethod":{"Value":"TOKC_TMWKMHX4VYTZPWPQM17ERFGKDHZ","Type":"CARD_TOKEN","Card":{"ExpirationYear":"2014","ExpirationMonth":"12","Number":"510005******6818"}}}}}}'
38
+ string: '{"extOrderId":"1342","orderId":"NJZFFJ82D2140528GUEST000P01","payMethods":null,"version":"2.0","redirectUri":"https://secure.payu.com/pl/standard/co/dot/authenticate/anonymous?sessionId=13423&merchantPosId=114207","status":{"code":null,"codeLiteral":null,"statusCode":"SUCCESS","statusDesc":null,"severity":null,"location":null},"resId":null,"properties":null}'
49
39
  http_version: '1.1'
50
- recorded_at: Thu, 21 Nov 2013 14:32:35 GMT
51
- recorded_with: VCR 2.6.0
40
+ recorded_at: Wed, 28 May 2014 12:21:23 GMT
41
+ recorded_with: VCR 2.9.2
@@ -2,17 +2,17 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: http://platnosci-dev5.dc2/api/v2/order/28161ZT5TF131121GUEST000P01.json
5
+ uri: https://114207:1f9fd7298097b9414db5d1bfd1204d20@secure.payu.com/api/v2/orders/MHQ3MRZKSQ140528GUEST000P01
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
9
9
  headers:
10
- openpayu-signature:
11
- - sender=45654;signature=69c369ae89fba8f8183f6534a1410b1b;algorithm=MD5
12
10
  accept:
13
- - ! '*/*'
11
+ - '*/*'
14
12
  user-agent:
15
13
  - Ruby
14
+ authorization:
15
+ - Basic MTE0MjA3OjFmOWZkNzI5ODA5N2I5NDE0ZGI1ZDFiZmQxMjA0ZDIw
16
16
  content-type:
17
17
  - application/json
18
18
  response:
@@ -20,32 +20,23 @@ http_interactions:
20
20
  code: 200
21
21
  message: OK
22
22
  headers:
23
- date:
24
- - Thu, 21 Nov 2013 14:32:35 GMT
25
23
  server:
26
- - Apache/2.2.17 (Unix) DAV/2 mod_ssl/2.2.17 OpenSSL/1.0.0c mod_jk/1.2.31 PHP/5.3.5
27
- mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1
28
- openpayu-signature:
29
- - signature=7bd43e0b99c03a76aca60c7896bce9cf;algorithm=MD5;sender=checkout;content=DOCUMENT;
30
- x-openpayu-signature:
31
- - signature=7bd43e0b99c03a76aca60c7896bce9cf;algorithm=MD5;sender=checkout;content=DOCUMENT;
32
- content-language:
33
- - pl
34
- content-length:
35
- - '550'
36
- set-cookie:
37
- - payu_persistent=mobile_agent-false#; Expires=Sun, 16-Nov-2014 14:32:35 GMT;
38
- Path=/
39
- - CSESSIONID=699C5F1B2B7FA87764F99990BDA185EF.01; Path=/pl/standard/co
24
+ - nginx
25
+ date:
26
+ - Wed, 28 May 2014 08:26:32 GMT
27
+ content-type:
28
+ - application/json
29
+ transfer-encoding:
30
+ - chunked
40
31
  connection:
41
32
  - close
42
- content-type:
43
- - application/json;charset=UTF-8
33
+ expires:
34
+ - '-1'
44
35
  body:
45
36
  encoding: US-ASCII
46
- string: ! '{"OpenPayU":{"OrderRetrieveResponse":{"Status":{"StatusCode":"SUCCESS","StatusDesc":"Request
47
- processed successfully."},"Orders":{"Order":{"ExtOrderId":"1342","Description":"New
48
- order","Products":{"Product":{"Name":"Mouse","Quantity":"1","UnitPrice":"10000"}},"OrderId":"28161ZT5TF131121GUEST000P01","CurrencyCode":"PLN","CustomerIp":"127.0.0.1","Status":"PENDING","NotifyUrl":"http://localhost/","ValidityTime":"48000","MerchantPosId":"45654","OrderCreateDate":"2013-11-21T15:32:34.067+01:00","OrderUrl":"http://localhost/","TotalAmount":"10000"}}}}}'
37
+ string: '{"pageResponse":null,"orders":{"orders":[{"shippingMethod":null,"description":"New
38
+ order","fee":null,"status":"NEW","merchantPosId":"114207","notifyUrl":"http://localhost/","customerIp":"127.0.0.1","extOrderId":"1342","totalAmount":100,"buyer":null,"orderCreateDate":1401265500678,"orderUrl":"http://localhost/","validityTime":48000,"payMethod":null,"products":{"products":[{"version":null,"code":null,"subMerchantId":null,"categoryId":null,"categoryName":null,"quantity":1,"unitPrice":100,"extraInfo":null,"weight":null,"discount":null,"name":"Mouse","size":null}]},"currencyCode":"PLN","orderId":"MHQ3MRZKSQ140528GUEST000P01"}]},"version":"2.0","redirectUri":null,"status":{"code":null,"codeLiteral":null,"statusCode":"SUCCESS","statusDesc":"Request
39
+ processing successful","severity":null,"location":null},"resId":null,"properties":null}'
49
40
  http_version: '1.1'
50
- recorded_at: Thu, 21 Nov 2013 14:32:35 GMT
51
- recorded_with: VCR 2.6.0
41
+ recorded_at: Wed, 28 May 2014 08:26:32 GMT
42
+ recorded_with: VCR 2.9.2
@@ -2,49 +2,40 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: put
5
- uri: http://platnosci-dev5.dc2/api/v2/order/28161ZT5TF131121GUEST000P01/status.json
5
+ uri: https://114207:1f9fd7298097b9414db5d1bfd1204d20@secure.payu.com/api/v2/orders/NJZFFJ82D2140528GUEST000P01/status
6
6
  body:
7
- encoding: US-ASCII
8
- string: ! '{"OpenPayU":{"OrderStatusUpdateRequest":{"order_id":"28161ZT5TF131121GUEST000P01","order_status":"COMPLETED","OrderId":"28161ZT5TF131121GUEST000P01","OrderStatus":"COMPLETED"}}}'
7
+ encoding: UTF-8
8
+ string: '{"orderStatus":"COMPLETED","orderId":"NJZFFJ82D2140528GUEST000P01"}'
9
9
  headers:
10
10
  accept:
11
- - ! '*/*'
11
+ - '*/*'
12
12
  user-agent:
13
13
  - Ruby
14
+ authorization:
15
+ - Basic MTE0MjA3OjFmOWZkNzI5ODA5N2I5NDE0ZGI1ZDFiZmQxMjA0ZDIw
14
16
  content-type:
15
17
  - application/json
16
- openpayu-signature:
17
- - sender=45654;signature=a9ead1b49004e2225a7560a57e341a2f;algorithm=MD5
18
18
  response:
19
19
  status:
20
20
  code: 200
21
21
  message: OK
22
22
  headers:
23
- date:
24
- - Thu, 21 Nov 2013 14:32:35 GMT
25
23
  server:
26
- - Apache/2.2.17 (Unix) DAV/2 mod_ssl/2.2.17 OpenSSL/1.0.0c mod_jk/1.2.31 PHP/5.3.5
27
- mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1
28
- openpayu-signature:
29
- - signature=530f2a4d86abaf8d1cbf0acb54b6effc;algorithm=MD5;sender=checkout;content=DOCUMENT;
30
- x-openpayu-signature:
31
- - signature=530f2a4d86abaf8d1cbf0acb54b6effc;algorithm=MD5;sender=checkout;content=DOCUMENT;
32
- content-language:
33
- - pl
34
- content-length:
35
- - '112'
36
- set-cookie:
37
- - payu_persistent=mobile_agent-false#; Expires=Sun, 16-Nov-2014 14:32:35 GMT;
38
- Path=/
39
- - CSESSIONID=723904F9CDF2061578920378B4955910.01; Path=/pl/standard/co
24
+ - nginx
25
+ date:
26
+ - Wed, 28 May 2014 12:23:18 GMT
27
+ content-type:
28
+ - application/json
29
+ transfer-encoding:
30
+ - chunked
40
31
  connection:
41
32
  - close
42
- content-type:
43
- - application/json;charset=UTF-8
33
+ expires:
34
+ - '-1'
44
35
  body:
45
36
  encoding: US-ASCII
46
- string: ! '{"OpenPayU":{"OrderStatusUpdateResponse":{"Status":{"StatusCode":"SUCCESS","StatusDesc":"Request
47
- successful"}}}}'
37
+ string: '{"version":"2.0","redirectUri":null,"status":{"code":null,"codeLiteral":null,"statusCode":"SUCCESS","statusDesc":"Status
38
+ was updated","severity":null,"location":null},"resId":null,"properties":null}'
48
39
  http_version: '1.1'
49
- recorded_at: Thu, 21 Nov 2013 14:32:35 GMT
50
- recorded_with: VCR 2.6.0
40
+ recorded_at: Wed, 28 May 2014 12:23:18 GMT
41
+ recorded_with: VCR 2.9.2
@@ -2,99 +2,86 @@
2
2
  require 'spec_helper'
3
3
 
4
4
  describe 'Create transparent order' do
5
- %w(json xml).each do |data_format|
6
- OpenPayU::Configuration.data_format = data_format
7
- context "run with data format #{OpenPayU::Configuration.data_format}" do
8
- before(:all) do
9
- order = TestObject::Order.valid_order
10
- VCR.use_cassette('create_order') do
11
- @response = OpenPayU::Order.create(order)
12
- end
13
- end
14
- context 'create order' do
15
- it { @response.response.code.should eq '200' }
16
- it { @response.status['status_code'].should eq 'SUCCESS' }
17
- it { @response.order_id.should_not be_empty }
18
- end
19
- context 'Retrieve order' do
20
- before(:all) do
21
- VCR.use_cassette('retrieve_order') do
22
- @response = OpenPayU::Order.retrieve(@response.order_id)
23
- end
24
- end
25
- it { @response.response.code.should eq '200' }
26
- it { @response.status['status_code'].should eq 'SUCCESS' }
27
- it { @response.orders.should_not be_empty }
5
+ context "run with data format #{OpenPayU::Configuration.data_format}" do
6
+ before(:all) do
7
+ order = TestObject::Order.valid_order
8
+ VCR.use_cassette('create_order') do
9
+ @response = OpenPayU::Order.create(order)
28
10
  end
11
+ end
12
+ context 'create order' do
29
13
 
30
- context 'Consume order notification' do
31
- before(:all) do
32
- body =
33
- if OpenPayU::Configuration.data_format == 'json'
34
- TestObject::Order.notification_request.to_json
35
- else
36
- TestObject::Order.notification_request['OpenPayU'].to_xml(
37
- root: 'OpenPayU',
38
- skip_types: true,
39
- skip_instruct: true
40
- )
41
- end
42
- request = OpenPayU::Documents::Request.new(body)
43
- @request = OpenPayU::Order.consume_notification(request)
14
+ it { @response.response.code.should eq '200' }
15
+ it { @response.status['status_code'].should eq 'SUCCESS' }
16
+ it { @response.order_id.should_not be_empty }
17
+ end
18
+ context 'Retrieve order' do
19
+ before(:all) do
20
+ VCR.use_cassette('retrieve_order') do
21
+ @response = OpenPayU::Order.retrieve("MHQ3MRZKSQ140528GUEST000P01")
44
22
  end
45
- it { @request.order.should_not be_empty }
46
23
  end
24
+ it { @response.response.code.should eq '200' }
25
+ it { @response.status['status_code'].should eq 'SUCCESS' }
26
+ it { @response.orders.should_not be_empty }
27
+ end
47
28
 
48
- context 'refund order' do
49
- before(:all) do
50
- VCR.use_cassette('refund_order') do
51
- @refund = OpenPayU::Refund.create({
52
- order_id: @response.order_id,
53
- description: 'Money refund'
54
- })
55
- end
56
- end
57
- it { @refund.response.code.should eq '200' }
58
- it { @refund.status['status_code'].should eq 'SUCCESS' }
59
- it { @refund.order_id.should eq @response.order_id }
60
- it { @refund.refund['status'].should eq 'INIT' }
29
+ context 'Consume order notification' do
30
+ it do
31
+ body = TestObject::Order.notification_request.to_json
32
+ request = OpenPayU::Documents::Request.new(body)
33
+ @request = OpenPayU::Order.consume_notification(request)
34
+ @request.order.should_not be_empty
61
35
  end
36
+ end
62
37
 
63
- context 'update order' do
64
- before(:all) do
65
- status_update = {
66
- order_id: @response.order_id,
67
- order_status: 'COMPLETED'
68
- }
69
- VCR.use_cassette('update_order') do
70
- @response = OpenPayU::Order.status_update(status_update)
71
- pp @retrieve_response
72
- end
73
- end
74
- it { @response.response.code.should eq '200' }
75
- it { @response.status['status_code'].should eq 'SUCCESS' }
76
- it { @response.status['status_desc'].should eq 'Request successful' }
77
- end
38
+ # context 'refund order' do
39
+ # before(:all) do
40
+ # # VCR.use_cassette('refund_order') do
41
+ # @refund = OpenPayU::Refund.create({
42
+ # order_id: 'VQWQ6XMVKR140415GUEST000P01',
43
+ # description: 'Money refund'
44
+ # })
45
+ # # end
46
+ # end
47
+ # it { @refund.response.code.should eq '200' }
48
+ # it { @refund.status['status_code'].should eq 'SUCCESS' }
49
+ # it { @refund.order_id.should eq @response.order_id }
50
+ # it { @refund.refund['status'].should eq 'INIT' }
51
+ # end
78
52
 
79
- context 'cancel order' do
80
- before(:all) do
81
- VCR.use_cassette('cancel_order') do
82
- @response = OpenPayU::Order.cancel(@response.order_id)
83
- end
53
+ context 'update order' do
54
+ before(:all) do
55
+ status_update = {
56
+ order_id: "NJZFFJ82D2140528GUEST000P01",
57
+ order_status: 'COMPLETED'
58
+ }
59
+ VCR.use_cassette('update_order') do
60
+ @response = OpenPayU::Order.status_update(status_update)
84
61
  end
85
- it { @response.response.code.should eq '200' }
86
- it { @response.status['status_code'].should eq 'SUCCESS' }
87
- it { @response.status['status_desc'].should eq 'Request successful' }
88
62
  end
63
+ it { @response.response.code.should eq '200' }
64
+ it { @response.status['status_code'].should eq 'SUCCESS' }
65
+ it { @response.status['status_desc'].should eq 'Status was updated' }
66
+ end
89
67
 
90
- describe ' Generate OrderNotifyResponse' do
91
- it do
92
- OpenPayU::Order.build_notify_response(3_243_243_324_342)
93
- .should include('SUCCESS')
68
+ context 'cancel order' do
69
+ before(:all) do
70
+ VCR.use_cassette('cancel_order') do
71
+ @response = OpenPayU::Order.cancel('VQWQ6XMVKR140415GUEST000P01')
94
72
  end
95
73
  end
74
+ it { @response.response.code.should eq '200' }
75
+ it { @response.status['status_code'].should eq 'SUCCESS' }
76
+ end
96
77
 
78
+ describe ' Generate OrderNotifyResponse' do
79
+ it do
80
+ OpenPayU::Order.build_notify_response(3_243_243_324_342)
81
+ .should include('SUCCESS')
82
+ end
97
83
  end
84
+
98
85
  end
99
86
  end
100
87
 
data/spec/openpayu.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  test:
2
- merchant_pos_id: '8334'
3
- signature_key: 95873897fb42d
2
+ merchant_pos_id: '145227'
3
+ signature_key: 13a980d4f851f3d9a1cfc792fb1f5e50
4
4
  algorithm: MD5 # MD5, SHA-1, SHA-256
5
5
  service_domain: payu.com
6
6
  protocol: https