public function paypaypalAction() { $this->setSmartyOutput(false); $arrUserRequest = $this->getUserRequest(); // no invoice id given if (false == isset($arrUserRequest['params']['0']) || false == is_numeric($arrUserRequest['params']['0'])) { $this->redirectTo('invoice'); return; } // paypal is disabled if (false == PAYPAL_ENABLE) { $this->setMessage('Die Bezahlung über PayPal ist momentan nicht möglich', 'error'); $this->redirectTo('invoice', 'pay', $arrUserRequest['params']['0']); return; } $objDataInvoice = new GSALES_DATA_INVOICE(); $objInvoice = $objDataInvoice->getInvoiceById($arrUserRequest['params']['0'], $this->objUserAuth->getCustomerId(), true); // invoice does not exist (or belongs to another customer) if (false == $objInvoice) { $this->redirectTo('invoice'); return; } // read customer details $objDataCustomer = new GSALES_DATA_CUSTOMER(); $objCustomer = $objDataCustomer->getCustomerById($this->objUserAuth->getCustomerId()); // do paypal require_once FE_DIR . '/lib/payment/paypal.php'; $objPayPal = new PAYPAL(); // invoice data $objPayPal->add('item_name', 'Rechnung ' . $objInvoice->getInvoiceNo()); $objPayPal->add('amount', $objInvoice->getOpenAmount()); $objPayPal->add('custom', $objInvoice->getId()); // custom field -> invoice id // customer data $objPayPal->add('first_name', $objCustomer->getFirstname()); $objPayPal->add('last_name', $objCustomer->getLastname()); $objPayPal->add('address1', $objCustomer->getAddress()); $objPayPal->add('city', $objCustomer->getCity()); $objPayPal->add('zip', $objCustomer->getZIP()); $objPayPal->add('email', $objCustomer->getEmail()); $objPayPal->startProcess(); }
public function paypalipnAction() { if (isset($_POST)) { $this->setSmartyOutput(false); require_once FE_DIR . '/lib/payment/paypal.php'; $objPayPal = new PAYPAL(); $objPayment == $objPayPal->checkAndvalidateIPN(); if (false == $objPayment) { return false; } } else { $this->redirectTo('index', 'index'); } }