killbill-cybersource 4.0.1 → 4.0.2

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: 70b683af2803875628c898a0e286c606904729e5
4
- data.tar.gz: 5c89305ff541fb3bafc46b17af392c2f33ff8f29
3
+ metadata.gz: 9b493be89fec342f29d8b2301b33df6d1fb2242f
4
+ data.tar.gz: af046593004ae23ac977ea4c818df2fc53620e5d
5
5
  SHA512:
6
- metadata.gz: c24e46930e496e0dc56ed77e2e67c1207ebcbaf5fd164c86090cfdb3b975e7b3c1df59e337ae93355ca63ba40a0cd732aaffb3970bb76ffde06995ad403bf8fc
7
- data.tar.gz: f0823fc7f52a074d5b6b8bd8cd847dbd2762d27fddb5c0e19123466a03a34bfe415391b9431511ca31d4511626222caeaf495a29c97141ffc030047984d02d9c
6
+ metadata.gz: 1f76a9a57ab6780e4bfefc3deb1429a7d86cfba8efb70bc45d0ac058557c36edf0912cdd6a87209dd699ba0bfd4fbcbbfbfaeb46a1ce6a4447aca02bbff59b5a
7
+ data.tar.gz: fd5086b9920e5cc9b734b094b94952e428b37b19d41f9bc4879fec8f3051ed85812aedd9440a94ca6eec5da944c507275ddd6747a19e17806b55212b9443fdee
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- killbill-cybersource (4.0.1)
4
+ killbill-cybersource (4.0.2)
5
5
  actionpack (~> 4.1.0)
6
6
  actionview (~> 4.1.0)
7
7
  activemerchant (~> 1.48.0)
@@ -19,13 +19,13 @@ PATH
19
19
  GEM
20
20
  remote: https://rubygems.org/
21
21
  specs:
22
- actionpack (4.1.14)
23
- actionview (= 4.1.14)
24
- activesupport (= 4.1.14)
22
+ actionpack (4.1.15)
23
+ actionview (= 4.1.15)
24
+ activesupport (= 4.1.15)
25
25
  rack (~> 1.5.2)
26
26
  rack-test (~> 0.6.2)
27
- actionview (4.1.14)
28
- activesupport (= 4.1.14)
27
+ actionview (4.1.15)
28
+ activesupport (= 4.1.15)
29
29
  builder (~> 3.1)
30
30
  erubis (~> 2.7.0)
31
31
  active_utils (3.0.0)
@@ -36,17 +36,17 @@ GEM
36
36
  builder (>= 2.1.2, < 4.0.0)
37
37
  i18n (>= 0.6.9)
38
38
  nokogiri (~> 1.4)
39
- activemodel (4.1.14)
40
- activesupport (= 4.1.14)
39
+ activemodel (4.1.15)
40
+ activesupport (= 4.1.15)
41
41
  builder (~> 3.1)
42
- activerecord (4.1.14)
43
- activemodel (= 4.1.14)
44
- activesupport (= 4.1.14)
42
+ activerecord (4.1.15)
43
+ activemodel (= 4.1.15)
44
+ activesupport (= 4.1.15)
45
45
  arel (~> 5.0.0)
46
46
  activerecord-bogacs (0.4.1)
47
- activerecord-jdbc-adapter (1.3.19)
47
+ activerecord-jdbc-adapter (1.3.20)
48
48
  activerecord (>= 2.2)
49
- activesupport (4.1.14)
49
+ activesupport (4.1.15)
50
50
  i18n (~> 0.6, >= 0.6.9)
51
51
  json (~> 1.7, >= 1.7.7)
52
52
  minitest (~> 5.1)
@@ -78,21 +78,21 @@ GEM
78
78
  ruby-maven (~> 3.3, >= 3.3.3)
79
79
  jdbc-mariadb (1.2.3)
80
80
  jdbc-sqlite3 (3.8.11.2)
81
- jruby-openssl (0.9.12-java)
81
+ jruby-openssl (0.9.16-java)
82
82
  json (1.8.3-java)
83
- killbill (7.0.1)
83
+ killbill (7.0.3)
84
84
  rack (>= 1.5.2)
85
85
  sinatra (~> 1.3.4)
86
86
  typhoeus (~> 0.6.9)
87
87
  tzinfo (~> 1.2.0)
88
88
  maven-tools (1.0.13)
89
89
  virtus (~> 1.0)
90
- minitest (5.8.3)
90
+ minitest (5.8.4)
91
91
  monetize (1.1.0)
92
92
  money (~> 6.5.0)
93
93
  money (6.5.1)
94
94
  i18n (>= 0.6.4, <= 0.7.0)
95
- nokogiri (1.6.7.1-java)
95
+ nokogiri (1.6.7.2-java)
96
96
  offsite_payments (2.1.0)
97
97
  actionpack (>= 3.2.20, < 5.0.0)
98
98
  active_utils (~> 3.0.0)
@@ -146,4 +146,4 @@ DEPENDENCIES
146
146
  rspec (~> 2.12.0)
147
147
 
148
148
  BUNDLED WITH
149
- 1.10.6
149
+ 1.11.2
data/NEWS CHANGED
@@ -1,3 +1,8 @@
1
+ 4.0.2
2
+ Add support for auth reversal after voiding a capture
3
+ Add support for ignore_avs and ignore_cvv properties
4
+ https://github.com/killbill/killbill-cybersource-plugin/issues/5
5
+
1
6
  4.0.1
2
7
  Add support for standalone credits on CreditCards
3
8
 
data/README.md CHANGED
@@ -135,6 +135,8 @@ Plugin properties
135
135
  | skip_gw | If true, skip the call to CyberSource |
136
136
  | payment_processor_account_id | Config entry name of the merchant account to use |
137
137
  | external_key_as_order_id | If true, set the payment external key as the CyberSource order id |
138
+ | ignore_avs | If true, ignore the results of AVS checking |
139
+ | ignore_cvv | If true, ignore the results of CVN checking |
138
140
  | cc_first_name | Credit card holder first name |
139
141
  | cc_last_name | Credit card holder last name |
140
142
  | cc_type | Credit card brand |
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.0.1
1
+ 4.0.2
@@ -282,6 +282,9 @@ module Killbill #:nodoc:
282
282
  end
283
283
  options[:email] = email
284
284
  end
285
+
286
+ ::Killbill::Plugin::ActiveMerchant::Utils.normalize_property(properties, 'ignore_avs')
287
+ ::Killbill::Plugin::ActiveMerchant::Utils.normalize_property(properties, 'ignore_cvv')
285
288
  end
286
289
 
287
290
  def get_report_api(kb_tenant_id)
@@ -25,9 +25,14 @@ module ActiveMerchant
25
25
  response = parse(raw_response)
26
26
 
27
27
  success = response[:decision] == 'ACCEPT'
28
- message = @@response_codes[('r' + response[:reasonCode]).to_sym] rescue response[:message]
29
28
  authorization = success ? [options[:order_id], response[:requestID], response[:requestToken]].compact.join(";") : nil
30
29
 
30
+ if response[:faultcode] == 'wsse:FailedCheck'
31
+ message = { :exception_message => response[:message], :payment_plugin_status => :CANCELED }.to_json
32
+ else
33
+ message = @@response_codes[('r' + response[:reasonCode]).to_sym] rescue response[:message]
34
+ end
35
+
31
36
  Response.new(success, message, response,
32
37
  :test => test?,
33
38
  :authorization => authorization,
data/pom.xml CHANGED
@@ -25,7 +25,7 @@
25
25
  <groupId>org.kill-bill.billing.plugin.ruby</groupId>
26
26
  <artifactId>cybersource-plugin</artifactId>
27
27
  <packaging>pom</packaging>
28
- <version>4.0.1</version>
28
+ <version>4.0.2</version>
29
29
  <name>cybersource-plugin</name>
30
30
  <url>http://github.com/killbill/killbill-cybersource-plugin</url>
31
31
  <description>Plugin for accessing Cybersource as a payment gateway</description>
@@ -46,6 +46,66 @@ describe Killbill::Cybersource::PaymentPlugin do
46
46
  end
47
47
  end
48
48
 
49
+ context 'Business Rules' do
50
+
51
+ it 'does not ignore AVS nor CVN' do
52
+ ::ActiveMerchant::Billing::CyberSourceGateway.any_instance.stub(:ssl_post) do |host, request_body|
53
+ request_body.should_not match('<ignoreAVSResult>')
54
+ request_body.should_not match('<ignoreCVResult>')
55
+ successful_purchase_response
56
+ end
57
+ purchase
58
+ purchase(:PROCESSED, [build_property('ignore_avs', 'false'), build_property('ignore_cvv', 'false')])
59
+ end
60
+
61
+ it 'ignores AVS and CVN' do
62
+ ::ActiveMerchant::Billing::CyberSourceGateway.any_instance.stub(:ssl_post) do |host, request_body|
63
+ request_body.should match('<ignoreAVSResult>')
64
+ request_body.should match('<ignoreCVResult>')
65
+ successful_purchase_response
66
+ end
67
+ purchase(:PROCESSED, [build_property('ignore_avs', 'true'), build_property('ignore_cvv', 'true')])
68
+ end
69
+
70
+ it 'ignores AVS but not CVN' do
71
+ ::ActiveMerchant::Billing::CyberSourceGateway.any_instance.stub(:ssl_post) do |host, request_body|
72
+ request_body.should match('<ignoreAVSResult>')
73
+ request_body.should_not match('<ignoreCVResult>')
74
+ successful_purchase_response
75
+ end
76
+ purchase(:PROCESSED, [build_property('ignore_avs', 'true')])
77
+ purchase(:PROCESSED, [build_property('ignore_avs', 'true'), build_property('ignore_cvv', 'false')])
78
+ end
79
+
80
+ it 'ignores CVN but not AVS' do
81
+ ::ActiveMerchant::Billing::CyberSourceGateway.any_instance.stub(:ssl_post) do |host, request_body|
82
+ request_body.should_not match('<ignoreAVSResult>')
83
+ request_body.should match('<ignoreCVResult>')
84
+ successful_purchase_response
85
+ end
86
+ purchase(:PROCESSED, [build_property('ignore_cvv', 'true')])
87
+ purchase(:PROCESSED, [build_property('ignore_avs', 'false'), build_property('ignore_cvv', 'true')])
88
+ end
89
+ end
90
+
91
+ context 'Errors handling' do
92
+
93
+ it 'handles expired passwords as CANCELED transactions' do
94
+ ::ActiveMerchant::Billing::CyberSourceGateway.any_instance.stub(:ssl_post).and_return(password_expired_response)
95
+ purchase(:CANCELED).gateway_error.should == 'wsse:FailedCheck: Security Data : Merchant password has expired.'
96
+ end
97
+
98
+ it 'handles bad passwords as CANCELED transactions' do
99
+ ::ActiveMerchant::Billing::CyberSourceGateway.any_instance.stub(:ssl_post).and_return(bad_password_response)
100
+ purchase(:CANCELED).gateway_error.should == 'wsse:FailedCheck: Security Data : UsernameToken authentication failed.'
101
+ end
102
+
103
+ it 'handles unsuccessful authorizations as ERROR transactions' do
104
+ ::ActiveMerchant::Billing::CyberSourceGateway.any_instance.stub(:ssl_post).and_return(unsuccessful_authorization_response)
105
+ purchase(:ERROR).gateway_error.should == 'Invalid account number'
106
+ end
107
+ end
108
+
49
109
  private
50
110
 
51
111
  def with_transaction(kb_payment_id, transaction_type, created_at, context)
@@ -64,4 +124,49 @@ describe Killbill::Cybersource::PaymentPlugin do
64
124
  ensure
65
125
  t.destroy! unless t.nil?
66
126
  end
127
+
128
+ def purchase(expected_status = :PROCESSED, properties = [])
129
+ kb_payment_id = SecureRandom.uuid
130
+ kb_payment = @plugin.kb_apis.proxied_services[:payment_api].add_payment(kb_payment_id)
131
+ kb_transaction_id = kb_payment.transactions[0].id
132
+
133
+ properties << build_property('email', 'foo@bar.com')
134
+ properties << build_property('token', '1234')
135
+
136
+ payment_response = @plugin.purchase_payment(SecureRandom.uuid, kb_payment_id, kb_transaction_id, SecureRandom.uuid, BigDecimal.new('100'), 'USD', properties, build_call_context)
137
+ payment_response.status.should eq(expected_status), payment_response.gateway_error
138
+ payment_response
139
+ end
140
+
141
+ def successful_purchase_response
142
+ <<-XML
143
+ <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
144
+ <soap:Header>
145
+ <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsu:Timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="Timestamp-2636690"><wsu:Created>2008-01-15T21:42:03.343Z</wsu:Created></wsu:Timestamp></wsse:Security></soap:Header><soap:Body><c:replyMessage xmlns:c="urn:schemas-cybersource-com:transaction-data-1.26"><c:merchantReferenceCode>b0a6cf9aa07f1a8495f89c364bbd6a9a</c:merchantReferenceCode><c:requestID>2004333231260008401927</c:requestID><c:decision>ACCEPT</c:decision><c:reasonCode>100</c:reasonCode><c:requestToken>Afvvj7Ke2Fmsbq0wHFE2sM6R4GAptYZ0jwPSA+R9PhkyhFTb0KRjoE4+ynthZrG6tMBwjAtT</c:requestToken><c:purchaseTotals><c:currency>USD</c:currency></c:purchaseTotals><c:ccAuthReply><c:reasonCode>100</c:reasonCode><c:amount>1.00</c:amount><c:authorizationCode>123456</c:authorizationCode><c:avsCode>Y</c:avsCode><c:avsCodeRaw>Y</c:avsCodeRaw><c:cvCode>M</c:cvCode><c:cvCodeRaw>M</c:cvCodeRaw><c:authorizedDateTime>2008-01-15T21:42:03Z</c:authorizedDateTime><c:processorResponse>00</c:processorResponse><c:authFactorCode>U</c:authFactorCode></c:ccAuthReply></c:replyMessage></soap:Body></soap:Envelope>
146
+ XML
147
+ end
148
+
149
+ def password_expired_response
150
+ <<-XML
151
+ <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
152
+ <soap:Header>
153
+ <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsu:Timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="Timestamp-2636690"><wsu:Created>2008-01-15T21:42:03.343Z</wsu:Created></wsu:Timestamp></wsse:Security></soap:Header><soap:Body><soap:Fault xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:c="urn:schemas-cybersource-com:transaction-data-1.0"><faultcode>wsse:FailedCheck</faultcode><faultstring>Security Data : Merchant password has expired.</faultstring></soap:Fault></soap:Body></soap:Envelope>
154
+ XML
155
+ end
156
+
157
+ def bad_password_response
158
+ <<-XML
159
+ <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
160
+ <soap:Header>
161
+ <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsu:Timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="Timestamp-2636690"><wsu:Created>2008-01-15T21:42:03.343Z</wsu:Created></wsu:Timestamp></wsse:Security></soap:Header><soap:Body><soap:Fault xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:c="urn:schemas-cybersource-com:transaction-data-1.0"><faultcode>wsse:FailedCheck</faultcode><faultstring>Security Data : UsernameToken authentication failed.</faultstring></soap:Fault></soap:Body></soap:Envelope>
162
+ XML
163
+ end
164
+
165
+ def unsuccessful_authorization_response
166
+ <<-XML
167
+ <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
168
+ <soap:Header>
169
+ <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsu:Timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="Timestamp-28121162"><wsu:Created>2008-01-15T21:50:41.580Z</wsu:Created></wsu:Timestamp></wsse:Security></soap:Header><soap:Body><c:replyMessage xmlns:c="urn:schemas-cybersource-com:transaction-data-1.26"><c:merchantReferenceCode>a1efca956703a2a5037178a8a28f7357</c:merchantReferenceCode><c:requestID>2004338415330008402434</c:requestID><c:decision>REJECT</c:decision><c:reasonCode>231</c:reasonCode><c:requestToken>Afvvj7KfIgU12gooCFE2/DanQIApt+G1OgTSA+R9PTnyhFTb0KRjgFY+ynyIFNdoKKAghwgx</c:requestToken><c:ccAuthReply><c:reasonCode>231</c:reasonCode></c:ccAuthReply></c:replyMessage></soap:Body></soap:Envelope>
170
+ XML
171
+ end
67
172
  end
@@ -214,6 +214,16 @@ describe Killbill::Cybersource::PaymentPlugin do
214
214
  payment_response = @plugin.void_payment(@pm.kb_account_id, @kb_payment.id, @kb_payment.transactions[2].id, @pm.kb_payment_method_id, @properties, @call_context)
215
215
  payment_response.status.should eq(:PROCESSED), payment_response.gateway_error
216
216
  payment_response.transaction_type.should == :VOID
217
+ Killbill::Cybersource::CybersourceResponse.last.params_amount.should == '10.00'
218
+
219
+ # From the CyberSource documentation:
220
+ # When you void a capture, a hold remains on the unused credit card funds. If you are not going to re-capture the authorization as described in "Capture After Void," page 71, and if
221
+ # your processor supports authorization reversal after void as described in "Authorization Reversal After Void," page 39, CyberSource recommends that you request an authorization reversal
222
+ # to release the hold on the unused credit card funds.
223
+ payment_response = @plugin.void_payment(@pm.kb_account_id, @kb_payment.id, @kb_payment.transactions[3].id, @pm.kb_payment_method_id, @properties, @call_context)
224
+ payment_response.status.should eq(:PROCESSED), payment_response.gateway_error
225
+ payment_response.transaction_type.should == :VOID
226
+ Killbill::Cybersource::CybersourceResponse.last.params_amount.should == '100.00'
217
227
  end
218
228
 
219
229
  it 'should be able to credit' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: killbill-cybersource
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1
4
+ version: 4.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kill Bill core team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-17 00:00:00.000000000 Z
11
+ date: 2016-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: killbill