flowcommerce-activemerchant 0.3.1 → 0.3.2
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 +5 -5
- data/.version +1 -1
- data/lib/active_merchant/billing/gateways/flow.rb +18 -4
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 | 
            -
             | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 2 | 
            +
            SHA256:
         | 
| 3 | 
            +
              metadata.gz: f8c050459bb5e3d462ec740f49de89e85bc1d6face8a91a4a62caa3f432e491e
         | 
| 4 | 
            +
              data.tar.gz: 2fe18804b6874c53adb20b904ab7fcebd2d41215de0fb4eff4bee06c258eff06
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: f4cd06bb6ccebf634edccf1c83d277294749ced7e6d0543427bf08a9e6126fff1328b1f7d6110fd0cf1db602b8d0a35f4f7b364671a385ae9c3f14483c444d4d
         | 
| 7 | 
            +
              data.tar.gz: 2005e3cfa3073ef522b8da892c16ce1d0095e7a8d451ecaa21f8b77a8a31012b9b31fe2519fcd5b31065ab8b539647583869ffe333b1b93f58829792f6498193
         | 
    
        data/.version
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            0.3. | 
| 1 | 
            +
            0.3.2
         | 
| @@ -98,8 +98,15 @@ module ActiveMerchant | |
| 98 98 | 
             
                  end
         | 
| 99 99 |  | 
| 100 100 | 
             
                  def purchase credit_card, order_number, options={}
         | 
| 101 | 
            -
                     | 
| 102 | 
            -
             | 
| 101 | 
            +
                    auth_response = flow_get_authorization order_number: order_number
         | 
| 102 | 
            +
             | 
| 103 | 
            +
                    if auth_response
         | 
| 104 | 
            +
                      capture options[:amount], auth_response.key, options
         | 
| 105 | 
            +
                    else
         | 
| 106 | 
            +
                      error_response 'No authorization for order: %s' % order_number
         | 
| 107 | 
            +
                    end
         | 
| 108 | 
            +
                  rescue Io::Flow::V0::HttpClient::ServerError => exception
         | 
| 109 | 
            +
                    error_response exception
         | 
| 103 110 | 
             
                  end
         | 
| 104 111 |  | 
| 105 112 | 
             
                  # https://docs.flow.io/module/payment/resource/reversals#post-organization-reversals
         | 
| @@ -148,10 +155,16 @@ module ActiveMerchant | |
| 148 155 | 
             
                    credit_card =
         | 
| 149 156 | 
             
                    case input
         | 
| 150 157 | 
             
                      when Hash
         | 
| 158 | 
            +
                        # ActiveMerchant::Billing::CreditCard does not support "address" field
         | 
| 159 | 
            +
                        # so we have to capture it manualy
         | 
| 160 | 
            +
                        # format - https://docs.flow.io/type/billing-address
         | 
| 161 | 
            +
                        @address = credit_card.delete(:address)
         | 
| 162 | 
            +
             | 
| 151 163 | 
             
                        ActiveMerchant::Billing::CreditCard.new input
         | 
| 152 164 | 
             
                      when ActiveMerchant::Billing::CreditCard
         | 
| 153 165 | 
             
                        input
         | 
| 154 166 | 
             
                      when String
         | 
| 167 | 
            +
                        # if it is a String then it allready is a token
         | 
| 155 168 | 
             
                        return input
         | 
| 156 169 | 
             
                      else
         | 
| 157 170 | 
             
                        raise 'Unsuported store method input type [%s]' % input.class
         | 
| @@ -162,13 +175,14 @@ module ActiveMerchant | |
| 162 175 | 
             
                                   cvv: credit_card.verification_value,
         | 
| 163 176 | 
             
                       expiration_year: credit_card.year.to_i,
         | 
| 164 177 | 
             
                      expiration_month: credit_card.month.to_i
         | 
| 165 | 
            -
                               address: credit_card.address
         | 
| 166 178 | 
             
                    }
         | 
| 167 179 |  | 
| 180 | 
            +
                    data[:address] = @address if @address
         | 
| 181 | 
            +
             | 
| 168 182 | 
             
                    response  = flow_instance.cards.post @flow_organization, data
         | 
| 169 183 |  | 
| 170 184 | 
             
                    if response.respond_to?(:token)
         | 
| 171 | 
            -
                       | 
| 185 | 
            +
                      response.token
         | 
| 172 186 | 
             
                    else
         | 
| 173 187 | 
             
                      Response.new false, 'Flow POST /:organization/cards - Failure', { response: response }
         | 
| 174 188 | 
             
                    end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: flowcommerce-activemerchant
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.3. | 
| 4 | 
            +
              version: 0.3.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Dino Reic
         | 
| @@ -83,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 83 83 | 
             
                  version: '0'
         | 
| 84 84 | 
             
            requirements: []
         | 
| 85 85 | 
             
            rubyforge_project: 
         | 
| 86 | 
            -
            rubygems_version: 2.5 | 
| 86 | 
            +
            rubygems_version: 2.7.5
         | 
| 87 87 | 
             
            signing_key: 
         | 
| 88 88 | 
             
            specification_version: 4
         | 
| 89 89 | 
             
            summary: Adapter for Flow.io global payment gateway
         |