如何在 Omnipay 中配置 CreditCard class?
How to configure CreditCard class in Omnipay?
我整天都在尝试在 CodeIgniter 中配置 Omnipay,我想我终于破解了它,但我卡在了信用卡验证部分。出于某种原因,当我 运行 我收到错误消息 Fatal error: Class 'CreditCard' not found in C:\xampp\htdocs\trabajo\emarket\application\controllers\inicio.php on line 37
这是我的控制器:
use Omnipay\Omnipay;
class Inicio extends CI_Controller {
public function index()
{
$gateway = Omnipay::create('PayPal_Pro');
$gateway->setUsername('######');
$gateway->setPassword('######');
$gateway->setSignature('#####');
$gateway->setTestMode(true);
$gateway->initialize();
$cardInput = array(
'firstName' => 'buyer',
'lastName' => 'one million',
'number' => '4032031186341789',
'company' => 'Visa',
'billingAddress1' => 'bill me here',
'billingAddress2' => 'or maybe here',
'billingPhone' => '4085873015',
'billingCity' => 'chicago',
'billingState' => 'illinois',
'billingPostCode' => '646960',
'shippingAddress1' => 'ship it here',
'shippingAddress2' => 'or ship here',
'shippingPhone' => '98789987',
'shippingCity' => 'chicago',
'shippingState' => 'illinois',
'shippingPostCode' => '989898',
);
$card = new CreditCard($cardInput);
}
}
感谢您抽出宝贵时间,如果能就我做错的地方提出一些建议,我将不胜感激。
类 已加载,但您需要指出这些。你是用关键字 use
来做的。否则你可以传递类似的东西:
$gateway = Omnipay\Omnipay::create('PayPal_Pro');//not quite sure if you need backslash infront of vendor name
或者您可以调用 CreditCard 实例的相同方式:
$card = new Omnipay\Common\CreditCard($cardInput);
这就是使用关键字 use
的原因。
我整天都在尝试在 CodeIgniter 中配置 Omnipay,我想我终于破解了它,但我卡在了信用卡验证部分。出于某种原因,当我 运行 我收到错误消息 Fatal error: Class 'CreditCard' not found in C:\xampp\htdocs\trabajo\emarket\application\controllers\inicio.php on line 37
这是我的控制器:
use Omnipay\Omnipay;
class Inicio extends CI_Controller {
public function index()
{
$gateway = Omnipay::create('PayPal_Pro');
$gateway->setUsername('######');
$gateway->setPassword('######');
$gateway->setSignature('#####');
$gateway->setTestMode(true);
$gateway->initialize();
$cardInput = array(
'firstName' => 'buyer',
'lastName' => 'one million',
'number' => '4032031186341789',
'company' => 'Visa',
'billingAddress1' => 'bill me here',
'billingAddress2' => 'or maybe here',
'billingPhone' => '4085873015',
'billingCity' => 'chicago',
'billingState' => 'illinois',
'billingPostCode' => '646960',
'shippingAddress1' => 'ship it here',
'shippingAddress2' => 'or ship here',
'shippingPhone' => '98789987',
'shippingCity' => 'chicago',
'shippingState' => 'illinois',
'shippingPostCode' => '989898',
);
$card = new CreditCard($cardInput);
}
}
感谢您抽出宝贵时间,如果能就我做错的地方提出一些建议,我将不胜感激。
类 已加载,但您需要指出这些。你是用关键字 use
来做的。否则你可以传递类似的东西:
$gateway = Omnipay\Omnipay::create('PayPal_Pro');//not quite sure if you need backslash infront of vendor name
或者您可以调用 CreditCard 实例的相同方式:
$card = new Omnipay\Common\CreditCard($cardInput);
这就是使用关键字 use
的原因。