本文整理汇总了PHP中PagSeguroConfig类的典型用法代码示例。如果您正苦于以下问题:PHP PagSeguroConfig类的具体用法?PHP PagSeguroConfig怎么用?PHP PagSeguroConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PagSeguroConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public static function init()
{
if (self::$config == null) {
self::$config = new PagSeguroConfig();
}
return self::$config;
}
示例2: main
public static function main()
{
$amount = 30.0;
//Required
$cardBrand = "visa";
//Optional
$maxInstallmentNoInterest = 2;
//Optional
try {
/**
* #### Credentials #####
* Replace the parameters below with your credentials
* You can also get your credentials from a config file. See an example:
* $credentials = new PagSeguroAccountCredentials("vendedor@lojamodelo.com.br",
* "E231B2C9BCC8474DA2E260B6C8CF60D3");
*/
$credentials = PagSeguroConfig::getAccountCredentials();
// Application authentication
//$credentials = PagSeguroConfig::getApplicationCredentials();
//$credentials->setAuthorizationCode("E231B2C9BCC8474DA2E260B6C8CF60D3");
$installments = PagSeguroInstallmentService::getInstallments($credentials, $amount, $cardBrand, $maxInstallmentNoInterest);
self::printInstallment($installments);
} catch (Exception $e) {
die($e->getMessage());
} catch (PagSeguroServiceException $e) {
die($e->getMessage());
}
}
示例3: main
public static function main()
{
$reference = "REF123";
$initialDate = '2015-09-03T00:00';
$finalDate = '2015-09-09T11:13';
$pageNumber = 1;
$maxPageResults = 20;
// $reference = "REF123";
//
// $initialDate = '2014-12-03T00:00';
// $finalDate = '2014-12-08T00:00';
// $pageNumber = 1;
// $maxPageResults = 20;
try {
/*
* #### Credentials #####
* Substitute the parameters below with your credentials
* You can also get your credentials from a config file. See an example:
* $credentials = PagSeguroConfig::getAccountCredentials();
*/
// seller authentication
$credentials = new PagSeguroAccountCredentials("vendedor@lojamodelo.com.br", "E231B2C9BCC8474DA2E260B6C8CF60D3");
$credentials = PagSeguroConfig::getAccountCredentials();
// application authentication
//$credentials = PagSeguroConfig::getApplicationCredentials();
//$credentials->setAuthorizationCode("E231B2C9BCC8474DA2E260B6C8CF60D3");
$result = PagSeguroTransactionSearchService::searchByReference($credentials, $reference, $initialDate, $finalDate, $pageNumber, $maxPageResults);
self::printResult($result, $initialDate, $finalDate);
} catch (PagSeguroServiceException $e) {
die($e->getMessage());
}
}
示例4: install
/**
* Perform instalation of PagSeguro module
*
* @return boolean
*/
public function install()
{
if (!parent::install() || !$this->registerHook('payment') || !$this->registerHook('paymentReturn') || !Configuration::updateValue('PAGSEGURO_EMAIL', '') || !Configuration::updateValue('PAGSEGURO_TOKEN', '') || !Configuration::updateValue('PAGSEGURO_URL_REDIRECT', '') || !Configuration::updateValue('PAGSEGURO_NOTIFICATION_URL', '') || !Configuration::updateValue('PAGSEGURO_CHARSET', PagSeguroConfig::getData('application', 'charset')) || !Configuration::updateValue('PAGSEGURO_LOG_ACTIVE', PagSeguroConfig::getData('log', 'active')) || !Configuration::updateValue('PAGSEGURO_LOG_FILELOCATION', PagSeguroConfig::getData('log', 'fileLocation')) || !Configuration::updateValue('PS_OS_PAGSEGURO', 0) || !$this->_generatePagSeguroOrderStatus()) {
return false;
}
return true;
}
示例5: main
/**
*
*/
public static function main()
{
// Instantiate a new authorization request
$authorizationRequest = new PagSeguroAuthorizationRequest();
$authorizationRequest->setReference('REF123');
$authorizationRequest->setRedirectURL('http://www.lojamodelo.com.br');
$authorizationRequest->setNotificationURL('http://www.lojamodelo.com.br');
/**
* @enum "CREATE_CHECKOUTS",
* @enum "RECEIVE_TRANSACTION_NOTIFICATIONS",
* @enum "SEARCH_TRANSACTIONS",
* @enum "MANAGE_PAYMENT_PRE_APPROVALS",
* @enum "DIRECT_PAYMENT",
* @enum "REFUND_TRANSACTIONS",
* @enum "CANCEL_TRANSACTIONS"
*/
$authorizationRequest->setPermissions(array("CREATE_CHECKOUTS", "RECEIVE_TRANSACTION_NOTIFICATIONS", "SEARCH_TRANSACTIONS", "MANAGE_PAYMENT_PRE_APPROVALS", "DIRECT_PAYMENT", "REFUND_TRANSACTIONS", "CANCEL_TRANSACTIONS"));
try {
/**
* #### Credentials #####
* Replace the parameters below with your credentials
* You can also get your credentials from a config file. See an example:
* $credentials = PagSeguroConfig::getApplicationCredentials();
*/
$credentials = new PagSeguroApplicationCredentials("appId", "appKey");
$credentials = PagSeguroConfig::getApplicationCredentials();
// Register this payment request in PagSeguro to obtain the payment URL to redirect your customer.
$return = $authorizationRequest->register($credentials);
self::printAuthorizationReturn($return);
} catch (PagSeguroServiceException $e) {
die($e->getMessage());
}
}
示例6: __construct
private function __construct()
{
self::$path = dirname(__FILE__);
PagSeguroAutoloader::init();
self::$resources = PagSeguroResources::init();
self::$config = PagSeguroConfig::init();
self::$log = LogPagSeguro::init();
}
示例7: transactionNotification
private static function transactionNotification($notificationCode)
{
$credentials = PagSeguroConfig::getAccountCredentials();
try {
return PagSeguroNotificationService::checkTransaction($credentials, $notificationCode);
} catch (PagSeguroServiceException $e) {
die($e->getMessage());
}
}
示例8: main
public static function main()
{
// Instantiate a new payment request
$directPaymentRequest = new PagSeguroDirectPaymentRequest();
// Set the Payment Mode for this payment request
$directPaymentRequest->setPaymentMode('DEFAULT');
// Set the Payment Method for this payment request
$directPaymentRequest->setPaymentMethod('CREDIT_CARD');
/**
* @todo Change the receiver Email
*/
$directPaymentRequest->setReceiverEmail('vendedor@lojamodelo.com.br');
// Set the currency
$directPaymentRequest->setCurrency("BRL");
// Add an item for this payment request
// Add an item for this payment request
$directPaymentRequest->addItem('0001', 'Descricao do item a ser vendido', 2, 10.0);
// Add an item for this payment request
$directPaymentRequest->addItem('0002', 'Descricao do item a ser vendido', 2, 5.0);
// Set a reference code for this payment request. It is useful to identify this payment
// in future notifications.
$directPaymentRequest->setReference("REF123");
// Set your customer information.
// If you using SANDBOX you must use an email @sandbox.pagseguro.com.br
$directPaymentRequest->setSender('João Comprador', 'email@comprador.com.br', '11', '56273440', 'CPF', '156.009.442-76', true);
$directPaymentRequest->setSenderHash("d94d002b6998ca9cd69092746518e50aded5a54aef64c4877ccea02573694986");
// Set shipping information for this payment request
$sedexCode = PagSeguroShippingType::getCodeByType('SEDEX');
$directPaymentRequest->setShippingType($sedexCode);
$directPaymentRequest->setShippingAddress('01452002', 'Av. Brig. Faria Lima', '1384', 'apto. 114', 'Jardim Paulistano', 'São Paulo', 'SP', 'BRA');
//Set billing information for credit card
$billing = new PagSeguroBilling(array('postalCode' => '01452002', 'street' => 'Av. Brig. Faria Lima', 'number' => '1384', 'complement' => 'apto. 114', 'district' => 'Jardim Paulistano', 'city' => 'São Paulo', 'state' => 'SP', 'country' => 'BRA'));
$token = "5b97542cd1524b67a9e89b3d90c1f262";
$installment = new PagSeguroDirectPaymentInstallment(array("quantity" => 2, "value" => "15.00", "noInterestInstallmentQuantity" => 2));
$cardCheckout = new PagSeguroCreditCardCheckout(array('token' => $token, 'installment' => $installment, 'holder' => new PagSeguroCreditCardHolder(array('name' => 'João Comprador', 'documents' => array('type' => 'CPF', 'value' => '156.009.442-76'), 'birthDate' => date('01/10/1979'), 'areaCode' => 11, 'number' => 56273440)), 'billing' => $billing));
//Set credit card for payment
$directPaymentRequest->setCreditCard($cardCheckout);
try {
/**
* #### Credentials #####
* Replace the parameters below with your credentials
* You can also get your credentials from a config file. See an example:
* $credentials = PagSeguroConfig::getAccountCredentials();
*/
// seller authentication
//$credentials = new PagSeguroAccountCredentials("vendedor@lojamodelo.com.br",
// "E231B2C9BCC8474DA2E260B6C8CF60D3");
// application authentication
$credentials = PagSeguroConfig::getApplicationCredentials();
$credentials->setAuthorizationCode("E231B2C9BCC8474DA2E260B6C8CF60D3");
// Register this payment request in PagSeguro to obtain the payment URL to redirect your customer.
$return = $directPaymentRequest->register($credentials);
self::printTransactionReturn($return);
} catch (PagSeguroServiceException $e) {
die($e->getMessage());
}
}
示例9: _load
/**
* Load model and language
*/
private function _load()
{
PagSeguroConfig::activeLog($this->_getDirectoryLog());
$this->language->load('payment/pagseguro');
$this->load->model('checkout/order');
$this->load->model('setting/setting');
$this->load->model('payment/pagseguro');
$this->language->load('payment/pagseguro');
}
示例10: preApprovalNotification
private static function preApprovalNotification($preApprovalCode)
{
$credentials = PagSeguroConfig::getAccountCredentials();
try {
$preApproval = PagSeguroNotificationService::checkPreApproval($credentials, $preApprovalCode);
// Do something with $preApproval
} catch (PagSeguroServiceException $e) {
die($e->getMessage());
}
}
示例11: authorizationNotification
private static function authorizationNotification($notificationCode)
{
$credentials = PagSeguroConfig::getApplicationCredentials();
try {
$authorization = PagSeguroNotificationService::checkAuthorization($credentials, $notificationCode);
// Do something with $authorization
} catch (PagSeguroServiceException $e) {
die($e->getMessage());
}
}
示例12: startup
/**
*
* @param \Controller $controller
* @throws RuntimeException
* @since 2.1
*/
public function startup(\Controller $controller)
{
$this->config = Configure::read('PagSeguro');
if (empty($this->config)) {
throw new RuntimeException('Você precisa definir as configurações básicas do plugin "PagSeguro", leia o manual.');
}
if (isset($this->config['isSandbox']) && true === $this->config['isSandbox']) {
PagSeguroConfig::setEnvironment('sandbox');
}
$this->credenciais = new PagSeguroAccountCredentials($this->config['email'], $this->config['token']);
}
示例13: __construct
private function __construct()
{
self::$active = PagSeguroConfig::logIsActive();
if (self::$active) {
$fileLocation = PagSeguroConfig::getLogFileLocation();
if (file_exists($fileLocation) && is_file($fileLocation)) {
self::$fileLocation = $fileLocation;
} else {
self::createFile();
}
}
}
示例14: requestAction
/**
* Process the payment request and redirect to PagSeguro Gateway
*/
public function requestAction()
{
$Order = $this->getOrder();
//Order Data
$PagSeguroPaymentModel = $this->getPagSeguroPaymentModel();
$enabledOSC = false;
$fileOSC = scandir(getcwd() . '/app/code/community/DeivisonArthur');
if ($fileOSC) {
$enabledOSC = Mage::helper('onepagecheckout')->isOnepageCheckoutEnabled();
}
$feedback = $enabledOSC == false ? 'checkout/onepage' : 'onepagecheckout';
if ($Order->getState() == Mage_Sales_Model_Order::STATE_NEW and $Order->getPayment()->getMethod() == $PagSeguroPaymentModel->getCode() and $Order->getId()) {
$orderId = $Order->getEntityId();
include_once Mage::getBaseDir('lib') . '/PagSeguroLibrary/PagSeguroLibrary.php';
$environment = PagSeguroConfig::getEnvironment();
if ($environment == 'production') {
$environment = "Produção";
} else {
$environment = "Sandbox";
}
$tp = (string) Mage::getConfig()->getTablePrefix();
$table = $tp . 'pagseguro_orders';
$read = Mage::getSingleton('core/resource')->getConnection('core_read');
$value = $read->query("SELECT `order_id` FROM `" . $table . "` WHERE `order_id` = " . $orderId);
$row = $value->fetch();
if ($row == false) {
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
$sql = "INSERT INTO `" . $table . "` (`order_id`, `environment`) \n VALUES ('{$orderId}','{$environment}')";
$connection->query($sql);
}
try {
$PagSeguroPaymentModel->setOrder($Order);
$this->_redirectUrl($PagSeguroPaymentModel->getRedirectPaymentHtml($Order));
//after verify if the order was created, instantiates the sendEmail() method
$this->sendEmail();
} catch (Exception $ex) {
Mage::log($ex->getMessage());
Mage::getSingleton('core/session')->addError(self::MENSAGEM);
$this->_redirectUrl(Mage::getUrl('checkout/cart'));
if ($checkout == 'PADRAO') {
$this->_redirectUrl(Mage::getUrl() . $feedback);
}
$this->_canceledStatus($Order);
}
} else {
Mage::getSingleton('core/session/canceled')->addError(self::MENSAGEM);
$this->_redirectUrl(Mage::getUrl('checkout/cart'));
if ($checkout == 'PADRAO') {
$this->_redirectUrl(Mage::getUrl() . $feedback);
}
$this->_canceledStatus($Order);
}
}
示例15: reLoad
public static function reLoad()
{
self::$active = PagSeguroConfig::logIsActive();
if (self::$active) {
$logFile = PagSeguroConfig::getLogFileLocation();
if (!empty($logFile)) {
self::createFile($logFile);
} else {
self::createFile();
}
}
}