public function __construct($type, $data, PaymentModel $payment)
 {
     $data['type'] = $type;
     $data['time'] = Time::dt($data['time']);
     $this->payment = $payment->newInstance($data);
     self::$paymentStatic = $payment->newInstance();
 }
 public function testDoubleCancel()
 {
     $input = $this->doPrepareCheckInput();
     $paymentPay = $this->makePay($input);
     // cancel
     $input = array('term' => $paymentPay->term, 'code' => $paymentPay->code, 'to' => $paymentPay->to, 'time' => Time::ts());
     $processor = $this->makeProcessor($input, 'cancel');
     $processor->response();
     $paymentCancel = $processor->item();
     $this->assertEquals('cancel', $paymentCancel->type);
     // cancel 2
     $processor = $this->makeProcessor($input, 'cancel');
     $response = $processor->response();
     $this->assertEquals(ProcessorException::RC_EXISTS_OPERATION, $response->code);
 }
 public function testFail()
 {
     $input = $this->doPrepareCheckInput();
     $input['amount'] = '0.00';
     // amount
     $dataCheck = $this->callGateway(Type::CHECK, $input);
     $this->assertEquals(Type::ERROR, $dataCheck->type, print_r($dataCheck, true));
     $this->assertContains('amount', $dataCheck->message, print_r($dataCheck, true));
     $input['amount'] = '10.00';
     // sign
     $input['sign'] = 'fail';
     $dataCheck = $this->callGateway(Type::CHECK, $input);
     $this->assertEquals(Type::ERROR, $dataCheck->type, print_r($dataCheck, true));
     $this->assertContains('sign', $dataCheck->message, print_r($dataCheck, true));
     unset($input['sign']);
     // time
     $input['time'] = 123;
     $dataCheck = $this->callGateway(Type::CHECK, $input);
     $this->assertEquals(Type::ERROR, $dataCheck->type, print_r($dataCheck, true));
     $this->assertContains('time', $dataCheck->message, print_r($dataCheck, true));
     $input['time'] = Time::ts();
 }
 public static function time()
 {
     return Time::ts();
 }
 private function getResponseData()
 {
     $data = array('term' => $this->payment->item()->term, 'type' => $this->payment->item()->type, 'code' => $this->payment->item()->code, 'amount' => $this->payment->item()->amount, 'cur' => $this->payment->item()->cur, 'status' => $this->payment->item()->status, 'time' => Time::ts());
     Secure::sign($data, $this->type->sid(), $this->term->secret);
     return $data;
 }
Views::label('to');
Views::text('to', $to);
?>
					</div>

					<div class="form-group">
						<?php 
Views::label('code');
Views::text('code', '');
?>
					</div>

					<div class="form-group">
						<?php 
Views::label('time');
Views::text('time', Time::ts());
?>
					</div>

					<div class="form-group">
						<?php 
Views::label('term');
Views::text('term', $terminal->id, array('size' => 10, 'style' => 'width: 100px; display: inline; margin-left: 10px;'));
?>
					</div>

					<div class="form-group">
						<?php 
Views::label('secret');
Views::text('secret', $terminal->secret);
?>