killbill-orbital 0.1.2 → 0.1.3

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: caf9e96477c8998f8775bafa6ac5880e9864ff52
4
- data.tar.gz: a2db465f2f8dbbba3f2f348ad04946147fe62acd
3
+ metadata.gz: 5fdf4dd372bc62747159a023b57278bf8a3360c4
4
+ data.tar.gz: 09e7bb10d1658c5051c0bd7024eefa65b6e6fa4c
5
5
  SHA512:
6
- metadata.gz: 63322da8cd5cd93f014c19a8f160641f34847a22ceac9cb8dabf06efb25353755cf75839ed8a6aacc542b69dca4b2b85e00209fbd5dc8d1baba3469642808064
7
- data.tar.gz: 50548d3981b5fba7f051c1feda33ff772666826392967265a79bead2ef987eaf02102599cda739450c2cbde5868d30631c17adb9fa71ab4e206227e6e93bbe76
6
+ metadata.gz: 855adf13295a186d53847336e8cb1f6a3ed5c52994386151d6bbf1b69817a856f887d96fe8e5bf29550cd61312d412665c824050f3a40bb030131aeae20726bb
7
+ data.tar.gz: 6078161015ec05e872faf8e8960fc075e6adc9c8f73affc08a76087d1914a7201c29ad4a046c49452ec0e43d231150e20feff215c6e9b51e16c151fa932400ad
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- killbill-orbital (0.1.2)
4
+ killbill-orbital (0.1.3)
5
5
  actionpack (~> 4.1.0)
6
6
  actionview (~> 4.1.0)
7
7
  activemerchant (~> 1.55.0)
data/NEWS CHANGED
@@ -1,3 +1,6 @@
1
+ 0.1.3
2
+ Convert non-standard Orbital AVS codes
3
+
1
4
  0.1.2
2
5
  Upgrade Orbital API version to 7.0.1
3
6
  Add network tokenization support
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -211,6 +211,67 @@ module ActiveMerchant
211
211
  end
212
212
  end
213
213
 
214
+ class AVSResult
215
+
216
+ # Convert the Orbital's AVS code (See https://github.com/activemerchant/active_merchant/blob/0f6fb4fcb442c310fa21307d9f233fbb56f5c0ad/lib/active_merchant/billing/gateways/orbital.rb#L744)
217
+ # to
218
+ # the 'standard' one (https://www.wellsfargo.com/downloads/pdf/biz/merchant/visa_avs.pdf
219
+ # http://en.wikipedia.org/wiki/Address_Verification_System)
220
+ # Note that 2, 8, D, E, UK are not converted because no suitable target codes in the standard codes are found
221
+ CONVERT_MAP = {
222
+ '1' => 'U', # 'No address supplied' => 'Address information unavailable.' => 'Address information unavailable.'
223
+ '2' => '2', # Unchanged: 'Bill-to address did not pass Auth Host edit checks'
224
+ '3' => 'I', # 'AVS not performed' => 'Address not verified.'=> 'Address not verified.'
225
+ '4' => 'S', # 'Issuer does not participate in AVS', => 'U.S.-issuing bank does not support AVS.'
226
+ '5' => 'E', # 'Edit-error - AVS data is invalid', => 'AVS data is invalid or AVS is not allowed for this card type.'
227
+ '6' => 'R', # 'System unavailable or time-out', => 'System unavailable.'
228
+ '7' => 'U', # 'Address information unavailable', => 'Address information unavailable.'
229
+ '8' => '8', # Unchanged: 'Transaction Ineligible for AVS'
230
+ '9' => 'X', # 'Zip Match/Zip 4 Match/Locale match', => 'Street address and 9-digit postal code match.'
231
+ 'A' => 'W', # 'Zip Match/Zip 4 Match/Locale no match', => 'Street address does not match, but 9-digit postal code matches.'
232
+ 'B' => 'Y', # 'Zip Match/Zip 4 no Match/Locale match', => 'Street address and 5-digit postal code match.'
233
+ 'C' => 'Z', # 'Zip Match/Zip 4 no Match/Locale no match', => 'Street address does not match, but 5-digit postal code matches.'
234
+ 'D' => 'D', # Unchanged: 'Zip No Match/Zip 4 Match/Locale match'
235
+ 'E' => 'E', # Unchanged: 'Zip No Match/Zip 4 Match/Locale no match',
236
+ 'F' => 'A', # 'Zip No Match/Zip 4 No Match/Locale match', => 'Street address matches, but 5-digit and 9-digit postal code do not match.'
237
+ 'G' => 'C', # 'No match at all', => 'Street address and postal code do not match.'
238
+ 'H' => 'Y', # 'Zip Match/Locale match', => 'Street address and 5-digit postal code match.'
239
+ 'J' => 'G', # 'Issuer does not participate in Global AVS', => 'Non-U.S. issuing bank does not support AVS.'
240
+ 'JA' => 'D', # 'International street address and postal match', => 'Street address and postal code match'
241
+ 'JB' => 'B', # 'International street address match. Postal code not verified', => 'Street address matches, but postal code not verified.'
242
+ 'JC' => 'I', # 'International street address and postal code not verified', => 'Address not verified.'
243
+ 'JD' => 'P', # 'International postal code match. Street address not verified', => 'Postal code matches, but street address not verified.'
244
+ 'M1' => 'K', # 'Cardholder name matches', => 'Card member's name matches but billing address and billing postal code do not match.'
245
+ 'M2' => 'V', # 'Cardholder name, billing address, and postal code matches', => 'Card member's name, billing address, and billing postal code match.'
246
+ 'M3' => 'L', # 'Cardholder name and billing code matches', => 'Card member's name and billing postal code match, but billing address does not match.'
247
+ 'M4' => 'O', # 'Cardholder name and billing address match', => 'Card member's name and billing address match, but billing postal code does not match. '
248
+ 'M5' => 'H', # 'Cardholder name incorrect, billing address and postal code match', => 'Card member's name does not match. Street address and postal code match. '
249
+ 'M6' => 'F', # 'Cardholder name incorrect, billing postal code matches', => 'Card member's name does not match, but billing postal code matches. '
250
+ 'M7' => 'T', # 'Cardholder name incorrect, billing address matches', => 'Card member's name does not match, but street address matches. '
251
+ 'M8' => 'C', # 'Cardholder name, billing address and postal code are all incorrect', => 'Street address and postal code do not match. '
252
+ 'N3' => 'B', # 'Address matches, ZIP not verified', => 'Street address matches, but postal code not verified. '
253
+ 'N4' => 'I', # 'Address and ZIP code not verified due to incompatible formats', => 'Address not verified. '
254
+ 'N5' => 'D', # 'Address and ZIP code match (International only)', => 'Street address and postal code match. '
255
+ 'N6' => 'I', # 'Address not verified (International only)', => 'Address not verified.'
256
+ 'N7' => 'P', # 'ZIP matches, address not verified', => 'Postal code matches, but street address not verified. '
257
+ 'N8' => 'D', # 'Address and ZIP code match (International only)', => 'Street address and postal code match.'
258
+ 'N9' => 'D', # 'Address and ZIP code match (UK only)', => 'Street address and postal code match.'
259
+ 'R' => 'S', # 'Issuer does not participate in AVS', => 'U.S. Bank does not support AVS. '
260
+ 'UK' => 'UK',# Unchanged: UNKNOWN
261
+ 'X' => 'X', # 'Zip Match/Zip 4 Match/Address Match', => 'Street address and 9-digit postal code match. '
262
+ 'Z' => 'Z' # 'Zip Match/Locale no match', => 'Street address does not match, but 5-digit postal code matches. '
263
+ }
264
+
265
+ def initialize(code)
266
+ @code = code.blank? ? nil : code.to_s.strip.upcase
267
+ if @code
268
+ @message = CODES[@code]
269
+ @postal_match = ORBITAL_POSTAL_MATCH_CODE[@code]
270
+ @street_match = ORBITAL_STREET_MATCH_CODE[@code]
271
+ @code = CONVERT_MAP[@code] unless CONVERT_MAP[@code].nil?
272
+ end
273
+ end
274
+ end
214
275
  end
215
276
  end
216
277
  end
data/pom.xml CHANGED
@@ -25,7 +25,7 @@
25
25
  <groupId>org.kill-bill.billing.plugin.ruby</groupId>
26
26
  <artifactId>orbital-plugin</artifactId>
27
27
  <packaging>pom</packaging>
28
- <version>0.1.2</version>
28
+ <version>0.1.3</version>
29
29
  <name>orbital-plugin</name>
30
30
  <url>http://github.com/killbill/killbill-orbital-plugin</url>
31
31
  <description>Plugin for accessing Orbital as a payment gateway</description>
@@ -0,0 +1,54 @@
1
+ require 'spec_helper'
2
+
3
+ include ::Killbill::Plugin::ActiveMerchant::RSpec
4
+
5
+ ActiveMerchant::Billing::Base.mode = :test
6
+
7
+ shared_examples "avs_response_code_specs" do |raw_code, expected_code|
8
+ it 'should translate to correct AVS codes from Orbital AVS codes' do
9
+ ::ActiveMerchant::Billing::OrbitalGateway.any_instance.stub(:ssl_post) do
10
+ mock_authorize_response(raw_code)
11
+ end
12
+ validate_avs_response expected_code
13
+ end
14
+
15
+ def mock_authorize_response(code)
16
+ <<-XML
17
+ <?xml version=\"1.0\" encoding=\"UTF-8\"?><Response><NewOrderResp><IndustryType></IndustryType><MessageType>A</MessageType><MerchantID>1111111</MerchantID><TerminalID>001</TerminalID><CardBrand>CC</CardBrand><AccountNum>XXXXXXXXXXXX5454</AccountNum><OrderID>5b257b31-1f84-44bc-b32</OrderID><TxRefNum>5834AA75E4466AEA59512165057C37DD810053C2</TxRefNum><TxRefIdx>0</TxRefIdx><ProcStatus>0</ProcStatus><ApprovalStatus>1</ApprovalStatus><RespCode>00</RespCode><AVSRespCode>#{code}</AVSRespCode><CVV2RespCode> </CVV2RespCode><AuthCode>tst424</AuthCode><RecurringAdviceCd></RecurringAdviceCd><CAVVRespCode></CAVVRespCode><StatusMsg>Approved</StatusMsg><RespMsg></RespMsg><HostRespCode>100</HostRespCode><HostAVSRespCode>I3</HostAVSRespCode><HostCVV2RespCode> </HostCVV2RespCode><CustomerRefNum></CustomerRefNum><CustomerName></CustomerName><ProfileProcStatus></ProfileProcStatus><CustomerProfileMessage></CustomerProfileMessage><RespTime>152837</RespTime><PartialAuthOccurred></PartialAuthOccurred><RequestedAmount></RequestedAmount><RedeemedAmount></RedeemedAmount><RemainingBalance></RemainingBalance><CountryFraudFilterStatus></CountryFraudFilterStatus><IsoCountryCode></IsoCountryCode></NewOrderResp></Response>
18
+ XML
19
+ end
20
+
21
+ def validate_avs_response(expected_code)
22
+ kb_payment_id, kb_transaction_id = create_payment
23
+ payment_response = @plugin.authorize_payment(SecureRandom.uuid, kb_payment_id, kb_transaction_id, SecureRandom.uuid, @amount, @currency, @properties, @call_context)
24
+ find_value_from_properties(payment_response.properties, 'avsResultCode').should == expected_code
25
+ end
26
+ end
27
+
28
+ describe 'Should present correct AVS codes' do
29
+
30
+ before(:each) do
31
+ # Start the plugin early to configure ActiveRecord
32
+ @plugin = build_plugin(::Killbill::Orbital::PaymentPlugin, 'orbital')
33
+ @plugin.start_plugin
34
+ ::Killbill::Orbital::OrbitalPaymentMethod.delete_all
35
+ ::Killbill::Orbital::OrbitalResponse.delete_all
36
+ ::Killbill::Orbital::OrbitalTransaction.delete_all
37
+ @call_context = build_call_context
38
+ @properties = build_pm_properties(nil,
39
+ {
40
+ :cc_number => 4111111111111111,
41
+ :cc_type => 'visa'
42
+ })
43
+ @amount = BigDecimal.new('100')
44
+ @currency = 'USD'
45
+ end
46
+
47
+ after(:each) do
48
+ @plugin.stop_plugin
49
+ end
50
+
51
+ ::ActiveMerchant::Billing::OrbitalGateway::AVSResult::CONVERT_MAP.each do |raw_code, expected_code|
52
+ include_examples "avs_response_code_specs", raw_code, expected_code
53
+ end
54
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: killbill-orbital
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
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: 2017-02-02 00:00:00.000000000 Z
11
+ date: 2017-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -316,6 +316,7 @@ files:
316
316
  - orbital.yml
317
317
  - pom.xml
318
318
  - release.sh
319
+ - spec/orbital/avs_response_spec.rb
319
320
  - spec/orbital/base_plugin_spec.rb
320
321
  - spec/orbital/cvv_indicator_spec.rb
321
322
  - spec/orbital/remote/integration_spec.rb