gocardless_pro 2.13.0 → 2.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/gocardless_pro.gemspec +9 -3
- data/lib/gocardless_pro/client.rb +1 -1
- data/lib/gocardless_pro/resources/creditor.rb +4 -0
- data/lib/gocardless_pro/resources/creditor_bank_account.rb +2 -0
- data/lib/gocardless_pro/resources/customer.rb +0 -11
- data/lib/gocardless_pro/resources/customer_bank_account.rb +2 -0
- data/lib/gocardless_pro/resources/redirect_flow.rb +2 -2
- data/lib/gocardless_pro/services/customer_notifications_service.rb +1 -1
- data/lib/gocardless_pro/services/customers_service.rb +25 -0
- data/lib/gocardless_pro/services/mandate_pdfs_service.rb +10 -1
- data/lib/gocardless_pro/services/mandates_service.rb +8 -4
- data/lib/gocardless_pro/version.rb +1 -1
- data/spec/resources/creditor_bank_account_spec.rb +14 -0
- data/spec/resources/customer_bank_account_spec.rb +15 -0
- data/spec/resources/customer_spec.rb +86 -0
- data/spec/services/creditor_bank_accounts_service_spec.rb +18 -0
- data/spec/services/customer_bank_accounts_service_spec.rb +19 -0
- data/spec/services/customers_service_spec.rb +97 -0
- metadata +36 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 131219f7fa59f03ce5e6417b9409fa86bf094f38598e95956a5e2e248bb5d9ea
|
4
|
+
data.tar.gz: 03b5abcd23588c08423705525e678656435cd833349f5c9313a2afe05ce185a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99bdc0f720c6cd9b6083a80f1901a1cded3afaf69fcf8f1318ab2ce5595b3ac92793df826cbba8319eaecadb025c242ecb9d7c002bae958f9a9cb7b92f316eaf
|
7
|
+
data.tar.gz: 85bd9696613ea720eec40cdecce0aa12b1bd199961186e189a1caaa9a8d086fc846459ea437a74274f578701dfd7f30a372a821cd94ab3771f0912538dabd609
|
data/README.md
CHANGED
@@ -141,7 +141,7 @@ The most common use of a custom header would be to set a custom [idempotency key
|
|
141
141
|
...
|
142
142
|
},
|
143
143
|
headers: {
|
144
|
-
"Idempotency-Key"
|
144
|
+
"Idempotency-Key" => "1f9630a9-0487-418d-bd37-8b77793c9985"
|
145
145
|
}
|
146
146
|
)
|
147
147
|
```
|
data/gocardless_pro.gemspec
CHANGED
@@ -17,12 +17,18 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
18
|
spec.require_paths = ['lib']
|
19
19
|
|
20
|
+
spec.add_dependency 'faraday', ['>= 0.9.2', '< 1.0']
|
21
|
+
|
20
22
|
spec.add_development_dependency 'rspec', '~> 3.7.0'
|
21
|
-
# Used by webmock and newer versions require ruby 2.1
|
22
|
-
spec.add_development_dependency 'public_suffix', '~> 2.0.5'
|
23
23
|
spec.add_development_dependency 'webmock', '~> 1.18'
|
24
24
|
spec.add_development_dependency 'rubocop', '~> 0.49.1'
|
25
25
|
spec.add_development_dependency 'yard', '~> 0.9.11'
|
26
26
|
|
27
|
-
|
27
|
+
# Pin the version of the 'public_suffix' gem, which is a transitive dependency
|
28
|
+
# of 'webmock' (newer versions require Ruby 2.1+).
|
29
|
+
spec.add_development_dependency 'public_suffix', '~> 2.0.5'
|
30
|
+
|
31
|
+
# Pin the version of the 'parallel' gem, which is a transitive dependency of
|
32
|
+
# 'rubocop' (newer versions require Ruby 2.2+).
|
33
|
+
spec.add_development_dependency 'parallel', '~> 1.13.0'
|
28
34
|
end
|
@@ -138,7 +138,7 @@ module GoCardlessPro
|
|
138
138
|
'User-Agent' => user_agent.to_s,
|
139
139
|
'Content-Type' => 'application/json',
|
140
140
|
'GoCardless-Client-Library' => 'gocardless-pro-ruby',
|
141
|
-
'GoCardless-Client-Version' => '2.
|
141
|
+
'GoCardless-Client-Version' => '2.14.0',
|
142
142
|
},
|
143
143
|
}
|
144
144
|
end
|
@@ -28,6 +28,7 @@ module GoCardlessPro
|
|
28
28
|
class CreditorBankAccount
|
29
29
|
attr_reader :account_holder_name
|
30
30
|
attr_reader :account_number_ending
|
31
|
+
attr_reader :account_type
|
31
32
|
attr_reader :bank_name
|
32
33
|
attr_reader :country_code
|
33
34
|
attr_reader :created_at
|
@@ -43,6 +44,7 @@ module GoCardlessPro
|
|
43
44
|
|
44
45
|
@account_holder_name = object['account_holder_name']
|
45
46
|
@account_number_ending = object['account_number_ending']
|
47
|
+
@account_type = object['account_type']
|
46
48
|
@bank_name = object['bank_name']
|
47
49
|
@country_code = object['country_code']
|
48
50
|
@created_at = object['created_at']
|
@@ -16,17 +16,6 @@ module GoCardlessPro
|
|
16
16
|
# have several [customer bank
|
17
17
|
# accounts](#core-endpoints-customer-bank-accounts), which in turn can have
|
18
18
|
# several Direct Debit [mandates](#core-endpoints-mandates).
|
19
|
-
#
|
20
|
-
# Notes:
|
21
|
-
# - the `phone_number` field may only be supplied for New Zealand customers,
|
22
|
-
# and must be supplied if you intend to set up an BECS NZ mandate with the
|
23
|
-
# customer.
|
24
|
-
# - the `swedish_identity_number` field may only be supplied for Swedish
|
25
|
-
# customers, and must be supplied if you intend to set up an Autogiro
|
26
|
-
# mandate with the customer.
|
27
|
-
# - the `danish_identity_number` field may only be supplied for Danish
|
28
|
-
# customers, and must be supplied if you intend to set up a Betalingsservice
|
29
|
-
# mandate with the customer.
|
30
19
|
class Customer
|
31
20
|
attr_reader :address_line1
|
32
21
|
attr_reader :address_line2
|
@@ -25,6 +25,7 @@ module GoCardlessPro
|
|
25
25
|
class CustomerBankAccount
|
26
26
|
attr_reader :account_holder_name
|
27
27
|
attr_reader :account_number_ending
|
28
|
+
attr_reader :account_type
|
28
29
|
attr_reader :bank_name
|
29
30
|
attr_reader :country_code
|
30
31
|
attr_reader :created_at
|
@@ -40,6 +41,7 @@ module GoCardlessPro
|
|
40
41
|
|
41
42
|
@account_holder_name = object['account_holder_name']
|
42
43
|
@account_number_ending = object['account_number_ending']
|
44
|
+
@account_type = object['account_type']
|
43
45
|
@bank_name = object['bank_name']
|
44
46
|
@country_code = object['country_code']
|
45
47
|
@created_at = object['created_at']
|
@@ -15,8 +15,8 @@ module GoCardlessPro
|
|
15
15
|
# Redirect flows enable you to use GoCardless' [hosted payment
|
16
16
|
# pages](https://pay-sandbox.gocardless.com/AL000000AKFPFF) to set up
|
17
17
|
# mandates with your customers. These pages are fully compliant and have
|
18
|
-
# been translated into Dutch, French, German, Italian,
|
19
|
-
# and Swedish.
|
18
|
+
# been translated into Danish, Dutch, French, German, Italian, Norwegian,
|
19
|
+
# Portuguese, Slovak, Spanish and Swedish.
|
20
20
|
#
|
21
21
|
# The overall flow is:
|
22
22
|
#
|
@@ -17,7 +17,7 @@ module GoCardlessPro
|
|
17
17
|
# If the notification has already been actioned, or the deadline to notify has
|
18
18
|
# passed,
|
19
19
|
# this endpoint will return an `already_actioned` error and you should not take
|
20
|
-
# further action.
|
20
|
+
# further action. This endpoint takes no additional parameters.
|
21
21
|
#
|
22
22
|
# Example URL: /customer_notifications/:identity/actions/handle
|
23
23
|
#
|
@@ -116,6 +116,31 @@ module GoCardlessPro
|
|
116
116
|
Resources::Customer.new(unenvelope_body(response.body), response)
|
117
117
|
end
|
118
118
|
|
119
|
+
# Removed customers will not appear in search results or lists of customers (in
|
120
|
+
# our API
|
121
|
+
# or exports), and it will not be possible to load an individually removed
|
122
|
+
# customer by
|
123
|
+
# ID.
|
124
|
+
#
|
125
|
+
# <p class="restricted-notice"><strong>The action of removing a customer cannot
|
126
|
+
# be
|
127
|
+
# reversed, so please use with care.</strong></p>
|
128
|
+
# Example URL: /customers/:identity
|
129
|
+
#
|
130
|
+
# @param identity # Unique identifier, beginning with "CU".
|
131
|
+
# @param options [Hash] parameters as a hash, under a params key.
|
132
|
+
def remove(identity, options = {})
|
133
|
+
path = sub_url('/customers/:identity', 'identity' => identity)
|
134
|
+
|
135
|
+
options[:retry_failures] = false
|
136
|
+
|
137
|
+
response = make_request(:delete, path, options)
|
138
|
+
|
139
|
+
return if response.body.nil?
|
140
|
+
|
141
|
+
Resources::Customer.new(unenvelope_body(response.body), response)
|
142
|
+
end
|
143
|
+
|
119
144
|
private
|
120
145
|
|
121
146
|
# Unenvelope the response of the body using the service's `envelope_key`
|
@@ -30,18 +30,27 @@ module GoCardlessPro
|
|
30
30
|
# | :--------------- |
|
31
31
|
# :-------------------------------------------------------------------------------------------------------------------------------------------
|
32
32
|
# |
|
33
|
+
# | ACH | English (`en`)
|
34
|
+
#
|
35
|
+
# |
|
33
36
|
# | Autogiro | English (`en`), Swedish (`sv`)
|
34
37
|
#
|
35
38
|
# |
|
36
39
|
# | Bacs | English (`en`)
|
37
40
|
#
|
38
41
|
# |
|
39
|
-
# |
|
42
|
+
# | BECS | English (`en`)
|
43
|
+
#
|
44
|
+
# |
|
45
|
+
# | BECS NZ | English (`en`)
|
40
46
|
#
|
41
47
|
# |
|
42
48
|
# | Betalingsservice | Danish (`da`), English (`en`)
|
43
49
|
#
|
44
50
|
# |
|
51
|
+
# | PAD | English (`en`)
|
52
|
+
#
|
53
|
+
# |
|
45
54
|
# | SEPA Core | Danish (`da`), Dutch (`nl`), English (`en`), French
|
46
55
|
# (`fr`), German (`de`), Italian (`it`), Portuguese (`pt`), Spanish (`es`),
|
47
56
|
# Swedish (`sv`) |
|
@@ -80,7 +80,8 @@ module GoCardlessPro
|
|
80
80
|
# Retrieves the details of an existing mandate.
|
81
81
|
# Example URL: /mandates/:identity
|
82
82
|
#
|
83
|
-
# @param identity # Unique identifier, beginning with "MD".
|
83
|
+
# @param identity # Unique identifier, beginning with "MD". Note that this prefix may not
|
84
|
+
# apply to mandates created before 2016.
|
84
85
|
# @param options [Hash] parameters as a hash, under a params key.
|
85
86
|
def get(identity, options = {})
|
86
87
|
path = sub_url('/mandates/:identity', 'identity' => identity)
|
@@ -97,7 +98,8 @@ module GoCardlessPro
|
|
97
98
|
# Updates a mandate object. This accepts only the metadata parameter.
|
98
99
|
# Example URL: /mandates/:identity
|
99
100
|
#
|
100
|
-
# @param identity # Unique identifier, beginning with "MD".
|
101
|
+
# @param identity # Unique identifier, beginning with "MD". Note that this prefix may not
|
102
|
+
# apply to mandates created before 2016.
|
101
103
|
# @param options [Hash] parameters as a hash, under a params key.
|
102
104
|
def update(identity, options = {})
|
103
105
|
path = sub_url('/mandates/:identity', 'identity' => identity)
|
@@ -123,7 +125,8 @@ module GoCardlessPro
|
|
123
125
|
# cancelled.
|
124
126
|
# Example URL: /mandates/:identity/actions/cancel
|
125
127
|
#
|
126
|
-
# @param identity # Unique identifier, beginning with "MD".
|
128
|
+
# @param identity # Unique identifier, beginning with "MD". Note that this prefix may not
|
129
|
+
# apply to mandates created before 2016.
|
127
130
|
# @param options [Hash] parameters as a hash, under a params key.
|
128
131
|
def cancel(identity, options = {})
|
129
132
|
path = sub_url('/mandates/:identity/actions/cancel', 'identity' => identity)
|
@@ -172,7 +175,8 @@ module GoCardlessPro
|
|
172
175
|
# Mandates can be resubmitted up to 3 times.
|
173
176
|
# Example URL: /mandates/:identity/actions/reinstate
|
174
177
|
#
|
175
|
-
# @param identity # Unique identifier, beginning with "MD".
|
178
|
+
# @param identity # Unique identifier, beginning with "MD". Note that this prefix may not
|
179
|
+
# apply to mandates created before 2016.
|
176
180
|
# @param options [Hash] parameters as a hash, under a params key.
|
177
181
|
def reinstate(identity, options = {})
|
178
182
|
path = sub_url('/mandates/:identity/actions/reinstate', 'identity' => identity)
|
@@ -17,6 +17,7 @@ describe GoCardlessPro::Resources::CreditorBankAccount do
|
|
17
17
|
|
18
18
|
'account_holder_name' => 'account_holder_name-input',
|
19
19
|
'account_number_ending' => 'account_number_ending-input',
|
20
|
+
'account_type' => 'account_type-input',
|
20
21
|
'bank_name' => 'bank_name-input',
|
21
22
|
'country_code' => 'country_code-input',
|
22
23
|
'created_at' => 'created_at-input',
|
@@ -36,6 +37,7 @@ describe GoCardlessPro::Resources::CreditorBankAccount do
|
|
36
37
|
|
37
38
|
'account_holder_name' => 'account_holder_name-input',
|
38
39
|
'account_number_ending' => 'account_number_ending-input',
|
40
|
+
'account_type' => 'account_type-input',
|
39
41
|
'bank_name' => 'bank_name-input',
|
40
42
|
'country_code' => 'country_code-input',
|
41
43
|
'created_at' => 'created_at-input',
|
@@ -55,6 +57,7 @@ describe GoCardlessPro::Resources::CreditorBankAccount do
|
|
55
57
|
|
56
58
|
'account_holder_name' => 'account_holder_name-input',
|
57
59
|
'account_number_ending' => 'account_number_ending-input',
|
60
|
+
'account_type' => 'account_type-input',
|
58
61
|
'bank_name' => 'bank_name-input',
|
59
62
|
'country_code' => 'country_code-input',
|
60
63
|
'created_at' => 'created_at-input',
|
@@ -107,6 +110,7 @@ describe GoCardlessPro::Resources::CreditorBankAccount do
|
|
107
110
|
|
108
111
|
'account_holder_name' => 'account_holder_name-input',
|
109
112
|
'account_number_ending' => 'account_number_ending-input',
|
113
|
+
'account_type' => 'account_type-input',
|
110
114
|
'bank_name' => 'bank_name-input',
|
111
115
|
'country_code' => 'country_code-input',
|
112
116
|
'created_at' => 'created_at-input',
|
@@ -149,6 +153,7 @@ describe GoCardlessPro::Resources::CreditorBankAccount do
|
|
149
153
|
|
150
154
|
'account_holder_name' => 'account_holder_name-input',
|
151
155
|
'account_number_ending' => 'account_number_ending-input',
|
156
|
+
'account_type' => 'account_type-input',
|
152
157
|
'bank_name' => 'bank_name-input',
|
153
158
|
'country_code' => 'country_code-input',
|
154
159
|
'created_at' => 'created_at-input',
|
@@ -182,6 +187,7 @@ describe GoCardlessPro::Resources::CreditorBankAccount do
|
|
182
187
|
|
183
188
|
'account_holder_name' => 'account_holder_name-input',
|
184
189
|
'account_number_ending' => 'account_number_ending-input',
|
190
|
+
'account_type' => 'account_type-input',
|
185
191
|
'bank_name' => 'bank_name-input',
|
186
192
|
'country_code' => 'country_code-input',
|
187
193
|
'created_at' => 'created_at-input',
|
@@ -209,6 +215,8 @@ describe GoCardlessPro::Resources::CreditorBankAccount do
|
|
209
215
|
|
210
216
|
expect(get_list_response.records.first.account_number_ending).to eq('account_number_ending-input')
|
211
217
|
|
218
|
+
expect(get_list_response.records.first.account_type).to eq('account_type-input')
|
219
|
+
|
212
220
|
expect(get_list_response.records.first.bank_name).to eq('bank_name-input')
|
213
221
|
|
214
222
|
expect(get_list_response.records.first.country_code).to eq('country_code-input')
|
@@ -241,6 +249,7 @@ describe GoCardlessPro::Resources::CreditorBankAccount do
|
|
241
249
|
|
242
250
|
'account_holder_name' => 'account_holder_name-input',
|
243
251
|
'account_number_ending' => 'account_number_ending-input',
|
252
|
+
'account_type' => 'account_type-input',
|
244
253
|
'bank_name' => 'bank_name-input',
|
245
254
|
'country_code' => 'country_code-input',
|
246
255
|
'created_at' => 'created_at-input',
|
@@ -266,6 +275,7 @@ describe GoCardlessPro::Resources::CreditorBankAccount do
|
|
266
275
|
|
267
276
|
'account_holder_name' => 'account_holder_name-input',
|
268
277
|
'account_number_ending' => 'account_number_ending-input',
|
278
|
+
'account_type' => 'account_type-input',
|
269
279
|
'bank_name' => 'bank_name-input',
|
270
280
|
'country_code' => 'country_code-input',
|
271
281
|
'created_at' => 'created_at-input',
|
@@ -307,6 +317,7 @@ describe GoCardlessPro::Resources::CreditorBankAccount do
|
|
307
317
|
|
308
318
|
'account_holder_name' => 'account_holder_name-input',
|
309
319
|
'account_number_ending' => 'account_number_ending-input',
|
320
|
+
'account_type' => 'account_type-input',
|
310
321
|
'bank_name' => 'bank_name-input',
|
311
322
|
'country_code' => 'country_code-input',
|
312
323
|
'created_at' => 'created_at-input',
|
@@ -342,6 +353,7 @@ describe GoCardlessPro::Resources::CreditorBankAccount do
|
|
342
353
|
|
343
354
|
'account_holder_name' => 'account_holder_name-input',
|
344
355
|
'account_number_ending' => 'account_number_ending-input',
|
356
|
+
'account_type' => 'account_type-input',
|
345
357
|
'bank_name' => 'bank_name-input',
|
346
358
|
'country_code' => 'country_code-input',
|
347
359
|
'created_at' => 'created_at-input',
|
@@ -398,6 +410,7 @@ describe GoCardlessPro::Resources::CreditorBankAccount do
|
|
398
410
|
|
399
411
|
'account_holder_name' => 'account_holder_name-input',
|
400
412
|
'account_number_ending' => 'account_number_ending-input',
|
413
|
+
'account_type' => 'account_type-input',
|
401
414
|
'bank_name' => 'bank_name-input',
|
402
415
|
'country_code' => 'country_code-input',
|
403
416
|
'created_at' => 'created_at-input',
|
@@ -438,6 +451,7 @@ describe GoCardlessPro::Resources::CreditorBankAccount do
|
|
438
451
|
|
439
452
|
'account_holder_name' => 'account_holder_name-input',
|
440
453
|
'account_number_ending' => 'account_number_ending-input',
|
454
|
+
'account_type' => 'account_type-input',
|
441
455
|
'bank_name' => 'bank_name-input',
|
442
456
|
'country_code' => 'country_code-input',
|
443
457
|
'created_at' => 'created_at-input',
|
@@ -17,6 +17,7 @@ describe GoCardlessPro::Resources::CustomerBankAccount do
|
|
17
17
|
|
18
18
|
'account_holder_name' => 'account_holder_name-input',
|
19
19
|
'account_number_ending' => 'account_number_ending-input',
|
20
|
+
'account_type' => 'account_type-input',
|
20
21
|
'bank_name' => 'bank_name-input',
|
21
22
|
'country_code' => 'country_code-input',
|
22
23
|
'created_at' => 'created_at-input',
|
@@ -36,6 +37,7 @@ describe GoCardlessPro::Resources::CustomerBankAccount do
|
|
36
37
|
|
37
38
|
'account_holder_name' => 'account_holder_name-input',
|
38
39
|
'account_number_ending' => 'account_number_ending-input',
|
40
|
+
'account_type' => 'account_type-input',
|
39
41
|
'bank_name' => 'bank_name-input',
|
40
42
|
'country_code' => 'country_code-input',
|
41
43
|
'created_at' => 'created_at-input',
|
@@ -55,6 +57,7 @@ describe GoCardlessPro::Resources::CustomerBankAccount do
|
|
55
57
|
|
56
58
|
'account_holder_name' => 'account_holder_name-input',
|
57
59
|
'account_number_ending' => 'account_number_ending-input',
|
60
|
+
'account_type' => 'account_type-input',
|
58
61
|
'bank_name' => 'bank_name-input',
|
59
62
|
'country_code' => 'country_code-input',
|
60
63
|
'created_at' => 'created_at-input',
|
@@ -107,6 +110,7 @@ describe GoCardlessPro::Resources::CustomerBankAccount do
|
|
107
110
|
|
108
111
|
'account_holder_name' => 'account_holder_name-input',
|
109
112
|
'account_number_ending' => 'account_number_ending-input',
|
113
|
+
'account_type' => 'account_type-input',
|
110
114
|
'bank_name' => 'bank_name-input',
|
111
115
|
'country_code' => 'country_code-input',
|
112
116
|
'created_at' => 'created_at-input',
|
@@ -149,6 +153,7 @@ describe GoCardlessPro::Resources::CustomerBankAccount do
|
|
149
153
|
|
150
154
|
'account_holder_name' => 'account_holder_name-input',
|
151
155
|
'account_number_ending' => 'account_number_ending-input',
|
156
|
+
'account_type' => 'account_type-input',
|
152
157
|
'bank_name' => 'bank_name-input',
|
153
158
|
'country_code' => 'country_code-input',
|
154
159
|
'created_at' => 'created_at-input',
|
@@ -182,6 +187,7 @@ describe GoCardlessPro::Resources::CustomerBankAccount do
|
|
182
187
|
|
183
188
|
'account_holder_name' => 'account_holder_name-input',
|
184
189
|
'account_number_ending' => 'account_number_ending-input',
|
190
|
+
'account_type' => 'account_type-input',
|
185
191
|
'bank_name' => 'bank_name-input',
|
186
192
|
'country_code' => 'country_code-input',
|
187
193
|
'created_at' => 'created_at-input',
|
@@ -209,6 +215,8 @@ describe GoCardlessPro::Resources::CustomerBankAccount do
|
|
209
215
|
|
210
216
|
expect(get_list_response.records.first.account_number_ending).to eq('account_number_ending-input')
|
211
217
|
|
218
|
+
expect(get_list_response.records.first.account_type).to eq('account_type-input')
|
219
|
+
|
212
220
|
expect(get_list_response.records.first.bank_name).to eq('bank_name-input')
|
213
221
|
|
214
222
|
expect(get_list_response.records.first.country_code).to eq('country_code-input')
|
@@ -241,6 +249,7 @@ describe GoCardlessPro::Resources::CustomerBankAccount do
|
|
241
249
|
|
242
250
|
'account_holder_name' => 'account_holder_name-input',
|
243
251
|
'account_number_ending' => 'account_number_ending-input',
|
252
|
+
'account_type' => 'account_type-input',
|
244
253
|
'bank_name' => 'bank_name-input',
|
245
254
|
'country_code' => 'country_code-input',
|
246
255
|
'created_at' => 'created_at-input',
|
@@ -266,6 +275,7 @@ describe GoCardlessPro::Resources::CustomerBankAccount do
|
|
266
275
|
|
267
276
|
'account_holder_name' => 'account_holder_name-input',
|
268
277
|
'account_number_ending' => 'account_number_ending-input',
|
278
|
+
'account_type' => 'account_type-input',
|
269
279
|
'bank_name' => 'bank_name-input',
|
270
280
|
'country_code' => 'country_code-input',
|
271
281
|
'created_at' => 'created_at-input',
|
@@ -307,6 +317,7 @@ describe GoCardlessPro::Resources::CustomerBankAccount do
|
|
307
317
|
|
308
318
|
'account_holder_name' => 'account_holder_name-input',
|
309
319
|
'account_number_ending' => 'account_number_ending-input',
|
320
|
+
'account_type' => 'account_type-input',
|
310
321
|
'bank_name' => 'bank_name-input',
|
311
322
|
'country_code' => 'country_code-input',
|
312
323
|
'created_at' => 'created_at-input',
|
@@ -342,6 +353,7 @@ describe GoCardlessPro::Resources::CustomerBankAccount do
|
|
342
353
|
|
343
354
|
'account_holder_name' => 'account_holder_name-input',
|
344
355
|
'account_number_ending' => 'account_number_ending-input',
|
356
|
+
'account_type' => 'account_type-input',
|
345
357
|
'bank_name' => 'bank_name-input',
|
346
358
|
'country_code' => 'country_code-input',
|
347
359
|
'created_at' => 'created_at-input',
|
@@ -399,6 +411,7 @@ describe GoCardlessPro::Resources::CustomerBankAccount do
|
|
399
411
|
|
400
412
|
'account_holder_name' => 'account_holder_name-input',
|
401
413
|
'account_number_ending' => 'account_number_ending-input',
|
414
|
+
'account_type' => 'account_type-input',
|
402
415
|
'bank_name' => 'bank_name-input',
|
403
416
|
'country_code' => 'country_code-input',
|
404
417
|
'created_at' => 'created_at-input',
|
@@ -434,6 +447,7 @@ describe GoCardlessPro::Resources::CustomerBankAccount do
|
|
434
447
|
|
435
448
|
'account_holder_name' => 'account_holder_name-input',
|
436
449
|
'account_number_ending' => 'account_number_ending-input',
|
450
|
+
'account_type' => 'account_type-input',
|
437
451
|
'bank_name' => 'bank_name-input',
|
438
452
|
'country_code' => 'country_code-input',
|
439
453
|
'created_at' => 'created_at-input',
|
@@ -474,6 +488,7 @@ describe GoCardlessPro::Resources::CustomerBankAccount do
|
|
474
488
|
|
475
489
|
'account_holder_name' => 'account_holder_name-input',
|
476
490
|
'account_number_ending' => 'account_number_ending-input',
|
491
|
+
'account_type' => 'account_type-input',
|
477
492
|
'bank_name' => 'bank_name-input',
|
478
493
|
'country_code' => 'country_code-input',
|
479
494
|
'created_at' => 'created_at-input',
|
@@ -525,4 +525,90 @@ describe GoCardlessPro::Resources::Customer do
|
|
525
525
|
end
|
526
526
|
end
|
527
527
|
end
|
528
|
+
|
529
|
+
describe '#remove' do
|
530
|
+
subject(:delete_response) { client.customers.remove(resource_id) }
|
531
|
+
|
532
|
+
let(:resource_id) { 'ABC123' }
|
533
|
+
|
534
|
+
let!(:stub) do
|
535
|
+
# /customers/%v
|
536
|
+
stub_url = '/customers/:identity'.gsub(':identity', resource_id)
|
537
|
+
stub_request(:delete, /.*api.gocardless.com#{stub_url}/).to_return(
|
538
|
+
body: {
|
539
|
+
'customers' => {
|
540
|
+
|
541
|
+
'address_line1' => 'address_line1-input',
|
542
|
+
'address_line2' => 'address_line2-input',
|
543
|
+
'address_line3' => 'address_line3-input',
|
544
|
+
'city' => 'city-input',
|
545
|
+
'company_name' => 'company_name-input',
|
546
|
+
'country_code' => 'country_code-input',
|
547
|
+
'created_at' => 'created_at-input',
|
548
|
+
'danish_identity_number' => 'danish_identity_number-input',
|
549
|
+
'email' => 'email-input',
|
550
|
+
'family_name' => 'family_name-input',
|
551
|
+
'given_name' => 'given_name-input',
|
552
|
+
'id' => 'id-input',
|
553
|
+
'language' => 'language-input',
|
554
|
+
'metadata' => 'metadata-input',
|
555
|
+
'phone_number' => 'phone_number-input',
|
556
|
+
'postal_code' => 'postal_code-input',
|
557
|
+
'region' => 'region-input',
|
558
|
+
'swedish_identity_number' => 'swedish_identity_number-input',
|
559
|
+
},
|
560
|
+
}.to_json,
|
561
|
+
headers: response_headers
|
562
|
+
)
|
563
|
+
end
|
564
|
+
|
565
|
+
it 'wraps the response and calls the right endpoint' do
|
566
|
+
expect(delete_response).to be_a(GoCardlessPro::Resources::Customer)
|
567
|
+
|
568
|
+
expect(stub).to have_been_requested
|
569
|
+
end
|
570
|
+
|
571
|
+
context 'when the request needs a body and custom header' do
|
572
|
+
let(:body) { { foo: 'bar' } }
|
573
|
+
let(:headers) { { 'Foo' => 'Bar' } }
|
574
|
+
subject(:delete_response) { client.customers.remove(resource_id, body, headers) }
|
575
|
+
|
576
|
+
let(:resource_id) { 'ABC123' }
|
577
|
+
|
578
|
+
let!(:stub) do
|
579
|
+
# /customers/%v
|
580
|
+
stub_url = '/customers/:identity'.gsub(':identity', resource_id)
|
581
|
+
stub_request(:delete, /.*api.gocardless.com#{stub_url}/).
|
582
|
+
with(
|
583
|
+
body: { foo: 'bar' },
|
584
|
+
headers: { 'Foo' => 'Bar' }
|
585
|
+
).to_return(
|
586
|
+
body: {
|
587
|
+
'customers' => {
|
588
|
+
|
589
|
+
'address_line1' => 'address_line1-input',
|
590
|
+
'address_line2' => 'address_line2-input',
|
591
|
+
'address_line3' => 'address_line3-input',
|
592
|
+
'city' => 'city-input',
|
593
|
+
'company_name' => 'company_name-input',
|
594
|
+
'country_code' => 'country_code-input',
|
595
|
+
'created_at' => 'created_at-input',
|
596
|
+
'danish_identity_number' => 'danish_identity_number-input',
|
597
|
+
'email' => 'email-input',
|
598
|
+
'family_name' => 'family_name-input',
|
599
|
+
'given_name' => 'given_name-input',
|
600
|
+
'id' => 'id-input',
|
601
|
+
'language' => 'language-input',
|
602
|
+
'metadata' => 'metadata-input',
|
603
|
+
'phone_number' => 'phone_number-input',
|
604
|
+
'postal_code' => 'postal_code-input',
|
605
|
+
'region' => 'region-input',
|
606
|
+
'swedish_identity_number' => 'swedish_identity_number-input',
|
607
|
+
},
|
608
|
+
}.to_json,
|
609
|
+
headers: response_headers
|
610
|
+
)
|
611
|
+
end
|
612
|
+
end
|
613
|
+
end
|
528
614
|
end
|
@@ -17,6 +17,7 @@ describe GoCardlessPro::Services::CreditorBankAccountsService do
|
|
17
17
|
|
18
18
|
'account_holder_name' => 'account_holder_name-input',
|
19
19
|
'account_number_ending' => 'account_number_ending-input',
|
20
|
+
'account_type' => 'account_type-input',
|
20
21
|
'bank_name' => 'bank_name-input',
|
21
22
|
'country_code' => 'country_code-input',
|
22
23
|
'created_at' => 'created_at-input',
|
@@ -36,6 +37,7 @@ describe GoCardlessPro::Services::CreditorBankAccountsService do
|
|
36
37
|
|
37
38
|
'account_holder_name' => 'account_holder_name-input',
|
38
39
|
'account_number_ending' => 'account_number_ending-input',
|
40
|
+
'account_type' => 'account_type-input',
|
39
41
|
'bank_name' => 'bank_name-input',
|
40
42
|
'country_code' => 'country_code-input',
|
41
43
|
'created_at' => 'created_at-input',
|
@@ -55,6 +57,7 @@ describe GoCardlessPro::Services::CreditorBankAccountsService do
|
|
55
57
|
|
56
58
|
'account_holder_name' => 'account_holder_name-input',
|
57
59
|
'account_number_ending' => 'account_number_ending-input',
|
60
|
+
'account_type' => 'account_type-input',
|
58
61
|
'bank_name' => 'bank_name-input',
|
59
62
|
'country_code' => 'country_code-input',
|
60
63
|
'created_at' => 'created_at-input',
|
@@ -130,6 +133,7 @@ describe GoCardlessPro::Services::CreditorBankAccountsService do
|
|
130
133
|
|
131
134
|
'account_holder_name' => 'account_holder_name-input',
|
132
135
|
'account_number_ending' => 'account_number_ending-input',
|
136
|
+
'account_type' => 'account_type-input',
|
133
137
|
'bank_name' => 'bank_name-input',
|
134
138
|
'country_code' => 'country_code-input',
|
135
139
|
'created_at' => 'created_at-input',
|
@@ -172,6 +176,7 @@ describe GoCardlessPro::Services::CreditorBankAccountsService do
|
|
172
176
|
|
173
177
|
'account_holder_name' => 'account_holder_name-input',
|
174
178
|
'account_number_ending' => 'account_number_ending-input',
|
179
|
+
'account_type' => 'account_type-input',
|
175
180
|
'bank_name' => 'bank_name-input',
|
176
181
|
'country_code' => 'country_code-input',
|
177
182
|
'created_at' => 'created_at-input',
|
@@ -233,6 +238,7 @@ describe GoCardlessPro::Services::CreditorBankAccountsService do
|
|
233
238
|
|
234
239
|
'account_holder_name' => 'account_holder_name-input',
|
235
240
|
'account_number_ending' => 'account_number_ending-input',
|
241
|
+
'account_type' => 'account_type-input',
|
236
242
|
'bank_name' => 'bank_name-input',
|
237
243
|
'country_code' => 'country_code-input',
|
238
244
|
'created_at' => 'created_at-input',
|
@@ -265,6 +271,8 @@ describe GoCardlessPro::Services::CreditorBankAccountsService do
|
|
265
271
|
|
266
272
|
expect(get_list_response.records.first.account_number_ending).to eq('account_number_ending-input')
|
267
273
|
|
274
|
+
expect(get_list_response.records.first.account_type).to eq('account_type-input')
|
275
|
+
|
268
276
|
expect(get_list_response.records.first.bank_name).to eq('bank_name-input')
|
269
277
|
|
270
278
|
expect(get_list_response.records.first.country_code).to eq('country_code-input')
|
@@ -320,6 +328,7 @@ describe GoCardlessPro::Services::CreditorBankAccountsService do
|
|
320
328
|
|
321
329
|
'account_holder_name' => 'account_holder_name-input',
|
322
330
|
'account_number_ending' => 'account_number_ending-input',
|
331
|
+
'account_type' => 'account_type-input',
|
323
332
|
'bank_name' => 'bank_name-input',
|
324
333
|
'country_code' => 'country_code-input',
|
325
334
|
'created_at' => 'created_at-input',
|
@@ -345,6 +354,7 @@ describe GoCardlessPro::Services::CreditorBankAccountsService do
|
|
345
354
|
|
346
355
|
'account_holder_name' => 'account_holder_name-input',
|
347
356
|
'account_number_ending' => 'account_number_ending-input',
|
357
|
+
'account_type' => 'account_type-input',
|
348
358
|
'bank_name' => 'bank_name-input',
|
349
359
|
'country_code' => 'country_code-input',
|
350
360
|
'created_at' => 'created_at-input',
|
@@ -379,6 +389,7 @@ describe GoCardlessPro::Services::CreditorBankAccountsService do
|
|
379
389
|
|
380
390
|
'account_holder_name' => 'account_holder_name-input',
|
381
391
|
'account_number_ending' => 'account_number_ending-input',
|
392
|
+
'account_type' => 'account_type-input',
|
382
393
|
'bank_name' => 'bank_name-input',
|
383
394
|
'country_code' => 'country_code-input',
|
384
395
|
'created_at' => 'created_at-input',
|
@@ -404,6 +415,7 @@ describe GoCardlessPro::Services::CreditorBankAccountsService do
|
|
404
415
|
|
405
416
|
'account_holder_name' => 'account_holder_name-input',
|
406
417
|
'account_number_ending' => 'account_number_ending-input',
|
418
|
+
'account_type' => 'account_type-input',
|
407
419
|
'bank_name' => 'bank_name-input',
|
408
420
|
'country_code' => 'country_code-input',
|
409
421
|
'created_at' => 'created_at-input',
|
@@ -434,6 +446,7 @@ describe GoCardlessPro::Services::CreditorBankAccountsService do
|
|
434
446
|
|
435
447
|
'account_holder_name' => 'account_holder_name-input',
|
436
448
|
'account_number_ending' => 'account_number_ending-input',
|
449
|
+
'account_type' => 'account_type-input',
|
437
450
|
'bank_name' => 'bank_name-input',
|
438
451
|
'country_code' => 'country_code-input',
|
439
452
|
'created_at' => 'created_at-input',
|
@@ -462,6 +475,7 @@ describe GoCardlessPro::Services::CreditorBankAccountsService do
|
|
462
475
|
|
463
476
|
'account_holder_name' => 'account_holder_name-input',
|
464
477
|
'account_number_ending' => 'account_number_ending-input',
|
478
|
+
'account_type' => 'account_type-input',
|
465
479
|
'bank_name' => 'bank_name-input',
|
466
480
|
'country_code' => 'country_code-input',
|
467
481
|
'created_at' => 'created_at-input',
|
@@ -503,6 +517,7 @@ describe GoCardlessPro::Services::CreditorBankAccountsService do
|
|
503
517
|
|
504
518
|
'account_holder_name' => 'account_holder_name-input',
|
505
519
|
'account_number_ending' => 'account_number_ending-input',
|
520
|
+
'account_type' => 'account_type-input',
|
506
521
|
'bank_name' => 'bank_name-input',
|
507
522
|
'country_code' => 'country_code-input',
|
508
523
|
'created_at' => 'created_at-input',
|
@@ -538,6 +553,7 @@ describe GoCardlessPro::Services::CreditorBankAccountsService do
|
|
538
553
|
|
539
554
|
'account_holder_name' => 'account_holder_name-input',
|
540
555
|
'account_number_ending' => 'account_number_ending-input',
|
556
|
+
'account_type' => 'account_type-input',
|
541
557
|
'bank_name' => 'bank_name-input',
|
542
558
|
'country_code' => 'country_code-input',
|
543
559
|
'created_at' => 'created_at-input',
|
@@ -649,6 +665,7 @@ describe GoCardlessPro::Services::CreditorBankAccountsService do
|
|
649
665
|
|
650
666
|
'account_holder_name' => 'account_holder_name-input',
|
651
667
|
'account_number_ending' => 'account_number_ending-input',
|
668
|
+
'account_type' => 'account_type-input',
|
652
669
|
'bank_name' => 'bank_name-input',
|
653
670
|
'country_code' => 'country_code-input',
|
654
671
|
'created_at' => 'created_at-input',
|
@@ -700,6 +717,7 @@ describe GoCardlessPro::Services::CreditorBankAccountsService do
|
|
700
717
|
|
701
718
|
'account_holder_name' => 'account_holder_name-input',
|
702
719
|
'account_number_ending' => 'account_number_ending-input',
|
720
|
+
'account_type' => 'account_type-input',
|
703
721
|
'bank_name' => 'bank_name-input',
|
704
722
|
'country_code' => 'country_code-input',
|
705
723
|
'created_at' => 'created_at-input',
|
@@ -17,6 +17,7 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
|
|
17
17
|
|
18
18
|
'account_holder_name' => 'account_holder_name-input',
|
19
19
|
'account_number_ending' => 'account_number_ending-input',
|
20
|
+
'account_type' => 'account_type-input',
|
20
21
|
'bank_name' => 'bank_name-input',
|
21
22
|
'country_code' => 'country_code-input',
|
22
23
|
'created_at' => 'created_at-input',
|
@@ -36,6 +37,7 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
|
|
36
37
|
|
37
38
|
'account_holder_name' => 'account_holder_name-input',
|
38
39
|
'account_number_ending' => 'account_number_ending-input',
|
40
|
+
'account_type' => 'account_type-input',
|
39
41
|
'bank_name' => 'bank_name-input',
|
40
42
|
'country_code' => 'country_code-input',
|
41
43
|
'created_at' => 'created_at-input',
|
@@ -55,6 +57,7 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
|
|
55
57
|
|
56
58
|
'account_holder_name' => 'account_holder_name-input',
|
57
59
|
'account_number_ending' => 'account_number_ending-input',
|
60
|
+
'account_type' => 'account_type-input',
|
58
61
|
'bank_name' => 'bank_name-input',
|
59
62
|
'country_code' => 'country_code-input',
|
60
63
|
'created_at' => 'created_at-input',
|
@@ -130,6 +133,7 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
|
|
130
133
|
|
131
134
|
'account_holder_name' => 'account_holder_name-input',
|
132
135
|
'account_number_ending' => 'account_number_ending-input',
|
136
|
+
'account_type' => 'account_type-input',
|
133
137
|
'bank_name' => 'bank_name-input',
|
134
138
|
'country_code' => 'country_code-input',
|
135
139
|
'created_at' => 'created_at-input',
|
@@ -172,6 +176,7 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
|
|
172
176
|
|
173
177
|
'account_holder_name' => 'account_holder_name-input',
|
174
178
|
'account_number_ending' => 'account_number_ending-input',
|
179
|
+
'account_type' => 'account_type-input',
|
175
180
|
'bank_name' => 'bank_name-input',
|
176
181
|
'country_code' => 'country_code-input',
|
177
182
|
'created_at' => 'created_at-input',
|
@@ -233,6 +238,7 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
|
|
233
238
|
|
234
239
|
'account_holder_name' => 'account_holder_name-input',
|
235
240
|
'account_number_ending' => 'account_number_ending-input',
|
241
|
+
'account_type' => 'account_type-input',
|
236
242
|
'bank_name' => 'bank_name-input',
|
237
243
|
'country_code' => 'country_code-input',
|
238
244
|
'created_at' => 'created_at-input',
|
@@ -265,6 +271,8 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
|
|
265
271
|
|
266
272
|
expect(get_list_response.records.first.account_number_ending).to eq('account_number_ending-input')
|
267
273
|
|
274
|
+
expect(get_list_response.records.first.account_type).to eq('account_type-input')
|
275
|
+
|
268
276
|
expect(get_list_response.records.first.bank_name).to eq('bank_name-input')
|
269
277
|
|
270
278
|
expect(get_list_response.records.first.country_code).to eq('country_code-input')
|
@@ -320,6 +328,7 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
|
|
320
328
|
|
321
329
|
'account_holder_name' => 'account_holder_name-input',
|
322
330
|
'account_number_ending' => 'account_number_ending-input',
|
331
|
+
'account_type' => 'account_type-input',
|
323
332
|
'bank_name' => 'bank_name-input',
|
324
333
|
'country_code' => 'country_code-input',
|
325
334
|
'created_at' => 'created_at-input',
|
@@ -345,6 +354,7 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
|
|
345
354
|
|
346
355
|
'account_holder_name' => 'account_holder_name-input',
|
347
356
|
'account_number_ending' => 'account_number_ending-input',
|
357
|
+
'account_type' => 'account_type-input',
|
348
358
|
'bank_name' => 'bank_name-input',
|
349
359
|
'country_code' => 'country_code-input',
|
350
360
|
'created_at' => 'created_at-input',
|
@@ -379,6 +389,7 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
|
|
379
389
|
|
380
390
|
'account_holder_name' => 'account_holder_name-input',
|
381
391
|
'account_number_ending' => 'account_number_ending-input',
|
392
|
+
'account_type' => 'account_type-input',
|
382
393
|
'bank_name' => 'bank_name-input',
|
383
394
|
'country_code' => 'country_code-input',
|
384
395
|
'created_at' => 'created_at-input',
|
@@ -404,6 +415,7 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
|
|
404
415
|
|
405
416
|
'account_holder_name' => 'account_holder_name-input',
|
406
417
|
'account_number_ending' => 'account_number_ending-input',
|
418
|
+
'account_type' => 'account_type-input',
|
407
419
|
'bank_name' => 'bank_name-input',
|
408
420
|
'country_code' => 'country_code-input',
|
409
421
|
'created_at' => 'created_at-input',
|
@@ -434,6 +446,7 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
|
|
434
446
|
|
435
447
|
'account_holder_name' => 'account_holder_name-input',
|
436
448
|
'account_number_ending' => 'account_number_ending-input',
|
449
|
+
'account_type' => 'account_type-input',
|
437
450
|
'bank_name' => 'bank_name-input',
|
438
451
|
'country_code' => 'country_code-input',
|
439
452
|
'created_at' => 'created_at-input',
|
@@ -462,6 +475,7 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
|
|
462
475
|
|
463
476
|
'account_holder_name' => 'account_holder_name-input',
|
464
477
|
'account_number_ending' => 'account_number_ending-input',
|
478
|
+
'account_type' => 'account_type-input',
|
465
479
|
'bank_name' => 'bank_name-input',
|
466
480
|
'country_code' => 'country_code-input',
|
467
481
|
'created_at' => 'created_at-input',
|
@@ -503,6 +517,7 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
|
|
503
517
|
|
504
518
|
'account_holder_name' => 'account_holder_name-input',
|
505
519
|
'account_number_ending' => 'account_number_ending-input',
|
520
|
+
'account_type' => 'account_type-input',
|
506
521
|
'bank_name' => 'bank_name-input',
|
507
522
|
'country_code' => 'country_code-input',
|
508
523
|
'created_at' => 'created_at-input',
|
@@ -538,6 +553,7 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
|
|
538
553
|
|
539
554
|
'account_holder_name' => 'account_holder_name-input',
|
540
555
|
'account_number_ending' => 'account_number_ending-input',
|
556
|
+
'account_type' => 'account_type-input',
|
541
557
|
'bank_name' => 'bank_name-input',
|
542
558
|
'country_code' => 'country_code-input',
|
543
559
|
'created_at' => 'created_at-input',
|
@@ -650,6 +666,7 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
|
|
650
666
|
|
651
667
|
'account_holder_name' => 'account_holder_name-input',
|
652
668
|
'account_number_ending' => 'account_number_ending-input',
|
669
|
+
'account_type' => 'account_type-input',
|
653
670
|
'bank_name' => 'bank_name-input',
|
654
671
|
'country_code' => 'country_code-input',
|
655
672
|
'created_at' => 'created_at-input',
|
@@ -710,6 +727,7 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
|
|
710
727
|
|
711
728
|
'account_holder_name' => 'account_holder_name-input',
|
712
729
|
'account_number_ending' => 'account_number_ending-input',
|
730
|
+
'account_type' => 'account_type-input',
|
713
731
|
'bank_name' => 'bank_name-input',
|
714
732
|
'country_code' => 'country_code-input',
|
715
733
|
'created_at' => 'created_at-input',
|
@@ -761,6 +779,7 @@ describe GoCardlessPro::Services::CustomerBankAccountsService do
|
|
761
779
|
|
762
780
|
'account_holder_name' => 'account_holder_name-input',
|
763
781
|
'account_number_ending' => 'account_number_ending-input',
|
782
|
+
'account_type' => 'account_type-input',
|
764
783
|
'bank_name' => 'bank_name-input',
|
765
784
|
'country_code' => 'country_code-input',
|
766
785
|
'created_at' => 'created_at-input',
|
@@ -833,4 +833,101 @@ describe GoCardlessPro::Services::CustomersService do
|
|
833
833
|
end
|
834
834
|
end
|
835
835
|
end
|
836
|
+
|
837
|
+
describe '#remove' do
|
838
|
+
subject(:delete_response) { client.customers.remove(resource_id) }
|
839
|
+
|
840
|
+
let(:resource_id) { 'ABC123' }
|
841
|
+
|
842
|
+
let!(:stub) do
|
843
|
+
# /customers/%v
|
844
|
+
stub_url = '/customers/:identity'.gsub(':identity', resource_id)
|
845
|
+
stub_request(:delete, /.*api.gocardless.com#{stub_url}/).to_return(
|
846
|
+
body: {
|
847
|
+
'customers' => {
|
848
|
+
|
849
|
+
'address_line1' => 'address_line1-input',
|
850
|
+
'address_line2' => 'address_line2-input',
|
851
|
+
'address_line3' => 'address_line3-input',
|
852
|
+
'city' => 'city-input',
|
853
|
+
'company_name' => 'company_name-input',
|
854
|
+
'country_code' => 'country_code-input',
|
855
|
+
'created_at' => 'created_at-input',
|
856
|
+
'danish_identity_number' => 'danish_identity_number-input',
|
857
|
+
'email' => 'email-input',
|
858
|
+
'family_name' => 'family_name-input',
|
859
|
+
'given_name' => 'given_name-input',
|
860
|
+
'id' => 'id-input',
|
861
|
+
'language' => 'language-input',
|
862
|
+
'metadata' => 'metadata-input',
|
863
|
+
'phone_number' => 'phone_number-input',
|
864
|
+
'postal_code' => 'postal_code-input',
|
865
|
+
'region' => 'region-input',
|
866
|
+
'swedish_identity_number' => 'swedish_identity_number-input',
|
867
|
+
},
|
868
|
+
}.to_json,
|
869
|
+
headers: response_headers
|
870
|
+
)
|
871
|
+
end
|
872
|
+
|
873
|
+
it 'wraps the response and calls the right endpoint' do
|
874
|
+
expect(delete_response).to be_a(GoCardlessPro::Resources::Customer)
|
875
|
+
|
876
|
+
expect(stub).to have_been_requested
|
877
|
+
end
|
878
|
+
|
879
|
+
describe 'retry behaviour' do
|
880
|
+
it "doesn't retry errors" do
|
881
|
+
stub_url = '/customers/:identity'.gsub(':identity', resource_id)
|
882
|
+
stub = stub_request(:delete, /.*api.gocardless.com#{stub_url}/).
|
883
|
+
to_timeout
|
884
|
+
|
885
|
+
expect { delete_response }.to raise_error(Faraday::TimeoutError)
|
886
|
+
expect(stub).to have_been_requested
|
887
|
+
end
|
888
|
+
end
|
889
|
+
|
890
|
+
context 'when the request needs a body and custom header' do
|
891
|
+
let(:body) { { foo: 'bar' } }
|
892
|
+
let(:headers) { { 'Foo' => 'Bar' } }
|
893
|
+
subject(:delete_response) { client.customers.remove(resource_id, body, headers) }
|
894
|
+
|
895
|
+
let(:resource_id) { 'ABC123' }
|
896
|
+
|
897
|
+
let!(:stub) do
|
898
|
+
# /customers/%v
|
899
|
+
stub_url = '/customers/:identity'.gsub(':identity', resource_id)
|
900
|
+
stub_request(:delete, /.*api.gocardless.com#{stub_url}/).
|
901
|
+
with(
|
902
|
+
body: { foo: 'bar' },
|
903
|
+
headers: { 'Foo' => 'Bar' }
|
904
|
+
).to_return(
|
905
|
+
body: {
|
906
|
+
'customers' => {
|
907
|
+
|
908
|
+
'address_line1' => 'address_line1-input',
|
909
|
+
'address_line2' => 'address_line2-input',
|
910
|
+
'address_line3' => 'address_line3-input',
|
911
|
+
'city' => 'city-input',
|
912
|
+
'company_name' => 'company_name-input',
|
913
|
+
'country_code' => 'country_code-input',
|
914
|
+
'created_at' => 'created_at-input',
|
915
|
+
'danish_identity_number' => 'danish_identity_number-input',
|
916
|
+
'email' => 'email-input',
|
917
|
+
'family_name' => 'family_name-input',
|
918
|
+
'given_name' => 'given_name-input',
|
919
|
+
'id' => 'id-input',
|
920
|
+
'language' => 'language-input',
|
921
|
+
'metadata' => 'metadata-input',
|
922
|
+
'phone_number' => 'phone_number-input',
|
923
|
+
'postal_code' => 'postal_code-input',
|
924
|
+
'region' => 'region-input',
|
925
|
+
'swedish_identity_number' => 'swedish_identity_number-input',
|
926
|
+
},
|
927
|
+
}.to_json,
|
928
|
+
headers: response_headers
|
929
|
+
)
|
930
|
+
end
|
931
|
+
end
|
932
|
+
end
|
836
933
|
end
|
metadata
CHANGED
@@ -1,43 +1,49 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gocardless_pro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GoCardless
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: faraday
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
20
|
-
|
19
|
+
version: 0.9.2
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '1.0'
|
23
|
+
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
29
|
+
version: 0.9.2
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '1.0'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
34
|
+
name: rspec
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
37
|
- - "~>"
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
39
|
+
version: 3.7.0
|
34
40
|
type: :development
|
35
41
|
prerelease: false
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
44
|
- - "~>"
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
46
|
+
version: 3.7.0
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: webmock
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,25 +87,33 @@ dependencies:
|
|
81
87
|
- !ruby/object:Gem::Version
|
82
88
|
version: 0.9.11
|
83
89
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
90
|
+
name: public_suffix
|
85
91
|
requirement: !ruby/object:Gem::Requirement
|
86
92
|
requirements:
|
87
|
-
- - "
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 0.9.2
|
90
|
-
- - "<"
|
93
|
+
- - "~>"
|
91
94
|
- !ruby/object:Gem::Version
|
92
|
-
version:
|
93
|
-
type: :
|
95
|
+
version: 2.0.5
|
96
|
+
type: :development
|
94
97
|
prerelease: false
|
95
98
|
version_requirements: !ruby/object:Gem::Requirement
|
96
99
|
requirements:
|
97
|
-
- - "
|
100
|
+
- - "~>"
|
98
101
|
- !ruby/object:Gem::Version
|
99
|
-
version: 0.
|
100
|
-
|
102
|
+
version: 2.0.5
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: parallel
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
101
108
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
109
|
+
version: 1.13.0
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: 1.13.0
|
103
117
|
description:
|
104
118
|
email:
|
105
119
|
- engineering@gocardless.com
|