本文整理汇总了PHP中PayPal::doPayment方法的典型用法代码示例。如果您正苦于以下问题:PHP PayPal::doPayment方法的具体用法?PHP PayPal::doPayment怎么用?PHP PayPal::doPayment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PayPal
的用法示例。
在下文中一共展示了PayPal::doPayment方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PayPal
function do_payment()
{
$amount = $this->input->get('amount');
$r = new PayPal();
$r->doExpressCheckout($amount, 'Da Greatest Library You Ever Seen');
$final = $r->doPayment();
if ($final['ACK'] == 'Success') {
echo 'Succeed!';
} else {
echo 'Error!';
}
}
示例2: PayPal
<?php
require_once './paypal/paypal.php';
require_once './paypal/httprequest.php';
//Load PHPMailer Class
require_once 'phpmailer/class.phpmailer.php';
//Use this form for production server
$r = new PayPal(true);
//Use this form for sandbox tests
// $r = new PayPal();
$final = $r->doPayment();
if ($final['ACK'] == 'Success') {
$payment = $r->getCheckoutDetails($final['TOKEN']);
//If payment from PayPal is successful, send out our thankyou email
$first_name = $payment['FIRSTNAME'];
$last_name = $payment['LASTNAME'];
$name = $first_name . ' ' . $last_name;
$email = $payment['EMAIL'];
$amount = $payment['CUSTOM'];
$amount = explode("|", $amount, 2);
$amount = $amount[0];
$date = $payment['TIMESTAMP'];
$date = strtotime($date);
// Build and send the email *using PHPMailer
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = true;
$mail->Host = $mailConfig['host'];
$mail->Port = 587;
$mail->Username = $mailConfig['user'];
示例3: executeConfirmation
public function executeConfirmation(sfWebRequest $request)
{
$paypal = new PayPal();
$final = $paypal->doPayment();
if ($final['ACK'] == 'Success') {
$this->result = "Succeed!";
/* Array
// (
// [TOKEN] => EC-4AV72391LH8693509
// [TIMESTAMP] => 2012-10-10T13:40:58Z
// [CORRELATIONID] => b20d0c034074
// [ACK] => Success
// [VERSION] => 52.0
// [BUILD] => 3893058
// [TRANSACTIONID] => 27557320TK055573R
// [TRANSACTIONTYPE] => expresscheckout
// [PAYMENTTYPE] => instant
// [ORDERTIME] => 2012-10-10T13:40:56Z
// [AMT] => 900.00
// [FEEAMT] => 30.85
// [TAXAMT] => 0.00
// [CURRENCYCODE] => EUR
// [PAYMENTSTATUS] => Completed
// [PENDINGREASON] => None
// [REASONCODE] => None
// )
:*/
// CONTRAT
$contratMobilyrent = new MobilyrentContrat();
$contratMobilyrent->setDatecontrat(date('Y-m-d'));
$contratMobilyrent->setDatedepart($this->getUser()->getAttribute('datedepart'));
$contratMobilyrent->setDateretourprevue($this->getUser()->getAttribute('dateretour'));
$contratMobilyrent->setDateretourreelle($this->getUser()->getAttribute('dateretour'));
$contratMobilyrent->setPrixjournalierconvenu($this->getUser()->getAttribute('voiture')->getTarifJour());
$contratMobilyrent->setNocontrat($final['CORRELATIONID']);
$contratMobilyrent->setKmdepart(0);
$contratMobilyrent->setKmretour(0);
$contratMobilyrent->setIsActivated(1);
$contratMobilyrent->setMontantaccompte($this->getUser()->getAttribute('voiture')->getMobilyrentModele()->getCaution());
$contratMobilyrent->save();
//FACTURE
$factureMobilyrent = new MobilyrentFacture();
$factureMobilyrent->setDatefacture(date('Y-m-d'));
$factureMobilyrent->setNofacture($final['CORRELATIONID']);
$factureMobilyrent->setTotalfacture($this->getUser()->getAttribute('montantLocation'));
$factureMobilyrent->setIsActivated(1);
$factureMobilyrent->setMobilyrentContrat($contratMobilyrent);
$factureMobilyrent->save();
//PAIEMENT
$paiementMobilyrent = new MobilyrentPaiement();
$paiementMobilyrent->setNom("test");
$paiementMobilyrent->setPrenom("test");
$paiementMobilyrent->setAdresse("1 Allée colette");
$paiementMobilyrent->setCodepostal("91270");
$paiementMobilyrent->setDatepaiement(date('Y-m-d'));
$paiementMobilyrent->setMontantpaiement($this->getUser()->getAttribute('montantLocation'));
$paiementMobilyrent->setMobilyrentFacture($factureMobilyrent);
$paiementMobilyrent->setIdtypepaiement(2);
$paiementMobilyrent->setIdstatut(1);
$paiementMobilyrent->save();
//GET SF_GUARD_USER
$user = Doctrine::getTable('sfGuardUser')->retrieveByUsername($this->getUser()->getAttribute('email_address'));
//echo '<pre>';
//print_r();
//exit;
//LOCATION
$locationMobilyrent = new MobilyrentLocation();
$locationMobilyrent->setMobilyrentContrat($contratMobilyrent);
$locationMobilyrent->setMobilyrentVehicule($this->getUser()->getAttribute('voiture'));
//$locationMobilyrent->setIduserprofile($this->getUser()->getGuardUser()->getProfile()->getId());
$locationMobilyrent->setIduserprofile($user->getProfile()->getId());
$locationMobilyrent->setIsActivated(1);
$locationMobilyrent->save();
$message = $this->getMailer()->compose(sfConfig::get('app_mail_saidi'), $this->getUser()->getAttribute('email_address'), '[Mobilyrent] - Reservation confirmée Mobilyrent location de voiture', '[Mobilyrent] - Reservation confirmée Mobilyrent location de voiture');
$this->getMailer()->send($message);
} else {
$this->result = "Failure!";
}
}
示例4: executeConfirmation
public function executeConfirmation(sfWebRequest $request)
{
$paypal = new PayPal();
$final = $paypal->doPayment();
if ($final['ACK'] == 'Success') {
$this->result = "Succeed!";
// CONTRAT
$contratMobilyrent = new MobilyrentContrat();
$contratMobilyrent->setDatecontrat(date('Y-m-d'));
$contratMobilyrent->setDatedepart($this->getUser()->getAttribute('datedepart'));
$contratMobilyrent->setDateretourprevue($this->getUser()->getAttribute('dateretour'));
$contratMobilyrent->setDateretourreelle($this->getUser()->getAttribute('dateretour'));
$contratMobilyrent->setPrixjournalierconvenu($this->getUser()->getAttribute('voiture')->getTarifJour());
$contratMobilyrent->setNocontrat($final['CORRELATIONID']);
$contratMobilyrent->setKmdepart(0);
$contratMobilyrent->setKmretour(0);
$contratMobilyrent->setIsActivated(1);
$contratMobilyrent->setMontantaccompte($this->getUser()->getAttribute('voiture')->getMobilyrentModele()->getCaution());
$contratMobilyrent->save();
//FACTURE
$factureMobilyrent = new MobilyrentFacture();
$factureMobilyrent->setDatefacture(date('Y-m-d'));
$factureMobilyrent->setNofacture($final['CORRELATIONID']);
$factureMobilyrent->setTotalfacture($this->getUser()->getAttribute('montantLocation'));
$factureMobilyrent->setIsActivated(1);
$factureMobilyrent->setMobilyrentContrat($contratMobilyrent);
$factureMobilyrent->save();
//PAIEMENT
$paiementMobilyrent = new MobilyrentPaiement();
$paiementMobilyrent->setNom($this->getUser()->getGuardUser()->getLastName());
$paiementMobilyrent->setPrenom($this->getUser()->getGuardUser()->getFirstName());
$paiementMobilyrent->setAdresse($this->getUser()->getGuardUser()->getProfile()->getAdresse());
$paiementMobilyrent->setCodepostal($this->getUser()->getGuardUser()->getProfile()->getCodepostal());
$paiementMobilyrent->setDatepaiement(date('Y-m-d'));
$paiementMobilyrent->setMontantpaiement($this->getUser()->getAttribute('montantLocation'));
$paiementMobilyrent->setMobilyrentFacture($factureMobilyrent);
$paiementMobilyrent->setIdtypepaiement(2);
$paiementMobilyrent->setIdstatut(1);
$paiementMobilyrent->save();
//GET SF_GUARD_USER
$user = Doctrine::getTable('sfGuardUser')->retrieveByUsername($this->getUser()->getAttribute('email_address'));
$locationMobilyrent = new MobilyrentLocation();
$locationMobilyrent->setMobilyrentContrat($contratMobilyrent);
$locationMobilyrent->setMobilyrentVehicule($this->getUser()->getAttribute('voiture'));
$locationMobilyrent->setIduserprofile($this->getUser()->getGuardUser()->getProfile()->getId());
//$locationMobilyrent->setIduserprofile($user->getProfile()->getId());
$locationMobilyrent->setIsActivated(1);
$locationMobilyrent->save();
$message = $this->getMailer()->compose(sfConfig::get('app_mail_saidi'), $this->getUser()->getAttribute('email_address'), '[Mobilyrent] - Reservation confirmée Mobilyrent location de voiture', '[Mobilyrent] - Reservation confirmée Mobilyrent location de voiture');
$this->getMailer()->send($message);
$startDate = $this->getUser()->getAttribute('datedepart');
$startTime = $this->getUser()->getAttribute('heuredepart');
$endDate = $this->getUser()->getAttribute('dateretour');
$endTime = $this->getUser()->getAttribute('heureretour');
$title = $this->getUser()->getGuardUser()->getName();
$voitureObject = $this->getUser()->getAttribute('voiture');
$content = "Reservation de la voiture:" . ' ' . $voitureObject->getNoimmatriculation();
$startDate = "{$startDate}T{$startTime}";
$endDate = "{$endDate}T{$endTime}";
$this->setPlanning($startDate, $endDate, $title, $content);
} else {
$this->result = "Failure!";
}
}