pin_up 1.4.2 → 1.4.4
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 +4 -4
- data/.travis.yml +1 -1
- data/Gemfile +14 -2
- data/Gemfile.lock +114 -48
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/lib/pin_up/charge.rb +1 -1
- data/lib/pin_up/pin_errors.rb +5 -0
- data/lib/pin_up/subscription.rb +1 -1
- data/lib/pin_up/transfer.rb +1 -1
- data/pin_up.gemspec +27 -19
- data/spec/bank_accounts_spec.rb +1 -1
- data/spec/cards_spec.rb +1 -1
- data/spec/charges_spec.rb +1 -1
- data/spec/customers_spec.rb +2 -2
- data/spec/errors_spec.rb +5 -25
- data/spec/plan_spec.rb +8 -4
- data/spec/recipients_spec.rb +1 -1
- data/spec/refund_spec.rb +1 -1
- data/spec/spec_helper.rb +4 -1
- data/spec/subscription_spec.rb +24 -21
- data/spec/transfers_spec.rb +2 -2
- data/spec/webhook_endpoints_spec.rb +7 -1
- metadata +71 -28
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1fe1a32870ffc34d85629f81a363474e79a62499f8f5a38e14f96f0b292b6017
|
|
4
|
+
data.tar.gz: e67a6b43dac04ee50e47349792030937ff7b8afa9583a4db4b26779cea21c0a2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d563d8e6c9d69ad1d1bc3e6d07fbfa79b780f087711cf558a10f386de2b222e2d281de650ba3054ab1a0956916c6e5df1b35fa85b13c392c263615dbe10753fb
|
|
7
|
+
data.tar.gz: 58ff548e91c809c51274c1badfde3ad39e5ea63d447a57f0507e1a48a115a6c9565bc8be82c3fba4fac8df52fc72457cc2d6529b98da0c3d3e884aa087af8e84
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
-
source
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
gem 'httparty'
|
|
4
|
+
gem 'rexml'
|
|
5
|
+
|
|
6
|
+
group :development do
|
|
7
|
+
gem 'rake'
|
|
8
|
+
gem 'rdoc'
|
|
9
|
+
gem 'rspec'
|
|
10
|
+
gem 'juwelier', '~> 2.1.0'
|
|
11
|
+
gem 'simplecov'
|
|
12
|
+
gem 'webmock'
|
|
13
|
+
gem 'vcr'
|
|
14
|
+
end
|
|
2
15
|
|
|
3
|
-
gemspec
|
data/Gemfile.lock
CHANGED
|
@@ -1,51 +1,114 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: .
|
|
3
|
-
specs:
|
|
4
|
-
pin_up (1.4.2)
|
|
5
|
-
httparty (= 0.17.0)
|
|
6
|
-
|
|
7
1
|
GEM
|
|
8
2
|
remote: https://rubygems.org/
|
|
9
3
|
specs:
|
|
10
|
-
addressable (2.
|
|
11
|
-
public_suffix (>= 2.0.2, <
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
4
|
+
addressable (2.8.5)
|
|
5
|
+
public_suffix (>= 2.0.2, < 6.0)
|
|
6
|
+
builder (3.2.4)
|
|
7
|
+
crack (0.4.5)
|
|
8
|
+
rexml
|
|
9
|
+
descendants_tracker (0.0.4)
|
|
10
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
|
11
|
+
diff-lcs (1.5.0)
|
|
12
|
+
docile (1.4.0)
|
|
13
|
+
faraday (1.10.3)
|
|
14
|
+
faraday-em_http (~> 1.0)
|
|
15
|
+
faraday-em_synchrony (~> 1.0)
|
|
16
|
+
faraday-excon (~> 1.1)
|
|
17
|
+
faraday-httpclient (~> 1.0)
|
|
18
|
+
faraday-multipart (~> 1.0)
|
|
19
|
+
faraday-net_http (~> 1.0)
|
|
20
|
+
faraday-net_http_persistent (~> 1.0)
|
|
21
|
+
faraday-patron (~> 1.0)
|
|
22
|
+
faraday-rack (~> 1.0)
|
|
23
|
+
faraday-retry (~> 1.0)
|
|
24
|
+
ruby2_keywords (>= 0.0.4)
|
|
25
|
+
faraday-em_http (1.0.0)
|
|
26
|
+
faraday-em_synchrony (1.0.0)
|
|
27
|
+
faraday-excon (1.1.0)
|
|
28
|
+
faraday-httpclient (1.0.1)
|
|
29
|
+
faraday-multipart (1.0.4)
|
|
30
|
+
multipart-post (~> 2)
|
|
31
|
+
faraday-net_http (1.0.1)
|
|
32
|
+
faraday-net_http_persistent (1.2.0)
|
|
33
|
+
faraday-patron (1.0.0)
|
|
34
|
+
faraday-rack (1.0.0)
|
|
35
|
+
faraday-retry (1.0.3)
|
|
36
|
+
git (1.18.0)
|
|
37
|
+
addressable (~> 2.8)
|
|
38
|
+
rchardet (~> 1.8)
|
|
39
|
+
github_api (0.19.0)
|
|
40
|
+
addressable (~> 2.4)
|
|
41
|
+
descendants_tracker (~> 0.0.4)
|
|
42
|
+
faraday (>= 0.8, < 2)
|
|
43
|
+
hashie (~> 3.5, >= 3.5.2)
|
|
44
|
+
oauth2 (~> 1.0)
|
|
45
|
+
hashdiff (1.0.1)
|
|
46
|
+
hashie (3.6.0)
|
|
47
|
+
highline (2.1.0)
|
|
48
|
+
httparty (0.21.0)
|
|
49
|
+
mini_mime (>= 1.0.0)
|
|
18
50
|
multi_xml (>= 0.5.2)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
51
|
+
juwelier (2.1.3)
|
|
52
|
+
builder
|
|
53
|
+
bundler (>= 1.13)
|
|
54
|
+
git (>= 1.2.5)
|
|
55
|
+
github_api
|
|
56
|
+
highline (>= 1.6.15)
|
|
57
|
+
nokogiri (>= 1.5.10)
|
|
58
|
+
rake
|
|
59
|
+
rdoc
|
|
60
|
+
semver
|
|
61
|
+
jwt (2.7.1)
|
|
62
|
+
mini_mime (1.1.5)
|
|
63
|
+
mini_portile2 (2.8.5)
|
|
64
|
+
multi_json (1.15.0)
|
|
24
65
|
multi_xml (0.6.0)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
66
|
+
multipart-post (2.3.0)
|
|
67
|
+
nokogiri (1.15.4)
|
|
68
|
+
mini_portile2 (~> 2.8.2)
|
|
69
|
+
racc (~> 1.4)
|
|
70
|
+
oauth2 (1.4.11)
|
|
71
|
+
faraday (>= 0.17.3, < 3.0)
|
|
72
|
+
jwt (>= 1.0, < 3.0)
|
|
73
|
+
multi_json (~> 1.3)
|
|
74
|
+
multi_xml (~> 0.5)
|
|
75
|
+
rack (>= 1.2, < 4)
|
|
76
|
+
psych (5.1.1.1)
|
|
77
|
+
stringio
|
|
78
|
+
public_suffix (5.0.3)
|
|
79
|
+
racc (1.7.3)
|
|
80
|
+
rack (3.0.8)
|
|
81
|
+
rake (13.1.0)
|
|
82
|
+
rchardet (1.8.0)
|
|
83
|
+
rdoc (6.6.0)
|
|
84
|
+
psych (>= 4.0.0)
|
|
85
|
+
rexml (3.2.6)
|
|
86
|
+
rspec (3.12.0)
|
|
87
|
+
rspec-core (~> 3.12.0)
|
|
88
|
+
rspec-expectations (~> 3.12.0)
|
|
89
|
+
rspec-mocks (~> 3.12.0)
|
|
90
|
+
rspec-core (3.12.2)
|
|
91
|
+
rspec-support (~> 3.12.0)
|
|
92
|
+
rspec-expectations (3.12.3)
|
|
35
93
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
36
|
-
rspec-support (~> 3.
|
|
37
|
-
rspec-mocks (3.
|
|
94
|
+
rspec-support (~> 3.12.0)
|
|
95
|
+
rspec-mocks (3.12.6)
|
|
38
96
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
39
|
-
rspec-support (~> 3.
|
|
40
|
-
rspec-support (3.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
97
|
+
rspec-support (~> 3.12.0)
|
|
98
|
+
rspec-support (3.12.1)
|
|
99
|
+
ruby2_keywords (0.0.5)
|
|
100
|
+
semver (1.0.1)
|
|
101
|
+
simplecov (0.22.0)
|
|
102
|
+
docile (~> 1.1)
|
|
103
|
+
simplecov-html (~> 0.11)
|
|
104
|
+
simplecov_json_formatter (~> 0.1)
|
|
105
|
+
simplecov-html (0.12.3)
|
|
106
|
+
simplecov_json_formatter (0.1.4)
|
|
107
|
+
stringio (3.0.9)
|
|
108
|
+
thread_safe (0.3.6)
|
|
109
|
+
vcr (6.2.0)
|
|
110
|
+
webmock (3.19.1)
|
|
111
|
+
addressable (>= 2.8.0)
|
|
49
112
|
crack (>= 0.3.2)
|
|
50
113
|
hashdiff (>= 0.4.0, < 2.0.0)
|
|
51
114
|
|
|
@@ -53,12 +116,15 @@ PLATFORMS
|
|
|
53
116
|
ruby
|
|
54
117
|
|
|
55
118
|
DEPENDENCIES
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
119
|
+
httparty
|
|
120
|
+
juwelier (~> 2.1.0)
|
|
121
|
+
rake
|
|
122
|
+
rdoc
|
|
123
|
+
rexml
|
|
124
|
+
rspec
|
|
125
|
+
simplecov
|
|
126
|
+
vcr
|
|
127
|
+
webmock
|
|
62
128
|
|
|
63
129
|
BUNDLED WITH
|
|
64
|
-
|
|
130
|
+
2.4.14
|
data/Rakefile
CHANGED
|
@@ -11,8 +11,8 @@ rescue Bundler::BundlerError => e
|
|
|
11
11
|
end
|
|
12
12
|
require 'rake'
|
|
13
13
|
|
|
14
|
-
require '
|
|
15
|
-
|
|
14
|
+
require 'juwelier'
|
|
15
|
+
Juwelier::Tasks.new do |gem|
|
|
16
16
|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
|
17
17
|
gem.name = "pin_up"
|
|
18
18
|
gem.homepage = "http://github.com/dNitza/pin_up"
|
|
@@ -24,7 +24,7 @@ Jeweler::Tasks.new do |gem|
|
|
|
24
24
|
# dependencies defined in Gemfile
|
|
25
25
|
gem.files.exclude(Dir.glob('spec/vcr/*.yml'))
|
|
26
26
|
end
|
|
27
|
-
|
|
27
|
+
Juwelier::RubygemsDotOrgTasks.new
|
|
28
28
|
|
|
29
29
|
require 'rake/testtask'
|
|
30
30
|
Rake::TestTask.new(:test) do |test|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.4.
|
|
1
|
+
1.4.4
|
data/lib/pin_up/charge.rb
CHANGED
|
@@ -37,7 +37,7 @@ module Pin
|
|
|
37
37
|
options.merge! page: page if page
|
|
38
38
|
|
|
39
39
|
options.each do |key, option|
|
|
40
|
-
term += "#{key.to_s}=#{
|
|
40
|
+
term += "#{key.to_s}=#{CGI.escape(option.to_s)}&"
|
|
41
41
|
end
|
|
42
42
|
build_collection_response(make_request(:get, {url: "charges/search?#{term}" } ), pagination)
|
|
43
43
|
end
|
data/lib/pin_up/pin_errors.rb
CHANGED
|
@@ -36,6 +36,8 @@ module Pin
|
|
|
36
36
|
when 422
|
|
37
37
|
message = handle_bad_response(response)
|
|
38
38
|
raise Pin::InvalidResource.new(response, message)
|
|
39
|
+
else
|
|
40
|
+
raise Pin::Unknown.new(response, "Unknown error with status code #{http_status}")
|
|
39
41
|
end
|
|
40
42
|
end
|
|
41
43
|
|
|
@@ -72,6 +74,9 @@ module Pin
|
|
|
72
74
|
end
|
|
73
75
|
end
|
|
74
76
|
|
|
77
|
+
class Unknown < SimpleError
|
|
78
|
+
end
|
|
79
|
+
|
|
75
80
|
class Unauthorized < SimpleError
|
|
76
81
|
end
|
|
77
82
|
|
data/lib/pin_up/subscription.rb
CHANGED
|
@@ -38,7 +38,7 @@ module Pin
|
|
|
38
38
|
# and any of: email, card (hash),card_token
|
|
39
39
|
# args: token (String), options (Hash)
|
|
40
40
|
# returns: a subscription object
|
|
41
|
-
# https://
|
|
41
|
+
# https://pinpayments.com/developers/api-reference/subscriptions#put-subscription
|
|
42
42
|
# NB: When providing a card (hash), you need to specify
|
|
43
43
|
# the full list of details.
|
|
44
44
|
def self.update(token, card_token = nil)
|
data/lib/pin_up/transfer.rb
CHANGED
|
@@ -44,7 +44,7 @@ module Pin
|
|
|
44
44
|
options.merge! page: page if page
|
|
45
45
|
|
|
46
46
|
options.each do |key, option|
|
|
47
|
-
term += "#{key.to_s}=#{
|
|
47
|
+
term += "#{key.to_s}=#{CGI.escape(option.to_s)}&"
|
|
48
48
|
end
|
|
49
49
|
build_collection_response(make_request(:get, {url: "transfers/search?#{term}" } ), pagination)
|
|
50
50
|
end
|
data/pin_up.gemspec
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
# Generated by
|
|
1
|
+
# Generated by juwelier
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
|
-
# Instead, edit
|
|
3
|
+
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
|
5
|
-
# stub: pin_up 1.4.
|
|
5
|
+
# stub: pin_up 1.4.4 ruby lib
|
|
6
6
|
|
|
7
7
|
Gem::Specification.new do |s|
|
|
8
8
|
s.name = "pin_up".freeze
|
|
9
|
-
s.version = "1.4.
|
|
9
|
+
s.version = "1.4.4"
|
|
10
10
|
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
|
12
12
|
s.require_paths = ["lib".freeze]
|
|
13
13
|
s.authors = ["Daniel Nitsikopoulos".freeze]
|
|
14
|
-
s.date = "
|
|
14
|
+
s.date = "2023-11-16"
|
|
15
15
|
s.description = "A Ruby gem wrapper for the pin-payments (pinpayments.com) API".freeze
|
|
16
16
|
s.email = "dnitza@gmail.com".freeze
|
|
17
17
|
s.extra_rdoc_files = [
|
|
18
|
+
"CHANGELOG.md",
|
|
18
19
|
"LICENSE.txt",
|
|
19
20
|
"README.md"
|
|
20
21
|
]
|
|
@@ -64,26 +65,33 @@ Gem::Specification.new do |s|
|
|
|
64
65
|
]
|
|
65
66
|
s.homepage = "http://github.com/dNitza/pin_up".freeze
|
|
66
67
|
s.licenses = ["MIT".freeze]
|
|
67
|
-
s.rubygems_version = "2.
|
|
68
|
+
s.rubygems_version = "3.2.22".freeze
|
|
68
69
|
s.summary = "A Ruby gem wrapper for the pin-payments API".freeze
|
|
69
70
|
|
|
70
71
|
if s.respond_to? :specification_version then
|
|
71
72
|
s.specification_version = 4
|
|
73
|
+
end
|
|
72
74
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
end
|
|
75
|
+
if s.respond_to? :add_runtime_dependency then
|
|
76
|
+
s.add_runtime_dependency(%q<httparty>.freeze, [">= 0"])
|
|
77
|
+
s.add_runtime_dependency(%q<rexml>.freeze, [">= 0"])
|
|
78
|
+
s.add_development_dependency(%q<rake>.freeze, [">= 0"])
|
|
79
|
+
s.add_development_dependency(%q<rdoc>.freeze, [">= 0"])
|
|
80
|
+
s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
|
|
81
|
+
s.add_development_dependency(%q<juwelier>.freeze, ["~> 2.1.0"])
|
|
82
|
+
s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
|
|
83
|
+
s.add_development_dependency(%q<webmock>.freeze, [">= 0"])
|
|
84
|
+
s.add_development_dependency(%q<vcr>.freeze, [">= 0"])
|
|
84
85
|
else
|
|
85
|
-
s.add_dependency(%q<httparty>.freeze, ["
|
|
86
|
-
s.add_dependency(%q<
|
|
86
|
+
s.add_dependency(%q<httparty>.freeze, [">= 0"])
|
|
87
|
+
s.add_dependency(%q<rexml>.freeze, [">= 0"])
|
|
88
|
+
s.add_dependency(%q<rake>.freeze, [">= 0"])
|
|
89
|
+
s.add_dependency(%q<rdoc>.freeze, [">= 0"])
|
|
90
|
+
s.add_dependency(%q<rspec>.freeze, [">= 0"])
|
|
91
|
+
s.add_dependency(%q<juwelier>.freeze, ["~> 2.1.0"])
|
|
92
|
+
s.add_dependency(%q<simplecov>.freeze, [">= 0"])
|
|
93
|
+
s.add_dependency(%q<webmock>.freeze, [">= 0"])
|
|
94
|
+
s.add_dependency(%q<vcr>.freeze, [">= 0"])
|
|
87
95
|
end
|
|
88
96
|
end
|
|
89
97
|
|
data/spec/bank_accounts_spec.rb
CHANGED
|
@@ -6,7 +6,7 @@ describe Pin::BankAccounts, :vcr do
|
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
it 'creates a bank account token and returns its details' do
|
|
9
|
-
options = { name: 'Roland Robot', bsb: '
|
|
9
|
+
options = { name: 'Roland Robot', bsb: '012984', number: '987654321' }
|
|
10
10
|
expect(Pin::BankAccounts.create(options)['token']).to match(/^[a-z]{2}[_]/)
|
|
11
11
|
end
|
|
12
12
|
end
|
data/spec/cards_spec.rb
CHANGED
data/spec/charges_spec.rb
CHANGED
data/spec/customers_spec.rb
CHANGED
|
@@ -4,7 +4,7 @@ describe 'Customer', :vcr, class: Pin::Customer do
|
|
|
4
4
|
let(:card_1) {
|
|
5
5
|
{ number: '5520000000000000',
|
|
6
6
|
expiry_month: '12',
|
|
7
|
-
expiry_year:
|
|
7
|
+
expiry_year: Date.today.next_year.year.to_s,
|
|
8
8
|
cvc: '123',
|
|
9
9
|
name: 'Roland Robot',
|
|
10
10
|
address_line1: '123 Fake Street',
|
|
@@ -17,7 +17,7 @@ describe 'Customer', :vcr, class: Pin::Customer do
|
|
|
17
17
|
let(:card_2) {
|
|
18
18
|
{ number: '4200000000000000',
|
|
19
19
|
expiry_month: '12',
|
|
20
|
-
expiry_year:
|
|
20
|
+
expiry_year: Date.today.next_year.year.to_s,
|
|
21
21
|
cvc: '111',
|
|
22
22
|
name: 'Roland TestRobot',
|
|
23
23
|
address_line1: '123 Fake Road',
|
data/spec/errors_spec.rb
CHANGED
|
@@ -4,7 +4,7 @@ describe 'Errors', :vcr, class: Pin::PinError do
|
|
|
4
4
|
let(:card_1) {
|
|
5
5
|
{ number: '5520000000000000',
|
|
6
6
|
expiry_month: '12',
|
|
7
|
-
expiry_year:
|
|
7
|
+
expiry_year: Date.today.next_year.year.to_s,
|
|
8
8
|
cvc: '123',
|
|
9
9
|
name: 'Roland Robot',
|
|
10
10
|
address_line1: '123 Fake Street',
|
|
@@ -17,7 +17,7 @@ describe 'Errors', :vcr, class: Pin::PinError do
|
|
|
17
17
|
let(:card_2) {
|
|
18
18
|
{ number: '4200000000000000',
|
|
19
19
|
expiry_month: '12',
|
|
20
|
-
expiry_year:
|
|
20
|
+
expiry_year: Date.today.next_year.year.to_s,
|
|
21
21
|
cvc: '111',
|
|
22
22
|
name: 'Roland TestRobot',
|
|
23
23
|
address_line1: '123 Fake Road',
|
|
@@ -36,26 +36,6 @@ describe 'Errors', :vcr, class: Pin::PinError do
|
|
|
36
36
|
Pin::Customer.create('email@example.com', card_1)['token']
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
let(:charge_hash) {
|
|
40
|
-
{ email: 'email@example.com',
|
|
41
|
-
description: 'A new charge from testing Pin gem',
|
|
42
|
-
amount: '400',
|
|
43
|
-
currency: 'AUD',
|
|
44
|
-
ip_address: '127.0.0.1',
|
|
45
|
-
card: {
|
|
46
|
-
number: '5520000000000000',
|
|
47
|
-
expiry_month: '05',
|
|
48
|
-
expiry_year: '2012',
|
|
49
|
-
cvc: '123',
|
|
50
|
-
name: 'Roland Robot',
|
|
51
|
-
address_line1: '42 Sevenoaks St',
|
|
52
|
-
address_city: 'Lathlain',
|
|
53
|
-
address_postcode: '6454',
|
|
54
|
-
address_state: 'WA',
|
|
55
|
-
address_country: 'Australia'
|
|
56
|
-
} }
|
|
57
|
-
}
|
|
58
|
-
|
|
59
39
|
let(:hash_of_details) {
|
|
60
40
|
{ email: 'email@example.com',
|
|
61
41
|
description: 'A new charge from testing Pin gem',
|
|
@@ -65,7 +45,7 @@ describe 'Errors', :vcr, class: Pin::PinError do
|
|
|
65
45
|
card: {
|
|
66
46
|
number: '5560000000000001',
|
|
67
47
|
expiry_month: '12',
|
|
68
|
-
expiry_year:
|
|
48
|
+
expiry_year: Date.today.next_year.year.to_s,
|
|
69
49
|
cvc: '123',
|
|
70
50
|
name: 'Roland Robot',
|
|
71
51
|
address_line1: '42 Sevenoaks St',
|
|
@@ -335,11 +315,11 @@ describe 'Errors', :vcr, class: Pin::PinError do
|
|
|
335
315
|
end
|
|
336
316
|
end
|
|
337
317
|
|
|
338
|
-
it 'should raise a
|
|
318
|
+
it 'should raise a 422 invalid state when deleting a cancelled subscription' do
|
|
339
319
|
deleted_subscription_token = Pin::Subscription.delete(subscription_1_token)['token']
|
|
340
320
|
expect { Pin::Subscription.delete(deleted_subscription_token) }.to raise_error do |error|
|
|
341
321
|
expect(error).to be_a Pin::InvalidResource
|
|
342
|
-
expect(error.message).to eq 'Cannot cancel subscription when state is
|
|
322
|
+
expect(error.message).to eq 'invalid_request: Cannot cancel subscription when state is cancelling'
|
|
343
323
|
expect(error.response).to be_a Hash
|
|
344
324
|
end
|
|
345
325
|
end
|
data/spec/plan_spec.rb
CHANGED
|
@@ -35,7 +35,7 @@ describe 'Plan', :vcr, class: Pin::Plan do
|
|
|
35
35
|
let(:card_1) {
|
|
36
36
|
{ number: '5520000000000000',
|
|
37
37
|
expiry_month: '12',
|
|
38
|
-
expiry_year:
|
|
38
|
+
expiry_year: Date.today.next_year.year.to_s,
|
|
39
39
|
cvc: '123',
|
|
40
40
|
name: 'Roland Robot',
|
|
41
41
|
address_line1: '123 Fake Street',
|
|
@@ -48,7 +48,7 @@ describe 'Plan', :vcr, class: Pin::Plan do
|
|
|
48
48
|
let(:card_2) {
|
|
49
49
|
{ number: '4200000000000000',
|
|
50
50
|
expiry_month: '12',
|
|
51
|
-
expiry_year:
|
|
51
|
+
expiry_year: Date.today.next_year.year.to_s,
|
|
52
52
|
cvc: '111',
|
|
53
53
|
name: 'Roland TestRobot',
|
|
54
54
|
address_line1: '123 Fake Road',
|
|
@@ -114,8 +114,12 @@ describe 'Plan', :vcr, class: Pin::Plan do
|
|
|
114
114
|
"created_at"=>match(/\d/),
|
|
115
115
|
"customer_permissions"=>["cancel"],
|
|
116
116
|
"token"=>match(/(plan)[_]([\w-]{22})/),
|
|
117
|
-
"
|
|
118
|
-
|
|
117
|
+
"subscription_counts" => {
|
|
118
|
+
"trial"=>0,
|
|
119
|
+
"active"=>0,
|
|
120
|
+
"cancelling"=>0,
|
|
121
|
+
"cancelled"=>0
|
|
122
|
+
})
|
|
119
123
|
end
|
|
120
124
|
|
|
121
125
|
it 'should return a paginated list of all plans' do
|
data/spec/recipients_spec.rb
CHANGED
data/spec/refund_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
|
@@ -25,7 +25,7 @@ RSpec.configure do |config|
|
|
|
25
25
|
.gsub(/[^\w\/]+/, '_')
|
|
26
26
|
valid_keys = %w[record match_on_requests_on]
|
|
27
27
|
options = example.metadata.select { |key,_| valid_keys.include? key }
|
|
28
|
-
VCR.use_cassette(name, record: :
|
|
28
|
+
VCR.use_cassette(name, record: :once) { example.call }
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
|
|
@@ -33,4 +33,7 @@ VCR.configure do |c|
|
|
|
33
33
|
c.cassette_library_dir = 'spec/vcr'
|
|
34
34
|
c.hook_into :webmock
|
|
35
35
|
c.allow_http_connections_when_no_cassette = true
|
|
36
|
+
|
|
37
|
+
c.filter_sensitive_data('PIN_SECRET') { ENV['PIN_SECRET'] }
|
|
38
|
+
c.filter_sensitive_data('PIN_SECRET_BASIC_AUTH') { Base64.strict_encode64(ENV['PIN_SECRET'].to_s + ':') }
|
|
36
39
|
end
|
data/spec/subscription_spec.rb
CHANGED
|
@@ -35,7 +35,7 @@ describe 'Subscription', :vcr, class: Pin::Subscription do
|
|
|
35
35
|
let(:card_1) {
|
|
36
36
|
{ number: '5520000000000000',
|
|
37
37
|
expiry_month: '12',
|
|
38
|
-
expiry_year:
|
|
38
|
+
expiry_year: Date.today.next_year.year.to_s,
|
|
39
39
|
cvc: '123',
|
|
40
40
|
name: 'Roland Robot',
|
|
41
41
|
address_line1: '123 Fake Street',
|
|
@@ -48,7 +48,7 @@ describe 'Subscription', :vcr, class: Pin::Subscription do
|
|
|
48
48
|
let(:card_2) {
|
|
49
49
|
{ number: '4200000000000000',
|
|
50
50
|
expiry_month: '12',
|
|
51
|
-
expiry_year:
|
|
51
|
+
expiry_year: Date.today.next_year.year.to_s,
|
|
52
52
|
cvc: '111',
|
|
53
53
|
name: 'Roland TestRobot',
|
|
54
54
|
address_line1: '123 Fake Road',
|
|
@@ -173,27 +173,30 @@ describe 'Subscription', :vcr, class: Pin::Subscription do
|
|
|
173
173
|
expect(Pin::Subscription.reactivate(deactivated['token'])['state']).to eq('active')
|
|
174
174
|
end
|
|
175
175
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
end
|
|
176
|
+
## History no longer exists as an endpoint
|
|
177
|
+
## Leaving this in for reference
|
|
179
178
|
|
|
180
|
-
it 'should
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
end
|
|
179
|
+
# it 'should fetch history for a subscription given a token' do
|
|
180
|
+
# expect(Pin::Subscription.history(subscription_2_token)).to_not eq []
|
|
181
|
+
# end
|
|
184
182
|
|
|
185
|
-
it 'should
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
end
|
|
183
|
+
# it 'should go to a specific page when page parameter is passed' do
|
|
184
|
+
# request = Pin::Subscription.history(subscription_2_token, 20, true)
|
|
185
|
+
# expect(request[:pagination]['current']).to eq 20
|
|
186
|
+
# end
|
|
189
187
|
|
|
190
|
-
it 'should
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
end
|
|
188
|
+
# it 'should list subscriptions on a page given a page' do
|
|
189
|
+
# request = Pin::Subscription.history(subscription_2_token, 1, true)
|
|
190
|
+
# expect(request[:response]).to_not eq []
|
|
191
|
+
# end
|
|
194
192
|
|
|
195
|
-
it 'should
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
end
|
|
193
|
+
# it 'should return pagination if true is passed for pagination' do
|
|
194
|
+
# request = Pin::Subscription.history(subscription_2_token, 1, true)
|
|
195
|
+
# request[:pagination].key?(%W('current previous next per_page pages count))
|
|
196
|
+
# end
|
|
197
|
+
|
|
198
|
+
# it 'should not list subscriptions for a given page if there are no subscriptions' do
|
|
199
|
+
# request = Pin::Subscription.history(subscription_2_token, 25, true)
|
|
200
|
+
# expect(request[:response]).to eq []
|
|
201
|
+
# end
|
|
199
202
|
end
|
data/spec/transfers_spec.rb
CHANGED
|
@@ -5,7 +5,7 @@ describe Pin::Transfer, :vcr do
|
|
|
5
5
|
{ email: 'test@example.com',
|
|
6
6
|
name: 'Roland Robot',
|
|
7
7
|
bank_account: { name: 'Roland Robot',
|
|
8
|
-
bsb: '
|
|
8
|
+
bsb: '012984',
|
|
9
9
|
number: 987654321 } }
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -55,5 +55,5 @@ describe Pin::Transfer, :vcr do
|
|
|
55
55
|
|
|
56
56
|
it 'should list transfers for search on a page given a page' do
|
|
57
57
|
expect(Pin::Transfer.search(1, query: 'Pay day')).to_not eq []
|
|
58
|
-
end
|
|
58
|
+
end
|
|
59
59
|
end
|
|
@@ -2,8 +2,12 @@ require 'spec_helper'
|
|
|
2
2
|
require 'securerandom'
|
|
3
3
|
|
|
4
4
|
RSpec.describe 'WebhookEndpoints', :vcr, class: Pin::WebhookEndpoints do
|
|
5
|
+
let(:create_endpoint) {
|
|
6
|
+
Pin::WebhookEndpoints.create(url: "http://example.com/webhooks#{SecureRandom.urlsafe_base64}/")
|
|
7
|
+
}
|
|
8
|
+
|
|
5
9
|
let(:token) {
|
|
6
|
-
|
|
10
|
+
create_endpoint['token']
|
|
7
11
|
}
|
|
8
12
|
|
|
9
13
|
before(:each) do
|
|
@@ -16,11 +20,13 @@ RSpec.describe 'WebhookEndpoints', :vcr, class: Pin::WebhookEndpoints do
|
|
|
16
20
|
end
|
|
17
21
|
|
|
18
22
|
it 'should list webhook endpoints' do
|
|
23
|
+
create_endpoint
|
|
19
24
|
expect(Pin::WebhookEndpoints.all).to_not eq []
|
|
20
25
|
Pin::WebhookEndpoints.delete(token) # since we are only allowed 5 or so sandbox webhooks
|
|
21
26
|
end
|
|
22
27
|
|
|
23
28
|
it 'should list webhook endpoint on a page given a page' do
|
|
29
|
+
create_endpoint
|
|
24
30
|
request = Pin::WebhookEndpoints.all(1, true)
|
|
25
31
|
expect(request[:response]).to_not eq []
|
|
26
32
|
Pin::WebhookEndpoints.delete(token) # since we are only allowed 5 or so sandbox webhooks
|
metadata
CHANGED
|
@@ -1,104 +1,147 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pin_up
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.4.
|
|
4
|
+
version: 1.4.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel Nitsikopoulos
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-11-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: httparty
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- -
|
|
17
|
+
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0
|
|
19
|
+
version: '0'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- -
|
|
24
|
+
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 0
|
|
26
|
+
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rexml
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rake
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
27
55
|
- !ruby/object:Gem::Dependency
|
|
28
56
|
name: rdoc
|
|
29
57
|
requirement: !ruby/object:Gem::Requirement
|
|
30
58
|
requirements:
|
|
31
|
-
- - "
|
|
59
|
+
- - ">="
|
|
32
60
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
61
|
+
version: '0'
|
|
34
62
|
type: :development
|
|
35
63
|
prerelease: false
|
|
36
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
65
|
requirements:
|
|
38
|
-
- - "
|
|
66
|
+
- - ">="
|
|
39
67
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '
|
|
68
|
+
version: '0'
|
|
41
69
|
- !ruby/object:Gem::Dependency
|
|
42
70
|
name: rspec
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: juwelier
|
|
43
85
|
requirement: !ruby/object:Gem::Requirement
|
|
44
86
|
requirements:
|
|
45
87
|
- - "~>"
|
|
46
88
|
- !ruby/object:Gem::Version
|
|
47
|
-
version:
|
|
89
|
+
version: 2.1.0
|
|
48
90
|
type: :development
|
|
49
91
|
prerelease: false
|
|
50
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
93
|
requirements:
|
|
52
94
|
- - "~>"
|
|
53
95
|
- !ruby/object:Gem::Version
|
|
54
|
-
version:
|
|
96
|
+
version: 2.1.0
|
|
55
97
|
- !ruby/object:Gem::Dependency
|
|
56
98
|
name: simplecov
|
|
57
99
|
requirement: !ruby/object:Gem::Requirement
|
|
58
100
|
requirements:
|
|
59
|
-
- - "
|
|
101
|
+
- - ">="
|
|
60
102
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: 0
|
|
103
|
+
version: '0'
|
|
62
104
|
type: :development
|
|
63
105
|
prerelease: false
|
|
64
106
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
107
|
requirements:
|
|
66
|
-
- - "
|
|
108
|
+
- - ">="
|
|
67
109
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: 0
|
|
110
|
+
version: '0'
|
|
69
111
|
- !ruby/object:Gem::Dependency
|
|
70
112
|
name: webmock
|
|
71
113
|
requirement: !ruby/object:Gem::Requirement
|
|
72
114
|
requirements:
|
|
73
|
-
- - "
|
|
115
|
+
- - ">="
|
|
74
116
|
- !ruby/object:Gem::Version
|
|
75
|
-
version:
|
|
117
|
+
version: '0'
|
|
76
118
|
type: :development
|
|
77
119
|
prerelease: false
|
|
78
120
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
121
|
requirements:
|
|
80
|
-
- - "
|
|
122
|
+
- - ">="
|
|
81
123
|
- !ruby/object:Gem::Version
|
|
82
|
-
version:
|
|
124
|
+
version: '0'
|
|
83
125
|
- !ruby/object:Gem::Dependency
|
|
84
126
|
name: vcr
|
|
85
127
|
requirement: !ruby/object:Gem::Requirement
|
|
86
128
|
requirements:
|
|
87
|
-
- - "
|
|
129
|
+
- - ">="
|
|
88
130
|
- !ruby/object:Gem::Version
|
|
89
|
-
version:
|
|
131
|
+
version: '0'
|
|
90
132
|
type: :development
|
|
91
133
|
prerelease: false
|
|
92
134
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
135
|
requirements:
|
|
94
|
-
- - "
|
|
136
|
+
- - ">="
|
|
95
137
|
- !ruby/object:Gem::Version
|
|
96
|
-
version:
|
|
138
|
+
version: '0'
|
|
97
139
|
description: A Ruby gem wrapper for the pin-payments (pinpayments.com) API
|
|
98
140
|
email: dnitza@gmail.com
|
|
99
141
|
executables: []
|
|
100
142
|
extensions: []
|
|
101
143
|
extra_rdoc_files:
|
|
144
|
+
- CHANGELOG.md
|
|
102
145
|
- LICENSE.txt
|
|
103
146
|
- README.md
|
|
104
147
|
files:
|
|
@@ -148,7 +191,7 @@ homepage: http://github.com/dNitza/pin_up
|
|
|
148
191
|
licenses:
|
|
149
192
|
- MIT
|
|
150
193
|
metadata: {}
|
|
151
|
-
post_install_message:
|
|
194
|
+
post_install_message:
|
|
152
195
|
rdoc_options: []
|
|
153
196
|
require_paths:
|
|
154
197
|
- lib
|
|
@@ -163,8 +206,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
163
206
|
- !ruby/object:Gem::Version
|
|
164
207
|
version: '0'
|
|
165
208
|
requirements: []
|
|
166
|
-
rubygems_version: 3.
|
|
167
|
-
signing_key:
|
|
209
|
+
rubygems_version: 3.2.22
|
|
210
|
+
signing_key:
|
|
168
211
|
specification_version: 4
|
|
169
212
|
summary: A Ruby gem wrapper for the pin-payments API
|
|
170
213
|
test_files: []
|