private function perform_request(Transaction $trans)
 {
     $r = new \CivicInfoBC\HTTP\Request($this->url);
     $r->verb = 'POST';
     $r->require_ssl = true;
     $r->body = $trans->beanstream->request;
     $r->headers = array('Content-Length' => strlen($r->body), 'Content-Type' => 'application/x-www-form-urlencoded');
     $r->follow_redirects = false;
     try {
         $response = $r->Execute();
     } catch (\Exception $e) {
         $trans->beanstream = self::make_http_error($trans->beanstream, $e);
         return false;
     }
     $res = new BeanstreamHTTPSuccess();
     $res->request = $trans->beanstream->request;
     $res->status = $response->status;
     $res->response = $response->response;
     $res->body = $response->body;
     $trans->beanstream = $res;
     if ($response->status === 200) {
         return true;
     }
     $trans->beanstream = self::make_error($trans->beanstream, new \RuntimeException(sprintf('HTTP request against Beanstream API returned HTTP %s %s', $response->status, $response->response), $response->status));
     return false;
 }
 private static function send_impl_impl(Transaction $trans, $body)
 {
     $request = new \CivicInfoBC\HTTP\Request($trans->hosted_checkout->url);
     $request->headers = array('Content-Type' => 'application/x-www-form-urlencoded', 'Content-Length' => strlen($body));
     $request->body = $body;
     $request->verb = 'POST';
     $request->follow_redirects = false;
     $response = $request->Execute();
     $success = $response->status === 200;
     $result = $success ? new EXactSuccess() : new EXactFailure();
     $result->request = $body;
     $result->status = $response->status;
     $result->response = $response->response;
     $result->body = $response->body;
     $trans->exact = $result;
     return $success;
 }