paypro 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +54 -0
- data/.gitignore +8 -47
- data/.rspec +3 -0
- data/.rubocop.yml +37 -15
- data/Gemfile +12 -2
- data/LICENSE +1 -1
- data/README.md +65 -23
- data/Rakefile +5 -1
- data/bin/console +8 -0
- data/bin/setup +8 -0
- data/lib/data/{ca-bundle.crt → cacert.pem} +617 -298
- data/lib/pay_pro/api_client.rb +131 -0
- data/lib/pay_pro/client.rb +67 -0
- data/lib/pay_pro/config.rb +30 -0
- data/lib/pay_pro/endpoint.rb +19 -0
- data/lib/pay_pro/endpoints/chargebacks.rb +14 -0
- data/lib/pay_pro/endpoints/customers.rb +15 -0
- data/lib/pay_pro/endpoints/events.rb +14 -0
- data/lib/pay_pro/endpoints/installment_plan_periods.rb +13 -0
- data/lib/pay_pro/endpoints/installment_plans.rb +15 -0
- data/lib/pay_pro/endpoints/mandates.rb +15 -0
- data/lib/pay_pro/endpoints/pay_methods.rb +13 -0
- data/lib/pay_pro/endpoints/payments.rb +15 -0
- data/lib/pay_pro/endpoints/refunds.rb +14 -0
- data/lib/pay_pro/endpoints/subscription_periods.rb +13 -0
- data/lib/pay_pro/endpoints/subscriptions.rb +15 -0
- data/lib/pay_pro/endpoints/webhooks.rb +15 -0
- data/lib/pay_pro/entities/chargeback.rb +5 -0
- data/lib/pay_pro/entities/customer.rb +10 -0
- data/lib/pay_pro/entities/entity.rb +41 -0
- data/lib/pay_pro/entities/event.rb +5 -0
- data/lib/pay_pro/entities/installment_plan.rb +29 -0
- data/lib/pay_pro/entities/installment_plan_period.rb +5 -0
- data/lib/pay_pro/entities/list.rb +65 -0
- data/lib/pay_pro/entities/mandate.rb +5 -0
- data/lib/pay_pro/entities/pay_method.rb +6 -0
- data/lib/pay_pro/entities/payment.rb +23 -0
- data/lib/pay_pro/entities/refund.rb +11 -0
- data/lib/pay_pro/entities/resource.rb +13 -0
- data/lib/pay_pro/entities/subscription.rb +38 -0
- data/lib/pay_pro/entities/subscription_period.rb +5 -0
- data/lib/pay_pro/entities/webhook.rb +30 -0
- data/lib/pay_pro/errors.rb +36 -0
- data/lib/pay_pro/operations/creatable.rb +11 -0
- data/lib/pay_pro/operations/deletable.rb +11 -0
- data/lib/pay_pro/operations/getable.rb +11 -0
- data/lib/pay_pro/operations/listable.rb +11 -0
- data/lib/pay_pro/operations/requestable.rb +12 -0
- data/lib/pay_pro/operations/updatable.rb +11 -0
- data/lib/pay_pro/response.rb +21 -0
- data/lib/pay_pro/signature.rb +59 -0
- data/lib/pay_pro/util.rb +48 -0
- data/lib/{paypro → pay_pro}/version.rb +1 -1
- data/lib/pay_pro.rb +77 -0
- data/paypro.gemspec +18 -11
- metadata +67 -48
- data/.circleci/config.yml +0 -74
- data/VERSION +0 -1
- data/examples/create_payment.rb +0 -7
- data/lib/paypro/client.rb +0 -68
- data/lib/paypro/errors.rb +0 -7
- data/lib/paypro.rb +0 -16
- data/spec/paypro/client_spec.rb +0 -114
- data/spec/paypro_spec.rb +0 -13
- data/spec/spec_helper.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b607a221258fa5d8bfe0bda8f604acb345d0e89066f8f86089386932762b3ca
|
4
|
+
data.tar.gz: ebc0b753e9d234c911a34af6e95a7bf733c85b60ff1c2f316bb73e2e812f98ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c481bd099168f64341e52b444ab2780737910d51932864912d57becb6ae8a618c2042b4046059d4a7ec8ad34d1a5189e15acca6e19c68487c494fde6083c2bf
|
7
|
+
data.tar.gz: 0aed28248485b406f8a3d15acc98acf8ec7932077f35f625c251f4df731fa4aae33fe34e640461fffd2501468b061450151e399ba7507f299bc42392fbead0c6
|
@@ -0,0 +1,54 @@
|
|
1
|
+
name: build
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- 'master'
|
7
|
+
pull_request:
|
8
|
+
branches:
|
9
|
+
- '**'
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
build:
|
13
|
+
name: Build
|
14
|
+
needs: test
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v3
|
19
|
+
- name: Set up Ruby
|
20
|
+
uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: 3.0
|
23
|
+
- name: Build
|
24
|
+
run: gem build paypro.gemspec
|
25
|
+
|
26
|
+
lint:
|
27
|
+
name: Lint
|
28
|
+
runs-on: ubuntu-latest
|
29
|
+
|
30
|
+
steps:
|
31
|
+
- uses: actions/checkout@v3
|
32
|
+
- name: Set up Ruby
|
33
|
+
uses: ruby/setup-ruby@v1
|
34
|
+
with:
|
35
|
+
ruby-version: 3.0
|
36
|
+
- name: Lint
|
37
|
+
run: bundle install && bundle exec rubocop
|
38
|
+
|
39
|
+
test:
|
40
|
+
name: Test (${{ matrix.ruby-version }})
|
41
|
+
needs: lint
|
42
|
+
runs-on: ubuntu-latest
|
43
|
+
strategy:
|
44
|
+
matrix:
|
45
|
+
ruby-version: ['3.0', 3.1, 3.2]
|
46
|
+
|
47
|
+
steps:
|
48
|
+
- uses: actions/checkout@v3
|
49
|
+
- name: Set up Ruby
|
50
|
+
uses: ruby/setup-ruby@v1
|
51
|
+
with:
|
52
|
+
ruby-version: ${{ matrix.ruby-version }}
|
53
|
+
- name: Test
|
54
|
+
run: bundle install && bundle exec rspec
|
data/.gitignore
CHANGED
@@ -1,53 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/_yardoc/
|
4
4
|
/coverage/
|
5
|
-
/
|
5
|
+
/doc/
|
6
6
|
/pkg/
|
7
7
|
/spec/reports/
|
8
|
-
/spec/examples.txt
|
9
|
-
/test/tmp/
|
10
|
-
/test/version_tmp/
|
11
8
|
/tmp/
|
9
|
+
*.DS_Store
|
12
10
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
# Used by dotenv library to load environment variables.
|
17
|
-
# .env
|
18
|
-
|
19
|
-
## Specific to RubyMotion:
|
20
|
-
.dat*
|
21
|
-
.repl_history
|
22
|
-
build/
|
23
|
-
*.bridgesupport
|
24
|
-
build-iPhoneOS/
|
25
|
-
build-iPhoneSimulator/
|
26
|
-
|
27
|
-
## Specific to RubyMotion (use of CocoaPods):
|
28
|
-
#
|
29
|
-
# We recommend against adding the Pods directory to your .gitignore. However
|
30
|
-
# you should judge for yourself, the pros and cons are mentioned at:
|
31
|
-
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
32
|
-
#
|
33
|
-
# vendor/Pods/
|
11
|
+
.rspec_status
|
12
|
+
.ruby-version
|
34
13
|
|
35
|
-
|
36
|
-
/.yardoc/
|
37
|
-
/_yardoc/
|
38
|
-
/doc/
|
39
|
-
/rdoc/
|
40
|
-
|
41
|
-
## Environment normalization:
|
42
|
-
/.bundle/
|
43
|
-
/vendor/bundle
|
44
|
-
/lib/bundler/man/
|
45
|
-
|
46
|
-
# for a library or gem, you might want to ignore these files since the code is
|
47
|
-
# intended to run in multiple environments; otherwise, check them in:
|
48
|
-
# Gemfile.lock
|
49
|
-
# .ruby-version
|
50
|
-
# .ruby-gemset
|
51
|
-
|
52
|
-
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
53
|
-
.rvmrc
|
14
|
+
Gemfile.lock
|
data/.rspec
ADDED
data/.rubocop.yml
CHANGED
@@ -1,17 +1,39 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-performance
|
3
|
+
- rubocop-rspec
|
4
|
+
|
1
5
|
AllCops:
|
6
|
+
NewCops: enable
|
7
|
+
SuggestExtensions: false
|
8
|
+
TargetRubyVersion: 3.0
|
9
|
+
|
10
|
+
# We disable this to allow automatic releases
|
11
|
+
Gemspec/RequireMFA:
|
12
|
+
Enabled: false
|
13
|
+
|
14
|
+
Metrics/AbcSize:
|
15
|
+
Max: 30
|
16
|
+
|
17
|
+
Metrics/ClassLength:
|
18
|
+
CountAsOne: ['array', 'hash', 'heredoc', 'method_call']
|
19
|
+
Max: 100
|
20
|
+
|
21
|
+
Metrics/MethodLength:
|
22
|
+
Max: 30
|
23
|
+
|
24
|
+
RSpec/ExampleLength:
|
25
|
+
CountAsOne: ['array', 'hash', 'heredoc']
|
26
|
+
Max: 10
|
27
|
+
|
28
|
+
RSpec/MultipleMemoizedHelpers:
|
29
|
+
Enabled: false
|
30
|
+
|
31
|
+
RSpec/NestedGroups:
|
32
|
+
Max: 5
|
33
|
+
|
34
|
+
Style/Documentation:
|
35
|
+
Enabled: false
|
36
|
+
|
37
|
+
Style/FrozenStringLiteralComment:
|
2
38
|
Exclude:
|
3
|
-
-
|
4
|
-
- "tmp/**/*"
|
5
|
-
- "vendor/**/*"
|
6
|
-
- "bin/**/*"
|
7
|
-
- "log/**/*"
|
8
|
-
- "public/**/*"
|
9
|
-
TargetRubyVersion: 2.4
|
10
|
-
Layout/LineLength:
|
11
|
-
Enabled: true
|
12
|
-
Max: 120
|
13
|
-
Metrics/BlockLength:
|
14
|
-
Exclude:
|
15
|
-
- 'Rakefile'
|
16
|
-
- '**/*.rake'
|
17
|
-
- 'spec/**/*.rb'
|
39
|
+
- 'bin/**'
|
data/Gemfile
CHANGED
@@ -2,9 +2,19 @@
|
|
2
2
|
|
3
3
|
source 'https://rubygems.org'
|
4
4
|
|
5
|
+
# Specify your gem's dependencies in paypro.gemspec
|
5
6
|
gemspec
|
6
7
|
|
7
8
|
group :development do
|
8
|
-
gem '
|
9
|
-
gem '
|
9
|
+
gem 'debug', '~> 1.8.0'
|
10
|
+
gem 'rake', '~> 12.0'
|
11
|
+
gem 'rspec', '~> 3.0'
|
12
|
+
|
13
|
+
gem 'rubocop', '~> 1.57'
|
14
|
+
gem 'rubocop-performance', '~> 1.19.0'
|
15
|
+
gem 'rubocop-rspec', '~> 2.25.0'
|
16
|
+
|
17
|
+
gem 'timecop', '~> 0.9.8'
|
18
|
+
|
19
|
+
gem 'webmock', '~> 3.19.0'
|
10
20
|
end
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,56 +1,98 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# PayPro Ruby Library
|
2
|
+
|
3
|
+
[![build](https://github.com/paypronl/paypro-ruby/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/paypronl/paypro-ruby/actions/workflows/build.yml)
|
3
4
|
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
|
4
|
-
[![Gem Version](https://badge.fury.io/rb/paypro.svg)](https://badge.fury.io/rb/paypro)
|
5
|
-
[![circleci](https://img.shields.io/circleci/project/github/RedSparr0w/node-csgo-parser.svg)](https://circleci.com/gh/paypronl/paypro-ruby-v1)
|
6
5
|
|
7
|
-
|
6
|
+
The PayPro Ruby library can be used to make integrating with the PayPro API easier when using Ruby.
|
7
|
+
It provides easy to use classes to interact with all resources available through the API.
|
8
|
+
|
9
|
+
It also provides the following:
|
10
|
+
|
11
|
+
- Built-in pagination support
|
12
|
+
- Easy configuration
|
13
|
+
- Webhook request verification helpers
|
8
14
|
|
9
15
|
## Requirements
|
10
16
|
|
11
|
-
|
17
|
+
- Ruby >= 3.0.0
|
12
18
|
|
13
19
|
## Installation
|
14
20
|
|
15
|
-
|
21
|
+
You can install the gem like this:
|
16
22
|
|
17
23
|
```sh
|
18
|
-
|
24
|
+
gem install paypro
|
19
25
|
```
|
20
26
|
|
21
|
-
|
27
|
+
If you'd rather install the gem through `bundler` you can put this in your Gemfile:
|
22
28
|
|
23
29
|
```ruby
|
24
30
|
source 'https://rubygems.org'
|
25
31
|
|
26
32
|
gem 'paypro'
|
33
|
+
|
27
34
|
```
|
28
35
|
|
29
|
-
|
36
|
+
## Getting started
|
37
|
+
|
38
|
+
In order to use the API you need to have a valid API key.
|
39
|
+
You can find your API key in the [PayPro dashboard](https://app.paypro.nl/developers/api-keys)
|
40
|
+
|
41
|
+
Example of using the API:
|
30
42
|
|
31
43
|
```ruby
|
32
|
-
|
44
|
+
require 'paypro'
|
45
|
+
|
46
|
+
client = PayPro::Client.new('pp_...')
|
47
|
+
|
48
|
+
# Creating a payment
|
49
|
+
payment = client.payments.create({ amount: 500, currency: 'EUR', description: 'Test Payment' })
|
50
|
+
|
51
|
+
# Retrieving all subscriptions
|
52
|
+
subscriptions = client.subscriptions.list
|
53
|
+
|
54
|
+
# Retrieving a single customer
|
55
|
+
customer = client.customers.get('CUSSDGDCJVZH5K')
|
56
|
+
|
33
57
|
```
|
34
58
|
|
35
|
-
##
|
59
|
+
## Per-request configuration
|
36
60
|
|
37
|
-
|
61
|
+
When you have multiple API keys to use during a single request, you can specify these in all requests.
|
38
62
|
|
39
63
|
```ruby
|
40
64
|
require 'paypro'
|
41
65
|
|
42
|
-
client = PayPro::Client.new('
|
43
|
-
client.command = 'create_payment';
|
44
|
-
client.params = { amount: 500, consumer_email: 'test@paypro.nl', pay_method: 'ideal/INGBNL2A' }
|
45
|
-
client.execute
|
46
|
-
```
|
66
|
+
client = PayPro::Client.new('pp_...')
|
47
67
|
|
48
|
-
|
68
|
+
# Creating a payment
|
69
|
+
payment = client.payments.create({ amount: 500, currency: 'EUR', description: 'Test Payment' }, api_key: 'pp_...')
|
49
70
|
|
50
|
-
|
71
|
+
# Retrieving five subscriptions
|
72
|
+
subscriptions = client.subscriptions.list({ limit: 5 }, api_key: 'pp_...')
|
73
|
+
|
74
|
+
# Retrieving a single customer
|
75
|
+
customer = client.customers.get('CUSSDGDCJVZH5K', api_key: 'pp_...', api_url: 'https://api-test.paypro.nl')
|
76
|
+
```
|
77
|
+
|
78
|
+
## Development
|
51
79
|
|
52
|
-
## Contributing
|
53
80
|
If you want to contribute to this project you can fork the repository. Create a new branch, add your feature and create a pull request. We will look at your request and determine if we want to add it.
|
54
81
|
|
55
|
-
|
56
|
-
|
82
|
+
To run all the tests:
|
83
|
+
|
84
|
+
```sh
|
85
|
+
bundle exec rspec
|
86
|
+
```
|
87
|
+
|
88
|
+
To run the linter:
|
89
|
+
|
90
|
+
```sh
|
91
|
+
bundle exec rubocop
|
92
|
+
```
|
93
|
+
|
94
|
+
To run an `irb` with the gem already required you can use:
|
95
|
+
|
96
|
+
```sh
|
97
|
+
bin/console
|
98
|
+
```
|
data/Rakefile
CHANGED
data/bin/console
ADDED