tres_delta 0.1.5 → 0.2.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
  SHA1:
3
- metadata.gz: 9f6c4326341b3554c9618b410c6a4173fcf9ea3f
4
- data.tar.gz: ff4701888db5698d1a932729bc8018b4e2219990
3
+ metadata.gz: c4dae42c72f22072a2044e3c913fb6ce35ffa2a1
4
+ data.tar.gz: 0641078552cd20d645ff1cbf803396607f2080b7
5
5
  SHA512:
6
- metadata.gz: 67db77e29f87b05472cc39bbf39a512aca86758310f2e99cffd2857915dd4277486f826fa3ab6ce3e0c85d9213ece55b2dcddfe0d16a2c81ed2aedf22d0d3449
7
- data.tar.gz: 645daa626f6dd681a9e694fd715abaeba2b44353e764394b8bc159c3a2735f655a1512fc6069bce175fc8f75db74842d117d9b532b2236fdffa98ec2787b4c0a
6
+ metadata.gz: e02848a7e4eed9e451f1411708311d1798e2a7a31360c0d40ac75771097a3f3ac19da804cdafb29873ae1a3b8f91a06eff20a673d15dc1e8c1c829a84b93a231
7
+ data.tar.gz: 77d8e93453fa1d0a8d765a5da78ffa35428bdeda88a7bb345445fd4fe04cba667315321dcc350899a5b42674ef8b6861d2b653e0531f3c9939f7fbfcd8567585
@@ -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
@@ -1,3 +1,3 @@
1
1
  module TresDelta
2
- VERSION = "0.1.5"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -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.1.5
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-02-01 00:00:00.000000000 Z
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.6
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...