six_saferpay 0.1.9 → 0.1.10

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: 343cf6e58f41bb5f03e492d03727df40bd709e201a9d6155a2e96701379bacd0
4
- data.tar.gz: 7b91e8ad24a7dca63053b43b56201eb75729e26573d44ba116d96b77ceeaddc4
3
+ metadata.gz: 25905e96758e61391e8ee95dfc6795ca1e84fb753fa8ce46a9948cdde7d6df4e
4
+ data.tar.gz: 686f52677a0abe0b4ca8d9ea03111985403840eab2d35e4ed3a554dacb48bff8
5
5
  SHA512:
6
- metadata.gz: 2368c62765a52810438b9e7e0c0d35bb957b4b84c3bda8cabd96943e1eb7ef3b47c7182c2a85a67ef33842e6ecc8419551ce7225512d1f84791a28badb91a1ce
7
- data.tar.gz: c106033464da5a27e9b371fabfe354f0b32cc4a9a5f28d2b1152485ed765a0da49950ca6b903e44df577f3b609365439be071690b2832aa0fcd83631b999b0de
6
+ metadata.gz: f77747f41a4f5c1727a9ccab460ce8934ca23a2504846d39bb261810ac92eeb7ba66d3f42ad2ec220b01d8b59dd91003b957413f7c25fbfc05f6c8141389bfd4
7
+ data.tar.gz: 1f35d0a4af9a38fd6ed22eec212db2a9277728119121de034df51b6471bb724dcb21fde9b7de3f93e7ade5c995ffb48f1c2903371841e6316450f129e0f87f42
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- six_saferpay (0.1.0)
4
+ six_saferpay (0.1.9)
5
5
  activesupport (>= 5.0.0.0)
6
6
 
7
7
  GEM
@@ -65,6 +65,7 @@ GEM
65
65
  spoon (0.0.6)
66
66
  ffi
67
67
  thread_safe (0.3.6)
68
+ thread_safe (0.3.6-java)
68
69
  timers (4.3.0)
69
70
  tty-color (0.4.3)
70
71
  tty-cursor (0.6.1)
@@ -12,7 +12,7 @@ module SixSaferpay
12
12
  capture_id: nil,
13
13
  status: ,
14
14
  date: ,
15
- invoice: )
15
+ invoice: nil)
16
16
  @response_header = SixSaferpay::ResponseHeader.new(response_header) if response_header
17
17
  @capture_id = capture_id
18
18
  @status = status
@@ -20,7 +20,11 @@ module SixSaferpay
20
20
  key = key.to_s.underscore
21
21
  key.to_sym
22
22
  end
23
- @object.response_class.new(hash)
23
+ if @response.code == "200"
24
+ @object.response_class.new(hash)
25
+ else
26
+ raise SixSaferpay::Error.new(hash)
27
+ end
24
28
  end
25
29
 
26
30
  private
@@ -0,0 +1,71 @@
1
+ module SixSaferpay
2
+ class Error < StandardError
3
+
4
+ attr_accessor(:response_header,
5
+ :behavior,
6
+ :error_name,
7
+ :error_message,
8
+ :transaction_id,
9
+ :error_detail,
10
+ :processor_name,
11
+ :processor_result,
12
+ :processor_message
13
+ )
14
+
15
+ def initialize(response_header: ,
16
+ behavior: ,
17
+ error_name: ,
18
+ error_message: ,
19
+ transaction_id: nil,
20
+ error_detail: nil,
21
+ processor_name: nil,
22
+ processor_result: nil,
23
+ processor_message: nil
24
+ )
25
+ @response_header = SixSaferpay::ResponseHeader.new(response_header.to_h) if response_header
26
+ @behavior = behavior
27
+ @error_name = error_name
28
+ @error_message = error_message
29
+ @transaction_id = transaction_id
30
+ @error_detail = error_detail
31
+ @processor_name = processor_name
32
+ @processor_result = processor_result
33
+ @processor_message = processor_message
34
+ end
35
+
36
+ def to_hash
37
+ hash = Hash.new
38
+ hash.merge!(response_header: @response_header.to_h) if @response_header
39
+ hash.merge!(behavior: @behavior) if @behavior
40
+ hash.merge!(error_name: @error_name) if @error_name
41
+ hash.merge!(error_message: @error_message) if @error_message
42
+ hash.merge!(transaction_id: @transaction_id) if @transaction_id
43
+ hash.merge!(error_detail: @error_detail) if @error_detail
44
+ hash.merge!(processor_name: @processor_name) if @processor_name
45
+ hash.merge!(processor_result: @processor_result) if @processor_result
46
+ hash.merge!(processor_message: @processor_message) if @processor_message
47
+ hash
48
+ end
49
+ alias_method :to_h, :to_hash
50
+
51
+ def full_message
52
+ error = "#{@behavior}: #{@error_name} - #{@error_message}"
53
+ if @error_detail
54
+ @error_detail.each do |detail|
55
+ error << "\n"
56
+ error << detail
57
+ end
58
+ end
59
+ error
60
+ end
61
+
62
+ def to_s
63
+ full_message
64
+ end
65
+
66
+ def message
67
+ full_message
68
+ end
69
+
70
+ end
71
+ end
@@ -7,7 +7,7 @@ module SixSaferpay
7
7
  :company,
8
8
  :gender,
9
9
  :legal_form,
10
- :street_1,
10
+ :street,
11
11
  :street_2,
12
12
  :zip,
13
13
  :city,
@@ -24,7 +24,7 @@ module SixSaferpay
24
24
  company: nil,
25
25
  gender: nil,
26
26
  legal_form: nil,
27
- street_1: nil,
27
+ street: nil,
28
28
  street_2: nil,
29
29
  zip: nil,
30
30
  city: nil,
@@ -39,7 +39,7 @@ module SixSaferpay
39
39
  @company = company
40
40
  @gender = gender
41
41
  @legal_form = legal_form
42
- @street_1 = street_1
42
+ @street = street
43
43
  @street_2 = street_2
44
44
  @zip = zip
45
45
  @city = city
@@ -57,7 +57,7 @@ module SixSaferpay
57
57
  hash.merge!(company: @company) if @company
58
58
  hash.merge!(gender: @gender) if @gender
59
59
  hash.merge!(legal_form: @legal_form) if @legal_form
60
- hash.merge!(street: @street_1) if @street_1
60
+ hash.merge!(street: @street) if @street
61
61
  hash.merge!(street_2: @street_2) if @street_2
62
62
  hash.merge!(zip: @zip) if @zip
63
63
  hash.merge!(city: @city) if @city
@@ -11,9 +11,9 @@ module SixSaferpay
11
11
 
12
12
  def to_hash
13
13
  body = Hash.new
14
- body.merge!(Success: @success)
15
- body.merge!(Fail: @fail)
16
- body.merge!(Abort: @abort) if @abort
14
+ body.merge!(success: @success)
15
+ body.merge!(fail: @fail)
16
+ body.merge!(abort: @abort) if @abort
17
17
  body
18
18
  end
19
19
  alias_method :to_h, :to_hash
@@ -9,7 +9,7 @@ module SixSaferpay
9
9
 
10
10
  def to_hash
11
11
  body = Hash.new
12
- body.merge!(CertificateExpirationDate: @certificate_expiration_date)
12
+ body.merge!(certificate_expiration_date: @certificate_expiration_date)
13
13
  body
14
14
  end
15
15
  alias_method :to_h, :to_hash
@@ -1,3 +1,3 @@
1
1
  module SixSaferpay
2
- VERSION = "0.1.9"
2
+ VERSION = "0.1.10"
3
3
  end
data/lib/six_saferpay.rb CHANGED
@@ -7,6 +7,7 @@ require 'net/http'
7
7
  spec = Gem::Specification.find_by_name("six_saferpay")
8
8
  gem_root = spec.gem_dir
9
9
 
10
+
10
11
  Dir[File.join(gem_root, "lib", "six_saferpay", "**/*.rb")].sort.each do |file|
11
12
  require file
12
13
  end
data/six_saferpay.gemspec CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
 
12
12
  spec.summary = %q{Write a short summary, because RubyGems requires one.}
13
13
  spec.description = %q{Write a longer description or delete this line.}
14
- spec.homepage = "http://fadendaten.ch"
14
+ spec.homepage = "https://github.com/fadendaten/six_saferpa://github.com/fadendaten/six_saferpay"
15
15
  spec.license = "MIT"
16
16
 
17
17
  # Specify which files should be added to the gem when it is released.
@@ -23,15 +23,15 @@ Gem::Specification.new do |spec|
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ["lib"]
25
25
 
26
- spec.add_runtime_dependency 'activesupport', '>= 5.0.0.0'
26
+ spec.add_runtime_dependency 'activesupport', '~> 5.0', '>= 5.0.0.0'
27
27
 
28
28
 
29
29
  spec.add_development_dependency 'bundler', '~> 2.0'
30
30
  spec.add_development_dependency 'rake', '~> 10.0'
31
31
  spec.add_development_dependency 'rspec', '~> 3.0'
32
- spec.add_development_dependency 'vcr', '~> 4.0.0'
33
- spec.add_development_dependency 'webmock', '~> 3.5.1'
34
- spec.add_development_dependency 'dotenv', '~> 2.7.0'
32
+ spec.add_development_dependency 'vcr', '~> 4.0', '>= 4.0.0'
33
+ spec.add_development_dependency 'webmock', '~> 3.5', '>= 3.5.1'
34
+ spec.add_development_dependency 'dotenv', '~> 2.7', '>= 2.7'
35
35
  spec.add_development_dependency 'pry', '~> 0.12.0'
36
36
  spec.add_development_dependency 'tty-prompt', '~> 0.18'
37
37
  spec.add_development_dependency 'simplecov', '~> 0.16'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: six_saferpay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Langenegger
@@ -14,6 +14,9 @@ dependencies:
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '5.0'
17
20
  - - ">="
18
21
  - !ruby/object:Gem::Version
19
22
  version: 5.0.0.0
@@ -21,6 +24,9 @@ dependencies:
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '5.0'
24
30
  - - ">="
25
31
  - !ruby/object:Gem::Version
26
32
  version: 5.0.0.0
@@ -71,6 +77,9 @@ dependencies:
71
77
  requirement: !ruby/object:Gem::Requirement
72
78
  requirements:
73
79
  - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '4.0'
82
+ - - ">="
74
83
  - !ruby/object:Gem::Version
75
84
  version: 4.0.0
76
85
  type: :development
@@ -78,6 +87,9 @@ dependencies:
78
87
  version_requirements: !ruby/object:Gem::Requirement
79
88
  requirements:
80
89
  - - "~>"
90
+ - !ruby/object:Gem::Version
91
+ version: '4.0'
92
+ - - ">="
81
93
  - !ruby/object:Gem::Version
82
94
  version: 4.0.0
83
95
  - !ruby/object:Gem::Dependency
@@ -85,6 +97,9 @@ dependencies:
85
97
  requirement: !ruby/object:Gem::Requirement
86
98
  requirements:
87
99
  - - "~>"
100
+ - !ruby/object:Gem::Version
101
+ version: '3.5'
102
+ - - ">="
88
103
  - !ruby/object:Gem::Version
89
104
  version: 3.5.1
90
105
  type: :development
@@ -92,6 +107,9 @@ dependencies:
92
107
  version_requirements: !ruby/object:Gem::Requirement
93
108
  requirements:
94
109
  - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: '3.5'
112
+ - - ">="
95
113
  - !ruby/object:Gem::Version
96
114
  version: 3.5.1
97
115
  - !ruby/object:Gem::Dependency
@@ -100,14 +118,20 @@ dependencies:
100
118
  requirements:
101
119
  - - "~>"
102
120
  - !ruby/object:Gem::Version
103
- version: 2.7.0
121
+ version: '2.7'
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '2.7'
104
125
  type: :development
105
126
  prerelease: false
106
127
  version_requirements: !ruby/object:Gem::Requirement
107
128
  requirements:
108
129
  - - "~>"
109
130
  - !ruby/object:Gem::Version
110
- version: 2.7.0
131
+ version: '2.7'
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: '2.7'
111
135
  - !ruby/object:Gem::Dependency
112
136
  name: pry
113
137
  requirement: !ruby/object:Gem::Requirement
@@ -185,6 +209,7 @@ files:
185
209
  - lib/six_saferpay/api/six_transaction/responses/initialize_response.rb
186
210
  - lib/six_saferpay/client.rb
187
211
  - lib/six_saferpay/error.rb
212
+ - lib/six_saferpay/errors/error.rb
188
213
  - lib/six_saferpay/model.rb
189
214
  - lib/six_saferpay/models/address.rb
190
215
  - lib/six_saferpay/models/address_form.rb
@@ -230,7 +255,6 @@ files:
230
255
  - lib/six_saferpay/models/six_transaction/initialize/card.rb
231
256
  - lib/six_saferpay/models/six_transaction/initialize/payment_means.rb
232
257
  - lib/six_saferpay/models/styling.rb
233
- - lib/six_saferpay/models/terminal.rb
234
258
  - lib/six_saferpay/models/three_ds.rb
235
259
  - lib/six_saferpay/models/transaction.rb
236
260
  - lib/six_saferpay/models/transaction_reference.rb
@@ -239,7 +263,7 @@ files:
239
263
  - lib/six_saferpay/models/wallet.rb
240
264
  - lib/six_saferpay/version.rb
241
265
  - six_saferpay.gemspec
242
- homepage: http://fadendaten.ch
266
+ homepage: https://github.com/fadendaten/six_saferpa://github.com/fadendaten/six_saferpay
243
267
  licenses:
244
268
  - MIT
245
269
  metadata: {}
@@ -1,16 +0,0 @@
1
- # module SixSaferpay
2
- # class Terminal
3
- # attr_accessor :terminal_id
4
-
5
- # def initialize(terminal_id: terminal_id )
6
- # @terminal_id = terminal_id || SixSaferpay.config.terminal_id
7
- # end
8
-
9
- # def to_hash
10
- # {
11
- # TerminalId: @terminal_id
12
- # }
13
- # end
14
- # alias_method :to_h, :to_hash
15
- # end
16
- # end