portmone 0.0.11 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +12 -7
- data/lib/portmone.rb +2 -1
- data/lib/portmone/client.rb +15 -5
- data/lib/portmone/responses/finish_3ds.rb +50 -0
- data/lib/portmone/responses/mobile_pay.rb +59 -0
- data/lib/portmone/version.rb +1 -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: 980c91387f0773f49b389434c6f23f1b6bc55d6ae06add5eca674a63f1f8c5dc
|
4
|
+
data.tar.gz: fc5894354208ecc4cd0c0f69958bcfbd61098b1c05efd0611d18c8e35889feb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccbbdf16e717828a105bdcbc40b1a46eeff82aaf00427b508e45f468e72d3f14839af92e4cfac3584f95d394d58a34471099b678fdc8d5892b14ba782c21adf0
|
7
|
+
data.tar.gz: b0834fa442c79c4fa22df054432e6cb18c99f1ab44636660c21daace7310f6dbae545ba75e52c717ea2ad1067a5e507298b96737d9b5401820250f10eeac94d4
|
data/Gemfile.lock
CHANGED
@@ -1,37 +1,41 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
portmone (0.0.
|
4
|
+
portmone (0.0.15)
|
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
|
|
10
11
|
GEM
|
11
12
|
remote: https://rubygems.org/
|
12
13
|
specs:
|
13
|
-
activesupport (
|
14
|
+
activesupport (6.0.2.1)
|
14
15
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
16
|
i18n (>= 0.7, < 2)
|
16
17
|
minitest (~> 5.1)
|
17
18
|
tzinfo (~> 1.1)
|
19
|
+
zeitwerk (~> 2.2)
|
18
20
|
addressable (2.5.2)
|
19
21
|
public_suffix (>= 2.0.2, < 4.0)
|
20
22
|
ast (2.3.0)
|
21
23
|
coderay (1.1.2)
|
22
|
-
concurrent-ruby (1.1.
|
24
|
+
concurrent-ruby (1.1.6)
|
23
25
|
crack (0.4.3)
|
24
26
|
safe_yaml (~> 1.0.0)
|
25
27
|
docile (1.1.5)
|
26
|
-
faraday (0.
|
28
|
+
faraday (0.17.3)
|
27
29
|
multipart-post (>= 1.2, < 3)
|
30
|
+
faraday-detailed_logger (2.3.0)
|
31
|
+
faraday (>= 0.8, < 2)
|
28
32
|
hashdiff (0.3.7)
|
29
|
-
i18n (1.
|
33
|
+
i18n (1.8.2)
|
30
34
|
concurrent-ruby (~> 1.0)
|
31
35
|
json (2.1.0)
|
32
36
|
method_source (0.9.0)
|
33
37
|
minitest (5.11.3)
|
34
|
-
money (6.13.
|
38
|
+
money (6.13.7)
|
35
39
|
i18n (>= 0.6.4, <= 2)
|
36
40
|
multi_xml (0.6.0)
|
37
41
|
multipart-post (2.1.1)
|
@@ -61,7 +65,7 @@ GEM
|
|
61
65
|
simplecov-html (~> 0.10.0)
|
62
66
|
simplecov-html (0.10.2)
|
63
67
|
thread_safe (0.3.6)
|
64
|
-
tzinfo (1.2.
|
68
|
+
tzinfo (1.2.6)
|
65
69
|
thread_safe (~> 0.1)
|
66
70
|
unicode-display_width (1.3.0)
|
67
71
|
vcr (2.9.3)
|
@@ -69,6 +73,7 @@ GEM
|
|
69
73
|
addressable (>= 2.3.6)
|
70
74
|
crack (>= 0.3.2)
|
71
75
|
hashdiff
|
76
|
+
zeitwerk (2.2.2)
|
72
77
|
|
73
78
|
PLATFORMS
|
74
79
|
ruby
|
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/lib/portmone/client.rb
CHANGED
@@ -42,10 +42,11 @@ module Portmone
|
|
42
42
|
|
43
43
|
def order_status(shop_order_number, created_date: nil)
|
44
44
|
if created_date
|
45
|
-
|
45
|
+
start_date = created_date - 1.day
|
46
|
+
end_date = created_date + 1.day
|
46
47
|
generic_report(shop_order_number: shop_order_number,
|
47
|
-
start_date:
|
48
|
-
end_date:
|
48
|
+
start_date: format_date(start_date),
|
49
|
+
end_date: format_date(end_date))
|
49
50
|
else
|
50
51
|
generic_report(shop_order_number: shop_order_number)
|
51
52
|
end
|
@@ -83,6 +84,15 @@ module Portmone
|
|
83
84
|
mobile_pay('APay', apple_pay_params, amount: amount, order_id: order_id, currency: currency)
|
84
85
|
end
|
85
86
|
|
87
|
+
def finish_3ds(md:, pa_res:, shop_bill_id:)
|
88
|
+
params = {
|
89
|
+
method: 'confirmMpi',
|
90
|
+
params: { data: { 'MD': md.to_s, 'PaRes': pa_res.to_s, 'shopBillId': shop_bill_id.to_s } },
|
91
|
+
id: '1',
|
92
|
+
}
|
93
|
+
make_json_request(MOBILE_API_URL, params, Portmone::Responses::Finish3DS)
|
94
|
+
end
|
95
|
+
|
86
96
|
private
|
87
97
|
|
88
98
|
def mobile_pay(payment_method, payment_system_params, amount:, order_id:, currency:)
|
@@ -98,7 +108,7 @@ module Portmone
|
|
98
108
|
.keep_if { |_, v| v.present? }
|
99
109
|
params = { params: { data: data }, method: payment_method, id: 1 }
|
100
110
|
|
101
|
-
make_json_request(MOBILE_API_URL, params, Portmone::Responses::
|
111
|
+
make_json_request(MOBILE_API_URL, params, Portmone::Responses::MobilePay)
|
102
112
|
end
|
103
113
|
|
104
114
|
def base_params
|
@@ -162,7 +172,7 @@ module Portmone
|
|
162
172
|
|
163
173
|
def make_json_request(url, params, response_class)
|
164
174
|
conn = Faraday.new(url: url) do |builder|
|
165
|
-
builder.response(:detailed_logger, @logger)
|
175
|
+
builder.response(:detailed_logger, @logger) if @logger
|
166
176
|
builder.adapter Faraday.default_adapter
|
167
177
|
end
|
168
178
|
|
@@ -0,0 +1,50 @@
|
|
1
|
+
class Portmone::Responses::Finish3DS
|
2
|
+
SUCCESS_STATUS = 'PAYED'.freeze
|
3
|
+
|
4
|
+
attr_reader :response
|
5
|
+
|
6
|
+
def initialize(faraday_response, currency:, timezone:)
|
7
|
+
@response = faraday_response
|
8
|
+
@currency = currency
|
9
|
+
@timezone = timezone
|
10
|
+
@response_body = @response.body.present? ? JSON.parse(@response.body) : { 'result' => {} }
|
11
|
+
end
|
12
|
+
|
13
|
+
def http_status
|
14
|
+
response.status
|
15
|
+
end
|
16
|
+
|
17
|
+
def success?
|
18
|
+
result['status'] == SUCCESS_STATUS && !required_3ds?
|
19
|
+
end
|
20
|
+
|
21
|
+
def error_code
|
22
|
+
result['errorCode']
|
23
|
+
end
|
24
|
+
|
25
|
+
def error_description
|
26
|
+
result['error']
|
27
|
+
end
|
28
|
+
|
29
|
+
def required_3ds?
|
30
|
+
result['isNeed3DS'] == 'Y'
|
31
|
+
end
|
32
|
+
|
33
|
+
def acs_url
|
34
|
+
result['actionMPI']
|
35
|
+
end
|
36
|
+
|
37
|
+
def md
|
38
|
+
result['md']
|
39
|
+
end
|
40
|
+
|
41
|
+
def pa_req
|
42
|
+
result['pareq']
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def result
|
48
|
+
@result ||= @response_body['result']
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,59 @@
|
|
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'] == 'Y'
|
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
|
+
def shop_bill_id
|
51
|
+
result['shopBillId']
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
def result
|
57
|
+
@result ||= @response_body['result']
|
58
|
+
end
|
59
|
+
end
|
data/lib/portmone/version.rb
CHANGED
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.16
|
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: 2021-05-26 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
|