Yii import autorize.net vendor - yii

I am new in Yii.
I have project where already implemented payment system (autorize.net)
Here is what I have.
In config file
return CMap::mergeArray(
require(dirname(__FILE__).'/main.php'),
array(
'import'=>array(
'application.vendor.authorize.*',
'application.vendor.authorize.lib.*',
'application.vendor.authorize.lib.shared.*',
And after this I can use this like this
$details = new AuthorizeNetTD;
Now I need to use this functional.
I am trying to call all needed files like this
Yii::import("application.vendor.authorize.lib.net.authorize.api.contract.v1.NameAndAddressType", true);
Yii::import("application.vendor.authorize.lib.net.authorize.api.contract.v1.CreditCardSimpleType", true);
Yii::import("application.vendor.authorize.lib.net.authorize.api.contract.v1.CreditCardType", true);
Yii::import("application.vendor.authorize.lib.net.authorize.api.contract.v1.CustomerAddressType", true);
Yii::import("application.vendor.authorize.lib.net.authorize.api.contract.v1.CustomerDataType", true);
Yii::import("application.vendor.authorize.lib.net.authorize.api.contract.v1.CustomerType", true);
Yii::import("application.vendor.authorize.lib.net.authorize.api.contract.v1.DriversLicenseType", true);
Yii::import("application.vendor.authorize.lib.net.authorize.api.contract.v1.OrderType", true);
Yii::import("application.vendor.authorize.lib.net.authorize.api.contract.v1.MerchantAuthenticationType", true);
Yii::import("application.vendor.authorize.lib.net.authorize.api.contract.v1.PaymentType", true);
Yii::import("application.vendor.authorize.lib.net.authorize.api.contract.v1.TransactionRequestType", true);
The directory structure looks like this:
But it doesn't work. I have errors like this
array(7) {
["code"]=>
int(500)
["type"]=>
string(11) "PHP warning"
["message"]=>
string(89) "include(MerchantAuthenticationType.php): failed to open stream: No such file or directory"
["file"]=>
string(57) "D:\xampp\htdocs\satellitedirect\yii\framework\YiiBase.php"
["line"]=>
How can I use Autorize.net SDK autoloader in Yii that I will not need to call files separatly.

Related

define('_PS_MODE_DEV_', false) PrestaShop is set to off, but on product pages errors still show

I have disabled error messages on PrestaShop from define file .debug messages do not appear on the home page, but on the products pages, notice message still appear.
I want to remove all debug messages from the entire site.
This is what i am getting in header
Notice: Array to string conversion in /home/calgar29/public_html/classes/Dispatcher.php on line 683
This is what I have done:
/* Debug only */
if (!defined('_PS_MODE_DEV_')) {
define('_PS_MODE_DEV_', false);
}
/* Compatibility warning */
define('_PS_DISPLAY_COMPATIBILITY_WARNING_', false);
if (_PS_MODE_DEV_ === true) {
#ini_set('display_errors', 'on');
#error_reporting(E_ALL | E_STRICT);
define('_PS_DEBUG_SQL_', true);
} else {
#ini_set('display_errors', 'off');
define('_PS_DEBUG_SQL_', false);
}
define('_PS_DEBUG_PROFILING_', false);
define('_PS_MODE_DEMO_', false);
I am using PrestaShop 1.6.
Maybe this is your server configuration (Apache or Nginx) that displays Notice, not PrestaShop
If you have customs modules installed, you can check if one doesn't have #ini_set('display_errors', 'on'); in its code.

CodeIgniter 3 - set_header does not work

This issue occurs when I'm trying to build CORS enabled RESTful API.
When I put this inside my view file (I'm using CodeIgniter)
// Allow from any origin
if (isset($_SERVER['HTTP_ORIGIN'])) {
$this->output->set_header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}", true);
$this->output->set_header('Access-Control-Allow-Credentials: true', true);
$this->output->set_header('Access-Control-Max-Age: 86400', true); // cache for 1 day
}
// Access-Control headers are received during OPTIONS requests
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']))
$this->output->set_header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS", true);
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
$this->output->set_header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}", true);
}
$this->output->set_header("Content-type: text/x-json", true);
None of the code above that sets the header works. Even when I used PHP's own header() function.
I had to set the headers from .htaccess files to make CORS work.
What is the issue here? I'd like to be able to set the headers from CodeIgniter's view file.
Help.
PS : I'm using CI 3.1.2
please use something:
$response = (new \CI_Output())
->set_status_header(200)
->set_header('Content-Type: application/json')
->set_header('Access-Control-Allow-Origin: *')
->set_header('Access-Control-Max-Age: ');
$response->_display();
session_write_close();
exit;

Github api with PHP

Im new in php and im trying to make a script who will create a new repository in github and catch a document that i have in my pc and make a commit in this new repository. This script will be executed in cmd. I search for github api and I have downloaded any folders with several files, i installed some things with a composer, but i cant create a new instance of github in my php.
I don't know anything about this, I spend two days in this and i cant write a function to talk with github. In the site of github developer I dont understand anything, I really need to do this, and im very lost. Im using PhpStorm 6.0.3.
What i cant understand:
1- The api is a folder with a lot of files? Or is a library who is imported in the phpstorm? How i put this in the phpstorm for i can get the methods and create my functions?
2- Where i get the methods for talk with the github api? Where i can see them? In github developer i dont understand nothing.
I see a question similar, but dont help me much.
Please help me
EDIT
I downloaded an api, and i use the composer require, apparently everything is fine, but when i execute some file to test the api, the same error pops up. The program cant find some files that is in the project, in the same folder.
Ex: PHP Fatal error: Interface 'Github\Api\ApiInterface' not found in D:\php-github-api-master\lib\Github\Api\AbstractApi.php on line 15
In anothers files the same error appears, i put "use" referecing the files that im trying to use, but dont work. Ex: use Github\Api\ApiInterface;
EDIT
This code will create a new repository right? When i execute this code I get the error above, Class 'Github\Api\AbstractApi' not found, but the class is in there.
class Repo extends AbstractApi
{
public function create(
$name,
$description = '',
$homepage = '',
$public = true,
$organization = null,
$hasIssues = false,
$hasWiki = false,
$hasDownloads = false,
$teamId = null,
$autoInit = false
) {
$path = null !== $organization ? 'orgs/'.$organization.'/repos' : 'user/repos';
$parameters = array(
'name' => $name,
'description' => $description,
'homepage' => $homepage,
'private' => !$public,
'has_issues' => $hasIssues,
'has_wiki' => $hasWiki,
'has_downloads' => $hasDownloads,
'auto_init' => $autoInit
);
if ($organization && $teamId) {
$parameters['team_id'] = $teamId;
}
return $this->post($path, $parameters);
}
}
Thanks,
Johann.
I finish my script, everything was done correct, sorry for my obviosly questions and thanks for who was answer me. My code:
<?php
include "vendor/autoload.php";
$client = new \Github\Client();
$username = "JohannLucas";
$password = "mypassword";
$method = Github\Client::AUTH_HTTP_PASSWORD;
//authenticate
$client->authenticate($username, $password, $method);
//Apagar Repositório
//$client->api('repo')->remove('JohannLucas', 'teste');
//Criar Repositório
$client->api('repo')->create('olamundo', 'Repositorio criado com o github api', 'http://my-repo-homepage.org', true);
//Commit
$committer = array('name' => 'JohannLucas', 'email' => 'johann.lucas#hotmail.com');
$path = "teste.txt";
$commitMessage = "Commit do teste.txt";
$content = "Olá Mundo!";
$branch = "master";
$repo = "olamundo";
$fileInfo = $client->api('repo')->contents()->create('JohannLucas', 'olamundo', $path, $content, $commitMessage, $branch, $committer);
print_r("Foi!");
Thanks!
Johann

PHPBB adding custom page in a new directory

My version of PHPBB is installed /board of my site
I am trying to make a custom page inside a new directory called store the file is called decals.php
decals.php
<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
page_header('Store - Decals');
$template->set_filenames(array(
'body' => 'store_decals_body.html',
));
make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
page_footer();
?>
the store_decals_body.html is uploaded to my styles directory and i cant seem to get mysite.com/board/store/decals.php to work. It always put me to mysite.com/board
Have I overlooked something here?
If you have the PHP file in a subdirectory, change the root path accordingly:
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../';

CapsuleCRM API ColdFusion Wrapper

Looking for a ColdFusion version of the following PHP API wrapper for CapsuleCRM:
<?php
// The data you want to send to Capsule CRM in xml format
// SEE http://capsulecrm.com/help/page/javelin_api_party
I'm understanding that this variable contains the XML string...
$myxml="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n
<person>\n
<title>Mr</title>\n
<firstName>Test12</firstName>\n
<lastName>Tester12</lastName>\n
<jobTitle>Chairman</jobTitle>\n
<organisationName>Big Company</organisationName>\n
<about>Testing</about>\n
</person>";
// The URL to connect with (note the /api/ that's needed and note it's person rather than party)
// SEE: http://capsulecrm.com/help/page/api_gettingstarted/
$capsulepage = 'https://sample.capsulecrm.com/api/person';
However, I don't know how to initiate cURL in ColdFusion.
// Initialise the session and return a cURL handle to pass to other cURL functions.
$ch = curl_init($capsulepage);
What does the 'curl_setopt_array' function do exactly? Is there a CF equivalent?
// set appropriate options NB these are the minimum necessary to achieve a post with a useful response
// ...can and should add more in a real application such as
// timeout CURLOPT_CONNECTTIMEOUT
// and useragent CURLOPT_USERAGENT
// replace 1234567890123456789 with your own API token from your user preferences page
$options = array(CURLOPT_USERPWD => '1234567890123456789:x',
CURLOPT_HTTPHEADER => array('Content-Type: text/xml'),
CURLOPT_HEADER => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $myxml
);
curl_setopt_array($ch, $options);
// Do the POST and collect the response for future printing etc then close the session
$response = curl_exec($ch);
$responseInfo = curl_getinfo($ch);
curl_close($ch);
?>
I could be wrong, but that looks like a basic http post. The equivalent in CF is cfhttp. To pass parameters/headers (ie curl_setopt_array) use cfhttpparam.