payu_api 0.1.4 → 0.1.5

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: 31d7e13c9d687f74c5be1e9a5ca0c504a7fd3040
4
- data.tar.gz: ea6e23a608a0ef04897d02c01e98092418779011
3
+ metadata.gz: 76a58280746739f8fde20c12bc5baa4967714074
4
+ data.tar.gz: 78e1448b997ea30a5aafcf06fe256bfd47512bf0
5
5
  SHA512:
6
- metadata.gz: 32d3020104aca518b93f1f081e1b730e0a6964f67e803725afb40ffb0644418d18a5376da000e86c6d9beaa3c1c5e3328a45cf217ac9c1a847411a6dff11d78a
7
- data.tar.gz: 1431d08f96dbb8895995826f4b338f80d412d592b4fb7cc081748e209db45b5a33efe8f9cbc3089c3b04cc6b86a845668be05d51b25cd534ab05f6e386b18f9e
6
+ metadata.gz: 2f70f51bb3f4f69f4191f4e76ffdad131b1aa58a2ffc538aca9ec72237af1fa5d40339bee66e4e4f69f13e581739c132817f084a7c5f7f75a6cbb329768ead7f
7
+ data.tar.gz: ac7b9111c41c08ba1bdaaf4d6a34d10be87a8e4659c080e26b8073ff6bad803157bd197182b840bb2f7b94110f63faee31a5cbcb6f4338c54e8be104e808eb37
data/README.md CHANGED
@@ -179,6 +179,37 @@ PayuAPI.signature_valid?(
179
179
  # => true
180
180
  ```
181
181
 
182
+ Retrieve payment methods which are enabled for pos:
183
+
184
+ ```ruby
185
+ response = client.get_paymethods
186
+
187
+ response.success?
188
+ # => true
189
+
190
+ response.pay_by_links
191
+ # => [
192
+ # {
193
+ # :value=>"m",
194
+ # :brandImageUrl=>"https://static.payu.com/images/mobile/logos/pbl_m.png",
195
+ # :name=>"mTransfer",
196
+ # :status=>"ENABLED"
197
+ # },
198
+ # {
199
+ # :value=>"m",
200
+ # :brandImageUrl=>"https://static.payu.com/images/mobile/logos/pbl_o.png",
201
+ # :name=>"Płacę z Bankiem Pekao S.A.",
202
+ # :status=>"ENABLED"
203
+ # },
204
+ # ]
205
+ ```
206
+ Similarly you can use `response.pex_tokens` to get `pexTokens` and `response.card_tokens` to get `cardTokens`. In case of no results available, the result will be empty array.
207
+
208
+ ```ruby
209
+ response.pex_tokens
210
+ # => []
211
+ ```
212
+
182
213
  ## Contributing
183
214
 
184
215
  Bug reports and pull requests are welcome on GitHub at https://github.com/busfor/payu_api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
data/lib/payu_api.rb CHANGED
@@ -13,8 +13,10 @@ require 'payu_api/responses/auth_response'
13
13
  require 'payu_api/responses/get_response'
14
14
  require 'payu_api/responses/create_response'
15
15
  require 'payu_api/responses/refund_response'
16
+ require 'payu_api/responses/paymethods_response'
16
17
  require 'payu_api/build_signature'
17
18
  require 'payu_api/order'
19
+ require 'payu_api/paymethods'
18
20
  require 'payu_api/client'
19
21
 
20
22
  module PayuAPI
@@ -25,5 +25,9 @@ module PayuAPI
25
25
  def refund(order_id:, params:)
26
26
  Order.refund(client: self, order_id: order_id, params: params)
27
27
  end
28
+
29
+ def get_paymethods
30
+ Paymethods.get(client: self)
31
+ end
28
32
  end
29
33
  end
@@ -0,0 +1,10 @@
1
+ module PayuAPI
2
+ class Paymethods
3
+ class << self
4
+ def get(client:)
5
+ request = ApiRequest.new(client, :GET, "/api/v2_1/paymethods")
6
+ PaymethodsResponse.new(http_response: request.call)
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,18 @@
1
+ # This methods allows to retrieve paymethods which are enabled for pos.
2
+ # For merchants with token payments enabled it also retrieves user payments tokens.
3
+ # Token payments requires OAuth token with grant type trusted_merchant.
4
+ module PayuAPI
5
+ class PaymethodsResponse < Response
6
+ def card_tokens
7
+ body[:cardTokens] || []
8
+ end
9
+
10
+ def pex_tokens
11
+ body[:pexTokens] || []
12
+ end
13
+
14
+ def pay_by_links
15
+ body[:payByLinks] || []
16
+ end
17
+ end
18
+ end
@@ -1,3 +1,3 @@
1
1
  module PayuAPI
2
- VERSION = '0.1.4'.freeze
2
+ VERSION = '0.1.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: payu_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Khrebtov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-18 00:00:00.000000000 Z
11
+ date: 2017-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-initializer
@@ -159,11 +159,13 @@ files:
159
159
  - lib/payu_api/client.rb
160
160
  - lib/payu_api/errors.rb
161
161
  - lib/payu_api/order.rb
162
+ - lib/payu_api/paymethods.rb
162
163
  - lib/payu_api/request.rb
163
164
  - lib/payu_api/response.rb
164
165
  - lib/payu_api/responses/auth_response.rb
165
166
  - lib/payu_api/responses/create_response.rb
166
167
  - lib/payu_api/responses/get_response.rb
168
+ - lib/payu_api/responses/paymethods_response.rb
167
169
  - lib/payu_api/responses/refund_response.rb
168
170
  - lib/payu_api/version.rb
169
171
  - payu_api.gemspec
@@ -187,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
187
189
  version: '0'
188
190
  requirements: []
189
191
  rubyforge_project:
190
- rubygems_version: 2.4.8
192
+ rubygems_version: 2.4.5.1
191
193
  signing_key:
192
194
  specification_version: 4
193
195
  summary: Ruby wrapper for PayU REST API