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,43 +1,32 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe GoCardlessPro::Resources::MandatePdf do
|
4
|
-
describe
|
4
|
+
describe 'initialising' do
|
5
5
|
let(:data) do
|
6
6
|
{
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
"url" => "url-input",
|
14
|
-
|
15
|
-
|
7
|
+
|
8
|
+
'expires_at' => 'expires_at-input',
|
9
|
+
|
10
|
+
'url' => 'url-input'
|
11
|
+
|
16
12
|
}
|
17
13
|
end
|
18
14
|
|
19
|
-
it
|
15
|
+
it 'can be initialized from an unenveloped response' do
|
20
16
|
resource = described_class.new(data)
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
expect(resource.url).to eq("url-input")
|
28
|
-
|
29
|
-
|
17
|
+
|
18
|
+
expect(resource.expires_at).to eq('expires_at-input')
|
19
|
+
|
20
|
+
expect(resource.url).to eq('url-input')
|
30
21
|
end
|
31
22
|
|
32
|
-
it
|
33
|
-
data[
|
23
|
+
it 'can handle new attributes without erroring' do
|
24
|
+
data['foo'] = 'bar'
|
34
25
|
expect { described_class.new(data) }.to_not raise_error
|
35
26
|
end
|
36
27
|
|
37
|
-
|
38
|
-
|
39
|
-
describe "#to_h" do
|
40
|
-
it "returns a hash representing the resource" do
|
28
|
+
describe '#to_h' do
|
29
|
+
it 'returns a hash representing the resource' do
|
41
30
|
expect(described_class.new(data).to_h).to eq(data)
|
42
31
|
end
|
43
32
|
end
|
@@ -1,111 +1,78 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe GoCardlessPro::Resources::Mandate 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
|
-
"creditor" => "creditor-input",
|
20
|
-
|
21
|
-
"customer_bank_account" => "customer_bank_account-input",
|
22
|
-
|
7
|
+
|
8
|
+
'created_at' => 'created_at-input',
|
9
|
+
|
10
|
+
'id' => 'id-input',
|
11
|
+
|
12
|
+
'links' => {
|
13
|
+
|
14
|
+
'creditor' => 'creditor-input',
|
15
|
+
|
16
|
+
'customer_bank_account' => 'customer_bank_account-input'
|
17
|
+
|
23
18
|
},
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
"scheme" => "scheme-input",
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
"status" => "status-input",
|
44
|
-
|
45
|
-
|
19
|
+
|
20
|
+
'metadata' => 'metadata-input',
|
21
|
+
|
22
|
+
'next_possible_charge_date' => 'next_possible_charge_date-input',
|
23
|
+
|
24
|
+
'payments_require_approval' => 'payments_require_approval-input',
|
25
|
+
|
26
|
+
'reference' => 'reference-input',
|
27
|
+
|
28
|
+
'scheme' => 'scheme-input',
|
29
|
+
|
30
|
+
'status' => 'status-input'
|
31
|
+
|
46
32
|
}
|
47
33
|
end
|
48
34
|
|
49
|
-
it
|
35
|
+
it 'can be initialized from an unenveloped response' do
|
50
36
|
resource = described_class.new(data)
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
expect(resource.next_possible_charge_date).to eq("next_possible_charge_date-input")
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
expect(resource.reference).to eq("reference-input")
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
expect(resource.scheme).to eq("scheme-input")
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
expect(resource.status).to eq("status-input")
|
86
|
-
|
87
|
-
|
37
|
+
|
38
|
+
expect(resource.created_at).to eq('created_at-input')
|
39
|
+
|
40
|
+
expect(resource.id).to eq('id-input')
|
41
|
+
|
42
|
+
expect(resource.links.creditor).to eq('creditor-input')
|
43
|
+
|
44
|
+
expect(resource.links.customer_bank_account).to eq('customer_bank_account-input')
|
45
|
+
|
46
|
+
expect(resource.metadata).to eq('metadata-input')
|
47
|
+
|
48
|
+
expect(resource.next_possible_charge_date).to eq('next_possible_charge_date-input')
|
49
|
+
|
50
|
+
expect(resource.payments_require_approval).to eq('payments_require_approval-input')
|
51
|
+
|
52
|
+
expect(resource.reference).to eq('reference-input')
|
53
|
+
|
54
|
+
expect(resource.scheme).to eq('scheme-input')
|
55
|
+
|
56
|
+
expect(resource.status).to eq('status-input')
|
88
57
|
end
|
89
58
|
|
90
|
-
it
|
91
|
-
data[
|
59
|
+
it 'can handle new attributes without erroring' do
|
60
|
+
data['foo'] = 'bar'
|
92
61
|
expect { described_class.new(data) }.to_not raise_error
|
93
62
|
end
|
94
63
|
|
95
|
-
|
96
|
-
|
97
|
-
data["links"]["foo"] = "bar"
|
64
|
+
it 'can handle new link attributes without erroring' do
|
65
|
+
data['links']['foo'] = 'bar'
|
98
66
|
expect { described_class.new(data) }.to_not raise_error
|
99
67
|
end
|
100
68
|
|
101
|
-
it
|
102
|
-
data[
|
69
|
+
it 'can handle a nil links value' do
|
70
|
+
data['links'] = nil
|
103
71
|
expect { described_class.new(data).links }.to_not raise_error
|
104
72
|
end
|
105
|
-
|
106
73
|
|
107
|
-
describe
|
108
|
-
it
|
74
|
+
describe '#to_h' do
|
75
|
+
it 'returns a hash representing the resource' do
|
109
76
|
expect(described_class.new(data).to_h).to eq(data)
|
110
77
|
end
|
111
78
|
end
|
@@ -1,143 +1,94 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe GoCardlessPro::Resources::Payment 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
|
-
"id" => "id-input",
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
"links" => {
|
38
|
-
|
39
|
-
"creditor" => "creditor-input",
|
40
|
-
|
41
|
-
"mandate" => "mandate-input",
|
42
|
-
|
43
|
-
"payout" => "payout-input",
|
44
|
-
|
45
|
-
"subscription" => "subscription-input",
|
46
|
-
|
7
|
+
|
8
|
+
'amount' => 'amount-input',
|
9
|
+
|
10
|
+
'amount_refunded' => 'amount_refunded-input',
|
11
|
+
|
12
|
+
'charge_date' => 'charge_date-input',
|
13
|
+
|
14
|
+
'created_at' => 'created_at-input',
|
15
|
+
|
16
|
+
'currency' => 'currency-input',
|
17
|
+
|
18
|
+
'description' => 'description-input',
|
19
|
+
|
20
|
+
'id' => 'id-input',
|
21
|
+
|
22
|
+
'links' => {
|
23
|
+
|
24
|
+
'creditor' => 'creditor-input',
|
25
|
+
|
26
|
+
'mandate' => 'mandate-input',
|
27
|
+
|
28
|
+
'payout' => 'payout-input',
|
29
|
+
|
30
|
+
'subscription' => 'subscription-input'
|
31
|
+
|
47
32
|
},
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
"reference" => "reference-input",
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
"status" => "status-input",
|
60
|
-
|
61
|
-
|
33
|
+
|
34
|
+
'metadata' => 'metadata-input',
|
35
|
+
|
36
|
+
'reference' => 'reference-input',
|
37
|
+
|
38
|
+
'status' => 'status-input'
|
39
|
+
|
62
40
|
}
|
63
41
|
end
|
64
42
|
|
65
|
-
it
|
43
|
+
it 'can be initialized from an unenveloped response' do
|
66
44
|
resource = described_class.new(data)
|
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
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
expect(resource.links.creditor).to eq("creditor-input")
|
99
|
-
|
100
|
-
expect(resource.links.mandate).to eq("mandate-input")
|
101
|
-
|
102
|
-
expect(resource.links.payout).to eq("payout-input")
|
103
|
-
|
104
|
-
expect(resource.links.subscription).to eq("subscription-input")
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
expect(resource.metadata).to eq("metadata-input")
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
expect(resource.reference).to eq("reference-input")
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
expect(resource.status).to eq("status-input")
|
118
|
-
|
119
|
-
|
45
|
+
|
46
|
+
expect(resource.amount).to eq('amount-input')
|
47
|
+
|
48
|
+
expect(resource.amount_refunded).to eq('amount_refunded-input')
|
49
|
+
|
50
|
+
expect(resource.charge_date).to eq('charge_date-input')
|
51
|
+
|
52
|
+
expect(resource.created_at).to eq('created_at-input')
|
53
|
+
|
54
|
+
expect(resource.currency).to eq('currency-input')
|
55
|
+
|
56
|
+
expect(resource.description).to eq('description-input')
|
57
|
+
|
58
|
+
expect(resource.id).to eq('id-input')
|
59
|
+
|
60
|
+
expect(resource.links.creditor).to eq('creditor-input')
|
61
|
+
|
62
|
+
expect(resource.links.mandate).to eq('mandate-input')
|
63
|
+
|
64
|
+
expect(resource.links.payout).to eq('payout-input')
|
65
|
+
|
66
|
+
expect(resource.links.subscription).to eq('subscription-input')
|
67
|
+
|
68
|
+
expect(resource.metadata).to eq('metadata-input')
|
69
|
+
|
70
|
+
expect(resource.reference).to eq('reference-input')
|
71
|
+
|
72
|
+
expect(resource.status).to eq('status-input')
|
120
73
|
end
|
121
74
|
|
122
|
-
it
|
123
|
-
data[
|
75
|
+
it 'can handle new attributes without erroring' do
|
76
|
+
data['foo'] = 'bar'
|
124
77
|
expect { described_class.new(data) }.to_not raise_error
|
125
78
|
end
|
126
79
|
|
127
|
-
|
128
|
-
|
129
|
-
data["links"]["foo"] = "bar"
|
80
|
+
it 'can handle new link attributes without erroring' do
|
81
|
+
data['links']['foo'] = 'bar'
|
130
82
|
expect { described_class.new(data) }.to_not raise_error
|
131
83
|
end
|
132
84
|
|
133
|
-
it
|
134
|
-
data[
|
85
|
+
it 'can handle a nil links value' do
|
86
|
+
data['links'] = nil
|
135
87
|
expect { described_class.new(data).links }.to_not raise_error
|
136
88
|
end
|
137
|
-
|
138
89
|
|
139
|
-
describe
|
140
|
-
it
|
90
|
+
describe '#to_h' do
|
91
|
+
it 'returns a hash representing the resource' do
|
141
92
|
expect(described_class.new(data).to_h).to eq(data)
|
142
93
|
end
|
143
94
|
end
|
@@ -1,103 +1,74 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe GoCardlessPro::Resources::Payout 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
|
-
"links" => {
|
26
|
-
|
27
|
-
"creditor" => "creditor-input",
|
28
|
-
|
29
|
-
"creditor_bank_account" => "creditor_bank_account-input",
|
30
|
-
|
7
|
+
|
8
|
+
'amount' => 'amount-input',
|
9
|
+
|
10
|
+
'arrival_date' => 'arrival_date-input',
|
11
|
+
|
12
|
+
'created_at' => 'created_at-input',
|
13
|
+
|
14
|
+
'currency' => 'currency-input',
|
15
|
+
|
16
|
+
'id' => 'id-input',
|
17
|
+
|
18
|
+
'links' => {
|
19
|
+
|
20
|
+
'creditor' => 'creditor-input',
|
21
|
+
|
22
|
+
'creditor_bank_account' => 'creditor_bank_account-input'
|
23
|
+
|
31
24
|
},
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
"status" => "status-input",
|
40
|
-
|
41
|
-
|
25
|
+
|
26
|
+
'reference' => 'reference-input',
|
27
|
+
|
28
|
+
'status' => 'status-input'
|
29
|
+
|
42
30
|
}
|
43
31
|
end
|
44
32
|
|
45
|
-
it
|
33
|
+
it 'can be initialized from an unenveloped response' do
|
46
34
|
resource = described_class.new(data)
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
expect(resource.links.creditor).to eq("creditor-input")
|
67
|
-
|
68
|
-
expect(resource.links.creditor_bank_account).to eq("creditor_bank_account-input")
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
expect(resource.reference).to eq("reference-input")
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
expect(resource.status).to eq("status-input")
|
78
|
-
|
79
|
-
|
35
|
+
|
36
|
+
expect(resource.amount).to eq('amount-input')
|
37
|
+
|
38
|
+
expect(resource.arrival_date).to eq('arrival_date-input')
|
39
|
+
|
40
|
+
expect(resource.created_at).to eq('created_at-input')
|
41
|
+
|
42
|
+
expect(resource.currency).to eq('currency-input')
|
43
|
+
|
44
|
+
expect(resource.id).to eq('id-input')
|
45
|
+
|
46
|
+
expect(resource.links.creditor).to eq('creditor-input')
|
47
|
+
|
48
|
+
expect(resource.links.creditor_bank_account).to eq('creditor_bank_account-input')
|
49
|
+
|
50
|
+
expect(resource.reference).to eq('reference-input')
|
51
|
+
|
52
|
+
expect(resource.status).to eq('status-input')
|
80
53
|
end
|
81
54
|
|
82
|
-
it
|
83
|
-
data[
|
55
|
+
it 'can handle new attributes without erroring' do
|
56
|
+
data['foo'] = 'bar'
|
84
57
|
expect { described_class.new(data) }.to_not raise_error
|
85
58
|
end
|
86
59
|
|
87
|
-
|
88
|
-
|
89
|
-
data["links"]["foo"] = "bar"
|
60
|
+
it 'can handle new link attributes without erroring' do
|
61
|
+
data['links']['foo'] = 'bar'
|
90
62
|
expect { described_class.new(data) }.to_not raise_error
|
91
63
|
end
|
92
64
|
|
93
|
-
it
|
94
|
-
data[
|
65
|
+
it 'can handle a nil links value' do
|
66
|
+
data['links'] = nil
|
95
67
|
expect { described_class.new(data).links }.to_not raise_error
|
96
68
|
end
|
97
|
-
|
98
69
|
|
99
|
-
describe
|
100
|
-
it
|
70
|
+
describe '#to_h' do
|
71
|
+
it 'returns a hash representing the resource' do
|
101
72
|
expect(described_class.new(data).to_h).to eq(data)
|
102
73
|
end
|
103
74
|
end
|