paynl 1.0.3 → 1.0.4

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: 66eee66c94170b3de1f74c75654ad1fe49556e3d6c572d78a2f6a5c78275d113
4
- data.tar.gz: dc6bb8747cc2640cc0c2b134bbc65785f4bd8f5ae46f554e6fbe5ca37ef5b0bd
3
+ metadata.gz: 4519098345b93aafef2fdca13a3db5539c1409d8c90fba79b93ec20e27e9b4a7
4
+ data.tar.gz: 206a0cf8f40ab3680af5b28f6d9a890384d2b1a064f0026af89ea2b2b8efc78d
5
5
  SHA512:
6
- metadata.gz: 4e5f855742aeab5b994164fb0e2a57e68ac5d04c1b2026b70ad3210404239b30a75a29f2e6a4b4dc4a75a6abd2f43b6f34bbf82f3002e9c2c0955d464017e010
7
- data.tar.gz: 4fd2b5d003733dbbb22c33ce9766124057bd0e499904b1b435e5da809851aa0f269282c6cd64c69389a74e6658b158816c3a4380911eb06110317f7c7d8099a8
6
+ metadata.gz: 4a696a0a1a098a624d4c6783bc297eeb3344cfdd7f7a438e277fe2df22763779d68d2401bf89de756ccee6d763fb3bd88c8f87dfad0c0b6f2b6fe15dfcfdf8e8
7
+ data.tar.gz: cac50aea97db25bbc4ba871431153d332d97856de07a0a49d6f55c2c33c988710b778f1f6da0069046ee7461cdf3962ac400420dc96b6b10e8b8167b1d611375
@@ -0,0 +1,41 @@
1
+ image: "ruby:2.7"
2
+
3
+
4
+ before_script:
5
+ - ruby -v # Print out ruby version for debugging
6
+ - bundle install
7
+ - gem install rspec
8
+ - mkdir ~/.gem || true
9
+ - touch ~/.gem/credentials || true
10
+ - url_host=`git remote get-url origin | sed -e "s/https:\/\/gitlab-ci-token:.*@//g"`
11
+ # runner runs on a detached HEAD, checkout current branch for editing
12
+ - git reset --hard
13
+ - git clean -fd
14
+ - git checkout $CI_COMMIT_REF_NAME
15
+ - git pull origin $CI_COMMIT_REF_NAME
16
+ - |-
17
+ echo "---
18
+ :rubygems_api_key: $RUBYGEM_KEY" > ~/.gem/credentials
19
+ - chmod 600 ~/.gem/credentials
20
+
21
+ rspec:
22
+ stage: test
23
+ script:
24
+ - rspec spec
25
+
26
+ build:
27
+ stage: build
28
+ script:
29
+ - rake build
30
+
31
+ prepare_deployment:
32
+ stage: deploy
33
+ only:
34
+ - web
35
+ script:
36
+ - rake spec
37
+ - rake build
38
+ - git config --global user.email "sebastian@sebsoft.nl"
39
+ - git config --global user.name "Sebastian Berm"
40
+ - git remote set-url origin "https://$GIT_ACCESS_USER:$GIT_ACCESS_PASSWORD@${url_host}"
41
+ - rake release
data/README.md CHANGED
@@ -30,8 +30,8 @@ Or install it yourself as:
30
30
  $ gem install paynl
31
31
 
32
32
  ## Requirements
33
- This gem requires Ruby 1.9.2+.
34
- We have tested this gem with Ruby 2.2.1.
33
+ This gem requires Ruby 2.5+.
34
+ We have tested this gem with Ruby 2.5, 2.6 and 2.7.
35
35
 
36
36
  ## Usage
37
37
 
@@ -46,6 +46,7 @@ require 'paynl'
46
46
 
47
47
  Paynl::Config::setApiToken('e41f83b246b706291ea9ad798ccfd9f0fee5e0ab')
48
48
  Paynl::Config::setServiceId('SL-3490-4320')
49
+ Paynl::Config::setTokenCode('AT-code-here')
49
50
  ```
50
51
 
51
52
  Getting a list of available payment methods for your site:
@@ -54,6 +55,7 @@ require 'paynl'
54
55
 
55
56
  Paynl::Config::setApiToken('e41f83b246b706291ea9ad798ccfd9f0fee5e0ab')
56
57
  Paynl::Config::setServiceId('SL-3490-4320')
58
+ Paynl::Config::setTokenCode('AT-code-here')
57
59
  api = Paynl::Paymentmethods.new
58
60
  options = Hash.new
59
61
  puts api.getList(options)
@@ -65,6 +67,7 @@ require 'paynl'
65
67
 
66
68
  Paynl::Config::setApiToken('e41f83b246b706291ea9ad798ccfd9f0fee5e0ab')
67
69
  Paynl::Config::setServiceId('SL-3490-4320')
70
+ Paynl::Config::setTokenCode('AT-code-here')
68
71
 
69
72
  data = Paynl::Transaction.new
70
73
  options = Hash.new
@@ -147,6 +150,7 @@ require 'paynl'
147
150
 
148
151
  Paynl::Config::setApiToken('e41f83b246b706291ea9ad798ccfd9f0fee5e0ab')
149
152
  Paynl::Config::setServiceId('SL-3490-4320')
153
+ Paynl::Config::setTokenCode('AT-code-here')
150
154
 
151
155
  data = Paynl::Transaction.new
152
156
  result = data.getTransaction(transactionId)
@@ -163,6 +167,7 @@ require 'paynl'
163
167
 
164
168
  Paynl::Config::setApiToken('e41f83b246b706291ea9ad798ccfd9f0fee5e0ab')
165
169
  Paynl::Config::setServiceId('SL-3490-4320')
170
+ Paynl::Config::setTokenCode('AT-code-here')
166
171
 
167
172
  data = Paynl::Transaction.new
168
173
  result = data.getTransaction(transactionId)
@@ -1,21 +1,21 @@
1
1
  require 'yaml'
2
2
  require 'typhoeus'
3
3
  require 'json'
4
- require 'paynl/api/api'
5
- require 'paynl/error/required/serviceiderror'
6
- require 'paynl/error/required/apitokenerror'
7
- require 'paynl/error/requirederror'
8
- require 'paynl/helper'
9
- require 'paynl/version'
10
- require 'paynl/api/validate/is_pay_server_ip'
11
- require 'paynl/api/validate/get_pay_server_ips'
12
- require 'paynl/api/transaction/get_service'
13
- require 'paynl/api/transaction/start_transaction'
14
- require 'paynl/api/transaction/info'
15
- require 'paynl/api/transaction/refund'
16
- require 'paynl/api/api'
17
- require 'paynl/config'
18
- require 'paynl/transaction'
19
- require 'paynl/paymentmethods'
20
- require 'paynl'
4
+ require_relative 'paynl/api/api'
5
+ require_relative 'paynl/error/required/serviceiderror'
6
+ require_relative 'paynl/error/required/apitokenerror'
7
+ require_relative 'paynl/error/requirederror'
8
+ require_relative 'paynl/helper'
9
+ require_relative 'paynl/version'
10
+ require_relative 'paynl/api/validate/is_pay_server_ip'
11
+ require_relative 'paynl/api/validate/get_pay_server_ips'
12
+ require_relative 'paynl/api/transaction/get_service'
13
+ require_relative 'paynl/api/transaction/start_transaction'
14
+ require_relative 'paynl/api/transaction/info'
15
+ require_relative 'paynl/api/transaction/refund'
16
+ require_relative 'paynl/api/api'
17
+ require_relative 'paynl/config'
18
+ require_relative 'paynl/transaction'
19
+ require_relative 'paynl/paymentmethods'
20
+ require_relative 'paynl'
21
21
 
@@ -44,14 +44,25 @@ module Paynl
44
44
 
45
45
  data = getData
46
46
  uri = Paynl::Config::getApiUrl(endpoint, version)
47
- # puts uri
48
- # puts data
49
- # Code to actually do the CURL request
50
- response = Typhoeus::Request.post(
51
- uri,
52
- params: data,
53
- :headers => { 'User-Agent' => 'Ruby SDK ' + VERSION }
54
- )
47
+ #puts uri
48
+ #puts data
49
+
50
+ if isServiceIdRequired
51
+ # Code to actually do the CURL request
52
+ response = Typhoeus::Request.post(
53
+ uri,
54
+ params: data,
55
+ userpwd: Paynl::Config::getTokenCode + ':' + Paynl::Config::getApiToken,
56
+ :headers => { 'User-Agent' => 'Ruby SDK ' + VERSION }
57
+ )
58
+ else
59
+ # Code to actually do the CURL request
60
+ response = Typhoeus::Request.post(
61
+ uri,
62
+ params: data,
63
+ :headers => { 'User-Agent' => 'Ruby SDK ' + VERSION }
64
+ )
65
+ end
55
66
 
56
67
  # if response.code != 200
57
68
  # raise 'API error'
@@ -14,7 +14,7 @@ module Paynl
14
14
 
15
15
  def doRequest
16
16
  # TODO: add caching to this
17
- return super('transaction/getService', nil)
17
+ return super('transaction/getService', 16)
18
18
  end
19
19
  end
20
20
  end
@@ -1,10 +1,21 @@
1
1
  module Paynl
2
2
  class Config
3
3
  @@apiToken=''
4
+ @@tokenCode=''
4
5
  @@serviceId=''
5
6
  @@apiBase='https://rest-api.pay.nl'
6
7
  @@apiVersion=5
7
8
 
9
+ # getTokenCode - Retrieves Pay.nl tokencode
10
+ def self.getTokenCode
11
+ return @@tokenCode
12
+ end
13
+
14
+ # setTokenCode - Sets Pay.nl tokencode
15
+ def self.setTokenCode(tokenCode)
16
+ @@tokenCode = tokenCode
17
+ end
18
+
8
19
  # getApiToken - Retrieves Pay.nl api token
9
20
  def self.getApiToken
10
21
  return @@apiToken
@@ -2,11 +2,17 @@ module Paynl
2
2
  class Helper
3
3
  def self.requireApiToken
4
4
  apiToken = Paynl::Config::getApiToken
5
+ tokenCode = Paynl::Config::getTokenCode
5
6
 
6
7
  # Hmm, porting PHP to Ruby is crap if you want to keep the structure
7
8
  if apiToken == nil? or apiToken == ''
8
9
  raise Paynl::Error::Required::ApiTokenError, 'Api token is required'
9
10
  end
11
+
12
+ if tokenCode == nil? or tokenCode == ''
13
+ raise Paynl::Error::Required::ApiTokenError, 'Api token code (AT-code) is required'
14
+ end
15
+
10
16
  end
11
17
 
12
18
  def self.requireServiceId
@@ -1,3 +1,3 @@
1
1
  module Paynl
2
- VERSION = '1.0.3'
2
+ VERSION = '1.0.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paynl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Berm
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-02 00:00:00.000000000 Z
11
+ date: 2020-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -75,6 +75,7 @@ extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
77
  - ".gitignore"
78
+ - ".gitlab-ci.yml"
78
79
  - ".rspec"
79
80
  - ".travis.yml"
80
81
  - Gemfile