lib/offsite_payments/integrations/checkout_finland.rb
# API parameter length limitations specified by Checkout.fi
# Parameters longer than this cause the HTTP POST to fail
API parameter length limitations specified by Checkout.fi
Parameters longer than this cause the HTTP POST to fail
API parameter length limitations specified by Checkout . fi Parameters longer than this cause the HTTP POST to fail
def check_param_length(name, value)
          max_length_substring = { "FIRSTNAME" => 40, "FAMILYNAME" => 40, "ADDRESS" => 40, "POSTCODE" => 14, "POSTOFFICE" => 18, "MESSAGE" => 1000, "EMAIL" => 200, "PHONE" => 30 }
          max_length_exception = { "RETURN" => 300, "CANCEL" => 300, "REJECT" => 300, "DELAYED" => 300, "STAMP" => 20, "AMOUNT" => 8, "REFERENCE" => 20, "CONTENT" => 2, "LANGUAGE" => 2, "MERCHANT" => 20, "COUNTRY" => 3, "CURRENCY" => 3, "DELIVERY_DATE" => 8 }
          if max_length_substring.include? name
            return value.to_s[0, max_length_substring[name]]
          end
          if max_length_exception.include? name
            if value.to_s.length > max_length_exception[name]
              raise ArgumentError, "Field #{name} length #{value.length} is longer than permitted by provider API. Maximum length #{max_length_exception[name]}."
            else
              return value
            end
          end
          value
        end
def check_param_length ( name , value ) max_length_substring = { "FIRSTNAME" => 40 , "FAMILYNAME" => 40 , "ADDRESS" => 40 , "POSTCODE" => 14 , "POSTOFFICE" => 18 , "MESSAGE" => 1000 , "EMAIL" => 200 , "PHONE" => 30 } max_length_exception = { "RETURN" => 300 , "CANCEL" => 300 , "REJECT" => 300 , "DELAYED" => 300 , "STAMP" => 20 , "AMOUNT" => 8 , "REFERENCE" => 20 , "CONTENT" => 2 , "LANGUAGE" => 2 , "MERCHANT" => 20 , "COUNTRY" => 3 , "CURRENCY" => 3 , "DELIVERY_DATE" => 8 } if max_length_substring . include? name return value . to_s [ 0 , max_length_substring [ name ] ] end if max_length_exception . include? name if value . to_s . length > max_length_exception [ name ] raise ArgumentError , "Field #{name} length #{value.length} is longer than permitted by provider API. Maximum length #{max_length_exception[name]}." else return value end end value end
API parameter length limitations specified by Checkout.fi
Parameters longer than this cause the HTTP POST to fail
API parameter length limitations specified by Checkout . fi Parameters longer than this cause the HTTP POST to fail
# Soft limitations, fields that can be clipped # Hard limitations, fields that cannot be clipped
name
<not_specific>
value
<not_specific>