示例#1
0
文件: Solo.php 项目: Silxik/banklink
 public function handleAuthResponse(array $responseData, $inputEncoding)
 {
     $hash = $this->generateHash($responseData, Services::getAuthResponseFields());
     $verification = $hash === $responseData[Fields::B02K_MAC];
     $responseData = ProtocolUtils::convertValues($responseData, $inputEncoding, 'UTF-8');
     if ($verification) {
         $status = 1;
     } else {
         $status = 0;
     }
     $response = new AuthResponse($status, $responseData);
     if ($status == 1) {
         $response->setPersonalCode($responseData[Fields::B02K_CUSTID]);
         $fullname = $responseData[Fields::B02K_CUSTNAME];
         $response->setFirstname(substr($fullname, 0, strpos($fullname, ' ')));
         $response->setLastname(substr($fullname, strpos($fullname, ' ') + 1));
     }
     return $response;
 }
示例#2
0
 public function handleAuthResponse(array $responseData, $verificationSuccess)
 {
     // if response was verified, try to guess status by service id
     if ($verificationSuccess) {
         $status = $responseData[Fields::SERVICE_ID] == Services::AUTHENTICATE_SUCCESS ? PaymentResponse::STATUS_SUCCESS : PaymentResponse::STATUS_CANCEL;
     } else {
         $status = PaymentResponse::STATUS_ERROR;
     }
     $response = new AuthResponse($status, $responseData);
     $response->setPersonalCode($responseData[Fields::VK_USER_ID]);
     if (AuthResponse::STATUS_SUCCESS === $status) {
         $fullname = $responseData[Fields::VK_USER_NAME];
         if (strpos($fullname, ',') !== false) {
             $response->setLastname(substr($fullname, 0, strpos($fullname, ',')));
             $response->setFirstname(substr($fullname, strpos($fullname, ',') + 1));
         } else {
             $response->setFirstname(substr($fullname, 0, strpos($fullname, ' ')));
             $response->setFirstname(substr($fullname, strpos($fullname, ' ') + 1));
         }
     }
     return $response;
 }