本文整理汇总了PHP中PagSeguroConfig::getAccountCredentials方法的典型用法代码示例。如果您正苦于以下问题:PHP PagSeguroConfig::getAccountCredentials方法的具体用法?PHP PagSeguroConfig::getAccountCredentials怎么用?PHP PagSeguroConfig::getAccountCredentials使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PagSeguroConfig
的用法示例。
在下文中一共展示了PagSeguroConfig::getAccountCredentials方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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());
}
}
示例2: 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());
}
}
示例3: transactionNotification
private static function transactionNotification($notificationCode)
{
$credentials = PagSeguroConfig::getAccountCredentials();
try {
return PagSeguroNotificationService::checkTransaction($credentials, $notificationCode);
} catch (PagSeguroServiceException $e) {
die($e->getMessage());
}
}
示例4: 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());
}
}
示例5: 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', 'comprador@email.com');
$directPaymentRequest->addParameter('notificationURL', 'http://www.lojamodelo.com.br');
$token = "5b97542cd1524b67a9e89b3d90c1f262";
$installment = new PagSeguroInstallment(array("quantity" => 1, "value" => "30.00"));
$cardCheckout = new PagSeguroCreditCardCheckout(array('token' => $token, 'installment' => $installment));
//Set credit card for payment
$directPaymentRequest->setCreditCard($cardCheckout);
try {
/**
* #### Credentials #####
* Replace the parameters below with your credentials
* You can also get your credentials like this:
* $credentials = new PagSeguroAccountCredentials("vendedor@lojamodelo.com.br",
* "E231B2C9BCC8474DA2E260B6C8CF60D3");
*/
// seller authentication
$credentials = PagSeguroConfig::getAccountCredentials();
// 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());
}
}
示例6: pagSeguro
public function pagSeguro()
{
/*
/* Carrega a biblioteca do CodeIgniter responsável pela validação dos formulários */
$this->load->library('form_validation', 'PagSeguroLibrary');
$this->load->model('presentes_model');
/* Define as tags onde a mensagem de erro será exibida na página */
$this->form_validation->set_error_delimiters('<span>', '</span>');
/* Define as regras para validação */
$this->form_validation->set_rules('valor', 'decimal', 'required');
/* Executa a validação e caso houver erro... */
if ($this->form_validation->run() === FALSE) {
/* Chama a função index do controlador */
$this->load->view('pages/presentes.php');
/* Senão, caso sucesso na validação... */
} else {
/* Recebe os dados do formulário (visão) */
$data['valor'] = $this->input->post('valor');
$data['descricao'] = 'Presente Luana e Juninho';
//inserir data atual também....
/* Chama a função inserir do modelo */
$this->presentes_model->pagSeguro($data);
//redirect('#contact');
}
/** INICIO PROCESSO PAGSEGURO */
require_once APPPATH . 'libraries/PagSeguroLibrary/PagSeguroLibrary.php';
/** INICIO PROCESSO PAGSEGURO */
$paymentrequest = new PagSeguroPaymentRequest();
$data = array('id' => '01', 'description' => 'Presente Luana e Juninho', 'quantity' => 1, 'amount' => $this->input->post('valor'));
$item = new PagSeguroItem($data);
/* $paymentRequest deve ser um objeto do tipo PagSeguroPaymentRequest */
$paymentrequest->addItem($item);
//Definindo moeda
$paymentrequest->setCurrency('BRL');
// 1- PAC(Encomenda Normal)
// 2-SEDEX
// 3-NOT_SPECIFIED(Não especificar tipo de frete)
$paymentrequest->setShipping(3);
//Url de redirecionamento
//$paymentrequest->setRedirectURL($redirectURL);// Url de retorno
$credentials = PagSeguroConfig::getAccountCredentials();
//credenciais do vendedor
//$compra_id = App_Lib_Compras::insert($produto);
//$paymentrequest->setReference($compra_id);//Referencia;
$url = $paymentrequest->register($credentials);
header("Location: {$url}");
}
示例7: makeRequisition
private function makeRequisition()
{
require_once VENDOR_PATH . 'PagSeguro/PagSeguroLibrary.php';
$payment = new \PagSeguroPaymentRequest();
$payment->setCurrency('BRL');
$payment->addItem('0001', $this->productName, $this->productQuantity, $this->productPrice);
$payment->setReference($this->pid);
$payment->setShippingType(3);
$payment->setsender($this->clientName, $this->clientMail, $this->clientAreaCode, $this->clientPhone);
$payment->setRedirectUrl($this->redirectUrl);
$credentials = \PagSeguroConfig::getAccountCredentials();
if (defined('ALLOW_PAYMENT_REQUEST') and ALLOW_PAYMENT_REQUEST === true) {
$this->paymentUrl = $payment->register($credentials);
} else {
$this->paymentUrl = '/loja/checkout/pid/' . $this->pid . '/continue/ok/';
}
}
示例8: searchByInterval
public static function searchByInterval()
{
// Substitute the code below
$days = 20;
try {
/**
* @todo
* #### Credentials #####
* Replace the parameters below with your credentials (e-mail and token)
* You can also get your credentials from a config file. See an example:
* $credentials = PagSeguroConfig::getAccountCredentials();
*/
$credentials = PagSeguroConfig::getAccountCredentials();
$result = PagSeguroPreApprovalSearchService::searchByInterval($credentials, $days);
self::printResult($result);
} catch (PagSeguroServiceException $e) {
die($e->getMessage());
}
}
示例9: searchByCode
public static function searchByCode()
{
// Substitute the code below with a valid pre-approval code for your account
$preApprovalCode = "0FEBE545C6C657A77402DF878C539E56";
try {
/**
* @todo
* #### Credentials #####
* Replace the parameters below with your credentials (e-mail and token)
* You can also get your credentials from a config file. See an example:
* $credentials = PagSeguroConfig::getAccountCredentials();
*/
$credentials = PagSeguroConfig::getAccountCredentials();
$result = PagSeguroPreApprovalSearchService::searchByCode($credentials, $preApprovalCode);
self::printResult($result);
} catch (PagSeguroServiceException $e) {
die($e->getMessage());
}
}
示例10: searchByNotification
public static function searchByNotification()
{
// Substitute the code below with a valid code notification for your account
$notificationCode = "29B0BEC9D653D653435EE42F3FAEF4461091";
try {
/**
* @todo
* #### Credentials #####
* Replace the parameters below with your credentials (e-mail and token)
* You can also get your credentials from a config file. See an example:
* $credentials = PagSeguroConfig::getAccountCredentials();
*/
$credentials = PagSeguroConfig::getAccountCredentials();
$result = PagSeguroPreApprovalSearchService::findByNotification($credentials, $notificationCode);
self::printResult($result);
} catch (PagSeguroServiceException $e) {
die($e->getMessage());
}
}
示例11: main
public static function main()
{
$transaction_code = 'FC138A0E-C734-44A8-A9B7-6A79E1E33292';
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");
$credentials = PagSeguroConfig::getAccountCredentials();
// application authentication
//$credentials = PagSeguroConfig::getApplicationCredentials();
//$credentials->setAuthorizationCode("E231B2C9BCC8474DA2E260B6C8CF60D3");
$transaction = PagSeguroTransactionSearchService::searchByCode($credentials, $transaction_code);
self::printTransaction($transaction);
} catch (PagSeguroServiceException $e) {
die($e->getMessage());
}
}
示例12: searchByDate
public static function searchByDate()
{
// Substitute the information below
$page = 1;
$maxPageResults = 1000;
$initialDate = "2015-03-10T00:00:00";
$finalDate = "2015-04-06T00:00:00";
try {
/**
* @todo
* #### Credentials #####
* Replace the parameters below with your credentials (e-mail and token)
* You can also get your credentials from a config file. See an example:
* $credentials = PagSeguroConfig::getAccountCredentials();
*/
$credentials = PagSeguroConfig::getAccountCredentials();
$result = PagSeguroPreApprovalSearchService::searchByDate($credentials, $page, $maxPageResults, $initialDate, $finalDate);
self::printResult($result, $initialDate, $finalDate);
} catch (PagSeguroServiceException $e) {
die($e->getMessage());
}
}
示例13: payment
function payment()
{
require_once APPPATH . 'third_party/PagSeguroLibrary/PagSeguroLibrary.php';
$this->load->model('../libraries/anuncios/model/ad_price_model', 'price');
$this->load->model('user_model');
// valida se o anuncio e o preco realmente existem
if (!$this->price->get($this->input->post('price_id', TRUE))->exists() || !$this->ad_model->get($this->input->post('ad_id', TRUE))->is_mine()) {
set_message("Operação inválida", 2);
redirect(site_url("act/anuncios/ad/home_page"));
}
$paymentRequest = new PagSeguroPaymentRequest();
$paymentRequest->AddItem($this->price->object->id, $this->price->object->title, 1, '0.10');
$paymentRequest->setShippingType(3);
$user_object = $this->user_model->get();
// dump($user_object);
// precisamos dos dados de cidade, bairro, rua e numero
$paymentRequest->setShippingAddress(str_replace(array("-", "."), "", $user_object->zip_code), @$user_object->street_name, @$user_object->number, '', @$user_object->district, @$user_object->city_name, @$user_object->state_letter, 'BRA');
$type = !empty($user_object->cpf) ? "CPF" : "CNPJ";
$type_value = !empty($user_object->cpf) ? $user_object->cpf : $user_object->cnpj;
$paymentRequest->setSender($user_object->name, $user_object->username, '11', '', $type, $type_value);
$paymentRequest->setCurrency("BRL");
$paymentRequest->setReference($this->ad_model->object->id);
$paymentRequest->setRedirectUrl(site_url("act/anuncios/ad/home_page"));
$paymentRequest->addParameter('notificationURL', site_url("pagseguro/notification/anuncios/" . $this->ad_model->object->id));
try {
$credentials = PagSeguroConfig::getAccountCredentials();
// getApplicationCredentials()
$checkoutUrl = $paymentRequest->register($credentials);
} catch (PagSeguroServiceException $e) {
set_message("Erro ao gerar link pagamento: " . $e->getMessage(), 2);
redirect(site_url("act/anuncios/ad/home_page"));
}
$this->data["ad"] = $this->ad_model->object;
$this->data["price"] = $this->price->object;
$this->load_view("../libraries/anuncios/views/anuncio_view/payment");
}
示例14: main
public static function main()
{
// Instantiate a new payment request
$paymentRequest = new PagSeguroPaymentRequest();
// Set the currency
$paymentRequest->setCurrency("BRL");
// Add an item for this payment request
$paymentRequest->addItem('0001', 'Notebook prata', 2, 430.0);
// Add another item for this payment request
$paymentRequest->addItem('0002', 'Notebook rosa', 2, 560.0);
// Set a reference code for this payment request. It is useful to identify this payment
// in future notifications.
$paymentRequest->setReference("REF123");
// Set shipping information for this payment request
$sedexCode = PagSeguroShippingType::getCodeByType('SEDEX');
$paymentRequest->setShippingType($sedexCode);
$paymentRequest->setShippingAddress('01452002', 'Av. Brig. Faria Lima', '1384', 'apto. 114', 'Jardim Paulistano', 'São Paulo', 'SP', 'BRA');
// Set your customer information.
$paymentRequest->setSender('João Comprador', 'email@comprador.com.br', '11', '56273440', 'CPF', '156.009.442-76');
// Set the url used by PagSeguro to redirect user after checkout process ends
$paymentRequest->setRedirectUrl("http://www.lojamodelo.com.br");
// Add checkout metadata information
$paymentRequest->addMetadata('PASSENGER_CPF', '15600944276', 1);
$paymentRequest->addMetadata('GAME_NAME', 'DOTA');
$paymentRequest->addMetadata('PASSENGER_PASSPORT', '23456', 1);
// Another way to set checkout parameters
$paymentRequest->addParameter('notificationURL', 'http://www.lojamodelo.com.br/nas');
$paymentRequest->addParameter('senderBornDate', '07/05/1981');
$paymentRequest->addIndexedParameter('itemId', '0003', 3);
$paymentRequest->addIndexedParameter('itemDescription', 'Notebook Preto', 3);
$paymentRequest->addIndexedParameter('itemQuantity', '1', 3);
$paymentRequest->addIndexedParameter('itemAmount', '200.00', 3);
// Add discount per payment method
$paymentRequest->addPaymentMethodConfig('CREDIT_CARD', 1.0, 'DISCOUNT_PERCENT');
$paymentRequest->addPaymentMethodConfig('EFT', 2.9, 'DISCOUNT_PERCENT');
$paymentRequest->addPaymentMethodConfig('BOLETO', 10.0, 'DISCOUNT_PERCENT');
$paymentRequest->addPaymentMethodConfig('DEPOSIT', 3.45, 'DISCOUNT_PERCENT');
$paymentRequest->addPaymentMethodConfig('BALANCE', 0.01, 'DISCOUNT_PERCENT');
// Add installment without addition per payment method
$paymentRequest->addPaymentMethodConfig('CREDIT_CARD', 6, 'MAX_INSTALLMENTS_NO_INTEREST');
// Add installment limit per payment method
$paymentRequest->addPaymentMethodConfig('CREDIT_CARD', 8, 'MAX_INSTALLMENTS_LIMIT');
// Add and remove a group and payment methods
$paymentRequest->acceptPaymentMethodGroup('CREDIT_CARD', 'DEBITO_ITAU');
$paymentRequest->excludePaymentMethodGroup('BOLETO', 'BOLETO');
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");
*/
// seller authentication
$credentials = PagSeguroConfig::getAccountCredentials();
// application authentication
//$credentials = PagSeguroConfig::getApplicationCredentials();
//$credentials->setAuthorizationCode("E231B2C9BCC8474DA2E260B6C8CF60D3");
// Register this payment request in PagSeguro to obtain the payment URL to redirect your customer.
$url = $paymentRequest->register($credentials);
self::printPaymentUrl($url);
} catch (PagSeguroServiceException $e) {
die($e->getMessage());
}
}
示例15: index
public function index()
{
$this->load->model('Order');
$this->load->library('PagSeguroLibrary');
$credentials = PagSeguroConfig::getAccountCredentials();
if ($this->input->get('transaction_id')) {
$id = $this->input->get('transaction_id');
$transaction = PagSeguroTransactionSearchService::searchByCode($credentials, $id);
$taxas_cobradas = $transaction->getFeeAmount();
$vl_liquido_transacao = $transaction->getNetAmount();
$vl_bruto_transacao = $transaction->getGrossAmount();
$nr_parcelas = $transaction->getInstallmentCount();
$nr_pedido_net = $transaction->getReference();
$ultimo_evento = $transaction->getLastEventDate();
$status = $transaction->getStatus()->getValue();
$paymentMethod = $transaction->getPaymentMethod();
$gross_amount = $transaction->getGrossAmount();
$code = $paymentMethod->getCode()->getValue();
$message = '';
$payment = '';
$status_crismetal = '';
switch ($status) {
case 1:
// crismetal : 1 - pendente
$message = "Aguardando pagamento.";
$status_crismetal = '1';
break;
case 2:
// crismetal : 1 - pendente
$message = "Em análise.";
$status_crismetal = '1';
break;
case 3:
// crismetal : 2 - aprovado
$message = "Pagamento aprovado.";
$status_crismetal = '2';
break;
case 4:
// crismetal : 2 - aprovado
$message = "Disponível (Paga).";
$status_crismetal = '2';
break;
case 5:
// crismetal : 9 - em disputa
$message = "Em disputa.";
$status_crismetal = '9';
break;
case 6:
// crismetal : 6 - devolvida
$message = "Devolvida.";
$status_crismetal = '6';
break;
case 7:
// crismetal : 7 - cancelada
$message = "Cancelada.";
$status_crismetal = '7';
break;
}
switch ($code) {
case 101:
$payment = "Cartão de crédito Visa.";
break;
case 102:
$payment = "Cartão de crédito MasterCard.";
break;
case 103:
$payment = "Cartão de crédito American Express.";
break;
case 104:
$payment = "Cartão de crédito Diners.";
break;
case 105:
$payment = "Cartão de crédito Hipercard.";
break;
case 106:
$payment = "Cartão de crédito Aura.";
break;
case 107:
$payment = "Cartão de crédito Elo.";
break;
case 108:
$payment = "Cartão de crédito PLENOCard.";
break;
case 109:
$payment = "Cartão de crédito PersonalCard.";
break;
case 110:
$payment = "Cartão de crédito JCB.";
break;
case 111:
$payment = "Cartão de crédito Discover.";
break;
case 112:
$payment = "Cartão de crédito BrasilCard.";
break;
case 113:
$payment = "Cartão de crédito FORTBRASIL.";
break;
case 114:
$payment = "Cartão de crédito CARDBAN.";
//.........这里部分代码省略.........