affirm 1.1.0 → 1.1.1

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: f7e00e989ab313897e9c4276f4b75e33399cefdb
4
- data.tar.gz: a918946c0a75ffcf870e79208e8f4d30244a4ddb
3
+ metadata.gz: 34f638e6eed73ed23e64d833f61fee602aa1442a
4
+ data.tar.gz: aa1c16021a35a1a6321be3b63262f51c1860d231
5
5
  SHA512:
6
- metadata.gz: cf933ec1f98c796aeb348c80dcfe4d104528138a5ac47d2cff0041665efeec1651ee23f78302c4bf94517b507d185825a3aa2ae2099bf739ecd6791425b6ff03
7
- data.tar.gz: 7dc451129c89024fc10618b6932918ca7f0cf5cf0b641987fb542d9dccffafe829ef96a01cf4c97f1c031131286ceee0a89852b3033939ed25cafce0002f9adc
6
+ metadata.gz: 72566a23520ae4fb8854c9309b844e1b635545cdb0419baf84fea574d6bac78ebb8918254259a3f22f2c570780760028b42e5806bf729e542b520df306dd4f3d
7
+ data.tar.gz: 878d556017ec38e215adc1de57d80a7bb04a30cda82b338a37ba38ca26b62ccf4dcaf2e772eeaf3a1f723d35bc64a97aa90c80b9e6773077a9ba0456802c3cd3
data/affirm.gemspec CHANGED
@@ -2,7 +2,7 @@ Gem::Specification.new do |s|
2
2
  s.name = "affirm"
3
3
  s.summary = "Affirm Ruby Client Library"
4
4
  s.description = "Ruby client library for integrating with Affirm financing payments"
5
- s.version = "1.1.0"
5
+ s.version = "1.1.1"
6
6
  s.license = "Apache License Version 2.0"
7
7
  s.author = "Reverb.com"
8
8
  s.email = "dev@reverb.com"
@@ -1,3 +1,10 @@
1
1
  module Affirm
2
- class ChargeError < Error; end
2
+ class ChargeError < Error
3
+ DUPLICATE_CAPTURE_CODE = "duplicate-capture"
4
+
5
+ def duplicate_capture?
6
+ code.to_s == DUPLICATE_CAPTURE_CODE
7
+ end
8
+
9
+ end
3
10
  end
data/spec/charge_spec.rb CHANGED
@@ -124,6 +124,18 @@ describe Affirm::Charge do
124
124
  it "raises a charge error" do
125
125
  expect { charge.capture }.to raise_error(Affirm::ChargeError)
126
126
  end
127
+
128
+ context "when the failed response is a duplicate capture" do
129
+ let(:response_code) { 400 }
130
+ let(:response_body) { load_fixture("charges/duplicate_capture.json") }
131
+ it "the raised error is a duplicate capture" do
132
+ begin
133
+ charge.capture
134
+ rescue Affirm::ChargeError => e
135
+ e.should be_duplicate_capture
136
+ end
137
+ end
138
+ end
127
139
  end
128
140
  end
129
141
 
@@ -0,0 +1,5 @@
1
+ {
2
+ "status_code": 400,
3
+ "code": "duplicate-capture",
4
+ "message": "Duplicate capture"
5
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: affirm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reverb.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-15 00:00:00.000000000 Z
11
+ date: 2015-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -103,6 +103,7 @@ files:
103
103
  - spec/client_spec.rb
104
104
  - spec/fixtures/charges/capture.json
105
105
  - spec/fixtures/charges/create.json
106
+ - spec/fixtures/charges/duplicate_capture.json
106
107
  - spec/fixtures/charges/invalid_request.json
107
108
  - spec/fixtures/charges/refund.json
108
109
  - spec/fixtures/charges/retrieve.json