pin_up 1.3.4 → 1.4.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 +5 -5
- data/.travis.yml +2 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +4 -9
- data/Gemfile.lock +74 -99
- data/README.md +155 -11
- data/VERSION +1 -1
- data/lib/pin_up.rb +3 -0
- data/lib/pin_up/pin_errors.rb +6 -0
- data/lib/pin_up/plan.rb +79 -0
- data/lib/pin_up/subscription.rb +80 -0
- data/lib/pin_up/webhook_endpoints.rb +45 -0
- data/pin_up.gemspec +48 -44
- data/spec/cards_spec.rb +14 -2
- data/spec/charges_spec.rb +57 -13
- data/spec/customers_spec.rb +52 -23
- data/spec/errors_spec.rb +294 -61
- data/spec/plan_spec.rb +189 -0
- data/spec/recipients_spec.rb +14 -9
- data/spec/refund_spec.rb +42 -8
- data/spec/spec_helper.rb +3 -4
- data/spec/subscription_spec.rb +201 -0
- data/spec/transfers_spec.rb +23 -17
- data/spec/webhook_endpoints_spec.rb +36 -0
- metadata +20 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1dadaa5a3ca76c61d6b86c888136f7df5ed353ff268c30174d94c63e7b3c3229
|
4
|
+
data.tar.gz: 4a9562a6650e9573751fe9111bdb1db9f5a20a42651e7129dae2a944fa45e296
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9dcc1e35755e241979202e1d693031fcd5f341059f3936e7951ffabc61e8596d2d6590ac59da4fdbcd6e2fe957ae361389688f2a7e07a32c83c3328900459ca5
|
7
|
+
data.tar.gz: 1d0a1855470803206375f525331c20c52b5ecf441e3251895498180d255c2af7d29b1d04ac025940f4cd56ca582a426f1107c0cb237123e2c2ffc8a75fa8c8d4
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
ADDED
data/Gemfile
CHANGED
@@ -1,19 +1,14 @@
|
|
1
|
-
source "
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
3
|
gem "httparty", ">= 0.11.0"
|
4
4
|
|
5
5
|
group :development do
|
6
|
-
gem "shoulda", "~> 3.5"
|
7
6
|
gem "rdoc", "~> 3.12"
|
8
7
|
gem "rspec" #, "~> 2.13"
|
9
|
-
gem "jeweler", "~> 2.
|
8
|
+
gem "jeweler", "~> 2.3.9"
|
10
9
|
gem "simplecov", "~> 0.7.1"
|
11
|
-
gem "webmock"
|
12
|
-
gem "vcr"
|
10
|
+
gem "webmock"#, "~> 1.12.3"
|
11
|
+
gem "vcr"#, "~> 2.5.0"
|
13
12
|
gem "guard-rspec" #, "~> 3.0.2"
|
14
13
|
gem "terminal-notifier-guard", "~> 1.5.3"
|
15
14
|
end
|
16
|
-
|
17
|
-
group :test do
|
18
|
-
gem "codeclimate-test-reporter", require: nil
|
19
|
-
end
|
data/Gemfile.lock
CHANGED
@@ -1,160 +1,135 @@
|
|
1
1
|
GEM
|
2
|
-
remote:
|
2
|
+
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
9
|
-
tzinfo (~> 1.1)
|
10
|
-
addressable (2.3.8)
|
11
|
-
builder (3.2.2)
|
12
|
-
celluloid (0.16.0)
|
13
|
-
timers (~> 4.0.0)
|
14
|
-
codeclimate-test-reporter (0.4.7)
|
15
|
-
simplecov (>= 0.7.1, < 1.0.0)
|
16
|
-
coderay (1.1.0)
|
17
|
-
crack (0.4.2)
|
4
|
+
addressable (2.4.0)
|
5
|
+
builder (3.2.3)
|
6
|
+
coderay (1.1.2)
|
7
|
+
crack (0.4.3)
|
18
8
|
safe_yaml (~> 1.0.0)
|
19
9
|
descendants_tracker (0.0.4)
|
20
10
|
thread_safe (~> 0.3, >= 0.3.1)
|
21
|
-
diff-lcs (1.
|
11
|
+
diff-lcs (1.3)
|
22
12
|
faraday (0.9.2)
|
23
13
|
multipart-post (>= 1.2, < 3)
|
24
|
-
ffi (1.9.
|
14
|
+
ffi (1.9.25)
|
25
15
|
formatador (0.2.5)
|
26
|
-
git (1.
|
27
|
-
github_api (0.
|
28
|
-
addressable (~> 2.
|
16
|
+
git (1.4.0)
|
17
|
+
github_api (0.16.0)
|
18
|
+
addressable (~> 2.4.0)
|
29
19
|
descendants_tracker (~> 0.0.4)
|
30
20
|
faraday (~> 0.8, < 0.10)
|
31
21
|
hashie (>= 3.4)
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
guard (2.12.5)
|
22
|
+
mime-types (>= 1.16, < 3.0)
|
23
|
+
oauth2 (~> 1.0)
|
24
|
+
guard (2.14.2)
|
36
25
|
formatador (>= 0.2.4)
|
37
|
-
listen (
|
38
|
-
lumberjack (
|
26
|
+
listen (>= 2.7, < 4.0)
|
27
|
+
lumberjack (>= 1.0.12, < 2.0)
|
39
28
|
nenv (~> 0.1)
|
40
29
|
notiffany (~> 0.0)
|
41
30
|
pry (>= 0.9.12)
|
42
31
|
shellany (~> 0.0)
|
43
32
|
thor (>= 0.18.1)
|
44
33
|
guard-compat (1.2.1)
|
45
|
-
guard-rspec (4.
|
34
|
+
guard-rspec (4.7.3)
|
46
35
|
guard (~> 2.1)
|
47
36
|
guard-compat (~> 1.1)
|
48
37
|
rspec (>= 2.99.0, < 4.0)
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
httparty (0.
|
53
|
-
json (~> 1.8)
|
38
|
+
hashdiff (0.3.7)
|
39
|
+
hashie (3.5.7)
|
40
|
+
highline (2.0.0)
|
41
|
+
httparty (0.16.2)
|
54
42
|
multi_xml (>= 0.5.2)
|
55
|
-
|
56
|
-
jeweler (2.1.1)
|
43
|
+
jeweler (2.3.9)
|
57
44
|
builder
|
58
|
-
bundler
|
45
|
+
bundler
|
59
46
|
git (>= 1.2.5)
|
60
|
-
github_api
|
47
|
+
github_api (~> 0.16.0)
|
61
48
|
highline (>= 1.6.15)
|
62
49
|
nokogiri (>= 1.5.10)
|
50
|
+
psych
|
63
51
|
rake
|
64
52
|
rdoc
|
65
|
-
|
66
|
-
json (1.8.
|
67
|
-
jwt (1.5.
|
68
|
-
listen (
|
69
|
-
|
70
|
-
rb-
|
71
|
-
|
72
|
-
lumberjack (1.0.
|
73
|
-
method_source (0.
|
74
|
-
|
75
|
-
|
76
|
-
multi_json (1.
|
77
|
-
multi_xml (0.
|
53
|
+
semver2
|
54
|
+
json (1.8.6)
|
55
|
+
jwt (1.5.6)
|
56
|
+
listen (3.1.5)
|
57
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
58
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
59
|
+
ruby_dep (~> 1.2)
|
60
|
+
lumberjack (1.0.13)
|
61
|
+
method_source (0.9.0)
|
62
|
+
mime-types (2.99.3)
|
63
|
+
mini_portile2 (2.3.0)
|
64
|
+
multi_json (1.13.1)
|
65
|
+
multi_xml (0.6.0)
|
78
66
|
multipart-post (2.0.0)
|
79
|
-
nenv (0.
|
80
|
-
nokogiri (1.
|
81
|
-
mini_portile2 (~> 2.
|
82
|
-
|
83
|
-
notiffany (0.0.6)
|
67
|
+
nenv (0.3.0)
|
68
|
+
nokogiri (1.8.2)
|
69
|
+
mini_portile2 (~> 2.3.0)
|
70
|
+
notiffany (0.1.1)
|
84
71
|
nenv (~> 0.1)
|
85
72
|
shellany (~> 0.0)
|
86
|
-
oauth2 (1.
|
87
|
-
faraday (>= 0.8, < 0.
|
73
|
+
oauth2 (1.4.0)
|
74
|
+
faraday (>= 0.8, < 0.13)
|
88
75
|
jwt (~> 1.0)
|
89
76
|
multi_json (~> 1.3)
|
90
77
|
multi_xml (~> 0.5)
|
91
78
|
rack (>= 1.2, < 3)
|
92
|
-
|
93
|
-
pry (0.10.1)
|
79
|
+
pry (0.11.3)
|
94
80
|
coderay (~> 1.1.0)
|
95
|
-
method_source (~> 0.
|
96
|
-
|
97
|
-
rack (2.0.
|
98
|
-
rake (
|
99
|
-
rb-fsevent (0.
|
100
|
-
rb-inotify (0.9.
|
101
|
-
ffi (>= 0.5.0)
|
81
|
+
method_source (~> 0.9.0)
|
82
|
+
psych (3.0.2)
|
83
|
+
rack (2.0.5)
|
84
|
+
rake (12.3.1)
|
85
|
+
rb-fsevent (0.10.3)
|
86
|
+
rb-inotify (0.9.10)
|
87
|
+
ffi (>= 0.5.0, < 2)
|
102
88
|
rdoc (3.12.2)
|
103
89
|
json (~> 1.4)
|
104
|
-
rspec (3.
|
105
|
-
rspec-core (~> 3.
|
106
|
-
rspec-expectations (~> 3.
|
107
|
-
rspec-mocks (~> 3.
|
108
|
-
rspec-core (3.
|
109
|
-
rspec-support (~> 3.
|
110
|
-
rspec-expectations (3.
|
90
|
+
rspec (3.7.0)
|
91
|
+
rspec-core (~> 3.7.0)
|
92
|
+
rspec-expectations (~> 3.7.0)
|
93
|
+
rspec-mocks (~> 3.7.0)
|
94
|
+
rspec-core (3.7.1)
|
95
|
+
rspec-support (~> 3.7.0)
|
96
|
+
rspec-expectations (3.7.0)
|
111
97
|
diff-lcs (>= 1.2.0, < 2.0)
|
112
|
-
rspec-support (~> 3.
|
113
|
-
rspec-mocks (3.
|
98
|
+
rspec-support (~> 3.7.0)
|
99
|
+
rspec-mocks (3.7.0)
|
114
100
|
diff-lcs (>= 1.2.0, < 2.0)
|
115
|
-
rspec-support (~> 3.
|
116
|
-
rspec-support (3.
|
101
|
+
rspec-support (~> 3.7.0)
|
102
|
+
rspec-support (3.7.1)
|
103
|
+
ruby_dep (1.5.0)
|
117
104
|
safe_yaml (1.0.4)
|
118
|
-
|
105
|
+
semver2 (3.4.2)
|
119
106
|
shellany (0.0.1)
|
120
|
-
shoulda (3.5.0)
|
121
|
-
shoulda-context (~> 1.0, >= 1.0.1)
|
122
|
-
shoulda-matchers (>= 1.4.1, < 3.0)
|
123
|
-
shoulda-context (1.2.1)
|
124
|
-
shoulda-matchers (2.8.0)
|
125
|
-
activesupport (>= 3.0.0)
|
126
107
|
simplecov (0.7.1)
|
127
108
|
multi_json (~> 1.0)
|
128
109
|
simplecov-html (~> 0.7.1)
|
129
110
|
simplecov-html (0.7.1)
|
130
|
-
slop (3.6.0)
|
131
111
|
terminal-notifier-guard (1.5.3)
|
132
|
-
thor (0.
|
133
|
-
thread_safe (0.3.
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
thread_safe (~> 0.1)
|
138
|
-
vcr (2.5.0)
|
139
|
-
webmock (1.12.3)
|
140
|
-
addressable (>= 2.2.7)
|
112
|
+
thor (0.20.0)
|
113
|
+
thread_safe (0.3.6)
|
114
|
+
vcr (4.0.0)
|
115
|
+
webmock (3.4.2)
|
116
|
+
addressable (>= 2.3.6)
|
141
117
|
crack (>= 0.3.2)
|
118
|
+
hashdiff
|
142
119
|
|
143
120
|
PLATFORMS
|
144
121
|
ruby
|
145
122
|
|
146
123
|
DEPENDENCIES
|
147
|
-
codeclimate-test-reporter
|
148
124
|
guard-rspec
|
149
125
|
httparty (>= 0.11.0)
|
150
|
-
jeweler (~> 2.
|
126
|
+
jeweler (~> 2.3.9)
|
151
127
|
rdoc (~> 3.12)
|
152
128
|
rspec
|
153
|
-
shoulda (~> 3.5)
|
154
129
|
simplecov (~> 0.7.1)
|
155
130
|
terminal-notifier-guard (~> 1.5.3)
|
156
|
-
vcr
|
157
|
-
webmock
|
131
|
+
vcr
|
132
|
+
webmock
|
158
133
|
|
159
134
|
BUNDLED WITH
|
160
|
-
1.
|
135
|
+
1.16.1
|
data/README.md
CHANGED
@@ -27,7 +27,7 @@ An optional second parameter can be passed in to set the environment (:live or :
|
|
27
27
|
|
28
28
|
An optional third parameter can be passed in to set the timeout of HTTParty in seconds. The default is `1800` (30 minutes).
|
29
29
|
|
30
|
-
|
30
|
+
## Charges
|
31
31
|
##### List All Charges
|
32
32
|
Pin::Charges.all
|
33
33
|
|
@@ -58,7 +58,7 @@ With Pagination:
|
|
58
58
|
# request[:response] => response hash
|
59
59
|
# request[:pagination] => "pagination":{"current":3,"previous":2,"next":4,"per_page":25,"pages":10,"count":239}
|
60
60
|
|
61
|
-
See https://
|
61
|
+
See [Pin Payments Charges API](https://pinpayments.com/developers/api-reference/charges#search-charges) for a full list of options.
|
62
62
|
|
63
63
|
##### Create A Charge
|
64
64
|
charge = {email: "email@example.com", description: "Description", amount: "400", currency: "AUD", ip_address: "127.0.0.1", customer_token: "cus_token" }
|
@@ -75,7 +75,7 @@ Also known as a pre-auth, this will hold a charge to be captured by for up to 5
|
|
75
75
|
##### Capture an authorised charge
|
76
76
|
Pin::Charges.capture(charge)
|
77
77
|
|
78
|
-
|
78
|
+
## Customers
|
79
79
|
##### List All Customers
|
80
80
|
Pin::Customer.all
|
81
81
|
|
@@ -112,19 +112,17 @@ With Pagination:
|
|
112
112
|
|
113
113
|
##### Update A Customer
|
114
114
|
###### Update Card details
|
115
|
-
|
115
|
+
|
116
116
|
Pin::Customer.update('cus_token', hash_of_details)
|
117
117
|
|
118
118
|
If passing a hash of details, it must be the full list of details of the credit card to be stored. (https://pin.net.au/docs/api/customers#put-customer)
|
119
119
|
|
120
120
|
###### Update only an email
|
121
|
-
---
|
122
121
|
|
123
122
|
hash_of_details = {email: 'new_email@example.com'}
|
124
123
|
Pin::Customer.update('cus_token', hash_of_details)
|
125
124
|
|
126
125
|
###### Update card by token
|
127
|
-
---
|
128
126
|
|
129
127
|
hash_of_details = {card_token: 'new_card_token'}
|
130
128
|
Pin::Customer.update('cus_token', hash_of_details)
|
@@ -155,7 +153,7 @@ You can also use a card token rather than a card hash
|
|
155
153
|
|
156
154
|
##### Delete a card given a customer and a token
|
157
155
|
This method will raise an exception if attempting to remove the user's primary card
|
158
|
-
|
156
|
+
|
159
157
|
customer_token = 'customer_token'
|
160
158
|
card_token = 'card_token'
|
161
159
|
Pin::Customer.delete_card(customer_token, card_token)
|
@@ -186,8 +184,115 @@ This will list all refunds for a particular charge (will return an empty hash if
|
|
186
184
|
|
187
185
|
Will return a card_token that can be stored against a customer.
|
188
186
|
|
189
|
-
Only use this method if you're comfortable sending card details to your server - otherwise you can use a form that Pin provides (https://
|
187
|
+
Only use this method if you're comfortable sending card details to your server - otherwise you can use a form that Pin provides (https://pinpayments.com/developers/integration-guides/payment-forms) and get the card_token that way.
|
188
|
+
|
189
|
+
## Plans
|
190
|
+
##### Create A Plan
|
191
|
+
Pin::Plan.create(plan)
|
192
|
+
|
193
|
+
plan = { name: 'Coffee Plan',
|
194
|
+
amount: '1000',
|
195
|
+
currency: 'AUD',
|
196
|
+
interval: 30,
|
197
|
+
interval_unit: 'day',
|
198
|
+
setup_amount: 0,
|
199
|
+
trial_amount: 0,
|
200
|
+
trial_interval: 7,
|
201
|
+
trial_interval_unit: 'day' }
|
202
|
+
|
203
|
+
Note: setup_amount, trial_amount, trial_interval and trial_interval_unit are all optional fields.
|
204
|
+
|
205
|
+
Pin::Plan.create(plan)
|
206
|
+
|
207
|
+
##### List All Plans
|
208
|
+
Pin::Plan.all
|
209
|
+
|
210
|
+
Show Plans on a particular page:
|
211
|
+
|
212
|
+
Pin::Plan.all(3)
|
213
|
+
|
214
|
+
With Pagination:
|
215
|
+
|
216
|
+
Pin::Plan.all(3,true)
|
217
|
+
|
218
|
+
##### Find a Plan
|
219
|
+
|
220
|
+
Pin::Plan.find(plan_token)
|
221
|
+
|
222
|
+
Return the details of a specified plan
|
223
|
+
|
224
|
+
##### Update a Plan
|
225
|
+
Update the name of a specified plan. Only the plan name can be updated!
|
226
|
+
|
227
|
+
Pin::Plan.update(plan_token, name_hash)
|
228
|
+
|
229
|
+
name_hash = { name: 'new_plan_name' }
|
190
230
|
|
231
|
+
##### Delete a Plan
|
232
|
+
Deletes a plan and all of its subscriptions. You will not be able to recover this.
|
233
|
+
|
234
|
+
Note: Plans can only be deleted if they have no running subscriptions.
|
235
|
+
|
236
|
+
Pin::Plan.delete(plan_token)
|
237
|
+
|
238
|
+
## Subscriptions
|
239
|
+
##### Create A Subscription
|
240
|
+
Activate a new subscription and return its details. The customer's card will immeadiately be billed the initial plan amount, unless there's a trial period.
|
241
|
+
|
242
|
+
|
243
|
+
subscription = { plan_token: plan_token,
|
244
|
+
customer_token: customer_token,
|
245
|
+
card_token: card_token,
|
246
|
+
include_setup_fee: true }
|
247
|
+
|
248
|
+
Note: card_token and include_setup_fee are both optional.
|
249
|
+
|
250
|
+
Pin::Subscription.create(subscription)
|
251
|
+
|
252
|
+
##### List All Subscriptions
|
253
|
+
|
254
|
+
Pin::Subscription.all
|
255
|
+
|
256
|
+
Show Subscriptions on a particular page:
|
257
|
+
|
258
|
+
Pin::Subscription.all(3)
|
259
|
+
|
260
|
+
With Pagination:
|
261
|
+
|
262
|
+
Pin::Subscription.all(3,true)
|
263
|
+
|
264
|
+
##### Find a Subscription
|
265
|
+
Return the details of a subscription.
|
266
|
+
|
267
|
+
Pin::Subscription.find(subscription_token)
|
268
|
+
|
269
|
+
##### Update a Subscription
|
270
|
+
Updates the card associated with a subscription identified by the subscription token.
|
271
|
+
|
272
|
+
Note: The card token must already be associated to the customer of the subscription.
|
273
|
+
|
274
|
+
Pin::Subscription.update(subscription_token, card_token)
|
275
|
+
|
276
|
+
##### Delete a Subscription
|
277
|
+
Cancels the subscription identified by the subscription token. Subscriptions can only be cancelled if they are in a trial or active state.
|
278
|
+
|
279
|
+
Note: Subscriptions will only attain a cancelled state once the subscription period has elapsed. Until such time subscriptions will be in a state of 'Cancelling'.
|
280
|
+
|
281
|
+
Pin::Subscription.delete(plan_token)
|
282
|
+
|
283
|
+
##### Reactivate a Subscription
|
284
|
+
Reactivates the subscription identified by the subscription token returning the details of the subscription
|
285
|
+
|
286
|
+
Pin::Subscription.reactivate(plan_token)
|
287
|
+
|
288
|
+
##### List Subscription history
|
289
|
+
Fetch the ledger entries relating to a subscription identified by a subscription token
|
290
|
+
|
291
|
+
Pin::Subscription.history(subscription_token)
|
292
|
+
|
293
|
+
###### With pagination
|
294
|
+
|
295
|
+
Pin::Subscription.history(subscription_token, 3, true)
|
191
296
|
|
192
297
|
## Recipients
|
193
298
|
The recipients API allows you to post bank account details and retrieve a token that you can safely store in your app. You can send funds to recipients using the [transfers API].
|
@@ -237,7 +342,7 @@ With Pagination:
|
|
237
342
|
# request[:response] => response hash
|
238
343
|
# request[:pagination] => "pagination":{"current":3,"previous":2,"next":4,"per_page":25,"pages":10,"count":239}
|
239
344
|
|
240
|
-
See https://
|
345
|
+
See [Pin Payments Transfers API](https://pinpayments.com/developers/api-reference/transfers#search-transfers) for a full list of options.
|
241
346
|
|
242
347
|
##### Get the line items associated with transfer.
|
243
348
|
`Pin::Transfer.line_items(transfer_token)`
|
@@ -258,6 +363,24 @@ A bank account token can only be used once to create a recipient. The token auto
|
|
258
363
|
|
259
364
|
`Pin::BankAccounts.create(options) `
|
260
365
|
|
366
|
+
## Webhook Endpoints
|
367
|
+
The Webhook Endpoints API allows you to create and view your webhook endpoints to enable your website to receive push notifications of events that occur on your Pin Payments account.
|
368
|
+
|
369
|
+
##### Create a new webhook endpoint and returns its details.
|
370
|
+
`options = { url: "http://example.com/webhooks/" }`
|
371
|
+
|
372
|
+
`Pin::WebhookEndpoints.create(options)`
|
373
|
+
|
374
|
+
##### Get a paginated list of all webhook endpoints.
|
375
|
+
`Pin::WebhookEndpoints.all`
|
376
|
+
|
377
|
+
##### Get the details of a webhook endpoint.
|
378
|
+
`Pin::WebhookEndpoints.find(token)`
|
379
|
+
|
380
|
+
##### Delete a webhook endpoint and all of its webhook requests. You will not be able to recover them.
|
381
|
+
`token = "whe_foobar"`
|
382
|
+
`Pin::WebhookEndpoints.delete(token)`
|
383
|
+
|
261
384
|
## Receipts
|
262
385
|
|
263
386
|
Receipts have been extracted out into their [own gem](https://github.com/dNitza/pin_up_receipts)
|
@@ -273,7 +396,7 @@ The requested resource could not be found in Pin.
|
|
273
396
|
A number of parameters sent to Pin were invalid.
|
274
397
|
|
275
398
|
### ChargeError
|
276
|
-
Something went wrong while creating a charge in Pin. This could be due to insufficient funds, a card being declined or expired. A full list of possible errors is available [here](https://
|
399
|
+
Something went wrong while creating a charge in Pin. This could be due to insufficient funds, a card being declined or expired. A full list of possible errors is available [here](https://pinpayments.com/developers/api-reference/charges).
|
277
400
|
|
278
401
|
### InsufficientPinBalance
|
279
402
|
|
@@ -290,12 +413,33 @@ Create a YAML file under 'spec' called 'test_data.yml' and add in:
|
|
290
413
|
|
291
414
|
PIN_SECRET: "your pin test secret"
|
292
415
|
|
293
|
-
uncomment line
|
416
|
+
uncomment line 16 in spec_helper.rb and
|
294
417
|
|
295
418
|
run
|
296
419
|
|
297
420
|
rspec spec/*.rb
|
298
421
|
|
422
|
+
### Record New VCR cassettes
|
423
|
+
After cloning the project one should create a new set of cassettes.
|
424
|
+
|
425
|
+
In spec_helper change
|
426
|
+
|
427
|
+
VCR.use_cassette(name, options) { example.call }
|
428
|
+
to
|
429
|
+
|
430
|
+
VCR.use_cassette(name, record: :all) { example.call }
|
431
|
+
|
432
|
+
Run all tests and then change the line back (replace record: :all with options)
|
433
|
+
|
434
|
+
### Updating VCR test cassettes
|
435
|
+
A contributor can update cassettes previously recorded by adding the following syntax:
|
436
|
+
|
437
|
+
record: :all, :match_requests_on => [:method, :host, :path]
|
438
|
+
|
439
|
+
E.g. in a particular spec file:
|
440
|
+
|
441
|
+
describe Pin::Balance, :vcr, record: :all, :match_requests_on => [:method, :host, :path] do
|
442
|
+
|
299
443
|
## Contributing to pin_up
|
300
444
|
|
301
445
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|