payment - Sha-out sign not matching Ogone, PHP -


i'm trying make payment plugin webshop ogone ideal payments. can make payment, when return cannot sha-signs match.

i have following request on return:

orderid=476&amount=90%2e82&pm=ideal&acceptance=0000000000&status=9&payid=43934127&ncerror=0&brand=ideal&shasign=5ab0a065baa83c5d807249a66e661acbb6709b8f 

according documentation, have order keys alphabetically , hash allowed.

these allowed keys:

['aavaddress', 'aavcheck', 'aavzip', 'acceptance', 'alias', 'amount', 'brand', 'cardno', 'cccty', 'cn', 'complus', 'currency', 'cvccheck', 'dcc_commpercentage', 'dcc_convamount', 'dcc_convccy', 'dcc_exchrate', 'dcc_exchratesource', 'dcc_exchratets', 'dcc_indicator', 'dcc_marginpercentage', 'dcc_validhous', 'digestcardno', 'eci', 'ed', 'enccardno', 'ip', 'ipcty', 'nbremailusage', 'nbripusage', 'nbripusage_alltx', 'nbrusage', 'ncerror', 'orderid', 'payid', 'pm', 'sco_category', 'scoring', 'status', 'trxdate', 'vc']; 

i made method make hash:

/**  * @return string  */ protected function getshaoutsign() {     $hash = '';     $values = \input::all();     $values = array_change_key_case($values, case_upper);     ksort($values);      foreach ($values $key => $value) {         if (in_array($key, $this->shaout)) {              if(!empty($value))             {                 $hash .= $key . '=' . $values[$key] . $this->settings->shaout;             }         }     }      return  strtoupper(sha1($hash)); } 

im 100% sure sha out key correct.

the string makes before sha1:

acceptance=0000000000abcdefghj1234560987654amount=90.82abcdefghj1234560987654brand=idealabcdefghj1234560987654orderid=476abcdefghj1234560987654payid=43934127abcdefghj1234560987654pm=idealabcdefghj1234560987654status=9abcdefghj1234560987654 

and final hash is:

68e459cb933e04b582a5d564ce6f591d5819b7f1 

no matter try, can't match 1 in $_get request.

my sha-out key: abcdefghj1234560987654

could point me right direction?

the sha out calculation wrong. code use in projects calculate it, $sha_parms full response of ogone. $_post or $_get

            /**             * function calculate sha received ogone             */             public function getshaout($sha_parms, $sha_out = null) {                     $sha_out = $sha_out ?: self::pass_phrase_out;                     $sha_parms = $this->ogonesort($sha_parms);                      $sha_string = '';                     foreach ($sha_parms $key => $value) {                             if ($key != 'shasign' && $value != '') {                                     $sha_string .= $key . '=' . $value . $sha_out;                             }                     }                      //return($sha_string);                     return strtoupper(sha1($sha_string));             }                            /**             *             *             **/             private function ogonesort($array) {                     $arraytosort = array();                     $origarray = array();                     foreach ($array $key => $value) {                             $arraytosort[strtolower($key)] = $value;                             //stores original value in array                             $origarray[strtolower($key)] = $key;                     }                      ksort($arraytosort);                      $sortedarray = array();                     foreach($arraytosort $key => $value) {                             //switch lowercase keys originals                             $key = strtoupper($origarray[$key]);                             $sortedarray[$key] = $value;                     }                      return $sortedarray;             } 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -