if ($this->config->get('pp_express_test') == 1) {
$api_endpoint = 'https://api-3t.sandbox.paypal.com/nvp';
} else {
$api_endpoint = 'https://api-3t.paypal.com/nvp';
}
$settings = array(
'USER' => $this->config->get('pp_express_username'),
'PWD' => $this->config->get('pp_express_password'),
'SIGNATURE' => $this->config->get('pp_express_signature'),
'VERSION' => '65.2',
'BUTTONSOURCE' => 'OpenCart_Cart_EC',
);
$this->log($data, 'Call data');
$defaults = array(
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_URL => $api_endpoint,
CURLOPT_USERAGENT => "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1",
CURLOPT_FRESH_CONNECT => 1,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_FORBID_REUSE => 1,
CURLOPT_TIMEOUT => 0,
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_POSTFIELDS => http_build_query(array_merge($data, $settings), '', "&")
);
$ch = curl_init();
curl_setopt_array($ch, $defaults);
if( ! $result = curl_exec($ch)) {
$this->log(array('error' => curl_error($ch), 'errno' => curl_errno($ch)), 'cURL failed');
}
$this->log($result, 'Result');
curl_close($ch);
return $this->cleanReturn($result);