chargehound 2.3.0 → 2.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 +4 -4
- data/CHANGELOG +2 -0
- data/lib/chargehound/api_request.rb +3 -0
- data/lib/chargehound/models.rb +3 -0
- data/lib/chargehound/version.rb +1 -1
- data/test/disputes_test.rb +67 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e80d07047ce895a670090420bdbd3d6f66095958fa0c4d2c1085e01172e84921
|
4
|
+
data.tar.gz: 67c975adfcc45bbf4e52431182e5eebea9e9faf0e75b94f129b4f00076b8f0e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36089c8a5fa6ffa8417d7be4890400d6965b3c7837b863d6bfc977839f21146a3275cfb34845f8a2472a61bf42efeaf406b8e330baac4f4b3b17b75d85b4e149
|
7
|
+
data.tar.gz: 63f28e567ec60579fa54262abc6dd126ac1351ade25e2ae91dd32df4c9a97b15e40a2fa5fc93d11726bfee74f7764f7fde5bafb10ae64c35d3e1a01521c6cd38
|
data/CHANGELOG
CHANGED
@@ -103,6 +103,9 @@ module Chargehound
|
|
103
103
|
dict['correspondence'] = dict.fetch('correspondence', []).map { |item|
|
104
104
|
CorrespondenceItem.new(item)
|
105
105
|
}
|
106
|
+
dict['past_payments'] = dict.fetch('past_payments', []).map { |item|
|
107
|
+
PastPayment.new(item)
|
108
|
+
}
|
106
109
|
Dispute.new(dict)
|
107
110
|
when 'list'
|
108
111
|
dict['data'].map! { |item| convert item }
|
data/lib/chargehound/models.rb
CHANGED
data/lib/chargehound/version.rb
CHANGED
data/test/disputes_test.rb
CHANGED
@@ -119,6 +119,46 @@ dispute_with_correspondence_info_response = {
|
|
119
119
|
]
|
120
120
|
}
|
121
121
|
|
122
|
+
dispute_with_past_payments_update = {
|
123
|
+
fields: {
|
124
|
+
customer_name: 'Susie'
|
125
|
+
},
|
126
|
+
past_payments: [
|
127
|
+
{
|
128
|
+
id: 'ch_1',
|
129
|
+
amount: 20_000,
|
130
|
+
currency: 'usd',
|
131
|
+
charged_at: '2019-09-10 11:09:41PM UTC'
|
132
|
+
}, {
|
133
|
+
id: 'ch_2',
|
134
|
+
amount: 50_000,
|
135
|
+
currency: 'usd',
|
136
|
+
charged_at: '2019-09-03 11:09:41PM UTC'
|
137
|
+
}
|
138
|
+
]
|
139
|
+
}
|
140
|
+
|
141
|
+
dispute_with_past_payments_response = {
|
142
|
+
id: 'dp_123',
|
143
|
+
object: 'dispute',
|
144
|
+
fields: {
|
145
|
+
customer_name: 'Susie'
|
146
|
+
},
|
147
|
+
past_payments: [
|
148
|
+
{
|
149
|
+
id: 'ch_1',
|
150
|
+
amount: 20_000,
|
151
|
+
currency: 'usd',
|
152
|
+
charged_at: '2019-09-10 11:09:41PM UTC'
|
153
|
+
}, {
|
154
|
+
id: 'ch_2',
|
155
|
+
amount: 50_000,
|
156
|
+
currency: 'usd',
|
157
|
+
charged_at: '2019-09-03 11:09:41PM UTC'
|
158
|
+
}
|
159
|
+
]
|
160
|
+
}
|
161
|
+
|
122
162
|
dispute_response = {
|
123
163
|
id: 'dp_123',
|
124
164
|
object: 'dispute'
|
@@ -188,7 +228,8 @@ describe Chargehound::Disputes do
|
|
188
228
|
id: 'dp_123',
|
189
229
|
object: 'dispute',
|
190
230
|
products: [],
|
191
|
-
correspondence: []
|
231
|
+
correspondence: [],
|
232
|
+
past_payments: []
|
192
233
|
}],
|
193
234
|
response: {
|
194
235
|
status: '200'
|
@@ -331,6 +372,31 @@ describe Chargehound::Disputes do
|
|
331
372
|
assert_requested stub
|
332
373
|
end
|
333
374
|
|
375
|
+
it 'can submit a dispute with past payments data' do
|
376
|
+
stub = stub_request(:post, 'https://api.chargehound.com/v1/disputes/dp_123/submit')
|
377
|
+
.with(headers: post_headers,
|
378
|
+
body: dispute_with_past_payments_update.to_json)
|
379
|
+
.to_return(body: dispute_with_past_payments_response.to_json,
|
380
|
+
status: 201)
|
381
|
+
|
382
|
+
Chargehound::Disputes.submit('dp_123', dispute_with_past_payments_update)
|
383
|
+
assert_requested stub
|
384
|
+
end
|
385
|
+
|
386
|
+
it 'has a model for past payments data' do
|
387
|
+
stub = stub_request(:post, 'https://api.chargehound.com/v1/disputes/dp_123/submit')
|
388
|
+
.with(headers: post_headers,
|
389
|
+
body: dispute_with_past_payments_update.to_json)
|
390
|
+
.to_return(body: dispute_with_past_payments_response.to_json,
|
391
|
+
status: 201)
|
392
|
+
|
393
|
+
dispute = Chargehound::Disputes.submit('dp_123',
|
394
|
+
dispute_with_past_payments_update)
|
395
|
+
|
396
|
+
assert_instance_of(Chargehound::PastPayment, dispute.past_payments[0])
|
397
|
+
assert_requested stub
|
398
|
+
end
|
399
|
+
|
334
400
|
it 'can update a dispute' do
|
335
401
|
stub = stub_request(:put, 'https://api.chargehound.com/v1/disputes/dp_123')
|
336
402
|
.with(headers: post_headers, body: dispute_update.to_json)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chargehound
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chargehound
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|