comgate_ruby 0.5.0 → 0.6.0
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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +4 -4
- data/lib/comgate/gateway.rb +17 -4
- data/lib/comgate/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: c88ee185af7a8e67a0e652866834bcff26e3f2a3e22299d8fe1acb069fec3c56
         | 
| 4 | 
            +
              data.tar.gz: de1435c492d44847a991e73d8bbd19d64a5d94958df9d36cf1e6e4935f54f865
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 81682fda76ce705ed1b3b1cba13baa704b6bcfc457ffed8bd44ebb7638259debf629881a2e8e1ba6b7aec3ccfe3284d58d015af4378ee6cb9e4b117c501a1f1d
         | 
| 7 | 
            +
              data.tar.gz: b93203aef6c290982f2c29bf3eb73f74e6da0e14c0401f80b1908dbf677ea546974444ed712e33e2ba08ba2d543112be7b8a4a11bc2b9b5dbab3ff0ee5459b16
         | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -18,13 +18,13 @@ If bundler is not being used to manage dependencies, install the gem by executin | |
| 18 18 | 
             
            ### 1) set gateway object
         | 
| 19 19 | 
             
              As singleton on app init or for each transaction:
         | 
| 20 20 | 
             
              ```ruby
         | 
| 21 | 
            -
                gateway =  | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 21 | 
            +
                gateway = Comgate::Gateway.new(merchant_gateway_id: ":comgate_id",
         | 
| 22 | 
            +
                                               test_calls: false,
         | 
| 23 | 
            +
                                               client_secret: ":comgate_secret")
         | 
| 24 24 | 
             
              ```
         | 
| 25 25 |  | 
| 26 26 | 
             
            ### 2) prepare endpoint
         | 
| 27 | 
            -
             Comgate sends POST requests to your app about transactions updates. The URL of it needs to be setup in Comgate Client portal. At endpoint, just call `gateway. | 
| 27 | 
            +
             Comgate sends POST requests to your app about transactions updates. The URL of it needs to be setup in Comgate Client portal. At endpoint, just call `gateway.process_callback(params)`, which will return
         | 
| 28 28 | 
             
                `{state: :paid, transaction_id: ":transID"}` (at least). See bullets 4) and 5) in Single payment process bellow.
         | 
| 29 29 | 
             
            ### 3) call appropriate method
         | 
| 30 30 | 
             
             (see bellow)
         | 
    
        data/lib/comgate/gateway.rb
    CHANGED
    
    | @@ -25,6 +25,18 @@ module Comgate | |
| 25 25 | 
             
                  preauth: %i[payment preauthorization],
         | 
| 26 26 | 
             
                  verification: %i[payment verification_payment],
         | 
| 27 27 |  | 
| 28 | 
            +
                  ## not used for Comgate, but for other Gateway payments they are needed
         | 
| 29 | 
            +
                  ## so here they are for evidence
         | 
| 30 | 
            +
                  # firstName: %i[payer first_name],
         | 
| 31 | 
            +
                  # lastName: %i[payer last_name],
         | 
| 32 | 
            +
                  # street: %i[payer street_line],
         | 
| 33 | 
            +
                  # city: %i[payer city],
         | 
| 34 | 
            +
                  # postalCode: %i[payer postal_code],
         | 
| 35 | 
            +
                  # payerCountryCode: %i[payer country_code],
         | 
| 36 | 
            +
                  # description: %i[payment description],
         | 
| 37 | 
            +
                  # returnUrl: %i[options shop_return_url],
         | 
| 38 | 
            +
                  # callbackUrl: %i[options callback_url],
         | 
| 39 | 
            +
             | 
| 28 40 | 
             
                  # responses
         | 
| 29 41 | 
             
                  transId: %i[transaction_id],
         | 
| 30 42 | 
             
                  transferId: %i[transfer_id],
         | 
| @@ -53,9 +65,9 @@ module Comgate | |
| 53 65 |  | 
| 54 66 | 
             
                def initialize(options)
         | 
| 55 67 | 
             
                  @options = options
         | 
| 56 | 
            -
                  return unless options[:merchant_gateway_id].nil? || options[: | 
| 68 | 
            +
                  return unless options[:merchant_gateway_id].nil? || options[:client_secret].nil? || options[:test_calls].nil?
         | 
| 57 69 |  | 
| 58 | 
            -
                  raise ArgumentError "options have to include :merchant_gateway_id, : | 
| 70 | 
            +
                  raise ArgumentError, "options have to include :merchant_gateway_id, :client_secret and :test_calls"
         | 
| 59 71 | 
             
                end
         | 
| 60 72 |  | 
| 61 73 | 
             
                def test_calls_used?
         | 
| @@ -128,9 +140,10 @@ module Comgate | |
| 128 140 | 
             
                            test_call: false)
         | 
| 129 141 | 
             
                end
         | 
| 130 142 |  | 
| 131 | 
            -
                def  | 
| 143 | 
            +
                def process_callback(comgate_params)
         | 
| 132 144 | 
             
                  Comgate::Response.new({ response_body: comgate_params }, DATA_CONVERSION_HASH)
         | 
| 133 145 | 
             
                end
         | 
| 146 | 
            +
                alias process_payment_callback process_callback  # backward compatibility
         | 
| 134 147 |  | 
| 135 148 | 
             
                def allowed_payment_methods(payment_data)
         | 
| 136 149 | 
             
                  ph = gateway_params.merge(convert_data_to_comgate_params(%i[curr lang country], payment_data, required: false))
         | 
| @@ -189,7 +202,7 @@ module Comgate | |
| 189 202 |  | 
| 190 203 | 
             
                def gateway_params
         | 
| 191 204 | 
             
                  { merchant: options[:merchant_gateway_id],
         | 
| 192 | 
            -
                    secret: options[: | 
| 205 | 
            +
                    secret: options[:client_secret] }
         | 
| 193 206 | 
             
                end
         | 
| 194 207 |  | 
| 195 208 | 
             
                def convert_data_to_comgate_params(comgate_keys, data, required:)
         | 
    
        data/lib/comgate/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: comgate_ruby
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.6.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Petr Mlčoch
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2023-04- | 
| 11 | 
            +
            date: 2023-04-26 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies: []
         | 
| 13 13 | 
             
            description: Write a longer description or delete this line.
         | 
| 14 14 | 
             
            email:
         |