Skip to content

Commit c1ef8ce

Browse files
author
Tim Rogers
authored
Add support for the new confirmation_url attribute in the Redirect Flow API (v2.3.0) (#31)
* Add support for the new `confirmation_url` attribute in the Redirect Flow API * Bump the library version to v2.3.0
1 parent 0f0d10d commit c1ef8ce

File tree

5 files changed

+31
-8
lines changed

5 files changed

+31
-8
lines changed

lib/gocardless_pro/client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def default_options
118118
'User-Agent' => user_agent.to_s,
119119
'Content-Type' => 'application/json',
120120
'GoCardless-Client-Library' => 'gocardless-pro-ruby',
121-
'GoCardless-Client-Version' => '2.2.0',
121+
'GoCardless-Client-Version' => '2.3.0',
122122
},
123123
}
124124
end

lib/gocardless_pro/resources/redirect_flow.rb

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,18 @@ module Resources
3939
# You may wish to create a [subscription](#core-endpoints-subscriptions) or
4040
# [payment](#core-endpoints-payments) at this point.
4141
#
42-
# It is
43-
# recommended that you link the redirect flow to your user object as soon as
44-
# it is created, and attach the created resources to that user in the
45-
# complete step.
42+
# Once you
43+
# have [completed](#redirect-flows-complete-a-redirect-flow) the redirect
44+
# flow via the API, you should display a confirmation page to your customer,
45+
# confirming that their Direct Debit has been set up. You can build your own
46+
# page, or redirect to the one we provide in the `confirmation_url`
47+
# attribute of the redirect flow.
4648
#
47-
# Redirect flows expire 30 minutes after they
48-
# are first created. You cannot complete an expired redirect flow.
49+
# Redirect flows expire 30
50+
# minutes after they are first created. You cannot complete an expired
51+
# redirect flow.
4952
class RedirectFlow
53+
attr_reader :confirmation_url
5054
attr_reader :created_at
5155
attr_reader :description
5256
attr_reader :id
@@ -60,6 +64,7 @@ class RedirectFlow
6064
def initialize(object, response = nil)
6165
@object = object
6266

67+
@confirmation_url = object['confirmation_url']
6368
@created_at = object['created_at']
6469
@description = object['description']
6570
@id = object['id']

lib/gocardless_pro/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ module GoCardlessPro
44

55
module GoCardlessPro
66
# Current version of the GC gem
7-
VERSION = '2.2.0'.freeze
7+
VERSION = '2.3.0'.freeze
88
end

spec/resources/redirect_flow_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
let(:new_resource) do
1616
{
1717

18+
'confirmation_url' => 'confirmation_url-input',
1819
'created_at' => 'created_at-input',
1920
'description' => 'description-input',
2021
'id' => 'id-input',
@@ -32,6 +33,7 @@
3233
body: {
3334
'redirect_flows' => {
3435

36+
'confirmation_url' => 'confirmation_url-input',
3537
'created_at' => 'created_at-input',
3638
'description' => 'description-input',
3739
'id' => 'id-input',
@@ -49,6 +51,7 @@
4951

5052
{
5153

54+
'confirmation_url' => 'confirmation_url-input',
5255
'created_at' => 'created_at-input',
5356
'description' => 'description-input',
5457
'id' => 'id-input',
@@ -99,6 +102,7 @@
99102
let(:new_resource) do
100103
{
101104

105+
'confirmation_url' => 'confirmation_url-input',
102106
'created_at' => 'created_at-input',
103107
'description' => 'description-input',
104108
'id' => 'id-input',
@@ -139,6 +143,7 @@
139143
body: {
140144
'redirect_flows' => {
141145

146+
'confirmation_url' => 'confirmation_url-input',
142147
'created_at' => 'created_at-input',
143148
'description' => 'description-input',
144149
'id' => 'id-input',
@@ -175,6 +180,7 @@
175180
body: {
176181
'redirect_flows' => {
177182

183+
'confirmation_url' => 'confirmation_url-input',
178184
'created_at' => 'created_at-input',
179185
'description' => 'description-input',
180186
'id' => 'id-input',
@@ -208,6 +214,7 @@
208214
body: {
209215
'redirect_flows' => {
210216

217+
'confirmation_url' => 'confirmation_url-input',
211218
'created_at' => 'created_at-input',
212219
'description' => 'description-input',
213220
'id' => 'id-input',
@@ -262,6 +269,7 @@
262269
body: {
263270
'redirect_flows' => {
264271

272+
'confirmation_url' => 'confirmation_url-input',
265273
'created_at' => 'created_at-input',
266274
'description' => 'description-input',
267275
'id' => 'id-input',
@@ -300,6 +308,7 @@
300308
body: {
301309
'redirect_flows' => {
302310

311+
'confirmation_url' => 'confirmation_url-input',
303312
'created_at' => 'created_at-input',
304313
'description' => 'description-input',
305314
'id' => 'id-input',

spec/services/redirect_flows_service_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
let(:new_resource) do
1616
{
1717

18+
'confirmation_url' => 'confirmation_url-input',
1819
'created_at' => 'created_at-input',
1920
'description' => 'description-input',
2021
'id' => 'id-input',
@@ -32,6 +33,7 @@
3233
body: {
3334
'redirect_flows' => {
3435

36+
'confirmation_url' => 'confirmation_url-input',
3537
'created_at' => 'created_at-input',
3638
'description' => 'description-input',
3739
'id' => 'id-input',
@@ -49,6 +51,7 @@
4951

5052
{
5153

54+
'confirmation_url' => 'confirmation_url-input',
5255
'created_at' => 'created_at-input',
5356
'description' => 'description-input',
5457
'id' => 'id-input',
@@ -122,6 +125,7 @@
122125
let(:new_resource) do
123126
{
124127

128+
'confirmation_url' => 'confirmation_url-input',
125129
'created_at' => 'created_at-input',
126130
'description' => 'description-input',
127131
'id' => 'id-input',
@@ -162,6 +166,7 @@
162166
body: {
163167
'redirect_flows' => {
164168

169+
'confirmation_url' => 'confirmation_url-input',
165170
'created_at' => 'created_at-input',
166171
'description' => 'description-input',
167172
'id' => 'id-input',
@@ -198,6 +203,7 @@
198203
body: {
199204
'redirect_flows' => {
200205

206+
'confirmation_url' => 'confirmation_url-input',
201207
'created_at' => 'created_at-input',
202208
'description' => 'description-input',
203209
'id' => 'id-input',
@@ -231,6 +237,7 @@
231237
body: {
232238
'redirect_flows' => {
233239

240+
'confirmation_url' => 'confirmation_url-input',
234241
'created_at' => 'created_at-input',
235242
'description' => 'description-input',
236243
'id' => 'id-input',
@@ -312,6 +319,7 @@
312319
body: {
313320
'redirect_flows' => {
314321

322+
'confirmation_url' => 'confirmation_url-input',
315323
'created_at' => 'created_at-input',
316324
'description' => 'description-input',
317325
'id' => 'id-input',
@@ -361,6 +369,7 @@
361369
body: {
362370
'redirect_flows' => {
363371

372+
'confirmation_url' => 'confirmation_url-input',
364373
'created_at' => 'created_at-input',
365374
'description' => 'description-input',
366375
'id' => 'id-input',

0 commit comments

Comments
 (0)