portmone 0.0.15 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d7ee6edc1358a4e1eaa145f9cb23efb37d5d63e80b359bfb3171233c1d1ed212
4
- data.tar.gz: 81b67530362627c8afcc3aa7483fb1f80bcb6f5f771906c39895bc4c5f984114
3
+ metadata.gz: 980c91387f0773f49b389434c6f23f1b6bc55d6ae06add5eca674a63f1f8c5dc
4
+ data.tar.gz: fc5894354208ecc4cd0c0f69958bcfbd61098b1c05efd0611d18c8e35889feb0
5
5
  SHA512:
6
- metadata.gz: c7200ed25f7ee0e97545b69a39943cabf0cd9bed2326b016e34da09f760457382d6b7f249fb659586c9b6e71d8346368147ca004d3db2a61b3bca99dcc5a6e56
7
- data.tar.gz: 7dbacbf95d0ae2a5f3b25fca110dc9ff567d0dbc123323dbc711e85d153f6f3fbfe87e541aff77f127710faf223bc82874f6865b5114a9291f2e221c237f9583
6
+ metadata.gz: ccbbdf16e717828a105bdcbc40b1a46eeff82aaf00427b508e45f468e72d3f14839af92e4cfac3584f95d394d58a34471099b678fdc8d5892b14ba782c21adf0
7
+ data.tar.gz: b0834fa442c79c4fa22df054432e6cb18c99f1ab44636660c21daace7310f6dbae545ba75e52c717ea2ad1067a5e507298b96737d9b5401820250f10eeac94d4
@@ -1,10 +1,13 @@
1
1
  class Portmone::Responses::Finish3DS
2
+ SUCCESS_STATUS = 'PAYED'.freeze
3
+
2
4
  attr_reader :response
3
5
 
4
6
  def initialize(faraday_response, currency:, timezone:)
5
7
  @response = faraday_response
6
8
  @currency = currency
7
9
  @timezone = timezone
10
+ @response_body = @response.body.present? ? JSON.parse(@response.body) : { 'result' => {} }
8
11
  end
9
12
 
10
13
  def http_status
@@ -12,6 +15,36 @@ class Portmone::Responses::Finish3DS
12
15
  end
13
16
 
14
17
  def success?
15
- http_status == 204
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']
16
49
  end
17
50
  end
@@ -47,6 +47,10 @@ class Portmone::Responses::MobilePay
47
47
  result['pareq'] if required_3ds?
48
48
  end
49
49
 
50
+ def shop_bill_id
51
+ result['shopBillId']
52
+ end
53
+
50
54
  private
51
55
 
52
56
  def result
@@ -1,3 +1,3 @@
1
1
  module Portmone
2
- VERSION = '0.0.15'
2
+ VERSION = '0.0.16'
3
3
  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.15
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: 2020-02-21 00:00:00.000000000 Z
11
+ date: 2021-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport