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
data/spec/spec_helper.rb CHANGED
@@ -15,12 +15,12 @@ end
15
15
  RSpec.configure do |config|
16
16
  config.before(:all) do
17
17
  OpenPayU::Configuration.configure do |cfg|
18
- cfg.env = 'platnosci-dev5'
19
- cfg.merchant_pos_id = '45654'
20
- cfg.signature_key = '981852826b1f62fb24e1771e878fb42d'
18
+ cfg.env = 'secure'
19
+ cfg.merchant_pos_id = '114207'
20
+ cfg.signature_key = '1f9fd7298097b9414db5d1bfd1204d20'
21
21
  cfg.algorithm = 'MD5'
22
- cfg.service_domain = 'dc2'
23
- cfg.protocol = 'http'
22
+ cfg.service_domain = 'payu.com'
23
+ cfg.protocol = 'https'
24
24
  cfg.data_format = 'json'
25
25
  end
26
26
  end
@@ -18,22 +18,14 @@ module TestObject
18
18
  email: 'dd@ddd.pl',
19
19
  phone: '123123123',
20
20
  first_name: 'Jan',
21
- last_name: 'Kowalski',
22
- language: 'pl_PL',
23
- NIN: '123456'
24
- },
25
- products: [
26
- {
27
- name: 'Mouse',
28
- unit_price: 100,
29
- quantity: 1
30
- }
31
- ],
32
- pay_methods: [
33
- {
34
- type: 'CARD_TOKEN',
35
- value: 'TOK_1HPPNU4HIOWT180pPDWhuhAmM3ym',
36
- }
21
+ last_name: 'Kowalski'
22
+ },
23
+ products: [
24
+ {
25
+ name: 'Mouse',
26
+ unit_price: 100,
27
+ quantity: 1
28
+ }
37
29
  ]
38
30
  }
39
31
  end
@@ -49,47 +41,30 @@ module TestObject
49
41
 
50
42
  def self.notification_request
51
43
  {
52
- 'OpenPayU' => {
53
- 'OrderNotifyRequest' => {
54
- 'Order' => {
55
- 'ExtOrderId' => 'extOrderId',
56
- 'Description' => 'product no. 1',
57
- 'Products' => {
58
- 'Product' => [
59
- {
60
- 'Name' => 'Product1',
61
- 'Quantity' => '1',
62
- 'UnitPrice' => '1000'
63
- }, {
64
- 'Name' => 'Product2',
65
- 'Quantity' => '3',
66
- 'UnitPrice' => '9870'
67
- }
68
- ]
69
- },
70
- 'Buyer' => {
71
- 'Phone' => '+48505606707',
72
- 'Email' => 'testowy@mail.pl',
73
- 'CustomerId' => 'guest',
74
- 'FirstName' => 'Jan',
75
- 'Language' => 'pl',
76
- 'LastName' => 'Kowalski'
77
- },
78
- 'OrderId' => 'JS2JMSQ68L130826GUEST000P01',
79
- 'CurrencyCode' => 'PLN',
80
- 'CustomerIp' => '10.1.1.127',
81
- 'Status' => 'COMPLETED',
82
- 'NotifyUrl' => 'http=>//sklep.url/notify',
83
- 'ValidityTime' => '86400',
84
- 'MerchantPosId' => '122643',
85
- 'PayMethod' => {
86
- 'Type' => 'PBL'
87
- },
88
- 'OrderCreateDate' => '2013-08-26T09=>51=>50.303+02=>00',
89
- 'OrderUrl' => 'http=>//sklep.url/order',
90
- 'TotalAmount' => '1000'
44
+ "order"=>{
45
+ "orderId"=>"LDLW5N7MF4140324GUEST000P01",
46
+ "extOrderId"=>"ExtOrderId",
47
+ "orderCreateDate"=>"2012-12-31T12=>00=>00",
48
+ "notifyUrl"=>"http=>//tempuri.org/notify",
49
+ "customerIp"=>"127.0.0.1",
50
+ "merchantPosId"=>"{MerchantPosId}",
51
+ "description"=>"My order description",
52
+ "currencyCode"=>"PLN",
53
+ "totalAmount"=>"200",
54
+ "buyer"=>{
55
+ "email"=>"john.doe@example.org",
56
+ "phone"=>"111111111",
57
+ "firstName"=>"John",
58
+ "lastName"=>"Doe"
59
+ },
60
+ "products"=>{
61
+ "products"=>{
62
+ "name"=>"Product 1",
63
+ "unitPrice"=>"200",
64
+ "quantity"=>"1"
91
65
  }
92
- }
66
+ },
67
+ "status"=>"COMPLETED"
93
68
  }
94
69
  }
95
70
  end
@@ -10,7 +10,7 @@ describe OpenPayU::Configuration do
10
10
  end
11
11
 
12
12
  it { OpenPayU::Configuration.valid?.should be_true }
13
- it { OpenPayU::Configuration.merchant_pos_id.should eq '8334' }
13
+ it { OpenPayU::Configuration.merchant_pos_id.should eq '145227' }
14
14
  it { OpenPayU::Configuration.env.should eq 'secure' }
15
15
  it { OpenPayU::Configuration.service_domain.should eq 'payu.com' }
16
16
 
@@ -7,7 +7,7 @@ describe OpenPayU::Models::Order do
7
7
 
8
8
  it { order.valid?.should be_true }
9
9
  it { order.all_objects_valid?.should be_true }
10
- it { order.merchant_pos_id.should eq '45654' }
10
+ it { order.merchant_pos_id.should eq OpenPayU::Configuration.merchant_pos_id }
11
11
 
12
12
  context 'should create product objects' do
13
13
  before { order.products = [{ name: 'Produkt 1' }] }
@@ -22,39 +22,9 @@ describe OpenPayU::Models::Order do
22
22
  it do
23
23
  hash = order.prepare_keys
24
24
  hash.delete('ReqId')
25
- hash.should eq({
26
- 'MerchantPosId' => '45654',
27
- 'CustomerIp' => '127.0.0.1',
28
- 'ExtOrderId' => 1342,
29
- 'OrderUrl' => 'http://localhost/',
30
- 'Description' => 'New order',
31
- 'CurrencyCode' => 'PLN',
32
- 'TotalAmount' => 100,
33
- 'NotifyUrl' => 'http://localhost/',
34
- 'ContinueUrl' => 'http://localhost/',
35
- 'ValidityTime' => '48000',
36
- 'Buyer' => {
37
- 'Email' => 'dd@ddd.pl',
38
- 'Phone' => '123123123',
39
- 'FirstName' => 'Jan',
40
- 'LastName' => 'Kowalski',
41
- 'Language' => 'pl_PL',
42
- 'NIN' => '123456'
43
- },
44
- 'Products' => [{
45
- 'Product' => {
46
- 'Name' => 'Mouse',
47
- 'UnitPrice' => 100,
48
- 'Quantity' => 1
49
- }
50
- }],
51
- 'PayMethods' => [{
52
- 'PayMethod' => {
53
- 'Type' => 'CARD_TOKEN',
54
- 'Value' => 'TOK_1HPPNU4HIOWT180pPDWhuhAmM3ym'
55
- }
56
- }]
57
- })
25
+ hash.has_key?('merchantPosId')
26
+ hash.has_key?('buyer')
27
+ hash.has_key?('products')
58
28
  end
59
29
  end
60
30
  end
@@ -7,11 +7,8 @@ describe OpenPayU do
7
7
  'TotalAmount' => '1000',
8
8
  'CompleteUrl' => 'http://localhost/complete'
9
9
  }
10
- OpenPayU.sign_form(
11
- form,
12
- '981852826b1f62fb24e1771e878fb42d'
13
- ).should eq(
14
- 'sender=45654;signature=7d4073dbcc85e3859ed4341891168717;algorithm=MD5'
10
+ OpenPayU.sign_form(form).should eq(
11
+ 'sender=114207;signature=e83176051ce82949552bb787c6c16385;algorithm=MD5'
15
12
  )
16
13
  end
17
14
 
metadata CHANGED
@@ -1,183 +1,155 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openpayu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krzysztof Streflik
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-17 00:00:00.000000000 Z
11
+ date: 2014-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
- requirement: !ruby/object:Gem::Requirement
15
+ version_requirements: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
20
+ requirement: !ruby/object:Gem::Requirement
23
21
  requirements:
24
22
  - - ~>
25
23
  - !ruby/object:Gem::Version
26
24
  version: '1.3'
25
+ prerelease: false
26
+ type: :development
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ! '>='
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
29
  version_requirements: !ruby/object:Gem::Requirement
37
30
  requirements:
38
- - - ! '>='
31
+ - - '>='
39
32
  - !ruby/object:Gem::Version
40
33
  version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rspec
43
34
  requirement: !ruby/object:Gem::Requirement
44
35
  requirements:
45
- - - ! '>='
36
+ - - '>='
46
37
  - !ruby/object:Gem::Version
47
38
  version: '0'
48
- type: :development
49
39
  prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: activemodel
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
40
  type: :development
63
- prerelease: false
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
64
43
  version_requirements: !ruby/object:Gem::Requirement
65
44
  requirements:
66
- - - ! '>='
45
+ - - '>='
67
46
  - !ruby/object:Gem::Version
68
47
  version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: activesupport
71
48
  requirement: !ruby/object:Gem::Requirement
72
49
  requirements:
73
- - - ! '>='
50
+ - - '>='
74
51
  - !ruby/object:Gem::Version
75
52
  version: '0'
76
- type: :development
77
53
  prerelease: false
54
+ type: :development
55
+ - !ruby/object:Gem::Dependency
56
+ name: activemodel
78
57
  version_requirements: !ruby/object:Gem::Requirement
79
58
  requirements:
80
- - - ! '>='
59
+ - - '>='
81
60
  - !ruby/object:Gem::Version
82
61
  version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: activemodel
85
62
  requirement: !ruby/object:Gem::Requirement
86
63
  requirements:
87
- - - ! '>='
64
+ - - '>='
88
65
  - !ruby/object:Gem::Version
89
66
  version: '0'
90
- type: :runtime
91
67
  prerelease: false
68
+ type: :runtime
69
+ - !ruby/object:Gem::Dependency
70
+ name: activesupport
92
71
  version_requirements: !ruby/object:Gem::Requirement
93
72
  requirements:
94
- - - ! '>='
73
+ - - '>='
95
74
  - !ruby/object:Gem::Version
96
75
  version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: activesupport
99
76
  requirement: !ruby/object:Gem::Requirement
100
77
  requirements:
101
- - - ! '>='
78
+ - - '>='
102
79
  - !ruby/object:Gem::Version
103
80
  version: '0'
104
- type: :runtime
105
81
  prerelease: false
82
+ type: :runtime
83
+ - !ruby/object:Gem::Dependency
84
+ name: vcr
106
85
  version_requirements: !ruby/object:Gem::Requirement
107
86
  requirements:
108
- - - ! '>='
87
+ - - '>='
109
88
  - !ruby/object:Gem::Version
110
89
  version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: vcr
113
90
  requirement: !ruby/object:Gem::Requirement
114
91
  requirements:
115
- - - ! '>='
92
+ - - '>='
116
93
  - !ruby/object:Gem::Version
117
94
  version: '0'
118
- type: :development
119
95
  prerelease: false
96
+ type: :development
97
+ - !ruby/object:Gem::Dependency
98
+ name: fakeweb
120
99
  version_requirements: !ruby/object:Gem::Requirement
121
100
  requirements:
122
- - - ! '>='
101
+ - - '>='
123
102
  - !ruby/object:Gem::Version
124
103
  version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: fakeweb
127
104
  requirement: !ruby/object:Gem::Requirement
128
105
  requirements:
129
- - - ! '>='
106
+ - - '>='
130
107
  - !ruby/object:Gem::Version
131
108
  version: '0'
132
- type: :development
133
109
  prerelease: false
110
+ type: :development
111
+ - !ruby/object:Gem::Dependency
112
+ name: yard
134
113
  version_requirements: !ruby/object:Gem::Requirement
135
114
  requirements:
136
- - - ! '>='
115
+ - - '>='
137
116
  - !ruby/object:Gem::Version
138
117
  version: '0'
139
- - !ruby/object:Gem::Dependency
140
- name: yard
141
118
  requirement: !ruby/object:Gem::Requirement
142
119
  requirements:
143
- - - ! '>='
120
+ - - '>='
144
121
  - !ruby/object:Gem::Version
145
122
  version: '0'
146
- type: :development
147
123
  prerelease: false
124
+ type: :development
125
+ - !ruby/object:Gem::Dependency
126
+ name: rdoc
148
127
  version_requirements: !ruby/object:Gem::Requirement
149
128
  requirements:
150
- - - ! '>='
129
+ - - '>='
151
130
  - !ruby/object:Gem::Version
152
131
  version: '0'
153
- - !ruby/object:Gem::Dependency
154
- name: rdoc
155
132
  requirement: !ruby/object:Gem::Requirement
156
133
  requirements:
157
- - - ! '>='
134
+ - - '>='
158
135
  - !ruby/object:Gem::Version
159
136
  version: '0'
160
- type: :development
161
137
  prerelease: false
138
+ type: :development
139
+ - !ruby/object:Gem::Dependency
140
+ name: codeclimate-test-reporter
162
141
  version_requirements: !ruby/object:Gem::Requirement
163
142
  requirements:
164
- - - ! '>='
143
+ - - '>='
165
144
  - !ruby/object:Gem::Version
166
145
  version: '0'
167
- - !ruby/object:Gem::Dependency
168
- name: codeclimate-test-reporter
169
146
  requirement: !ruby/object:Gem::Requirement
170
147
  requirements:
171
- - - ! '>='
148
+ - - '>='
172
149
  - !ruby/object:Gem::Version
173
150
  version: '0'
174
- type: :development
175
151
  prerelease: false
176
- version_requirements: !ruby/object:Gem::Requirement
177
- requirements:
178
- - - ! '>='
179
- - !ruby/object:Gem::Version
180
- version: '0'
152
+ type: :development
181
153
  description: A SDK for OpenPayU API
182
154
  email:
183
155
  - krzysztof.streflik@allegro.pl
@@ -268,12 +240,10 @@ files:
268
240
  - lib/openpayu/refund.rb
269
241
  - lib/openpayu/token.rb
270
242
  - lib/openpayu/version.rb
271
- - lib/openpayu/xml_builder.rb
272
243
  - lib/openpayu_ruby.rb
273
244
  - openpayu_ruby.gemspec
274
245
  - spec/cassettes/cancel_order.yml
275
246
  - spec/cassettes/create_order.yml
276
- - spec/cassettes/refund_order.yml
277
247
  - spec/cassettes/retrieve_order.yml
278
248
  - spec/cassettes/update_order.yml
279
249
  - spec/integration/order_spec.rb
@@ -289,30 +259,29 @@ homepage: ''
289
259
  licenses:
290
260
  - MIT
291
261
  metadata: {}
292
- post_install_message:
262
+ post_install_message:
293
263
  rdoc_options: []
294
264
  require_paths:
295
265
  - lib
296
266
  required_ruby_version: !ruby/object:Gem::Requirement
297
267
  requirements:
298
- - - ! '>='
268
+ - - '>='
299
269
  - !ruby/object:Gem::Version
300
270
  version: '0'
301
271
  required_rubygems_version: !ruby/object:Gem::Requirement
302
272
  requirements:
303
- - - ! '>='
273
+ - - '>='
304
274
  - !ruby/object:Gem::Version
305
275
  version: '0'
306
276
  requirements: []
307
- rubyforge_project:
308
- rubygems_version: 2.1.11
309
- signing_key:
277
+ rubyforge_project:
278
+ rubygems_version: 2.2.2
279
+ signing_key:
310
280
  specification_version: 4
311
281
  summary: A SDK for OpenPayU API
312
282
  test_files:
313
283
  - spec/cassettes/cancel_order.yml
314
284
  - spec/cassettes/create_order.yml
315
- - spec/cassettes/refund_order.yml
316
285
  - spec/cassettes/retrieve_order.yml
317
286
  - spec/cassettes/update_order.yml
318
287
  - spec/integration/order_spec.rb
@@ -324,4 +293,3 @@ test_files:
324
293
  - spec/unit/models/order_spec.rb
325
294
  - spec/unit/models/refund_spec.rb
326
295
  - spec/unit/openpayu_spec.rb
327
- has_rdoc: