activemerchant 1.56.0 → 1.57.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +42 -0
  3. data/lib/active_merchant/billing/gateways/authorize_net.rb +52 -21
  4. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +1 -0
  5. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +243 -0
  6. data/lib/active_merchant/billing/gateways/bpoint.rb +1 -1
  7. data/lib/active_merchant/billing/gateways/braintree_blue.rb +11 -11
  8. data/lib/active_merchant/billing/gateways/bridge_pay.rb +37 -8
  9. data/lib/active_merchant/billing/gateways/card_stream.rb +36 -11
  10. data/lib/active_merchant/billing/gateways/checkout_v2.rb +3 -0
  11. data/lib/active_merchant/billing/gateways/clearhaus.rb +2 -2
  12. data/lib/active_merchant/billing/gateways/creditcall.rb +1 -1
  13. data/lib/active_merchant/billing/gateways/cyber_source.rb +12 -1
  14. data/lib/active_merchant/billing/gateways/element.rb +335 -0
  15. data/lib/active_merchant/billing/gateways/forte.rb +8 -0
  16. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
  17. data/lib/active_merchant/billing/gateways/litle.rb +1 -1
  18. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +2 -1
  19. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +165 -0
  20. data/lib/active_merchant/billing/gateways/payeezy.rb +54 -12
  21. data/lib/active_merchant/billing/gateways/sage.rb +379 -128
  22. data/lib/active_merchant/billing/gateways/stripe.rb +13 -3
  23. data/lib/active_merchant/billing/gateways/trans_first.rb +26 -6
  24. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +573 -0
  25. data/lib/active_merchant/billing/gateways/worldpay.rb +7 -0
  26. data/lib/active_merchant/billing/network_tokenization_credit_card.rb +11 -0
  27. data/lib/active_merchant/version.rb +1 -1
  28. metadata +7 -6
  29. data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +0 -89
  30. data/lib/active_merchant/billing/gateways/sage/sage_core.rb +0 -115
  31. data/lib/active_merchant/billing/gateways/sage/sage_vault.rb +0 -149
  32. data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +0 -97
@@ -65,6 +65,13 @@ module ActiveMerchant #:nodoc:
65
65
  end
66
66
  end
67
67
 
68
+ def verify(credit_card, options={})
69
+ MultiResponse.run(:use_first_response) do |r|
70
+ r.process { authorize(100, credit_card, options) }
71
+ r.process(:ignore_result) { void(r.authorization, options) }
72
+ end
73
+ end
74
+
68
75
  def supports_scrubbing
69
76
  true
70
77
  end
@@ -15,6 +15,17 @@ module ActiveMerchant #:nodoc:
15
15
  self.require_name = false
16
16
 
17
17
  attr_accessor :payment_cryptogram, :eci, :transaction_id
18
+ attr_writer :source
19
+
20
+ SOURCES = [:apple_pay, :android_pay]
21
+
22
+ def source
23
+ if defined?(@source) && SOURCES.include?(@source)
24
+ @source
25
+ else
26
+ :apple_pay
27
+ end
28
+ end
18
29
 
19
30
  def type
20
31
  "network_tokenization"
@@ -1,3 +1,3 @@
1
1
  module ActiveMerchant
2
- VERSION = "1.56.0"
2
+ VERSION = "1.57.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activemerchant
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.56.0
4
+ version: 1.57.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Luetke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-01 00:00:00.000000000 Z
11
+ date: 2016-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -170,6 +170,7 @@ files:
170
170
  - lib/active_merchant/billing/gateways/balanced.rb
171
171
  - lib/active_merchant/billing/gateways/bank_frick.rb
172
172
  - lib/active_merchant/billing/gateways/banwire.rb
173
+ - lib/active_merchant/billing/gateways/barclaycard_smartpay.rb
173
174
  - lib/active_merchant/billing/gateways/barclays_epdq.rb
174
175
  - lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb
175
176
  - lib/active_merchant/billing/gateways/be2bill.rb
@@ -205,6 +206,7 @@ files:
205
206
  - lib/active_merchant/billing/gateways/dibs.rb
206
207
  - lib/active_merchant/billing/gateways/efsnet.rb
207
208
  - lib/active_merchant/billing/gateways/elavon.rb
209
+ - lib/active_merchant/billing/gateways/element.rb
208
210
  - lib/active_merchant/billing/gateways/epay.rb
209
211
  - lib/active_merchant/billing/gateways/evo_ca.rb
210
212
  - lib/active_merchant/billing/gateways/eway.rb
@@ -230,6 +232,7 @@ files:
230
232
  - lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem
231
233
  - lib/active_merchant/billing/gateways/ideal/ideal_response.rb
232
234
  - lib/active_merchant/billing/gateways/ideal_rabobank.rb
235
+ - lib/active_merchant/billing/gateways/in_context_paypal_express.rb
233
236
  - lib/active_merchant/billing/gateways/inspire.rb
234
237
  - lib/active_merchant/billing/gateways/instapay.rb
235
238
  - lib/active_merchant/billing/gateways/ipp.rb
@@ -258,6 +261,7 @@ files:
258
261
  - lib/active_merchant/billing/gateways/moneris_us.rb
259
262
  - lib/active_merchant/billing/gateways/money_movers.rb
260
263
  - lib/active_merchant/billing/gateways/nab_transact.rb
264
+ - lib/active_merchant/billing/gateways/ncr_secure_pay.rb
261
265
  - lib/active_merchant/billing/gateways/net_registry.rb
262
266
  - lib/active_merchant/billing/gateways/netaxept.rb
263
267
  - lib/active_merchant/billing/gateways/netbilling.rb
@@ -317,10 +321,6 @@ files:
317
321
  - lib/active_merchant/billing/gateways/redsys.rb
318
322
  - lib/active_merchant/billing/gateways/s5.rb
319
323
  - lib/active_merchant/billing/gateways/sage.rb
320
- - lib/active_merchant/billing/gateways/sage/sage_bankcard.rb
321
- - lib/active_merchant/billing/gateways/sage/sage_core.rb
322
- - lib/active_merchant/billing/gateways/sage/sage_vault.rb
323
- - lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb
324
324
  - lib/active_merchant/billing/gateways/sage_pay.rb
325
325
  - lib/active_merchant/billing/gateways/sallie_mae.rb
326
326
  - lib/active_merchant/billing/gateways/secure_net.rb
@@ -336,6 +336,7 @@ files:
336
336
  - lib/active_merchant/billing/gateways/swipe_checkout.rb
337
337
  - lib/active_merchant/billing/gateways/tns.rb
338
338
  - lib/active_merchant/billing/gateways/trans_first.rb
339
+ - lib/active_merchant/billing/gateways/trans_first_transaction_express.rb
339
340
  - lib/active_merchant/billing/gateways/transact_pro.rb
340
341
  - lib/active_merchant/billing/gateways/transax.rb
341
342
  - lib/active_merchant/billing/gateways/transnational.rb
@@ -1,89 +0,0 @@
1
- require 'active_merchant/billing/gateways/sage/sage_core'
2
-
3
- module ActiveMerchant #:nodoc:
4
- module Billing #:nodoc:
5
- class SageBankcardGateway < Gateway #:nodoc:
6
- include SageCore
7
- self.live_url = 'https://www.sagepayments.net/cgi-bin/eftBankcard.dll?transaction'
8
- self.source = 'bankcard'
9
-
10
- # Credit cards supported by Sage
11
- # * VISA
12
- # * MasterCard
13
- # * AMEX
14
- # * Diners
15
- # * Carte Blanche
16
- # * Discover
17
- # * JCB
18
- # * Sears
19
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :diners_club]
20
-
21
- def authorize(money, credit_card, options = {})
22
- post = {}
23
- add_credit_card(post, credit_card)
24
- add_transaction_data(post, money, options)
25
- commit(:authorization, post)
26
- end
27
-
28
- def purchase(money, credit_card, options = {})
29
- post = {}
30
- add_credit_card(post, credit_card)
31
- add_transaction_data(post, money, options)
32
- commit(:purchase, post)
33
- end
34
-
35
- # The +money+ amount is not used. The entire amount of the
36
- # initial authorization will be captured.
37
- def capture(money, reference, options = {})
38
- post = {}
39
- add_reference(post, reference)
40
- commit(:capture, post)
41
- end
42
-
43
- def void(reference, options = {})
44
- post = {}
45
- add_reference(post, reference)
46
- commit(:void, post)
47
- end
48
-
49
- def credit(money, credit_card, options = {})
50
- post = {}
51
- add_credit_card(post, credit_card)
52
- add_transaction_data(post, money, options)
53
- commit(:credit, post)
54
- end
55
-
56
- def refund(money, reference, options={})
57
- post = {}
58
- add_reference(post, reference)
59
- add_transaction_data(post, money, options)
60
- commit(:refund, post)
61
- end
62
-
63
- private
64
-
65
- def add_credit_card(post, credit_card)
66
- post[:C_name] = credit_card.name
67
- post[:C_cardnumber] = credit_card.number
68
- post[:C_exp] = expdate(credit_card)
69
- post[:C_cvv] = credit_card.verification_value if credit_card.verification_value?
70
- end
71
-
72
- def parse(data)
73
- response = {}
74
- response[:success] = data[1,1]
75
- response[:code] = data[2,6]
76
- response[:message] = data[8,32].strip
77
- response[:front_end] = data[40, 2]
78
- response[:cvv_result] = data[42, 1]
79
- response[:avs_result] = data[43, 1].strip
80
- response[:risk] = data[44, 2]
81
- response[:reference] = data[46, 10]
82
-
83
- response[:order_number], response[:recurring] = data[57...-1].split("\034")
84
- response
85
- end
86
- end
87
- end
88
- end
89
-
@@ -1,115 +0,0 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
3
- module SageCore #:nodoc:
4
- def self.included(base)
5
- base.cattr_accessor :source
6
- base.supported_countries = ['US', 'CA']
7
- base.homepage_url = 'http://www.sagepayments.com'
8
- base.display_name = 'Sage Payment Solutions'
9
- end
10
-
11
- # Transactions types:
12
- # <tt>01</tt> - Sale
13
- # <tt>02</tt> - AuthOnly
14
- # <tt>03</tt> - Force/PriorAuthSale
15
- # <tt>04</tt> - Void
16
- # <tt>06</tt> - Credit
17
- # <tt>11</tt> - PriorAuthSale by Reference*
18
- TRANSACTIONS = {
19
- :purchase => '01',
20
- :authorization => '02',
21
- :capture => '11',
22
- :void => '04',
23
- :credit => '06',
24
- :refund => '10'
25
- }
26
-
27
- def initialize(options = {})
28
- requires!(options, :login, :password)
29
- super
30
- end
31
-
32
- private
33
- def add_invoice(post, options)
34
- post[:T_ordernum] = (options[:order_id] || generate_unique_id).slice(0, 20)
35
- post[:T_tax] = amount(options[:tax]) unless options[:tax].blank?
36
- post[:T_shipping] = amount(options[:shipping]) unless options[:shipping].blank?
37
- end
38
-
39
- def add_reference(post, reference)
40
- ref, _ = reference.to_s.split(";")
41
- post[:T_reference] = ref
42
- end
43
-
44
- def add_amount(post, money)
45
- post[:T_amt] = amount(money)
46
- end
47
-
48
- def add_customer_data(post, options)
49
- post[:T_customer_number] = options[:customer] if Float(options[:customer]) rescue nil
50
- end
51
-
52
- def add_addresses(post, options)
53
- billing_address = options[:billing_address] || options[:address] || {}
54
-
55
- post[:C_address] = billing_address[:address1]
56
- post[:C_city] = billing_address[:city]
57
-
58
- if ['US', 'CA'].include?(billing_address[:country])
59
- post[:C_state] = billing_address[:state]
60
- else
61
- post[:C_state] = "Outside of United States"
62
- end
63
-
64
- post[:C_zip] = billing_address[:zip]
65
- post[:C_country] = billing_address[:country]
66
- post[:C_telephone] = billing_address[:phone]
67
- post[:C_fax] = billing_address[:fax]
68
- post[:C_email] = options[:email]
69
-
70
- if shipping_address = options[:shipping_address]
71
- post[:C_ship_name] = shipping_address[:name]
72
- post[:C_ship_address] = shipping_address[:address1]
73
- post[:C_ship_city] = shipping_address[:city]
74
- post[:C_ship_state] = shipping_address[:state]
75
- post[:C_ship_zip] = shipping_address[:zip]
76
- post[:C_ship_country] = shipping_address[:country]
77
- end
78
- end
79
-
80
- def add_transaction_data(post, money, options)
81
- add_amount(post, money)
82
- add_invoice(post, options)
83
- add_addresses(post, options)
84
- add_customer_data(post, options)
85
- end
86
-
87
- def commit(action, params)
88
- response = parse(ssl_post(self.live_url, post_data(action, params)))
89
-
90
- Response.new(success?(response), response[:message], response,
91
- :test => test?,
92
- :authorization => authorization_from(response),
93
- :avs_result => { :code => response[:avs_result] },
94
- :cvv_result => response[:cvv_result]
95
- )
96
- end
97
-
98
- def authorization_from(response)
99
- "#{response[:reference]};#{source}"
100
- end
101
-
102
- def success?(response)
103
- response[:success] == 'A'
104
- end
105
-
106
- def post_data(action, params = {})
107
- params[:M_id] = @options[:login]
108
- params[:M_key] = @options[:password]
109
- params[:T_code] = TRANSACTIONS[action]
110
-
111
- params.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
112
- end
113
- end
114
- end
115
- end
@@ -1,149 +0,0 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
3
- class SageVaultGateway < Gateway #:nodoc:
4
- self.live_url = 'https://www.sagepayments.net/web_services/wsVault/wsVault.asmx'
5
-
6
- def initialize(options = {})
7
- requires!(options, :login, :password)
8
- super
9
- end
10
-
11
- def store(credit_card, options = {})
12
- request = build_store_request(credit_card, options)
13
- commit(:store, request)
14
- end
15
-
16
- def unstore(identification, options = {})
17
- request = build_unstore_request(identification, options)
18
- commit(:unstore, request)
19
- end
20
-
21
- private
22
-
23
- # A valid request example, since the Sage docs have none:
24
- #
25
- # <?xml version="1.0" encoding="UTF-8" ?>
26
- # <SOAP-ENV:Envelope
27
- # xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
28
- # xmlns:ns1="https://www.sagepayments.net/web_services/wsVault/wsVault">
29
- # <SOAP-ENV:Body>
30
- # <ns1:INSERT_CREDIT_CARD_DATA>
31
- # <ns1:M_ID>279277516172</ns1:M_ID>
32
- # <ns1:M_KEY>O3I8G2H8V6A3</ns1:M_KEY>
33
- # <ns1:CARDNUMBER>4111111111111111</ns1:CARDNUMBER>
34
- # <ns1:EXPIRATION_DATE>0915</ns1:EXPIRATION_DATE>
35
- # </ns1:INSERT_CREDIT_CARD_DATA>
36
- # </SOAP-ENV:Body>
37
- # </SOAP-ENV:Envelope>
38
- def build_store_request(credit_card, options)
39
- xml = Builder::XmlMarkup.new
40
- add_credit_card(xml, credit_card, options)
41
- xml.target!
42
- end
43
-
44
- def build_unstore_request(identification, options)
45
- xml = Builder::XmlMarkup.new
46
- add_identification(xml, identification, options)
47
- xml.target!
48
- end
49
-
50
- def add_customer_data(xml)
51
- xml.tag! 'ns1:M_ID', @options[:login]
52
- xml.tag! 'ns1:M_KEY', @options[:password]
53
- end
54
-
55
- def add_credit_card(xml, credit_card, options)
56
- xml.tag! 'ns1:CARDNUMBER', credit_card.number
57
- xml.tag! 'ns1:EXPIRATION_DATE', exp_date(credit_card)
58
- end
59
-
60
- def add_identification(xml, identification, options)
61
- xml.tag! 'ns1:GUID', identification
62
- end
63
-
64
- def exp_date(credit_card)
65
- year = sprintf("%.4i", credit_card.year)
66
- month = sprintf("%.2i", credit_card.month)
67
-
68
- "#{month}#{year[-2..-1]}"
69
- end
70
-
71
- def commit(action, request)
72
- response = parse(ssl_post(live_url,
73
- build_soap_request(action, request),
74
- build_headers(action))
75
- )
76
-
77
- case action
78
- when :store
79
- success = response[:success] == 'true'
80
- message = response[:message].downcase.capitalize if response[:message]
81
- when :unstore
82
- success = response[:delete_data_result] == 'true'
83
- message = success ? 'Succeeded' : 'Failed'
84
- end
85
-
86
- Response.new(success, message, response,
87
- authorization: response[:guid]
88
- )
89
- end
90
-
91
- ENVELOPE_NAMESPACES = {
92
- 'xmlns:SOAP-ENV' => "http://schemas.xmlsoap.org/soap/envelope/",
93
- 'xmlns:ns1' => "https://www.sagepayments.net/web_services/wsVault/wsVault"
94
- }
95
-
96
- ACTION_ELEMENTS = {
97
- store: 'INSERT_CREDIT_CARD_DATA',
98
- unstore: 'DELETE_DATA'
99
- }
100
-
101
- def build_soap_request(action, body)
102
- xml = Builder::XmlMarkup.new
103
-
104
- xml.instruct!
105
- xml.tag! 'SOAP-ENV:Envelope', ENVELOPE_NAMESPACES do
106
- xml.tag! 'SOAP-ENV:Body' do
107
- xml.tag! "ns1:#{ACTION_ELEMENTS[action]}" do
108
- add_customer_data(xml)
109
- xml << body
110
- end
111
- end
112
- end
113
- xml.target!
114
- end
115
-
116
- SOAP_ACTIONS = {
117
- store: 'https://www.sagepayments.net/web_services/wsVault/wsVault/INSERT_CREDIT_CARD_DATA',
118
- unstore: 'https://www.sagepayments.net/web_services/wsVault/wsVault/DELETE_DATA'
119
- }
120
-
121
- def build_headers(action)
122
- {
123
- "SOAPAction" => SOAP_ACTIONS[action],
124
- "Content-Type" => "text/xml; charset=utf-8"
125
- }
126
- end
127
-
128
- def parse(body)
129
- response = {}
130
- hashify_xml!(body, response)
131
- response
132
- end
133
-
134
- def hashify_xml!(xml, response)
135
- xml = REXML::Document.new(xml)
136
-
137
- # Store
138
- xml.elements.each("//Table1/*") do |node|
139
- response[node.name.underscore.to_sym] = node.text
140
- end
141
-
142
- # Unstore
143
- xml.elements.each("//DELETE_DATAResponse/*") do |node|
144
- response[node.name.underscore.to_sym] = node.text
145
- end
146
- end
147
- end
148
- end
149
- end