swiss-activemerchant 1.0.5 → 1.0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ca4e65b4371a17da4cf7850a83b7d893ac845ea182a2b51c392c5c84c501e5a
4
- data.tar.gz: 68892e1f40dd978c6ee10c76d8b26cd040eafdd7a5b0089a0d6e26a93a41dd5d
3
+ metadata.gz: 34abdcccc7dd765c1985f3e60bdcdc537d2d9b63a0250a6f378d11cda6b25405
4
+ data.tar.gz: df3d015816886fd14ab83ca447ea017023f7120e5935b37786983df3556d6e74
5
5
  SHA512:
6
- metadata.gz: 249a74b5d612fcd1d68eb3e3420dab33b5fe278fa1011a6efa21974d1b7a4ca3ff435924d190ac37b3f272780d3f1983d958488d10ad95e221d5d964c62ea423
7
- data.tar.gz: d4fcad1ae822bde689ae32ebf728a37ae16e88ff45a5c7d559c7f8ff05b701146e8ff465869407669d22f481389950cf75dcd8acbaac9247982b626766dc38bd
6
+ metadata.gz: 89dfb3bf5286b79a450977b8bf6a5954cffbc251bdd94a641f99799f2327a03f4baa5a9634b8717c9cf1c4389a66f7ad473b7ecaab5c6c3b833a9500825b3291
7
+ data.tar.gz: b2b44a3dc9b5c15142eea6a653aae9a5a97c6f6e692ac987a1aafa2c6d53d7250388f9cd15862db47cc9bb7172d909dc662d52d1f16f6dd0ef7363f3a471b98a
@@ -3,7 +3,7 @@ require 'nokogiri'
3
3
  module ActiveMerchant #:nodoc:
4
4
  module Billing #:nodoc:
5
5
  class IxopayGateway < Gateway
6
- self.test_url = 'https://secure.cardflo.io/transaction'
6
+ self.test_url = 'https://secure.ixopay.com/transaction'
7
7
  self.live_url = 'https://secure.ixopay.com/transaction'
8
8
 
9
9
  self.supported_countries = %w(AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BQ BQ BR BS BT BV BW BY BZ CA CC CD CF CG CH CI CK CL CM CN CO CR CU CV CW CX CY CZ DE DJ DK DM DO DZ EC EE EG EH ER ES ET FI FJ FK FM FO FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT GU GW GY HK HM HN HR HT HU ID IE IL IM IN IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN KP KR KW KY KZ LA LB LC LI LK LR LS LT LU LV LY MA MC MD ME MF MG MH MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN PR PS PT PW PY QA RE RO RS RU RW SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR SS ST SV SX SY SZ TC TD TF TG TH TJ TK TL TM TN TO TR TT TV TW TZ UA UG UM US UY UZ VA VC VE VG VI VN VU WF WS YE YT ZA ZM ZW)
@@ -102,7 +102,7 @@ module ActiveMerchant #:nodoc:
102
102
 
103
103
  def generate_signature(http_method, xml, timestamp)
104
104
  content_type = 'text/xml; charset=utf-8'
105
- message = "#{http_method}\n#{Digest::SHA512.hexdigest(xml)}\n#{content_type}\n#{timestamp}\n\n/transaction"
105
+ message = "#{http_method}\n#{Digest::MD5.hexdigest(xml)}\n#{content_type}\n#{timestamp}\n\n/transaction"
106
106
  digest = OpenSSL::Digest.new('sha512')
107
107
  hmac = OpenSSL::HMAC.digest(digest, @secret, message)
108
108
 
@@ -118,7 +118,7 @@ module ActiveMerchant #:nodoc:
118
118
 
119
119
  def build_xml_request
120
120
  builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
121
- xml.transactionWithCard 'xmlns' => 'https://secure.cardflo.io/Schema/V2/TransactionWithCard' do
121
+ xml.transactionWithCard 'xmlns' => 'http://secure.ixopay.com/Schema/V2/TransactionWithCard' do
122
122
  xml.username @options[:username]
123
123
  xml.password Digest::SHA1.hexdigest(@options[:password])
124
124
  yield(xml)
@@ -151,7 +151,7 @@ module ActiveMerchant #:nodoc:
151
151
  xml.amount localized_amount(money, currency)
152
152
  xml.currency currency
153
153
  xml.description description
154
- xml.callbackUrl("https://www.google.com/")
154
+ xml.callbackUrl(options[:callback_url])
155
155
  add_stored_credentials(xml, options)
156
156
  end
157
157
  end
@@ -281,14 +281,12 @@ module ActiveMerchant #:nodoc:
281
281
 
282
282
  def commit(request)
283
283
  url = (test? ? test_url : live_url)
284
- url = "#{url}/#{options[:api_key]}/debit"
284
+
285
285
  # ssl_post raises an exception for any non-2xx HTTP status from the gateway
286
- debugger
287
286
  response =
288
287
  begin
289
288
  parse(ssl_post(url, request, headers(request)))
290
289
  rescue StandardError => error
291
- debugger
292
290
  parse(error.response.body)
293
291
  end
294
292
 
@@ -246,7 +246,6 @@ module ActiveMerchant #:nodoc:
246
246
  post[:shipping_phone] = shipping_address[:phone]
247
247
  end
248
248
 
249
- debugger
250
249
  if (descriptor = options[:descriptors])
251
250
  post[:descriptor] = options[:descriptor]
252
251
  post[:descriptor_phone] = descriptor[:descriptor_phone]
@@ -7,6 +7,9 @@ module ActiveMerchant #:nodoc:
7
7
  # particularly useful if you already have code interacting with
8
8
  # ActiveMerchant and want to easily take advantage of Spreedly's vault.
9
9
  class SpreedlyCoreGateway < Gateway
10
+ SUCCESS_CODE = 200
11
+ SOFT_DECLINE_CODES = [401, 402, 408, 415, 422].freeze
12
+
10
13
  self.live_url = 'https://core.spreedly.com/v1'
11
14
 
12
15
  self.supported_countries = %w(AD AE AT AU BD BE BG BN CA CH CY CZ DE DK EE EG ES FI FR GB
@@ -99,7 +102,7 @@ module ActiveMerchant #:nodoc:
99
102
  # credit_card - The CreditCard to store
100
103
  # options - A standard ActiveMerchant options hash
101
104
  def store(credit_card, options = {})
102
- retain = (options.has_key?(:retain) ? options[:retain] : true)
105
+ retain = true
103
106
  save_card(retain, credit_card, options)
104
107
  end
105
108
 
@@ -281,21 +284,26 @@ module ActiveMerchant #:nodoc:
281
284
 
282
285
  def commit(relative_url, request, method = :post, authorization_field = :token)
283
286
  begin
284
- raw_response = ssl_request(method, "#{live_url}/#{relative_url}", request, headers)
287
+ raw_response = ssl_request(method, request_url(relative_url), request, headers)
285
288
  rescue ResponseError => e
286
289
  raw_response = e.response.body
287
290
  end
288
291
 
289
- response_from(raw_response, authorization_field)
292
+ response_from(raw_response, authorization_field, request, relative_url)
290
293
  end
291
294
 
292
- def response_from(raw_response, authorization_field)
295
+ def response_from(raw_response, authorization_field, request_body, relative_url)
293
296
  parsed = parse(raw_response)
294
297
  options = {
295
298
  authorization: parsed[authorization_field],
296
299
  test: (parsed[:on_test_gateway] == 'true'),
297
300
  avs_result: { code: parsed[:response_avs_code] },
298
- cvv_result: parsed[:response_cvv_code]
301
+ cvv_result: parsed[:response_cvv_code],
302
+ response_type: response_type(@response_http_code.to_i),
303
+ response_http_code: @response_http_code,
304
+ request_endpoint: request_url(relative_url),
305
+ request_method: :post,
306
+ request_body:
299
307
  }
300
308
 
301
309
  Response.new(parsed[:succeeded] == 'true', parsed[:message] || parsed[:error], parsed, options)
@@ -307,6 +315,30 @@ module ActiveMerchant #:nodoc:
307
315
  'Content-Type' => 'text/xml'
308
316
  }
309
317
  end
318
+
319
+ def request_url(relative_url)
320
+ "#{live_url}/#{relative_url}"
321
+ end
322
+
323
+ def handle_response(response)
324
+ @response_http_code = response.code.to_i
325
+ case @response_http_code
326
+ when 200...300
327
+ response.body
328
+ else
329
+ raise ResponseError.new(response)
330
+ end
331
+ end
332
+
333
+ def response_type(code)
334
+ if code == SUCCESS_CODE
335
+ 0
336
+ elsif SOFT_DECLINE_CODES.include?(code)
337
+ 1
338
+ else
339
+ 2
340
+ end
341
+ end
310
342
  end
311
343
  end
312
344
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveMerchant
2
- VERSION = '1.0.5'
2
+ VERSION = '1.0.7'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swiss-activemerchant
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Luetke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-22 00:00:00.000000000 Z
11
+ date: 2024-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport