예제 #1
0
 public function complete($request)
 {
     // Reconstruct the payment object
     $this->payment = Payment::get()->byID($request->param('OtherID'));
     // Save the payer ID for good measure
     $this->payment->PayerID = $request->getVar('PayerID');
     $this->payment->write();
     // Reconstruct the gateway object
     $methodName = $request->param('ID');
     $this->gateway = PaymentFactory::get_gateway($methodName);
     // Confirm the payment
     $data = array('PayerID' => $request->getVar('PayerID'), 'Token' => $request->getVar('token'), 'Amount' => $this->payment->Amount->Amount, 'Currency' => $this->payment->Amount->Currency);
     $result = $this->gateway->confirm($data);
     $this->payment->updateStatus($result);
     // Do redirection
     $this->doRedirect();
     return;
 }
예제 #2
0
 /**
  * Process request from the external gateway, this action is usually triggered if the payment was cancelled
  * and the user was redirected to the cancelURL.
  * 
  * @param SS_HTTPResponse $request
  */
 public function cancel($request)
 {
     // Reconstruct the payment object
     $this->payment = Payment::get()->byID($request->param('OtherID'));
     // Reconstruct the gateway object
     $methodName = $request->param('ID');
     $this->gateway = PaymentFactory::get_gateway($methodName);
     // The payment result was a failure
     $this->payment->updateStatus(new PaymentGateway_Failure());
     // Do redirection
     $this->doRedirect();
 }