Created
June 14, 2011 11:05
-
-
Save KarlHerler/1024692 to your computer and use it in GitHub Desktop.
Lab version of the algorithm for creating a hash to maksutruva's payment gateway, it's madness
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'sinatra' | |
require 'digest/sha1' | |
def getShit(keys) | |
hashprimer = "" | |
keys.each do |k| | |
hashprimer = hashprimer + params[k]+"&" if k=="pmt_action" | |
hashprimer = hashprimer + params[k]+"&" if k=="pmt_version" | |
hashprimer = hashprimer + params[k]+"&" if k=="pmt_selleriban" | |
hashprimer = hashprimer + params[k]+"&" if k=="pmt_id" | |
hashprimer = hashprimer + params[k]+"&" if k=="pmt_orderid" | |
hashprimer = hashprimer + params[k]+"&" if k=="pmt_reference" | |
hashprimer = hashprimer + params[k]+"&" if k=="pmt_duedate" | |
hashprimer = hashprimer + params[k]+"&" if k=="pmt_amount" | |
hashprimer = hashprimer + params[k]+"&" if k=="pmt_currency" | |
hashprimer = hashprimer + params[k]+"&" if k=="pmt_okreturn" | |
hashprimer = hashprimer + params[k]+"&" if k=="pmt_errorreturn" | |
hashprimer = hashprimer + params[k]+"&" if k=="pmt_cancelreturn" | |
hashprimer = hashprimer + params[k]+"&" if k=="pmt_delayedpayreturn" | |
hashprimer = hashprimer + params[k]+"&" if k=="pmt_escrow" | |
hashprimer = hashprimer + params[k]+"&" if k=="pmt_escrowchangeallowed" | |
hashprimer = hashprimer + params[k]+"&" if k=="pmt_buyername" | |
hashprimer = hashprimer + params[k]+"&" if k=="pmt_paymentmethod" | |
hashprimer = hashprimer + params[k]+"&" if k=="pmt_buyeridentificationcode" | |
hashprimer = hashprimer + params[k]+"&" if k=="pmt_buyeraddress" | |
hashprimer = hashprimer + params[k]+"&" if k=="pmt_buyerpostalcode" | |
hashprimer = hashprimer + params[k]+"&" if k=="pmt_buyercity" | |
hashprimer = hashprimer + params[k]+"&" if k=="pmt_buyercountry" | |
hashprimer = hashprimer + params[k]+"&" if k=="pmt_deliveryname" | |
hashprimer = hashprimer + params[k]+"&" if k=="pmt_deliveryaddress" | |
hashprimer = hashprimer + params[k]+"&" if k=="pmt_deliverypostalcode" | |
hashprimer = hashprimer + params[k]+"&" if k=="pmt_deliverycity" | |
hashprimer = hashprimer + params[k]+"&" if k=="pmt_deliverycountry" | |
hashprimer = hashprimer + params[k]+"&" if k=="pmt_sellercosts" | |
hashprimer = hashprimer + params[k]+"&" if k=~/pmt_row_name\d/ | |
hashprimer = hashprimer + params[k]+"&" if k=~/pmt_row_desc\d/ | |
hashprimer = hashprimer + params[k]+"&" if k=~/pmt_row_quantity\d/ | |
hashprimer = hashprimer + params[k]+"&" if k=~/pmt_row_deliverydate\d/ | |
hashprimer = hashprimer + params[k]+"&" if k=~/pmt_row_price_gross\d/ | |
hashprimer = hashprimer + params[k]+"&" if k=~/pmt_row_price_net\d/ | |
hashprimer = hashprimer + params[k]+"&" if k=~/pmt_row_vat\d/ | |
hashprimer = hashprimer + params[k]+"&" if k=~/pmt_row_discountpercentage\d/ | |
hashprimer = hashprimer + params[k]+"&" if k=~/pmt_row_type\d/ | |
end | |
# | |
hashprimer = hashprimer + "testiavain&" | |
return hashprimer | |
return Digest::SHA1.hexdigest hashprimer | |
end | |
post '/' do | |
getShit(params.keys) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment