portmone 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -1
- data/lib/portmone/client.rb +10 -2
- data/lib/portmone/responses/finish_3ds.rb +17 -0
- data/lib/portmone/responses/mobile_pay.rb +55 -0
- data/lib/portmone/version.rb +1 -1
- data/lib/portmone.rb +2 -1
- data/portmone.gemspec +2 -0
- metadata +18 -3
- data/lib/portmone/responses/mobile_pay_response.rb +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b43a7888113edbf7d84a9e831ac036bb6581b47124f77e59fb1f1fd45f4f97b
|
4
|
+
data.tar.gz: d4468725f2ca96b963a45c2816ec35edcf35d85d13d1e43681e8ed58c6de66db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ec4c266c83d5c5cbc93633be53db62188d418f0cb0726bd355b62f4efa0246d426b63d8f04816c85641b0d161bd5336c722dcce8ba19c9017b319fb2ba69b56
|
7
|
+
data.tar.gz: 52b21d69b2b10a4e42f0b94b4a542f7953877e108d24f4c54ff1bbd689ddc0c3bba81d2b023fb23a57ebe144d46dd7fe5be77b2f28eac2eb1a7001b4b325dc9a
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
portmone (0.0.
|
4
|
+
portmone (0.0.13)
|
5
5
|
activesupport
|
6
6
|
faraday (~> 0.9)
|
7
|
+
faraday-detailed_logger
|
7
8
|
money (~> 6.0)
|
8
9
|
multi_xml (~> 0.5)
|
9
10
|
|
@@ -25,6 +26,8 @@ GEM
|
|
25
26
|
docile (1.1.5)
|
26
27
|
faraday (0.15.4)
|
27
28
|
multipart-post (>= 1.2, < 3)
|
29
|
+
faraday-detailed_logger (2.1.3)
|
30
|
+
faraday (~> 0.8)
|
28
31
|
hashdiff (0.3.7)
|
29
32
|
i18n (1.6.0)
|
30
33
|
concurrent-ruby (~> 1.0)
|
data/lib/portmone/client.rb
CHANGED
@@ -84,6 +84,14 @@ module Portmone
|
|
84
84
|
mobile_pay('APay', apple_pay_params, amount: amount, order_id: order_id, currency: currency)
|
85
85
|
end
|
86
86
|
|
87
|
+
def finish_3ds(md:, pa_res:, order_id:)
|
88
|
+
params = {
|
89
|
+
params: { data: { 'MD': md.to_s, 'PaRes': pa_res.to_s, 'shopBillId': order_id }, id: 1 },
|
90
|
+
method: 'confirmMpi',
|
91
|
+
}
|
92
|
+
make_json_request(MOBILE_API_URL, params, Portmone::Responses::Finish3DS)
|
93
|
+
end
|
94
|
+
|
87
95
|
private
|
88
96
|
|
89
97
|
def mobile_pay(payment_method, payment_system_params, amount:, order_id:, currency:)
|
@@ -99,7 +107,7 @@ module Portmone
|
|
99
107
|
.keep_if { |_, v| v.present? }
|
100
108
|
params = { params: { data: data }, method: payment_method, id: 1 }
|
101
109
|
|
102
|
-
make_json_request(MOBILE_API_URL, params, Portmone::Responses::
|
110
|
+
make_json_request(MOBILE_API_URL, params, Portmone::Responses::MobilePay)
|
103
111
|
end
|
104
112
|
|
105
113
|
def base_params
|
@@ -163,7 +171,7 @@ module Portmone
|
|
163
171
|
|
164
172
|
def make_json_request(url, params, response_class)
|
165
173
|
conn = Faraday.new(url: url) do |builder|
|
166
|
-
builder.response(:detailed_logger, @logger)
|
174
|
+
builder.response(:detailed_logger, @logger) if @logger
|
167
175
|
builder.adapter Faraday.default_adapter
|
168
176
|
end
|
169
177
|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class Portmone::Responses::Finish3DS
|
2
|
+
attr_reader :response
|
3
|
+
|
4
|
+
def initialize(faraday_response, currency:, timezone:)
|
5
|
+
@response = faraday_response
|
6
|
+
@currency = currency
|
7
|
+
@timezone = timezone
|
8
|
+
end
|
9
|
+
|
10
|
+
def http_status
|
11
|
+
response.status
|
12
|
+
end
|
13
|
+
|
14
|
+
def success?
|
15
|
+
http_status == 204
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
class Portmone::Responses::MobilePay
|
2
|
+
SUCCESS_STATUS = 'PAYED'.freeze
|
3
|
+
CREATED_STATUS = 'CREATED'.freeze
|
4
|
+
|
5
|
+
attr_reader :response
|
6
|
+
|
7
|
+
def initialize(faraday_response, currency:, timezone:)
|
8
|
+
@response = faraday_response
|
9
|
+
@response_body = JSON.parse(@response.body)
|
10
|
+
@currency = currency
|
11
|
+
@timezone = timezone
|
12
|
+
end
|
13
|
+
|
14
|
+
def http_status
|
15
|
+
response.status
|
16
|
+
end
|
17
|
+
|
18
|
+
def success?
|
19
|
+
result['status'] == SUCCESS_STATUS
|
20
|
+
end
|
21
|
+
|
22
|
+
def created?
|
23
|
+
result['status'] == CREATED_STATUS
|
24
|
+
end
|
25
|
+
|
26
|
+
def error_code
|
27
|
+
result['errorCode']
|
28
|
+
end
|
29
|
+
|
30
|
+
def error_description
|
31
|
+
result['error']
|
32
|
+
end
|
33
|
+
|
34
|
+
def required_3ds?
|
35
|
+
created? && result['isNeed3DS']
|
36
|
+
end
|
37
|
+
|
38
|
+
def acs_url
|
39
|
+
result['actionMPI'] if required_3ds?
|
40
|
+
end
|
41
|
+
|
42
|
+
def md
|
43
|
+
result['md'] if required_3ds?
|
44
|
+
end
|
45
|
+
|
46
|
+
def pa_req
|
47
|
+
result['pareq'] if required_3ds?
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def result
|
53
|
+
@result ||= @response_body['result']
|
54
|
+
end
|
55
|
+
end
|
data/lib/portmone/version.rb
CHANGED
data/lib/portmone.rb
CHANGED
@@ -13,5 +13,6 @@ require 'portmone/responses/base_response'
|
|
13
13
|
require 'portmone/responses/generate_url'
|
14
14
|
require 'portmone/responses/order_status'
|
15
15
|
require 'portmone/responses/refund_order_status'
|
16
|
-
require 'portmone/responses/
|
16
|
+
require 'portmone/responses/mobile_pay'
|
17
|
+
require 'portmone/responses/finish_3ds'
|
17
18
|
require 'portmone/client'
|
data/portmone.gemspec
CHANGED
@@ -26,6 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_dependency 'faraday', '~> 0.9'
|
27
27
|
spec.add_dependency 'money', '~> 6.0'
|
28
28
|
spec.add_dependency 'multi_xml', '~> 0.5'
|
29
|
+
spec.add_dependency 'faraday-detailed_logger'
|
29
30
|
|
30
31
|
spec.add_development_dependency 'bundler', '~> 1.14'
|
31
32
|
spec.add_development_dependency 'minitest', '~> 5.0'
|
@@ -35,4 +36,5 @@ Gem::Specification.new do |spec|
|
|
35
36
|
spec.add_development_dependency 'simplecov', '~> 0.14'
|
36
37
|
spec.add_development_dependency 'vcr', '~> 2.9'
|
37
38
|
spec.add_development_dependency 'webmock', '~> 3.0'
|
39
|
+
|
38
40
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: portmone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Sviridov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0.5'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: faraday-detailed_logger
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: bundler
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -191,8 +205,9 @@ files:
|
|
191
205
|
- lib/portmone.rb
|
192
206
|
- lib/portmone/client.rb
|
193
207
|
- lib/portmone/responses/base_response.rb
|
208
|
+
- lib/portmone/responses/finish_3ds.rb
|
194
209
|
- lib/portmone/responses/generate_url.rb
|
195
|
-
- lib/portmone/responses/
|
210
|
+
- lib/portmone/responses/mobile_pay.rb
|
196
211
|
- lib/portmone/responses/order_status.rb
|
197
212
|
- lib/portmone/responses/refund_order_status.rb
|
198
213
|
- lib/portmone/transaction.rb
|
@@ -1,28 +0,0 @@
|
|
1
|
-
class Portmone::Responses::MobilePayResponse
|
2
|
-
SUCCESS_STATUS = 'PAYED'.freeze
|
3
|
-
|
4
|
-
attr_reader :response
|
5
|
-
|
6
|
-
def initialize(faraday_response, currency:, timezone:)
|
7
|
-
@response = faraday_response
|
8
|
-
@response_body = JSON.parse(@response.body)
|
9
|
-
@currency = currency
|
10
|
-
@timezone = timezone
|
11
|
-
end
|
12
|
-
|
13
|
-
def http_status
|
14
|
-
response.status
|
15
|
-
end
|
16
|
-
|
17
|
-
def success?
|
18
|
-
@response_body['result']['status'] == SUCCESS_STATUS
|
19
|
-
end
|
20
|
-
|
21
|
-
def error_code
|
22
|
-
@response_body['result']['errorCode']
|
23
|
-
end
|
24
|
-
|
25
|
-
def error_description
|
26
|
-
@response_body['result']['error']
|
27
|
-
end
|
28
|
-
end
|