easybill 0.2.17 → 0.2.18

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
  SHA1:
3
- metadata.gz: db9c7e5fbf2f0dce0f22b7d1f39e084c8f9de86b
4
- data.tar.gz: 4da8f71c973ed2478394a282f1565854783df254
3
+ metadata.gz: 18aed9fd911fb721123bef8409e5c6b4b82f4abf
4
+ data.tar.gz: 785f4ef18fb4c089a99b7864c4dd92fc6c427494
5
5
  SHA512:
6
- metadata.gz: 08e76ed6811ec5901323ec690aeafc8ea1bf6522c467dc15ab334c7e388be54950f83f3000d6ecba22ee00364e75af81bdadab804e94274a6db51740f9f6e3f5
7
- data.tar.gz: d792eee33d7edd5bf772d6ee96f323602d9dbaf0524863200a51c5ddd600dedac4195729f1f701c0c6bc2717edc725c9bb4783c88e0e1590a5f724205630cc8c
6
+ metadata.gz: 51e4f72f81a81eca6f105e254412d26c1710e5318ba09b4effa61fed9810d601eed0cb701e2a0dcd81fa625741e583982b8e4fd7472cec496a1817325da4c02a
7
+ data.tar.gz: 3ea58b28ab0616912cd69c486da2452d68325720c9048fecc5c6fbccac53d9f709d062f832d52703c003a186467abbfa437744f3bb9f74d95525cfcb27857ad4
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -63,7 +63,15 @@ module Easybill
63
63
  response = yield
64
64
 
65
65
  begin
66
- if response.body.empty? || (response.body.is_a?(Hash) && response.body.key?(:fault))
66
+ if response.body.is_a?(Hash) && response.body.key?(:fault)
67
+ # Work around issue on Easybill's side.
68
+ if response.body[:fault][:faultstring] ==
69
+ 'Call to undefined method StandardDocumentStorno::isPayed()'
70
+ return OpenStruct.new(body: {
71
+ get_document_payments_response: { payed: false, to_pay: '0' }
72
+ })
73
+ end
74
+
67
75
  fail Easybill::Error, response.body[:fault][:faultstring]
68
76
  end
69
77
  rescue NoMethodError
@@ -1,3 +1,3 @@
1
1
  module Easybill
2
- VERSION = '0.2.17'
2
+ VERSION = '0.2.18'
3
3
  end
@@ -186,4 +186,11 @@ describe Easybill::Client do
186
186
  )
187
187
  end
188
188
  end
189
+
190
+ context 'workarounds' do
191
+ it 'returns an empty list for payments on a cancelled (storno) document', :vcr do
192
+ expect(subject.get_document_payments(24356039))
193
+ .to eq([Easybill::Payment.new(payed: false, to_pay: '0')])
194
+ end
195
+ end
189
196
  end
@@ -0,0 +1,50 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://soap2.easybill.de/webservices/webservice4/soap.easybill.php
6
+ body:
7
+ encoding: UTF-8
8
+ string: |
9
+ <env:Envelope xmlns:lol0="http://www.easybill.de/webservice/" xmlns:lol1="http://www.easybill.de/webservice/document/" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
10
+ <env:Header>
11
+ <lol0:UserAuthKey>easybill-api-key</lol0:UserAuthKey>
12
+ </env:Header>
13
+ <env:Body>
14
+ <lol1:GetDocumentPaymentsRequest>24356039</lol1:GetDocumentPaymentsRequest>
15
+ </env:Body>
16
+ </env:Envelope>
17
+ headers:
18
+ User-Agent:
19
+ - HTTPClient/1.0 (2.6.0.1, ruby 2.2.0 (2014-12-25))
20
+ Accept:
21
+ - "*/*"
22
+ Date:
23
+ - Fri, 16 Jan 2015 16:36:01 GMT
24
+ Soapaction:
25
+ - '"http://www.easybill.de/webservice/payments/getDocumentPayments"'
26
+ Content-Type:
27
+ - text/xml;charset=UTF-8
28
+ response:
29
+ status:
30
+ code: 500
31
+ message: Internal Service Error
32
+ headers:
33
+ Server:
34
+ - nginx/1.6.2
35
+ Date:
36
+ - Fri, 16 Jan 2015 16:36:07 GMT
37
+ Content-Type:
38
+ - text/xml; charset=utf-8
39
+ Content-Length:
40
+ - '325'
41
+ Connection:
42
+ - keep-alive
43
+ body:
44
+ encoding: UTF-8
45
+ string: |
46
+ <?xml version="1.0" encoding="UTF-8"?>
47
+ <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>Call to undefined method StandardDocumentStorno::isPayed()</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
48
+ http_version:
49
+ recorded_at: Fri, 16 Jan 2015 16:36:07 GMT
50
+ recorded_with: VCR 2.9.3
@@ -47,6 +47,7 @@ end
47
47
  ENV['EASYBILL_API_KEY'] = 'easybill-api-key' if ENV['EASYBILL_API_KEY'].nil?
48
48
 
49
49
  VCR.configure do |c|
50
+ c.configure_rspec_metadata!
50
51
  c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
51
52
  c.hook_into :webmock
52
53
  c.filter_sensitive_data('easybill-api-key') { Easybill.configuration.api_key }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easybill
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.17
4
+ version: 0.2.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - ad2games GmbH
@@ -121,6 +121,7 @@ files:
121
121
  - Gemfile
122
122
  - LICENSE.txt
123
123
  - README.md
124
+ - Rakefile
124
125
  - easybill.gemspec
125
126
  - lib/easybill.rb
126
127
  - lib/easybill/client.rb
@@ -138,6 +139,7 @@ files:
138
139
  - spec/easybill/document_spec.rb
139
140
  - spec/easybill_spec.rb
140
141
  - spec/fixtures/fixtures.yml
142
+ - spec/fixtures/vcr_cassettes/Easybill_Client/workarounds/returns_an_empty_list_for_payments_on_a_cancelled_storno_document.yml
141
143
  - spec/fixtures/vcr_cassettes/add_document_payment_-_adds_a_payment_.yml
142
144
  - spec/fixtures/vcr_cassettes/create_document_-_raises_Easybill_Error_if_unsuccessful_.yml
143
145
  - spec/fixtures/vcr_cassettes/create_document_-_returns_an_Easybill_Document_on_success_.yml
@@ -194,6 +196,7 @@ test_files:
194
196
  - spec/easybill/document_spec.rb
195
197
  - spec/easybill_spec.rb
196
198
  - spec/fixtures/fixtures.yml
199
+ - spec/fixtures/vcr_cassettes/Easybill_Client/workarounds/returns_an_empty_list_for_payments_on_a_cancelled_storno_document.yml
197
200
  - spec/fixtures/vcr_cassettes/add_document_payment_-_adds_a_payment_.yml
198
201
  - spec/fixtures/vcr_cassettes/create_document_-_raises_Easybill_Error_if_unsuccessful_.yml
199
202
  - spec/fixtures/vcr_cassettes/create_document_-_returns_an_Easybill_Document_on_success_.yml