protected function _callback(RM_PayPal_Service $provider)
 {
     $bookingRef = $provider->getBookingRef($provider->ipnData['invoice']);
     $transactionInfo = new RM_Payments_Transaction_Info();
     $transactionInfo->providerName = 'PayPal';
     $transactionInfo->id = $provider->ipnData['txn_id'];
     $transactionInfo->reservationID = $bookingRef;
     $transactionInfo->statusCode = $provider->ipnData['payment_status'];
     $transactionInfo->total = $provider->ipnData['mc_gross'];
     $callbackClassName = $provider->ipnData['custom'];
     $callbackObject = new $callbackClassName();
     $callbackObject->paymentTransactionCallback($transactionInfo);
 }
Beispiel #2
0
 public function beginTransaction($value, $reservationID, $description, $successUrl, $cancelUrl, $callbackClassName)
 {
     $payPalService = new RM_PayPal_Service();
     try {
         $payPalService->initialize($payPalService->createInvoiceNumber($reservationID, true), $description, $value);
     } catch (RM_Exception $e) {
         RM_Log::toLog("PayPal transaction aborted: " . $e->getMessage());
         throw new RM_Transaction_Exception();
     }
     $fields = $payPalService->getFields();
     $request = RM_Environment::getConnector()->getRequestHTTP();
     $request->setControllerName('PayPal');
     $request->setActionName('form');
     $controller = new RM_User_PayPalController($request, new Zend_Controller_Response_Http());
     $controller->setFrontController(Zend_Controller_Front::getInstance());
     $controller->view->setScriptPath(RM_Environment::getConnector()->getRootPath() . DIRECTORY_SEPARATOR . 'RM' . DIRECTORY_SEPARATOR . 'userdata' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'PayPal' . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'user' . DIRECTORY_SEPARATOR . 'scripts' . DIRECTORY_SEPARATOR . 'PayPal');
     $fields['custom'] = $callbackClassName;
     $fields['return'] = $successUrl;
     $fields['cancel_return'] = $cancelUrl;
     $controller->view->fields = $fields;
     $controller->view->paypal_url = $payPalService->getPaypalURL();
     echo $controller->view->render('form.phtml');
     return;
 }