示例#1
0
 private function run()
 {
     $this->type->validate();
     $this->initTerm();
     $this->type->validateSign($this->term->secret);
     $this->type->validateTermEnabled($this->term->mode);
     $this->initPayment();
     $this->payment->doProcess();
     $this->sendCallbackUrl();
 }
 /**
  * @param array  $input
  * @param int    $code
  * @param string $message
  *
  * @return void
  *
  * @dataProvider auth
  */
 public function testAuth($input, $code = null, $message = null)
 {
     Secure::sign($input, 'auth', 'secret');
     $opType = new Type('auth', $input);
     try {
         $this->assertTrue($opType->validate());
         if ($code) {
             $this->assertFalse(true, 'Exception must be there with code ' . $code);
         }
     } catch (ProcessorException $e) {
         $this->assertEquals($code, $e->getCode(), $e->getMessage());
         $this->assertContains($message, $e->getMessage());
     }
 }
 /**
  * Production gate
  * Public access
  *
  */
 public function endpoint()
 {
     /**
      * @var Processor $processor
      */
     $type = Type::ENDPOINT;
     $input = $this->getVerifiedInput('endpoint', $type, Input::all());
     $errorMessage = 'Request error';
     $urlBack = '';
     if ($input) {
         $errorMessage = '';
         $urlBack = $input['back'];
         $opType = new Type($type, $input);
         try {
             $opType->validate();
         } catch (ProcessorException $e) {
             $errorMessage = $e->getMessage();
         }
     }
     if ($errorMessage) {
         return Redirect::route('ff-bank-em-error')->with(array('errorMessage' => $errorMessage, 'errorUrl' => Views::url($urlBack, array('resultBankEmulatorPayment' => 'error')), 'errorUrlName' => 'вернуться в магазин'));
     }
     $term = Terminal::find($input['term']);
     $paymentParams = $this->getPaymentFields($input);
     Secure::sign($paymentParams, $type, $term->secret);
     $this->layout = View::make('ff-bank-em::layouts.endpoint');
     return $this->layout->nest('content', 'ff-bank-em::demo.endpoint', compact('paymentParams'));
 }