payture-ewallet 0.1.5 → 0.2.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
  SHA256:
3
- metadata.gz: bb3b029effee09d2d9148e7928d0d374f568cda878bd2d14190d963ae8fb7214
4
- data.tar.gz: 63ece76ff2459b1401dc30ba0bf611e9f920b324c7b5af9092560e0dcb6d9ac8
3
+ metadata.gz: 1c572e14b33a34f924d184aa87aa334e1345cd69ea74e58e6c5b85497520c36d
4
+ data.tar.gz: d63e2be11ec47610cd79c04e3752cdf89e086beb5fda9ae9b6f0050b715d6166
5
5
  SHA512:
6
- metadata.gz: 9a1b9af65e56942d1a93bf0f445e66d300992d7a80881befdd7709e4d4b926d89fd3214adf28971361dd2f204518937a439e867396b0d9e3f76a36c2a1a452e2
7
- data.tar.gz: d913614721b2dba418bcd593c4fe7ef8d407b85bec3e3b6a31546dfe0a93e279763720386c11c2057e378e7f0788400989efb87aa343fbcca6fefdf4a97800d8
6
+ metadata.gz: a307d58d349d50fd35e2734aa948abcb7270d69ecc3453a63911c429a9b990d134b4cabdf8793b14a2a497f2f0af1454e340e434f740f0ceba314822dbfec91c
7
+ data.tar.gz: 7f84148a824cd5063ef976d9a93c6cb65c561024bfd14b2b0636a45188bc768a1e27f5d7ed13fe4c20f8e76b13b5e268d06e377bdcaf9d2cd54acbfe0af2dc17
@@ -23,6 +23,7 @@ module Payture::Ewallet
23
23
  @open_timeout = options[:open_timeout]
24
24
 
25
25
  check_required_fields!
26
+ update_money_rounding_mode
26
27
  end
27
28
 
28
29
  def base_url
@@ -37,5 +38,9 @@ module Payture::Ewallet
37
38
  'Required options: host, merchant_id, password, currency'
38
39
  end
39
40
  end
41
+
42
+ def update_money_rounding_mode
43
+ Money.rounding_mode = BigDecimal::ROUND_HALF_UP
44
+ end
40
45
  end
41
46
  end
@@ -29,14 +29,17 @@ module Payture::Ewallet
29
29
  end
30
30
 
31
31
  def make_request(url, params)
32
+ data = compact_hash(params)
32
33
  conn = Faraday.new do |builder|
33
34
  builder.adapter Faraday.default_adapter
34
35
  builder.request :url_encoded
35
36
  builder.response(:logger, config.logger) if config.logger
36
37
  end
37
- conn.get(url, compact_hash(params)) do |req|
38
+ conn.post(url) do |req|
39
+ req.headers['Content-Type'] = 'application/x-www-form-urlencoded'
38
40
  req.options.timeout = config.timeout if config.timeout
39
41
  req.options.open_timeout = config.open_timeout if config.open_timeout
42
+ req.body = URI.encode_www_form(data)
40
43
  end
41
44
  rescue Faraday::Error => e
42
45
  raise Error, "#{e.class}: #{e.message}"
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Payture::Ewallet
4
+ module Methods
5
+ class GetState < Base
6
+ private
7
+
8
+ def url
9
+ "#{config.base_url}/GetState"
10
+ end
11
+
12
+ def params(order_id:)
13
+ {
14
+ Key: config.merchant_id,
15
+ OrderId: order_id,
16
+ }
17
+ end
18
+
19
+ def response_class
20
+ Responses::GetState
21
+ end
22
+ end
23
+ end
24
+ end
@@ -2,25 +2,7 @@
2
2
 
3
3
  module Payture::Ewallet
4
4
  module Methods
5
- class PayStatus < Base
6
- private
7
-
8
- def url
9
- "#{config.base_url}/PayStatus"
10
- end
11
-
12
- def params(order_id:)
13
- {
14
- VWID: config.merchant_id,
15
- DATA: encoded_data(
16
- OrderId: order_id,
17
- ),
18
- }
19
- end
20
-
21
- def response_class
22
- Responses::PayStatus
23
- end
5
+ class PayStatus < GetState
24
6
  end
25
7
  end
26
8
  end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Payture::Ewallet
4
+ module Responses
5
+ class GetState < Base
6
+ def order_id
7
+ body['OrderId']
8
+ end
9
+
10
+ def forwarded
11
+ body['Forwarded']
12
+ end
13
+
14
+ def status
15
+ state
16
+ end
17
+
18
+ def state
19
+ body['State']
20
+ end
21
+
22
+ def merchant_contract
23
+ body['MerchantContract']
24
+ end
25
+
26
+ def final_terminal
27
+ body['FinalTerminal']
28
+ end
29
+
30
+ def amount
31
+ money(body['Amount'])
32
+ end
33
+
34
+ def rrn
35
+ body['RRN']
36
+ end
37
+
38
+ def user_login
39
+ body['VWUserLgn']
40
+ end
41
+
42
+ def card_id
43
+ body['CardId']
44
+ end
45
+
46
+ def pan_mask
47
+ body['PANMask']
48
+ end
49
+
50
+ def add_info
51
+ body['AddInfo']
52
+ end
53
+ end
54
+ end
55
+ end
@@ -2,22 +2,7 @@
2
2
 
3
3
  module Payture::Ewallet
4
4
  module Responses
5
- class PayStatus < Base
6
- def status
7
- body['Status']
8
- end
9
-
10
- def amount
11
- money(body['Amount'])
12
- end
13
-
14
- def card_id
15
- body['CardId']
16
- end
17
-
18
- def user_login
19
- body['VWUserLgn']
20
- end
5
+ class PayStatus < GetState
21
6
  end
22
7
  end
23
8
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Payture
4
4
  module Ewallet
5
- VERSION = '0.1.5'
5
+ VERSION = '0.2.5'
6
6
  end
7
7
  end
@@ -15,11 +15,13 @@ require 'payture/ewallet/methods/init'
15
15
  require 'payture/ewallet/methods/charge'
16
16
  require 'payture/ewallet/methods/unblock'
17
17
  require 'payture/ewallet/methods/refund'
18
+ require 'payture/ewallet/methods/get_state'
18
19
  require 'payture/ewallet/methods/pay_status'
19
20
  require 'payture/ewallet/responses/base'
20
21
  require 'payture/ewallet/responses/init'
21
22
  require 'payture/ewallet/responses/charge'
22
23
  require 'payture/ewallet/responses/refund'
24
+ require 'payture/ewallet/responses/get_state'
23
25
  require 'payture/ewallet/responses/pay_status'
24
26
 
25
27
  module Payture
@@ -22,11 +22,11 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ['lib']
24
24
 
25
- spec.add_dependency 'faraday', '~> 0.9'
25
+ spec.add_dependency 'faraday', '>= 0.9'
26
26
  spec.add_dependency 'money', '~> 6.0'
27
27
  spec.add_dependency 'multi_xml', '~> 0.5'
28
28
 
29
- spec.add_development_dependency 'bundler', '~> 1.14'
29
+ spec.add_development_dependency 'bundler', '>= 1.14'
30
30
  spec.add_development_dependency 'minitest', '~> 5.0'
31
31
  spec.add_development_dependency 'pry', '~> 0.10'
32
32
  spec.add_development_dependency 'rake', '~> 10.0'
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: payture-ewallet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.2.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: 2020-02-11 00:00:00.000000000 Z
11
+ date: 2023-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.9'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.9'
27
27
  - !ruby/object:Gem::Dependency
@@ -56,14 +56,14 @@ dependencies:
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.14'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.14'
69
69
  - !ruby/object:Gem::Dependency
@@ -189,12 +189,14 @@ files:
189
189
  - lib/payture/ewallet/make_pay_url.rb
190
190
  - lib/payture/ewallet/methods/base.rb
191
191
  - lib/payture/ewallet/methods/charge.rb
192
+ - lib/payture/ewallet/methods/get_state.rb
192
193
  - lib/payture/ewallet/methods/init.rb
193
194
  - lib/payture/ewallet/methods/pay_status.rb
194
195
  - lib/payture/ewallet/methods/refund.rb
195
196
  - lib/payture/ewallet/methods/unblock.rb
196
197
  - lib/payture/ewallet/responses/base.rb
197
198
  - lib/payture/ewallet/responses/charge.rb
199
+ - lib/payture/ewallet/responses/get_state.rb
198
200
  - lib/payture/ewallet/responses/init.rb
199
201
  - lib/payture/ewallet/responses/pay_status.rb
200
202
  - lib/payture/ewallet/responses/refund.rb
@@ -219,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
219
221
  - !ruby/object:Gem::Version
220
222
  version: '0'
221
223
  requirements: []
222
- rubygems_version: 3.0.3
224
+ rubygems_version: 3.4.21
223
225
  signing_key:
224
226
  specification_version: 4
225
227
  summary: Ruby wrapper for Payture eWallet API