tres_delta 0.1.5 → 0.2.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/lib/tres_delta/gateway.rb +22 -0
- data/lib/tres_delta/version.rb +1 -1
- data/spec/tres_delta/gateway_spec.rb +27 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4dae42c72f22072a2044e3c913fb6ce35ffa2a1
|
4
|
+
data.tar.gz: 0641078552cd20d645ff1cbf803396607f2080b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e02848a7e4eed9e451f1411708311d1798e2a7a31360c0d40ac75771097a3f3ac19da804cdafb29873ae1a3b8f91a06eff20a673d15dc1e8c1c829a84b93a231
|
7
|
+
data.tar.gz: 77d8e93453fa1d0a8d765a5da78ffa35428bdeda88a7bb345445fd4fe04cba667315321dcc350899a5b42674ef8b6861d2b653e0531f3c9939f7fbfcd8567585
|
data/lib/tres_delta/gateway.rb
CHANGED
@@ -29,6 +29,28 @@ module TresDelta
|
|
29
29
|
}
|
30
30
|
end
|
31
31
|
|
32
|
+
def capture(transaction_key, customer_code, card_token, amount)
|
33
|
+
request :capture, capture_params(transaction_key, customer_code, card_token, amount)
|
34
|
+
end
|
35
|
+
|
36
|
+
def capture_params(transaction_key, customer_code, card_token, amount)
|
37
|
+
{
|
38
|
+
'clientCredentials' => client_credentials,
|
39
|
+
'captureParams' => {
|
40
|
+
'CreditCardTransaction' => {
|
41
|
+
'CurrencyCode' => 'USDollars',
|
42
|
+
'StoredCardIdentifier' => {
|
43
|
+
'CustomerCode' => customer_code,
|
44
|
+
'Token' => card_token
|
45
|
+
},
|
46
|
+
'TotalAmount' => amount,
|
47
|
+
'TransactionKey' => transaction_key
|
48
|
+
},
|
49
|
+
'TerminalIdentifier' => terminal_identifier
|
50
|
+
}
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
32
54
|
def card_verification(transaction_key, credit_card)
|
33
55
|
request(:card_verification, card_verification_params(transaction_key, credit_card))
|
34
56
|
end
|
data/lib/tres_delta/version.rb
CHANGED
@@ -187,4 +187,31 @@ describe TresDelta::Gateway do
|
|
187
187
|
end
|
188
188
|
end
|
189
189
|
end
|
190
|
+
|
191
|
+
describe "capture" do
|
192
|
+
let(:order_number) { SecureRandom.hex(6) }
|
193
|
+
let(:amount) { 13.37 }
|
194
|
+
let(:address_params) { { address: good_address, zip_code: zip_code_good} }
|
195
|
+
let(:auth_response) { gateway.authorize(transaction_key, credit_card, amount, order_number, customer) }
|
196
|
+
let(:vault) { TresDelta::Vault }
|
197
|
+
let(:token) { auth_response.token }
|
198
|
+
let(:response) { gateway.capture(transaction_key, customer.vault_key, token, amount) }
|
199
|
+
|
200
|
+
before(:each) do
|
201
|
+
vault.create_customer(customer)
|
202
|
+
end
|
203
|
+
|
204
|
+
it "captures the authorization" do
|
205
|
+
expect(response.success?).to be_truthy
|
206
|
+
end
|
207
|
+
|
208
|
+
context "we try to capture even _more_ funds" do
|
209
|
+
let(:second_response) { gateway.capture(transaction_key, customer.vault_key, token, amount) }
|
210
|
+
|
211
|
+
it "captures the first request, but fails the second" do
|
212
|
+
expect(response.success?).to be_truthy
|
213
|
+
expect(second_response.success?).to be_falsey
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
190
217
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tres_delta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 1000Bulbs
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-05-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: savon
|
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
119
|
version: '0'
|
120
120
|
requirements: []
|
121
121
|
rubyforge_project:
|
122
|
-
rubygems_version: 2.4.
|
122
|
+
rubygems_version: 2.4.8
|
123
123
|
signing_key:
|
124
124
|
specification_version: 4
|
125
125
|
summary: If you need to talk to 3Delta's credit card vault/payment gateway in Ruby...
|