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!'; } }
public function executeConnexion(sfWebRequest $request) { $class = sfConfig::get('app_sf_guard_plugin_signin_form', 'sfGuardFormSignin'); $this->formIdentification = new $class(); if ($request->ismethod('post')) { $this->formIdentification->bind($request->getParameter('signin')); if ($this->formIdentification->isValid()) { $values = $this->formIdentification->getValues(); $this->getUser()->signin($values['user'], array_key_exists('remember', $values) ? $values['remember'] : false); $paypal = new PayPal(); $ret = $paypal->doExpressCheckout($this->getUser()->getAttribute('montantLocation'), 'Location de la voiture'); //print_r($ret); } } }
<?php require_once './paypal/paypal.php'; require_once './paypal/httprequest.php'; //Use this form for production server $r = new PayPal(true); //Use this form for sandbox tests // $r = new PayPal(); $amount = (double) $_POST['amount']; $ret = $r->doExpressCheckout($amount, 'Donation to the Processing Foundation'); //An error occured. The auxiliary information is in the $ret array echo 'Error:'; print_r($ret);
* names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY MARTIN MALY ''AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL MARTIN MALY BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ require_once './class/paypal.php'; //where necessary require_once './class/httprequest.php'; //where necessary //Use this form for production server $r = new PayPal(true); //Use this form for sandbox tests //$r = new PayPal(); $donamound = $_POST['donation-amount']; $dondesc = $_POST['cause']; if ($donamound == '') { $donamound = '10'; } $ret = $r->doExpressCheckout($donamound, $dondesc); //An error occured. The auxiliary information is in the $ret array echo 'Error:'; print_r($ret);
* * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY MARTIN MALY ''AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL MARTIN MALY BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ require_once '../classes/paypal.php'; //when needed require_once '../classes/httprequest.php'; //when needed //Use this form for production server //$r = new PayPal(true); //Use this form for sandbox tests $r = new PayPal(); $ret = $r->doExpressCheckout(10, 'Access to source code library'); //An error occured. The auxiliary information is in the $ret array print_r($ret);
public function executeIdentification(sfWebRequest $request) { if (!$this->getUser()->isAuthenticated()) { $this->formInscription = new InscriptionForm(); $class = sfConfig::get('app_sf_guard_plugin_signin_form', 'sfGuardFormSignin'); $this->form = new $class(); if ($request->ismethod('post')) { if ($request->getParameter('send') == "signin") { $this->form->bind($request->getParameter('signin')); if ($this->form->isValid()) { $values = $this->form->getValues(); $this->getUser()->signin($values['user'], array_key_exists('remember', $values) ? $values['remember'] : false); if ($this->getUser()->getAttribute('montantLocation')) { $paypal = new PayPal(); $ret = $paypal->doExpressCheckout($this->getUser()->getAttribute('montantLocation'), 'Location de la voiture'); print_r($ret); } else { $this->redirect('espace_membre_profil'); } } } else { if ($request->getParameter('send') == "signup") { $this->formInscription->bind($request->getParameter('signup')); if ($this->formInscription->isValid()) { $values = $this->formInscription->getValues(); //print_r($values); //exit; $user = new sfGuardUser(); $user->setEmailAddress($values['email_address']); $user->setUsername($values['email_address']); $user->setLastName($values['nom']); $user->setFirstName($values['prenom']); $user->setPassword($values['password1']); $user->setIsActive(1); $user->getProfile()->setAdresse($values['adresse']); $user->getProfile()->setCodepostal($values['codepostal']); $user->getProfile()->setVille($values['ville']); $user->getProfile()->setFixe($values['fixe']); $user->getProfile()->setMobile($values['mobile']); $user->getProfile()->setDateNaissance($values['date_naissance']); $user->getProfile()->setNumeroPermis($values['numero_permis']); $user->getProfile()->setVilleDelivrance($values['ville_permis']); $user->getProfile()->setPaysDelivrance($values['pays_permis']); $user->getProfile()->setDateDelivrance($values['date_delivrance_permis']); $user->getProfile()->setIsActivated(1); $user->addGroupByName("client"); $user->save(); $this->getUser()->setAttribute('email_address', $values['email_address']); $message = $this->getMailer()->compose(sfConfig::get('app_mail_saidi'), $values['email_address'], '[Mobilyrent] - Inscription Mobilyrent location de voiture', '[Mobilyrent] - Inscription Mobilyrent location de voiture'); $this->getMailer()->send($message); //echo $this->getUser()->getAttribute('montantLocation');exit; if ($this->getUser()->getAttribute('montantLocation')) { $paypal = new PayPal(); $ret = $paypal->doExpressCheckout($this->getUser()->getAttribute('montantLocation'), 'Location de la voiture'); print_r($ret); } //$this->getUser()->setFlash('notice', sprintf('Inscription terminée.<br/>Un email vous a été envoyé. Connectez vous et continuer votre reservation.')); } } } } } else { $paypal = new PayPal(); $ret = $paypal->doExpressCheckout($this->getUser()->getAttribute('montantLocation'), 'Location de la voiture'); print_r($ret); } }
* notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the <organization> nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY MARTIN MALY ''AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL MARTIN MALY BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ require_once './class/paypal.php'; //where necessary require_once './class/httprequest.php'; //where necessary //Use this form for production server //$r = new PayPal(true); //Use this form for sandbox tests $r = new PayPal(); $ret = $r->doExpressCheckout(10, 'A perfect item!'); //An error occured. The auxiliary information is in the $ret array echo 'Error:'; print_r($ret);