gopay 0.2 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -55,50 +55,6 @@ Such YAML config file can be also placed in Rails config dir (named gopay.yml) -
55
55
 
56
56
  h2. Usage
57
57
 
58
- <pre>
59
- # first you have to init a payment
60
- payment = GoPay::EshopPayment.new(:variable_symbol => "gopay_test_#{GoPay.configuration.goid}",
61
- :total_price_in_cents => 100,
62
- :product_name => "productName",
63
- :payment_channel => "cz_gp_w"
64
- )
65
- # and request its creation on paygate:
66
- payment.create # =>
67
- # #<GoPay::EshopPayment:0x7fa27c0fab88
68
- # @last_response=
69
- # {:"@xmlns:ns1"=>"urn:AxisEPaymentProvider",
70
- # :total_price=>"100",
71
- # :variable_symbol=>"gopay_test_8531903182",
72
- # :result=>"CALL_COMPLETED",
73
- # :payment_channel=>
74
- # {:"@xsi:type"=>"soapenc:string",
75
- # :"@xmlns:soapenc"=>"http://schemas.xmlsoap.org/soap/encoding/"},
76
- # :eshop_go_id=>"8531903182",
77
- # :session_state=>"WAITING",
78
- # :"@xsi:type"=>"ns1:EPaymentStatus",
79
- # :buyer_go_id=>
80
- # {:"@xsi:type"=>"soapenc:long",
81
- # :"@xmlns:soapenc"=>"http://schemas.xmlsoap.org/soap/encoding/"},
82
- # :product_name=>"productName",
83
- # :payment_session_id=>"3000523838",
84
- # :result_description=>"WAITING",
85
- # :url=>"http://www.failed_url.cz",
86
- # :encrypted_signature=>
87
- # "b653c3b55e981abb29ff9a6b25eb1153abb4d5e888b4675594b636456146c189fba2f81e6303dfa3a5b661f6d58385a0"},
88
- # @payment_channel="cz_gp_w",
89
- # @payment_session_id="3000523838",
90
- # @product_name="productName",
91
- # @total_price_in_cents=100,
92
-
93
- # After user gets back to success/failed url, you can check status of payment:
94
- payment = GoPay::EshopPayment.new(:variable_symbol => "XXXXX",
95
- :total_price_in_cents => price.to_i,
96
- :product_name => name,
97
- :payment_session_id => payment_session_id,
98
- :payment_channels => ["cz_gp_w"])
99
-
100
- payment.actual_session_state # => "PAYMENT_DONE"
101
- payment.is_in_state?(GoPay::PAYMENT_DONE) # => true
102
-
103
- </pre>
58
+ While gem is under decent construction, I removed old usage example in favor of tests that are actual as hell! ;)
104
59
 
60
+ Big thanks to @Pepan, who moved gem to 1.9.3!
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
13
13
 
14
14
  s.rubyforge_project = "gopay"
15
15
 
16
- s.add_dependency("savon")
16
+ s.add_dependency("savon", ">= 2.0.0")
17
17
  s.add_development_dependency("shoulda")
18
18
  s.add_development_dependency("mocha")
19
19
 
@@ -1,7 +1,5 @@
1
1
  require "savon"
2
2
 
3
- Savon.configure { |config| config.log = false }
4
-
5
3
  module GoPay
6
4
 
7
5
  class BasePayment
@@ -25,10 +23,9 @@ module GoPay
25
23
  attr_accessor :payment_session_id, :response
26
24
 
27
25
  def create
28
- client = Savon::Client.new GoPay.configuration.urls["wsdl"]
29
- soap_response = client.request "createPayment" do |soap|
30
- soap.body = {"paymentCommand" => payment_command_hash}
31
- end
26
+ client = Savon::Client.new :wsdl => GoPay.configuration.urls["wsdl"], :log => false
27
+ soap_response = client.call :create_payment, :message => { :payment_command => payment_command_hash }
28
+
32
29
  self.response = soap_response.to_hash[:create_payment_response][:create_payment_return]
33
30
  valid_response?(response, GoPay::STATUSES[:created])
34
31
  valid = valid_response?(response, GoPay::STATUSES[:created])
@@ -37,10 +34,9 @@ module GoPay
37
34
  end
38
35
 
39
36
  def load(validated_status = nil)
40
- client = Savon::Client.new GoPay.configuration.urls["wsdl"]
41
- soap_response = client.request "paymentStatus" do |soap|
42
- soap.body = {"paymentSessionInfo" => payment_session_hash}
43
- end
37
+ client = Savon::Client.new :wsdl => GoPay.configuration.urls["wsdl"], :log => false
38
+ soap_response = client.call :payment_status, :message => { :payment_session_info => payment_session_hash }
39
+
44
40
  self.response = soap_response.to_hash[:payment_status_response][:payment_status_return]
45
41
  valid_payment_session?(response, validated_status)
46
42
  end
@@ -1,7 +1,5 @@
1
1
  require "savon"
2
2
 
3
- Savon.configure { |config| config.log = false }
4
-
5
3
  module GoPay
6
4
  class PaymentMethod
7
5
 
@@ -14,8 +12,9 @@ module GoPay
14
12
  end
15
13
 
16
14
  def self.all
17
- client = Savon::Client.new GoPay.configuration.urls["wsdl"]
18
- response = client.request("paymentMethodList")
15
+ client = Savon::Client.new :wsdl => GoPay.configuration.urls["wsdl"], :log => false
16
+ response = client.call :payment_method_list
17
+
19
18
  response.to_hash[:payment_method_list_response][:payment_method_list_return][:payment_method_list_return].map do |item|
20
19
  PaymentMethod.new(item)
21
20
  end
@@ -1,3 +1,3 @@
1
1
  module GoPay
2
- VERSION = "0.2"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,73 +1,76 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: gopay
3
- version: !ruby/object:Gem::Version
4
- version: '0.2'
3
+ version: !ruby/object:Gem::Version
4
+ hash: 21
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 2
9
+ - 1
10
+ version: 0.2.1
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - papricek
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2012-11-21 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2013-05-30 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
15
21
  name: savon
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :runtime
23
22
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
23
+ requirement: &id001 !ruby/object:Gem::Requirement
25
24
  none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '0'
30
- - !ruby/object:Gem::Dependency
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 15
29
+ segments:
30
+ - 2
31
+ - 0
32
+ - 0
33
+ version: 2.0.0
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
31
37
  name: shoulda
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: '0'
38
- type: :development
39
38
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
39
+ requirement: &id002 !ruby/object:Gem::Requirement
41
40
  none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
46
- - !ruby/object:Gem::Dependency
47
- name: mocha
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 3
45
+ segments:
46
+ - 0
47
+ version: "0"
54
48
  type: :development
49
+ version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ name: mocha
55
52
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
53
+ requirement: &id003 !ruby/object:Gem::Requirement
57
54
  none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- description: GoPay is a library making it easy to access GoPay http://www.gopay.cz
63
- paygate from Ruby. It offers some basic wrapper around soap calls in the form of
64
- AR-like models. Its autoconfigurable from Rails.
65
- email:
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ hash: 3
59
+ segments:
60
+ - 0
61
+ version: "0"
62
+ type: :development
63
+ version_requirements: *id003
64
+ description: GoPay is a library making it easy to access GoPay http://www.gopay.cz paygate from Ruby. It offers some basic wrapper around soap calls in the form of AR-like models. Its autoconfigurable from Rails.
65
+ email:
66
66
  - patrikjira@gmail.com
67
67
  executables: []
68
+
68
69
  extensions: []
70
+
69
71
  extra_rdoc_files: []
70
- files:
72
+
73
+ files:
71
74
  - .gitignore
72
75
  - .rvmrc
73
76
  - Gemfile
@@ -91,29 +94,38 @@ files:
91
94
  - test/test_helper.rb
92
95
  homepage: http://gopay.defactory.net
93
96
  licenses: []
97
+
94
98
  post_install_message:
95
99
  rdoc_options: []
96
- require_paths:
100
+
101
+ require_paths:
97
102
  - lib
98
- required_ruby_version: !ruby/object:Gem::Requirement
103
+ required_ruby_version: !ruby/object:Gem::Requirement
99
104
  none: false
100
- requirements:
101
- - - ! '>='
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ hash: 3
109
+ segments:
110
+ - 0
111
+ version: "0"
112
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
113
  none: false
106
- requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: '0'
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ hash: 3
118
+ segments:
119
+ - 0
120
+ version: "0"
110
121
  requirements: []
122
+
111
123
  rubyforge_project: gopay
112
- rubygems_version: 1.8.21
124
+ rubygems_version: 1.8.25
113
125
  signing_key:
114
126
  specification_version: 3
115
127
  summary: A little gem making integration of GoPay easy
116
- test_files:
128
+ test_files:
117
129
  - test/config_test.rb
118
130
  - test/crypt_test.rb
119
131
  - test/models_test.rb