/** * Posts data back to PayPal for order verification * * @param array $post * @return boolean */ public function isVerified($post) { $sandboxMode = $this->billingService->getGatewayConfigValue(self::GATEWAY_KEY, 'sandboxMode'); $hostname = $sandboxMode ? 'www.sandbox.paypal.com' : 'www.paypal.com'; $nvpStr = ''; foreach ($post as $key => $value) { $value = urlencode(stripslashes($value)); $nvpStr .= "{$key}={$value}&"; } $nvpStr .= 'cmd=_notify-validate'; // post back to PayPal for validation $headers = "POST /cgi-bin/webscr HTTP/1.1\r\n"; $headers .= "Content-Type: application/x-www-form-urlencoded\r\n"; $headers .= "Content-Length: " . strlen($nvpStr) . "\r\n"; $headers .= "Host: " . $hostname . "\r\n"; $headers .= "Connection: close\r\n\r\n"; $fp = fsockopen($hostname, 80, $errno, $errstr, 30); if (!$fp) { return false; } fputs($fp, $headers . $nvpStr); $str = ''; while (!feof($fp)) { $str .= trim(fgets($fp, 2048)); } fclose($fp); return $sandboxMode ? true : mb_strstr($str, 'VERIFIED') !== false; }
/** * Posts data back to PayPal for order verification * * @param array $post * @return boolean */ public function isVerified($post) { $sandboxMode = $this->billingService->getGatewayConfigValue(self::GATEWAY_KEY, 'sandboxMode'); $hostname = $sandboxMode ? 'www.sandbox.paypal.com' : 'www.paypal.com'; $nvpStr = ''; foreach ($post as $key => $value) { $value = urlencode(stripslashes($value)); $nvpStr .= "{$key}={$value}&"; } $nvpStr .= 'cmd=_notify-validate'; $str = file_get_contents('https://' . $hostname . '/cgi-bin/webscr?' . $nvpStr); return mb_strstr($str, 'VERIFIED') !== false; }
/** * Sends request to DataLink Service * * @param array $transactionTypes * @param boolean $testMode * @return array */ public function getDataLinkServiceResponse(array $transactionTypes, $testMode = false) { $requestStr = self::DATALINK_URL . '?startTime=' . $this->getDateFormat(time() - 24 * 60 * 60) . '&endTime=' . $this->getDateFormat(time()) . '&transactionTypes=' . implode(',', $transactionTypes) . '&clientAccnum=' . $this->billingService->getGatewayConfigValue(self::GATEWAY_KEY, 'clientAccnum') . '&clientSubacc=' . $this->billingService->getGatewayConfigValue(self::GATEWAY_KEY, 'clientSubacc') . '&username='******'datalinkUsername') . '&password='******'datalinkPassword') . ($testMode ? '&testMode=1' : ''); $logger = OW::getLogger('billingccbill'); $logger->addEntry($requestStr, 'datalink.request-string'); $handle = curl_init($requestStr); ob_start(); curl_exec($handle); $string = ob_get_contents(); ob_end_clean(); $logger->addEntry($string, 'datalink.response-string'); $responseArr = array(); if (!curl_errno($handle)) { $responseArr = $this->parseDatalinkResponse($string); $logger->addEntry(print_r($responseArr, true), 'datalink.response-array'); } curl_close($handle); $logger->writeLog(); return $responseArr; }
/** * Returns Moneybookers gateway script url (sandbox or live) * * @return string */ private function getOrderFormActionUrl() { $sandboxMode = $this->billingService->getGatewayConfigValue(self::GATEWAY_KEY, 'sandboxMode'); return $sandboxMode ? 'http://www.moneybookers.com/app/test_payment.pl' : 'https://www.moneybookers.com/app/payment.pl'; }
public function isVerified() { $arHash = array($_POST['m_operation_id'], $_POST['m_operation_ps'], $_POST['m_operation_date'], $_POST['m_operation_pay_date'], $_POST['m_shop'], $_POST['m_orderid'], $_POST['m_amount'], $_POST['m_curr'], $_POST['m_desc'], $_POST['m_status'], $this->billingService->getGatewayConfigValue(self::GATEWAY_KEY, 'm_key')); $sign_hash = strtoupper(hash('sha256', implode(":", $arHash))); return $_POST["m_sign"] == $sign_hash && $_POST['m_status'] == "success"; }