swiss-activemerchant 1.0.6 → 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:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 34abdcccc7dd765c1985f3e60bdcdc537d2d9b63a0250a6f378d11cda6b25405
         | 
| 4 | 
            +
              data.tar.gz: df3d015816886fd14ab83ca447ea017023f7120e5935b37786983df3556d6e74
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 89dfb3bf5286b79a450977b8bf6a5954cffbc251bdd94a641f99799f2327a03f4baa5a9634b8717c9cf1c4389a66f7ad473b7ecaab5c6c3b833a9500825b3291
         | 
| 7 | 
            +
              data.tar.gz: b2b44a3dc9b5c15142eea6a653aae9a5a97c6f6e692ac987a1aafa2c6d53d7250388f9cd15862db47cc9bb7172d909dc662d52d1f16f6dd0ef7363f3a471b98a
         | 
| @@ -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 =  | 
| 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,  | 
| 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
         | 
    
        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. | 
| 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 | 
| 11 | 
            +
            date: 2024-12-11 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: activesupport
         |