gocardless_pro 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +12 -0
- data/README.md +71 -28
- data/gocardless_pro.gemspec +1 -1
- data/lib/gocardless_pro/api_service.rb +4 -2
- data/lib/gocardless_pro/client.rb +2 -1
- data/lib/gocardless_pro/error.rb +12 -1
- data/lib/gocardless_pro/resources/mandate.rb +3 -0
- data/lib/gocardless_pro/resources/payout.rb +3 -0
- data/lib/gocardless_pro/resources/redirect_flow.rb +15 -14
- data/lib/gocardless_pro/services/bank_details_lookups_service.rb +10 -0
- data/lib/gocardless_pro/services/creditor_bank_accounts_service.rb +5 -2
- data/lib/gocardless_pro/services/creditors_service.rb +5 -2
- data/lib/gocardless_pro/services/customer_bank_accounts_service.rb +7 -3
- data/lib/gocardless_pro/services/customers_service.rb +5 -2
- data/lib/gocardless_pro/services/events_service.rb +2 -1
- data/lib/gocardless_pro/services/mandate_pdfs_service.rb +2 -1
- data/lib/gocardless_pro/services/mandates_service.rb +10 -5
- data/lib/gocardless_pro/services/payments_service.rb +11 -6
- data/lib/gocardless_pro/services/payouts_service.rb +2 -1
- data/lib/gocardless_pro/services/redirect_flows_service.rb +6 -3
- data/lib/gocardless_pro/services/refunds_service.rb +5 -2
- data/lib/gocardless_pro/services/subscriptions_service.rb +7 -3
- data/lib/gocardless_pro/version.rb +1 -1
- data/spec/api_response_spec.rb +4 -4
- data/spec/api_service_spec.rb +41 -43
- data/spec/client_spec.rb +2 -2
- data/spec/error_spec.rb +27 -18
- data/spec/resources/bank_details_lookup_spec.rb +19 -34
- data/spec/resources/creditor_bank_account_spec.rb +54 -99
- data/spec/resources/creditor_spec.rb +66 -115
- data/spec/resources/customer_bank_account_spec.rb +54 -99
- data/spec/resources/customer_spec.rb +71 -138
- data/spec/resources/event_spec.rb +74 -107
- data/spec/resources/mandate_pdf_spec.rb +15 -26
- data/spec/resources/mandate_spec.rb +54 -87
- data/spec/resources/payment_spec.rb +70 -119
- data/spec/resources/payout_spec.rb +50 -79
- data/spec/resources/redirect_flow_spec.rb +58 -95
- data/spec/resources/refund_spec.rb +42 -75
- data/spec/resources/subscription_spec.rb +82 -155
- data/spec/response_spec.rb +45 -46
- data/spec/services/bank_details_lookups_service_spec.rb +55 -60
- data/spec/services/creditor_bank_accounts_service_spec.rb +303 -347
- data/spec/services/creditors_service_spec.rb +290 -333
- data/spec/services/customer_bank_accounts_service_spec.rb +332 -380
- data/spec/services/customers_service_spec.rb +347 -400
- data/spec/services/events_service_spec.rb +154 -184
- data/spec/services/mandate_pdfs_service_spec.rb +52 -57
- data/spec/services/mandates_service_spec.rb +374 -410
- data/spec/services/payments_service_spec.rb +404 -461
- data/spec/services/payouts_service_spec.rb +161 -184
- data/spec/services/redirect_flows_service_spec.rb +188 -205
- data/spec/services/refunds_service_spec.rb +245 -280
- data/spec/services/subscriptions_service_spec.rb +423 -485
- data/spec/spec_helper.rb +46 -48
- metadata +22 -20
@@ -1,123 +1,78 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe GoCardlessPro::Resources::CustomerBankAccount do
|
4
|
-
describe
|
4
|
+
describe 'initialising' do
|
5
5
|
let(:data) do
|
6
6
|
{
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
"currency" => "currency-input",
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
"enabled" => "enabled-input",
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
"id" => "id-input",
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
"links" => {
|
42
|
-
|
43
|
-
"customer" => "customer-input",
|
44
|
-
|
7
|
+
|
8
|
+
'account_holder_name' => 'account_holder_name-input',
|
9
|
+
|
10
|
+
'account_number_ending' => 'account_number_ending-input',
|
11
|
+
|
12
|
+
'bank_name' => 'bank_name-input',
|
13
|
+
|
14
|
+
'country_code' => 'country_code-input',
|
15
|
+
|
16
|
+
'created_at' => 'created_at-input',
|
17
|
+
|
18
|
+
'currency' => 'currency-input',
|
19
|
+
|
20
|
+
'enabled' => 'enabled-input',
|
21
|
+
|
22
|
+
'id' => 'id-input',
|
23
|
+
|
24
|
+
'links' => {
|
25
|
+
|
26
|
+
'customer' => 'customer-input'
|
27
|
+
|
45
28
|
},
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
"metadata" => "metadata-input",
|
50
|
-
|
51
|
-
|
29
|
+
|
30
|
+
'metadata' => 'metadata-input'
|
31
|
+
|
52
32
|
}
|
53
33
|
end
|
54
34
|
|
55
|
-
it
|
35
|
+
it 'can be initialized from an unenveloped response' do
|
56
36
|
resource = described_class.new(data)
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
expect(resource.currency).to eq("currency-input")
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
expect(resource.enabled).to eq("enabled-input")
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
expect(resource.id).to eq("id-input")
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
expect(resource.links.customer).to eq("customer-input")
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
expect(resource.metadata).to eq("metadata-input")
|
98
|
-
|
99
|
-
|
37
|
+
|
38
|
+
expect(resource.account_holder_name).to eq('account_holder_name-input')
|
39
|
+
|
40
|
+
expect(resource.account_number_ending).to eq('account_number_ending-input')
|
41
|
+
|
42
|
+
expect(resource.bank_name).to eq('bank_name-input')
|
43
|
+
|
44
|
+
expect(resource.country_code).to eq('country_code-input')
|
45
|
+
|
46
|
+
expect(resource.created_at).to eq('created_at-input')
|
47
|
+
|
48
|
+
expect(resource.currency).to eq('currency-input')
|
49
|
+
|
50
|
+
expect(resource.enabled).to eq('enabled-input')
|
51
|
+
|
52
|
+
expect(resource.id).to eq('id-input')
|
53
|
+
|
54
|
+
expect(resource.links.customer).to eq('customer-input')
|
55
|
+
|
56
|
+
expect(resource.metadata).to eq('metadata-input')
|
100
57
|
end
|
101
58
|
|
102
|
-
it
|
103
|
-
data[
|
59
|
+
it 'can handle new attributes without erroring' do
|
60
|
+
data['foo'] = 'bar'
|
104
61
|
expect { described_class.new(data) }.to_not raise_error
|
105
62
|
end
|
106
63
|
|
107
|
-
|
108
|
-
|
109
|
-
data["links"]["foo"] = "bar"
|
64
|
+
it 'can handle new link attributes without erroring' do
|
65
|
+
data['links']['foo'] = 'bar'
|
110
66
|
expect { described_class.new(data) }.to_not raise_error
|
111
67
|
end
|
112
68
|
|
113
|
-
it
|
114
|
-
data[
|
69
|
+
it 'can handle a nil links value' do
|
70
|
+
data['links'] = nil
|
115
71
|
expect { described_class.new(data).links }.to_not raise_error
|
116
72
|
end
|
117
|
-
|
118
73
|
|
119
|
-
describe
|
120
|
-
it
|
74
|
+
describe '#to_h' do
|
75
|
+
it 'returns a hash representing the resource' do
|
121
76
|
expect(described_class.new(data).to_h).to eq(data)
|
122
77
|
end
|
123
78
|
end
|
@@ -1,155 +1,88 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe GoCardlessPro::Resources::Customer do
|
4
|
-
describe
|
4
|
+
describe 'initialising' do
|
5
5
|
let(:data) do
|
6
6
|
{
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
"family_name" => "family_name-input",
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
"given_name" => "given_name-input",
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
"id" => "id-input",
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
"language" => "language-input",
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
"metadata" => "metadata-input",
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
"postal_code" => "postal_code-input",
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
"region" => "region-input",
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
"swedish_identity_number" => "swedish_identity_number-input",
|
70
|
-
|
71
|
-
|
7
|
+
|
8
|
+
'address_line1' => 'address_line1-input',
|
9
|
+
|
10
|
+
'address_line2' => 'address_line2-input',
|
11
|
+
|
12
|
+
'address_line3' => 'address_line3-input',
|
13
|
+
|
14
|
+
'city' => 'city-input',
|
15
|
+
|
16
|
+
'company_name' => 'company_name-input',
|
17
|
+
|
18
|
+
'country_code' => 'country_code-input',
|
19
|
+
|
20
|
+
'created_at' => 'created_at-input',
|
21
|
+
|
22
|
+
'email' => 'email-input',
|
23
|
+
|
24
|
+
'family_name' => 'family_name-input',
|
25
|
+
|
26
|
+
'given_name' => 'given_name-input',
|
27
|
+
|
28
|
+
'id' => 'id-input',
|
29
|
+
|
30
|
+
'language' => 'language-input',
|
31
|
+
|
32
|
+
'metadata' => 'metadata-input',
|
33
|
+
|
34
|
+
'postal_code' => 'postal_code-input',
|
35
|
+
|
36
|
+
'region' => 'region-input',
|
37
|
+
|
38
|
+
'swedish_identity_number' => 'swedish_identity_number-input'
|
39
|
+
|
72
40
|
}
|
73
41
|
end
|
74
42
|
|
75
|
-
it
|
43
|
+
it 'can be initialized from an unenveloped response' do
|
76
44
|
resource = described_class.new(data)
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
expect(resource.family_name).to eq("family_name-input")
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
expect(resource.given_name).to eq("given_name-input")
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
expect(resource.id).to eq("id-input")
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
expect(resource.language).to eq("language-input")
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
expect(resource.metadata).to eq("metadata-input")
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
expect(resource.postal_code).to eq("postal_code-input")
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
expect(resource.region).to eq("region-input")
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
expect(resource.swedish_identity_number).to eq("swedish_identity_number-input")
|
140
|
-
|
141
|
-
|
45
|
+
|
46
|
+
expect(resource.address_line1).to eq('address_line1-input')
|
47
|
+
|
48
|
+
expect(resource.address_line2).to eq('address_line2-input')
|
49
|
+
|
50
|
+
expect(resource.address_line3).to eq('address_line3-input')
|
51
|
+
|
52
|
+
expect(resource.city).to eq('city-input')
|
53
|
+
|
54
|
+
expect(resource.company_name).to eq('company_name-input')
|
55
|
+
|
56
|
+
expect(resource.country_code).to eq('country_code-input')
|
57
|
+
|
58
|
+
expect(resource.created_at).to eq('created_at-input')
|
59
|
+
|
60
|
+
expect(resource.email).to eq('email-input')
|
61
|
+
|
62
|
+
expect(resource.family_name).to eq('family_name-input')
|
63
|
+
|
64
|
+
expect(resource.given_name).to eq('given_name-input')
|
65
|
+
|
66
|
+
expect(resource.id).to eq('id-input')
|
67
|
+
|
68
|
+
expect(resource.language).to eq('language-input')
|
69
|
+
|
70
|
+
expect(resource.metadata).to eq('metadata-input')
|
71
|
+
|
72
|
+
expect(resource.postal_code).to eq('postal_code-input')
|
73
|
+
|
74
|
+
expect(resource.region).to eq('region-input')
|
75
|
+
|
76
|
+
expect(resource.swedish_identity_number).to eq('swedish_identity_number-input')
|
142
77
|
end
|
143
78
|
|
144
|
-
it
|
145
|
-
data[
|
79
|
+
it 'can handle new attributes without erroring' do
|
80
|
+
data['foo'] = 'bar'
|
146
81
|
expect { described_class.new(data) }.to_not raise_error
|
147
82
|
end
|
148
83
|
|
149
|
-
|
150
|
-
|
151
|
-
describe "#to_h" do
|
152
|
-
it "returns a hash representing the resource" do
|
84
|
+
describe '#to_h' do
|
85
|
+
it 'returns a hash representing the resource' do
|
153
86
|
expect(described_class.new(data).to_h).to eq(data)
|
154
87
|
end
|
155
88
|
end
|
@@ -1,131 +1,98 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe GoCardlessPro::Resources::Event do
|
4
|
-
describe
|
4
|
+
describe 'initialising' do
|
5
5
|
let(:data) do
|
6
6
|
{
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
"payout" => "payout-input",
|
38
|
-
|
39
|
-
"previous_customer_bank_account" => "previous_customer_bank_account-input",
|
40
|
-
|
41
|
-
"refund" => "refund-input",
|
42
|
-
|
43
|
-
"subscription" => "subscription-input",
|
44
|
-
|
7
|
+
|
8
|
+
'action' => 'action-input',
|
9
|
+
|
10
|
+
'created_at' => 'created_at-input',
|
11
|
+
|
12
|
+
'details' => 'details-input',
|
13
|
+
|
14
|
+
'id' => 'id-input',
|
15
|
+
|
16
|
+
'links' => {
|
17
|
+
|
18
|
+
'mandate' => 'mandate-input',
|
19
|
+
|
20
|
+
'new_customer_bank_account' => 'new_customer_bank_account-input',
|
21
|
+
|
22
|
+
'organisation' => 'organisation-input',
|
23
|
+
|
24
|
+
'parent_event' => 'parent_event-input',
|
25
|
+
|
26
|
+
'payment' => 'payment-input',
|
27
|
+
|
28
|
+
'payout' => 'payout-input',
|
29
|
+
|
30
|
+
'previous_customer_bank_account' => 'previous_customer_bank_account-input',
|
31
|
+
|
32
|
+
'refund' => 'refund-input',
|
33
|
+
|
34
|
+
'subscription' => 'subscription-input'
|
35
|
+
|
45
36
|
},
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
"resource_type" => "resource_type-input",
|
54
|
-
|
55
|
-
|
37
|
+
|
38
|
+
'metadata' => 'metadata-input',
|
39
|
+
|
40
|
+
'resource_type' => 'resource_type-input'
|
41
|
+
|
56
42
|
}
|
57
43
|
end
|
58
44
|
|
59
|
-
it
|
45
|
+
it 'can be initialized from an unenveloped response' do
|
60
46
|
resource = described_class.new(data)
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
expect(resource.links.previous_customer_bank_account).to eq("previous_customer_bank_account-input")
|
93
|
-
|
94
|
-
expect(resource.links.refund).to eq("refund-input")
|
95
|
-
|
96
|
-
expect(resource.links.subscription).to eq("subscription-input")
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
expect(resource.metadata).to eq("metadata-input")
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
expect(resource.resource_type).to eq("resource_type-input")
|
106
|
-
|
107
|
-
|
47
|
+
|
48
|
+
expect(resource.action).to eq('action-input')
|
49
|
+
|
50
|
+
expect(resource.created_at).to eq('created_at-input')
|
51
|
+
|
52
|
+
expect(resource.details).to eq('details-input')
|
53
|
+
|
54
|
+
expect(resource.id).to eq('id-input')
|
55
|
+
|
56
|
+
expect(resource.links.mandate).to eq('mandate-input')
|
57
|
+
|
58
|
+
expect(resource.links.new_customer_bank_account).to eq('new_customer_bank_account-input')
|
59
|
+
|
60
|
+
expect(resource.links.organisation).to eq('organisation-input')
|
61
|
+
|
62
|
+
expect(resource.links.parent_event).to eq('parent_event-input')
|
63
|
+
|
64
|
+
expect(resource.links.payment).to eq('payment-input')
|
65
|
+
|
66
|
+
expect(resource.links.payout).to eq('payout-input')
|
67
|
+
|
68
|
+
expect(resource.links.previous_customer_bank_account).to eq('previous_customer_bank_account-input')
|
69
|
+
|
70
|
+
expect(resource.links.refund).to eq('refund-input')
|
71
|
+
|
72
|
+
expect(resource.links.subscription).to eq('subscription-input')
|
73
|
+
|
74
|
+
expect(resource.metadata).to eq('metadata-input')
|
75
|
+
|
76
|
+
expect(resource.resource_type).to eq('resource_type-input')
|
108
77
|
end
|
109
78
|
|
110
|
-
it
|
111
|
-
data[
|
79
|
+
it 'can handle new attributes without erroring' do
|
80
|
+
data['foo'] = 'bar'
|
112
81
|
expect { described_class.new(data) }.to_not raise_error
|
113
82
|
end
|
114
83
|
|
115
|
-
|
116
|
-
|
117
|
-
data["links"]["foo"] = "bar"
|
84
|
+
it 'can handle new link attributes without erroring' do
|
85
|
+
data['links']['foo'] = 'bar'
|
118
86
|
expect { described_class.new(data) }.to_not raise_error
|
119
87
|
end
|
120
88
|
|
121
|
-
it
|
122
|
-
data[
|
89
|
+
it 'can handle a nil links value' do
|
90
|
+
data['links'] = nil
|
123
91
|
expect { described_class.new(data).links }.to_not raise_error
|
124
92
|
end
|
125
|
-
|
126
93
|
|
127
|
-
describe
|
128
|
-
it
|
94
|
+
describe '#to_h' do
|
95
|
+
it 'returns a hash representing the resource' do
|
129
96
|
expect(described_class.new(data).to_h).to eq(data)
|
130
97
|
end
|
131
98
|
end
|