public function testCorrect() { // auth $input = $this->doPrepareAuthInput(); $input['pan'] = BankCard::getValidCustomPan(); $data = $this->callGateway(Type::AUTH, $input); $this->assertEquals('00', $data->rc, print_r($data, true)); // double $dataError = $this->callGateway(Type::AUTH, $input); $this->assertEquals('-3', $dataError->rc, print_r($dataError, true)); // complete $input = array('term' => $data->term, 'order' => $data->order, 'amount' => $data->amount, 'cur' => $data->cur, 'rrn' => $data->rrn, 'irn' => $data->irn, 'time' => Time::ts()); $data = $this->callGateway(Type::COMPLETE, $input); $this->assertEquals('00', $data->rc, print_r($data, true)); $count = Payment::count(); // double complete $dataError = $this->callGateway(Type::COMPLETE, $input); $this->assertEquals('00', $dataError->rc, print_r($dataError, true)); $this->assertEquals($count, Payment::count()); // refund $data = $this->callGateway(Type::REFUND, $input); $this->assertEquals('00', $data->rc, print_r($data, true)); $count = Payment::count(); // double refund $data = $this->callGateway(Type::REFUND, $input); $this->assertEquals('00', $data->rc, print_r($data, true)); $this->assertEquals($count, Payment::count()); }
public function testAuthComplete() { $input = $this->doPrepareAuthInput(); $input['pan'] = BankCard::getValidCustomPan(); $processor = $this->makeProcessor($input, 'auth'); $processor->response(); $payment = $processor->item(); $this->assertEquals('00', $payment->rc); $input = array('term' => $processor->item()->term, 'order' => $processor->item()->order, 'amount' => $processor->item()->amount, 'cur' => $processor->item()->cur, 'rrn' => $processor->item()->rrn, 'irn' => $processor->item()->irn, 'time' => Time::ts()); $processor = $this->makeProcessor($input, 'complete'); $processor->response(); $payment = $processor->item(); $this->assertEquals('00', $payment->rc); }
private function getResponseData() { $data = array('term' => $this->payment->item()->term, 'type' => $this->payment->item()->type, 'order' => $this->payment->item()->order, 'amount' => $this->payment->item()->amount, 'cur' => $this->payment->item()->cur, 'rc' => $this->payment->item()->rc, 'approval' => $this->payment->item()->approval, 'irn' => $this->payment->item()->irn, 'rrn' => $this->payment->item()->rrn, 'status' => $this->payment->item()->status, 'time' => Time::ts()); $rc = $this->payment->item()->rc; $pan = $this->payment->item()->pan; if ($pan) { $data['pan'] = $pan; } if ($rc !== '00') { if (isset(ProcessorException::$errors[$rc])) { $data['message'] = ProcessorException::$errors[$rc]; } } Secure::sign($data, $this->type->sid(), $this->term->secret); return $data; }
/** * * Generate params for payment shop form * * @param $terminal * * @return array */ private function getEndpointFields($terminal) { $fields = Type::$fields[Type::ENDPOINT]; $params = array(); foreach ($fields as $name) { $value = ''; switch ($name) { case 'term': $value = $terminal->id; break; case 'amount': $value = '123.45'; break; case 'cur': $value = 'RUB'; break; case 'order': $value = '123456'; break; case 'name': $value = 'Boogie-Woogie Shopping'; break; case 'desc': $value = 'Beauty Dress & Smart Phone'; break; case 'url': $value = URL::route('ff-bank-em-shop'); break; case 'back': $value = URL::route('ff-bank-em-shop'); break; case 'time': $value = Time::ts(); break; } $params[$name] = $value; } Secure::sign($params, Type::ENDPOINT, $terminal->secret); return $params; }
public static function time() { return Time::ts(); }
Views::label('url'); Views::text('url', URL::route('ff-bank-em-shop')); ?> </div> <div class="form-group"> <?php Views::label('email'); Views::text('email', '*****@*****.**'); ?> </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); ?>