public function validateIpn($arr_params) { try { parent::validateIpn(); $sHash = sha1($arr_params['trxid'] . $arr_params['ec'] . $arr_params['status'] . $this->arr_settings['account'] . $this->arr_settings['secret']); $this->payment_result->log .= "hashcalc:" . $sHash; $this->payment_result->log .= "hashget:" . $arr_params['sha1']; if ($sHash == $arr_params['sha1']) { switch ($arr_params['status']) { case "Success": $this->payment_result->confirmed = 1; break; case "Expired": $this->payment_result->confirmed = 0; break; case "Cancelled": $this->payment_result->confirmed = 0; break; case "Failure": $this->payment_result->confirmed = 0; break; } } else { $this->payment_result->confirmed = 0; } } catch (Exception $e) { $this->payment_result->log .= "CATCH" . print_r($e, true); $this->payment_result->error = 01; $this->payment_result->confirmed = 0; } return $this->payment_result; }
public function validateIpn($arr_params) { try { //The PaymentResult object is instantiated parent::validateIpn(); //if all checks are fine $this->payment_result->confirmed = 1; $this->payment_result->log .= "extra logging"; } catch (Exception $e) { //when an error occured $this->payment_result->confirmed = 0; $this->payment_result->log .= "CATCH:" . print_r($e, true); $this->payment_result->error = 01; } return $this->payment_result; }
public function validateIpn($arr_params) { try { $obj_ideal = new Mollie_iDEAL_Payment($this->arr_settings['account']); parent::validateIpn(); $obj_ideal->checkPayment($arr_params['transaction_id']); if ($obj_ideal->getBankStatus() == 'Success') { $this->payment_result->confirmed = 1; } elseif ($this->obj_ideal->getBankStatus() != 'CheckedBefore') { $this->payment_result->confirmed = 0; } $this->payment_result->log .= "Transaction " . $arr_params['transaction_id'] . " recorded with Bank status: " . $obj_ideal->getBankStatus(); } catch (Exception $e) { $this->payment_result->log .= "CATCH" . print_r($e, true); $this->payment_result->error = 01; $this->payment_result->confirmed = 0; } return $this->payment_result; }
public function validateIpn($arr_params) { try { parent::validateIpn($arr_params); // verify the SHA Sign //$shaCheckFields = array ('AAVADDRESS', 'AAVCHECK','AAVMAIL','AAVNAME','AAVPHONE', 'AAVZIP', 'ACCEPTANCE', 'ALIAS', 'AMOUNT', 'BIC', 'BIN','BRAND', 'CARDNO', 'CCCTY', 'CN', 'COMPLUS','CREATION_STATUS', 'CREDITDEBIT','CURRENCY', 'CVCCHECK', 'DCC_COMMPERCENTAGE', 'DCC_CONVAMOUNT', 'DCC_CONVCCY', 'DCC_EXCHRATE', 'DCC_EXCHRATESOURCE', 'DCC_EXCHRATETS', 'DCC_INDICATOR', 'DCC_MARGINPERCENTAGE', 'DCC_VALIDHOURS', 'DIGESTCARDNO', 'ECI', 'ED', 'ENCCARDNO','FXAMOUNT','FXCURRENCY','IBAN', 'IP', 'IPCTY', 'MOBILEMODE', 'NBREMAILUSAGE', 'NBRIPUSAGE', 'NBRIPUSAGE_ALLTX', 'NBRUSAGE', 'NCERROR', 'NCERRORCARDNO','NCERRORCN','NCERRORCVC','NCERRORED','ORDERID', 'PAYID', 'PM', 'SCO_CATEGORY', 'SCORING', 'STATUS','SUBBRAND', 'SUBSCRIPTION_ID', 'TRXDATE', 'VC' ); $arr_check = array_change_key_case($arr_params, CASE_UPPER); $signature = $this->arr_settings['secret2']; ksort($arr_check); unset($arr_check['SHASIGN']); unset($arr_check['ORDERGUID']); $stringToHash = ""; foreach ($arr_check as $key => $value) { if ($value == "") { continue; } $stringToHash .= $key . '=' . $value . $signature; } $sha_calc = strtoupper(sha1($stringToHash)); $sha_post = $arr_params['SHASIGN']; $this->payment_result->log .= print_r($arr_params, true); $this->payment_result->log .= "SHASIGN:{$sha_post}|{$sha_calc}"; if ($sha_post == $sha_calc) { //valid $this->payment_result->transaction = $arr_params['PAYID']; if ($arr_params['ACCEPTANCE'] != "" && $arr_params['STATUS'] == 9) { $this->payment_result->confirmed = 1; } else { $this->payment_result->confirmed = 0; } } else { //invalid $this->payment_result->confirmed = 0; } } catch (Exception $e) { $this->payment_result->log .= "CATCH" . print_r($e, true); $this->payment_result->error = 01; $this->payment_result->confirmed = 0; } return $this->payment_result; }
public function validateIpn($arr_params) { try { parent::validateIpn(); $hashbase = $arr_params['sale_id'] . $arr_params['vendor_id'] . $arr_params['invoice_id'] . $this->arr_settings['secret']; $rehash = strtoupper(md5($hashbase)); if ($rehash == $arr_params['md5_hash']) { $this->payment_result->confirmed = 1; //SET TO PAID $this->payment_result->transaction = $arr_params['sale_id']; //TRANSACTION ID FROM PROVIDER } else { //HASH WAS NOT THE SAME, ORDER CHANGED / HACK ATTEMPT } } catch (Exception $e) { $this->payment_result->log .= "CATCH" . print_r($e, true); $this->payment_result->error = 01; $this->payment_result->confirmed = 0; } return $this->payment_result; }
public function validateIpn($arr_notifications) { try { parent::validateIpn($arr_notifications); $this->payment_result->transaction = $arr_notifications['new-order-notification']['google-order-number']['VALUE']; $arr_lastchange = end($arr_notifications['order-state-change-notification']); switch ($arr_lastchange['new-financial-order-state']['VALUE']) { case "CHARGED": $this->payment_result->confirmed = 1; break; default: $this->payment_result->confirmed = 0; break; } $Gresponse = new GoogleResponse($this->arr_settings['account'], $this->arr_settings['secret']); $ack_response = $Gresponse->SendAck($arr_notifications['serial-number'], false); } catch (Exception $e) { $this->payment_result->log .= "CATCH" . print_r($e, true); $this->payment_result->error = 01; $this->payment_result->confirmed = 0; } return $this->payment_result; }
public function validateIpn($arr_params) { try { parent::validateIpn(); // transaction id (same as the transaction->id given in the transaction request) $transactionid = $arr_params['transactionid']; // (notify.php?type=initial is used as notification_url and should output a link) $initial = $arr_params['type'] == "initial"; /* * Transaction Details */ $this->obj_msp->transaction['id'] = $transactionid; // returns the status $status = $this->obj_msp->getStatus(); if ($this->obj_msp->error && !$initial) { // only show error if we dont need to display the link echo "Error " . $this->obj_msp->error_code . ": " . $this->obj_msp->error; exit; } switch ($status) { case "initialized": // waiting $this->payment_result->confirmed = 0; break; case "completed": // payment complete $this->payment_result->confirmed = 1; break; case "uncleared": // waiting (credit cards or direct debit) $this->payment_result->confirmed = 0; break; case "void": // canceled $this->payment_result->confirmed = 0; break; case "declined": // declined $this->payment_result->confirmed = 0; break; case "refunded": // refunded $this->payment_result->confirmed = 0; break; case "expired": // expired $this->payment_result->confirmed = 0; break; default: } $this->ipn_result->transaction = $transactionid; $this->payment_result->log .= "Transaction {$transactionid} recorded with Bank status: {$status}"; if (!$initial) { // link to notify.php for MultiSafepay back-end (for delayed payment notifications) // backend expects an "ok" if no error occurred echo "ok"; } } catch (Exception $e) { $this->payment_result->log .= "CATCH" . print_r($e, true); $this->payment_result->error = 01; $this->payment_result->confirmed = 0; } return $this->payment_result; }
public function validateIpn($arr_params) { try { parent::validateIpn(); $md5source = $this->arr_settings['secret'] . $this->arr_settings['account'] . $arr_params['x_trans_id'] . $arr_params['x_amount']; $md5 = md5($md5source); $this->payment_result->transaction = $arr_params['x_trans_id']; if ($arr_params['x_response_code'] == '1') { // if (strtoupper($md5) != $arr_params['x_MD5_Hash']) { $this->payment_result->confirmed = 1; } else { $this->payment_result->confirmed = 0; } } else { $this->payment_result->confirmed = 0; } } catch (Exception $e) { $this->payment_result->log .= "CATCH" . print_r($e, true); $this->payment_result->error = 01; $this->payment_result->confirmed = 0; } return $this->payment_result; }
public function validateIpn($arr_params) { try { parent::validateIpn(); //create HTTP vars $req = 'cmd=_notify-validate'; foreach ($arr_params as $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&{$key}={$value}"; } //check fields with original orderdata if (isset($this->arr_order['total'])) { if ((double) $arr_params['mc_gross'] != (double) $this->arr_order['total']) { $this->payment_result->error = 04; $this->payment_result->confirmed = 0; } } if (isset($this->arr_order['currency'])) { if ($arr_params['mc_currency'] != $this->arr_order['currency']) { $this->payment_result->error = 05; $this->payment_result->confirmed = 0; } } if ($this->payment_result->error == "") { //validation request to paypal $ch = curl_init(); // Starts the curl handler curl_setopt($ch, CURLOPT_URL, $this->url_submit); // Sets the paypal address for curl curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Returns result to a variable instead of echoing curl_setopt($ch, CURLOPT_TIMEOUT, 10); // Sets a time limit for curl in seconds (do not set too low) curl_setopt($ch, CURLOPT_POST, 1); // Set curl to send data using post curl_setopt($ch, CURLOPT_POSTFIELDS, $req); // Add the request parameters to the post $res = curl_exec($ch); // run the curl process (and return the result to $result curl_close($ch); //check response $this->payment_result->log .= print_r($res, true) . "\n"; if (strcmp($res, "VERIFIED") == 0) { $this->payment_result->confirmed = 1; $this->payment_result->transaction = $_POST['txn_id']; } else { $this->payment_result->confirmed = 0; $this->payment_result->error = 01; if (strcmp($res, "INVALID") == 0) { // log for manual investigation $this->payment_result->error = 02; } $this->payment_result->confirmed = 0; } } } catch (Exception $e) { $this->payment_result->log .= "CATCH" . print_r($e, true); $this->payment_result->error = 01; $this->payment_result->confirmed = 0; } return $this->payment_result; }