paypro 2.0.0 → 2.1.0

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: 1b607a221258fa5d8bfe0bda8f604acb345d0e89066f8f86089386932762b3ca
4
- data.tar.gz: ebc0b753e9d234c911a34af6e95a7bf733c85b60ff1c2f316bb73e2e812f98ae
3
+ metadata.gz: 0564a67b210cd7adbc23d04d6d82bb1dc618fbc7bd8c8916233c5e8301b84509
4
+ data.tar.gz: bf2048e8ea71ff85b3f24ae91be9a9d946b2640e62bafac150433aba259a4409
5
5
  SHA512:
6
- metadata.gz: 0c481bd099168f64341e52b444ab2780737910d51932864912d57becb6ae8a618c2042b4046059d4a7ec8ad34d1a5189e15acca6e19c68487c494fde6083c2bf
7
- data.tar.gz: 0aed28248485b406f8a3d15acc98acf8ec7932077f35f625c251f4df731fa4aae33fe34e640461fffd2501468b061450151e399ba7507f299bc42392fbead0c6
6
+ metadata.gz: 1190b371b19d5cf6bd4eb909be5b718f299bcf006ded6a8c48bb8b4b7f881ca2a33d760db4c13063d63dee87240a02abaf0c89cc2c5efa96bf82ffbb45f54977
7
+ data.tar.gz: 77bd89f811f21519371c134d79fded8062adb8223765a6a68889e81adfe2c89c310455364d693a5b2c2d67ffa20b3c764d1b0fb55994f7dc99c00017e29a0db3
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  /.bundle/
2
+ /.idea
2
3
  /.yardoc
3
4
  /_yardoc/
4
5
  /coverage/
data/.rubocop.yml CHANGED
@@ -1,4 +1,4 @@
1
- require:
1
+ plugins:
2
2
  - rubocop-performance
3
3
  - rubocop-rspec
4
4
 
data/Gemfile CHANGED
@@ -10,9 +10,9 @@ group :development do
10
10
  gem 'rake', '~> 12.0'
11
11
  gem 'rspec', '~> 3.0'
12
12
 
13
- gem 'rubocop', '~> 1.57'
14
- gem 'rubocop-performance', '~> 1.19.0'
15
- gem 'rubocop-rspec', '~> 2.25.0'
13
+ gem 'rubocop', '~> 1.75.5'
14
+ gem 'rubocop-performance', '~> 1.25.0'
15
+ gem 'rubocop-rspec', '~> 3.6.0'
16
16
 
17
17
  gem 'timecop', '~> 0.9.8'
18
18
 
@@ -71,12 +71,7 @@ module PayPro
71
71
 
72
72
  case pay_pro_response.status
73
73
  when 401
74
- raise AuthenticationError.new(
75
- message: 'Invalid API key supplied. ' \
76
- 'Make sure to set a correct API key without any whitespace around it. ' \
77
- 'You can find your API key in the PayPro dashboard at "https://app.paypro.nl/developers/api-keys".',
78
- **default_params
79
- )
74
+ raise authentication_error(**default_params)
80
75
  when 404
81
76
  raise ResourceNotFoundError.new(message: 'Resource not found', **default_params)
82
77
  when 422
@@ -86,6 +81,12 @@ module PayPro
86
81
  code: pay_pro_response.data['error']['type'],
87
82
  **default_params
88
83
  )
84
+ when 500
85
+ raise PayPro::Error.new(
86
+ message: pay_pro_response.data['error']['message'],
87
+ code: pay_pro_response.data['error']['type'],
88
+ **default_params
89
+ )
89
90
  end
90
91
  rescue JSON::ParserError
91
92
  raise PayPro::Error.new(
@@ -95,6 +96,15 @@ module PayPro
95
96
  )
96
97
  end
97
98
 
99
+ def authentication_error(**default_params)
100
+ AuthenticationError.new(
101
+ message: 'Invalid API key supplied. ' \
102
+ 'Make sure to set a correct API key without any whitespace around it. ' \
103
+ 'You can find your API key in the PayPro dashboard at "https://app.paypro.nl/developers/api-keys".',
104
+ **default_params
105
+ )
106
+ end
107
+
98
108
  def request_headers(api_key)
99
109
  {
100
110
  'Content-Type' => 'application/json',
@@ -2,9 +2,24 @@
2
2
 
3
3
  module PayPro
4
4
  class Customer < Resource
5
- include PayPro::Operations::Deletable
6
5
  include PayPro::Operations::Updatable
7
6
 
8
7
  RESOURCE_PATH = 'customers'
8
+
9
+ def mandates(**options)
10
+ api_request(
11
+ method: 'get',
12
+ uri: "#{resource_url}/mandates",
13
+ options: options
14
+ )
15
+ end
16
+
17
+ def subscriptions(**options)
18
+ api_request(
19
+ method: 'get',
20
+ uri: "#{resource_url}/subscriptions",
21
+ options: options
22
+ )
23
+ end
9
24
  end
10
25
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PayPro
4
- VERSION = '2.0.0'
4
+ VERSION = '2.1.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paypro
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - PayPro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-03 00:00:00.000000000 Z
11
+ date: 2025-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday