paysera 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4db3c9e0b922a48f34110f61da51681ae8820d79
4
- data.tar.gz: d5ec01d783c2d30bb1ba344d235b5349bbe9eeb6
3
+ metadata.gz: 75d36b3f57cd4ee01f60db8d7664272860901d07
4
+ data.tar.gz: 4f00f64ec0baafc9939004b9c4d89a9ff983fb2b
5
5
  SHA512:
6
- metadata.gz: ab25e3b2ef8afdeeb1255cd37f893d3eb60d2cc4937b8a54cf2fe9377993b7179191b24c0651f02c2bcfe9c4acdfb2f7db53f642b96d5afaa74f792e084dd2a2
7
- data.tar.gz: b94565c982d25657300bb7454e7cf4e18dce59ef0498965dc9eafe4069720c5437d6f52311a89716604aff20eb38935dd91a336cc4de04b924ebf6e1fcd4890e
6
+ metadata.gz: da1dd914dea8cba2cc83ef06c2ef4bca82d5f13a474bb817514fe7b871e5525368e3caded520b436fbaaeaf1a43377732a089bb9be6b68ff57799cc0d2e59eb5
7
+ data.tar.gz: c29e28032560252df17d64b812f74c8e9b169730955f333d4bc21d9b38279ef0434f50d6ad181cf0674fba0ba21c901fc022b433cbd680b98e52c8733a45b18a
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  Paysera account is a true electronic wallet, which can not be lost; you will always find the amount of money that you have deposited in your account. In most cases, this type of account is better than bank account, because it is subject to higher security requirements, administrators of Paysera system can not lend or invest money held on the owner’s account.
5
5
  Paysera.com services are constantly expanded and improved by the top-level specialists in accordance with the latest payment innovations."* — [Paysera](https://www.paysera.com/index.html)
6
6
 
7
- This gem provides easy access to Paysera payment API.
7
+ This gem provides easy access to the Paysera payment API.
8
8
 
9
9
  ## Installation
10
10
 
@@ -24,7 +24,7 @@ Or install it yourself as:
24
24
 
25
25
  ## Usage
26
26
 
27
- You can set default config like so:
27
+ You can set default configuration like this:
28
28
 
29
29
  ```ruby
30
30
  Paysera.config do |config|
@@ -33,12 +33,11 @@ Paysera.config do |config|
33
33
  end
34
34
  ```
35
35
 
36
- If you are using *Ruby on Rails* add it to `config/initializers/paysera.rb`. However it do not necessarily has to be rails,
37
- you can add this into any Ruby app.
36
+ If you are using *Ruby on Rails* add it to `config/initializers/paysera.rb`. However the gem usage is not restricted to Ruby on Rails, you can use it in any Ruby application.
38
37
 
39
- ### Request
38
+ #### Request
40
39
 
41
- To make a request you only need to execute this:
40
+ To make a request execute this:
42
41
 
43
42
  ```ruby
44
43
  # Minimum requirements for request_params
@@ -51,7 +50,7 @@ request_params_example = {
51
50
  Paysera::Request.build_request(request_params_example, [sign_password])
52
51
  ```
53
52
 
54
- It will generate payment link to paysera - `https://mokejimai.lt/pay/?data=...&sign=...`.
53
+ It will generate payment link to paysera - `https://paysera.lt/pay/?data=...&sign=...`.
55
54
  So you can do this if you are using *Rails*:
56
55
 
57
56
 
@@ -59,22 +58,22 @@ So you can do this if you are using *Rails*:
59
58
  redirect_to Paysera::Request.build_request(...)
60
59
  ```
61
60
 
62
- You can use all parameters from: https://developers.paysera.com/en/payments/current#request-parameters
61
+ You can use any parameters from: https://developers.paysera.com/en/payments/current#request-parameters
63
62
 
64
- If required parameter not found or it is invalid it will raise `Paysera::Error::Request` error with specific error message.
63
+ If required parameters are not present or are invalid the gem will raise a `Paysera::Error::Request` error with a specific error message.
65
64
 
66
- If you specify `projectid` or `sign_password` it will overwrite initializer.
65
+ If you specify `projectid` or `sign_password` it will overwrite the values set in the initializer.
67
66
 
68
- ### Response
67
+ #### Response
69
68
 
70
69
  ```ruby
71
70
  # params should include valid data, ss1 and ss2
72
71
  response = Paysera::Response.new(params, [projectid], [sign_password])
73
72
  ```
74
73
 
75
- If `ss1` or `ss2` will fail to validate it will raise `Paysera::Error::Response` error with specific error message.
74
+ If `ss1` or `ss2` fails to validate a `Paysera::Error::Response` exception will be raised with a specific error message.
76
75
 
77
- To check if response is sms/mikro
76
+ To check if it's a sms/mikro response:
78
77
 
79
78
  ```ruby
80
79
  if response.sms?
@@ -82,7 +81,7 @@ if response.sms?
82
81
  end
83
82
  ```
84
83
 
85
- To check if response is bank/makro:
84
+ To check if it's a bank/makro response:
86
85
 
87
86
  ```ruby
88
87
  if response.bank?
@@ -90,16 +89,23 @@ if response.bank?
90
89
  end
91
90
  ```
92
91
 
93
- To get response data:
92
+ To access the response data (keys are symbols):
94
93
 
95
94
  ```ruby
96
95
  response.get_data
96
+
97
+ puts response.get_data[:sms] # => keyword1 text
97
98
  ```
98
99
 
99
- It will return Hash of data: [SMS specification](https://developers.paysera.com/en/sms-keywords/current#detailed-specification) and [Bank specification(see "Encoded parameters")](https://developers.paysera.com/en/payments/1.6#integration-via-specification)
100
+ It will return a Hash with data: [SMS specification](https://developers.paysera.com/en/sms-keywords/current#detailed-specification) and [Bank specification(see "Encoded parameters")](https://developers.paysera.com/en/payments/1.6#integration-via-specification)
101
+
100
102
 
103
+ If you specify `projectid` or `sign_password` it will overwrite the values set in the initializer.
101
104
 
102
- If you specify `projectid` or `sign_password` it will overwrite initializer.
105
+ Also you propably want to skip CSRF verification for your callback action:
106
+ ```ruby
107
+ skip_before_filter :verify_authenticity_token, :only => [:receive_callback] # :receive_callback - your callback action
108
+ ```
103
109
 
104
110
  ## Contributing
105
111
 
@@ -111,4 +117,4 @@ If you specify `projectid` or `sign_password` it will overwrite initializer.
111
117
 
112
118
  ## License
113
119
 
114
- MIT License: see [LICENSE](https://github.com/TomasAchmedovas/paysera/blob/master/LICENSE) file
120
+ MIT License: see [LICENSE](https://github.com/TomasAchmedovas/paysera/blob/master/LICENSE) file
@@ -25,7 +25,7 @@ module Paysera
25
25
  })
26
26
 
27
27
 
28
- "https://www.mokejimai.lt/pay/?#{query}"
28
+ "https://www.paysera.lt/pay/?#{query}"
29
29
  end
30
30
 
31
31
  private
@@ -6,7 +6,7 @@ require 'base64'
6
6
 
7
7
  module Paysera
8
8
  class Response
9
- PAYSERA_PUBLIC_KEY = 'https://www.webtopay.com/download/public.key'
9
+ PAYSERA_PUBLIC_KEY = 'http://downloads.paysera.com/download/public.key'
10
10
 
11
11
  def initialize(query, projectid: nil, sign_password: nil)
12
12
  raise send_error("'data' parameter was not found") if query[:data].nil?
@@ -24,7 +24,7 @@ module Paysera
24
24
 
25
25
  @data = convert_to_hash safely_decode_string(query[:data])
26
26
 
27
- raise send_error("'projectid' mismatch") if @data[:projectid].to_i != projectid
27
+ raise send_error("'projectid' mismatch") if @data[:projectid].to_i != projectid.to_i
28
28
  end
29
29
 
30
30
  def sms?
@@ -1,3 +1,3 @@
1
1
  module Paysera
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
@@ -63,6 +63,16 @@ describe Paysera::Response do
63
63
  ss2: response_data[:ss2],
64
64
  p_id: 1,
65
65
  sign: sign_password) }.to raise_exception /projectid.+mismatch/i }
66
+ it { expect { new_response(data: response_data[:data],
67
+ ss1: response_data[:ss1],
68
+ ss2: response_data[:ss2],
69
+ p_id: 56571,
70
+ sign: sign_password) }.not_to raise_error }
71
+ it { expect { new_response(data: response_data[:data],
72
+ ss1: response_data[:ss1],
73
+ ss2: response_data[:ss2],
74
+ p_id: "56571",
75
+ sign: sign_password) }.not_to raise_error }
66
76
  end
67
77
  end
68
78
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paysera
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Achmedovas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-06 00:00:00.000000000 Z
11
+ date: 2015-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  version: '0'
95
95
  requirements: []
96
96
  rubyforge_project:
97
- rubygems_version: 2.4.5
97
+ rubygems_version: 2.4.6
98
98
  signing_key:
99
99
  specification_version: 4
100
100
  summary: Paysera.com payment API