chargehound 2.3.0 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 10e5712b827a309931649f02599f15bfadcbf841e51c6dd2d6fdd1e983f45f3c
4
- data.tar.gz: 465c1d4f2234ff6ee6935d743a02c91a7b297ef5b24bfb7140caa5643379deb1
3
+ metadata.gz: e80d07047ce895a670090420bdbd3d6f66095958fa0c4d2c1085e01172e84921
4
+ data.tar.gz: 67c975adfcc45bbf4e52431182e5eebea9e9faf0e75b94f129b4f00076b8f0e6
5
5
  SHA512:
6
- metadata.gz: 00a639c1ecf429abc9d2a002f54200c0f842e5fba32d81443b593dec097a71c0c09f8922bca0f063ab2834510bb3cfd4a20ec7505cede0fdb5285643dc29488d
7
- data.tar.gz: 6a1676b358c82754387827303a85d32ac94d87847a4ffd6f01d4551c2d1349a186fb3c7d66ffed80cc76c90ad12e0a09528746e89c8476d8ad06436111be6e65
6
+ metadata.gz: 36089c8a5fa6ffa8417d7be4890400d6965b3c7837b863d6bfc977839f21146a3275cfb34845f8a2472a61bf42efeaf406b8e330baac4f4b3b17b75d85b4e149
7
+ data.tar.gz: 63f28e567ec60579fa54262abc6dd126ac1351ade25e2ae91dd32df4c9a97b15e40a2fa5fc93d11726bfee74f7764f7fde5bafb10ae64c35d3e1a01521c6cd38
data/CHANGELOG CHANGED
@@ -20,3 +20,5 @@
20
20
  - Update docs
21
21
  2.3.0 April, 2019
22
22
  - Add Correspondence model
23
+ 2.4.0 Sept, 2019
24
+ - Add PastPayment model
@@ -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 }
@@ -43,6 +43,9 @@ module Chargehound
43
43
  class CorrespondenceItem < ChargehoundObject
44
44
  end
45
45
 
46
+ class PastPayment < ChargehoundObject
47
+ end
48
+
46
49
  # Expose response properties via this struct on response objects
47
50
  HTTPResponse = Struct.new(:status)
48
51
  end
@@ -1,3 +1,3 @@
1
1
  module Chargehound
2
- VERSION = '2.3.0'.freeze
2
+ VERSION = '2.4.0'.freeze
3
3
  end
@@ -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.3.0
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-04-05 00:00:00.000000000 Z
11
+ date: 2019-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler