Esempio n. 1
0
 /**
  * payment processing
  */
 public function doProcess()
 {
     // card errors
     $rc = $this->doProcessCards();
     if ($rc !== '00') {
         $this->payment->rc = $rc;
         $this->payment->rrn = '';
         $this->payment->irn = '';
         $this->payment->status = Status::ERROR;
         $this->payment->save();
         return;
     }
     // process type errors
     $rc = $this->doProcessType();
     if ($rc !== '00') {
         $this->payment->rc = $rc;
         $this->payment->status = Status::ERROR;
         $this->payment->save();
         return;
     }
     // auth
     $this->doDetectAuth();
     // approved
     if ($this->payment->status != Status::AUTHORIZATION) {
         $this->payment->status = Status::SUCCESS;
     }
     $this->payment->rc = '00';
     $this->payment->approval = mt_rand(100000, 999999);
     $this->payment->save();
 }