fingertips-adyen 0.3.8.20100930.2 → 0.3.8.20101007

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/TODO +0 -2
  2. data/lib/adyen.rb +1 -1
  3. data/lib/adyen/api.rb +4 -3
  4. data/spec/api_spec.rb +25 -0
  5. metadata +4 -5
data/TODO CHANGED
@@ -10,5 +10,3 @@
10
10
  * adyen-activemerchant
11
11
 
12
12
  = API
13
-
14
- * Add Response#errors which returns validation errors from the SOAP API
data/lib/adyen.rb CHANGED
@@ -13,7 +13,7 @@ module Adyen
13
13
  # Version constant for the Adyen plugin.
14
14
  # DO NOT CHANGE THIS VALUE BY HAND. It will be updated automatically by
15
15
  # the gem:release rake task.
16
- VERSION = "0.3.8.20100930.2"
16
+ VERSION = "0.3.8.20101007"
17
17
 
18
18
  # Loads configuration settings from a Hash.
19
19
  #
data/lib/adyen/api.rb CHANGED
@@ -325,7 +325,7 @@ module Adyen
325
325
  :psp_reference => result.text('./payment:pspReference'),
326
326
  :result_code => result.text('./payment:resultCode'),
327
327
  :auth_code => result.text('./payment:authCode'),
328
- :refusal_reason => result.text('./payment:refusalReason')
328
+ :refusal_reason => (invalid_request? ? fault_message : result.text('./payment:refusalReason'))
329
329
  }
330
330
  end
331
331
  end
@@ -399,9 +399,10 @@ module Adyen
399
399
 
400
400
  def params
401
401
  @params ||= xml_querier.xpath('//recurring:listRecurringDetailsResponse/recurring:result') do |result|
402
- {
402
+ details = result.xpath('.//recurring:RecurringDetail')
403
+ details.empty? ? {} : {
403
404
  :creation_date => DateTime.parse(result.text('./recurring:creationDate')),
404
- :details => result.xpath('.//recurring:RecurringDetail').map { |node| parse_recurring_detail(node) },
405
+ :details => details.map { |node| parse_recurring_detail(node) },
405
406
  :last_known_shopper_email => result.text('./recurring:lastKnownShopperEmail'),
406
407
  :shopper_reference => result.text('./recurring:shopperReference')
407
408
  }
data/spec/api_spec.rb CHANGED
@@ -440,6 +440,11 @@ describe Adyen::API do
440
440
  @response.should be_invalid_request
441
441
  end
442
442
 
443
+ it "returns the fault message from #refusal_reason" do
444
+ @response.refusal_reason.should == 'validation 101 Invalid card number'
445
+ @response.params[:refusal_reason].should == 'validation 101 Invalid card number'
446
+ end
447
+
443
448
  it "returns creditcard validation errors" do
444
449
  [
445
450
  ["validation 101 Invalid card number", [:number, 'is not a valid creditcard number']],
@@ -676,6 +681,11 @@ describe Adyen::API do
676
681
  end
677
682
 
678
683
  it_should_have_shortcut_methods_for_params_on_the_response
684
+
685
+ it "returns an empty hash when there are no details" do
686
+ stub_net_http(LIST_EMPTY_RESPONSE)
687
+ @recurring.list.params.should == {}
688
+ end
679
689
  end
680
690
 
681
691
  describe "disable_request_body" do
@@ -867,6 +877,21 @@ LIST_RESPONSE = <<EOS
867
877
  </soap:Envelope>
868
878
  EOS
869
879
 
880
+ LIST_EMPTY_RESPONSE = <<EOS
881
+ <?xml version="1.0"?>
882
+ <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
883
+ <soap:Body>
884
+ <ns1:listRecurringDetailsResponse xmlns:ns1="http://recurring.services.adyen.com">
885
+ <ns1:result>
886
+ <details xmlns="http://recurring.services.adyen.com"/>
887
+ <lastKnownShopperEmail xmlns="http://recurring.services.adyen.com" xsi:nil="true"/>
888
+ <shopperReference xmlns="http://recurring.services.adyen.com" xsi:nil="true"/>
889
+ </ns1:result>
890
+ </ns1:listRecurringDetailsResponse>
891
+ </soap:Body>
892
+ </soap:Envelope>
893
+ EOS
894
+
870
895
  DISABLE_RESPONSE = <<EOS
871
896
  <?xml version="1.0"?>
872
897
  <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fingertips-adyen
3
3
  version: !ruby/object:Gem::Version
4
- hash: 80403907
4
+ hash: 40202089
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
9
  - 8
10
- - 20100930
11
- - 2
12
- version: 0.3.8.20100930.2
10
+ - 20101007
11
+ version: 0.3.8.20101007
13
12
  platform: ruby
14
13
  authors:
15
14
  - Willem van Bergen
@@ -20,7 +19,7 @@ autorequire:
20
19
  bindir: bin
21
20
  cert_chain: []
22
21
 
23
- date: 2010-09-30 00:00:00 +02:00
22
+ date: 2010-10-07 00:00:00 +02:00
24
23
  default_executable:
25
24
  dependencies:
26
25
  - !ruby/object:Gem::Dependency