Example #1
0
 /**
  * Order direct
  *
  * @param array $data
  */
 public function order_direct(array $data = array())
 {
     $order_response = false;
     $result = Pronamic_WP_Pay_Util::remote_get_body($this->api_url, 200, array('method' => 'POST', 'sslverify' => false, 'body' => $data));
     if (is_wp_error($result)) {
         $this->error = $result;
     } else {
         $xml = Pronamic_WP_Pay_Util::simplexml_load_string($result);
         if (is_wp_error($xml)) {
             $this->error = $xml;
         } else {
             $order_response = Pronamic_WP_Pay_Gateways_Ogone_OrderResponseParser::parse($xml);
             if (!empty($order_response->nc_error)) {
                 $ogone_error = new Pronamic_WP_Pay_Gateways_Ogone_Error(Pronamic_WP_Pay_XML_Security::filter($order_response->nc_error), Pronamic_WP_Pay_XML_Security::filter($order_response->nc_error_plus));
                 $this->error = new WP_Error('ogone_error', (string) $ogone_error, $ogone_error);
             }
         }
     }
     return $order_response;
 }
Example #2
0
 /**
  * Get order status
  */
 public function get_order_status($order_id)
 {
     $return = null;
     // API user ID and password
     $user_id = $this->get_user_id();
     $password = $this->get_password();
     if ('' === $user_id || '' === $password) {
         return $return;
     }
     $result = Pronamic_WP_Pay_Util::remote_get_body($this->get_direct_query_url(), 200, array('method' => 'POST', 'body' => array(Pronamic_WP_Pay_Gateways_Ogone_Parameters::ORDERID => $order_id, Pronamic_WP_Pay_Gateways_Ogone_Parameters::PSPID => $this->data->get_field(Pronamic_WP_Pay_Gateways_Ogone_Parameters::PSPID), Pronamic_WP_Pay_Gateways_Ogone_Parameters::USER_ID => $user_id, Pronamic_WP_Pay_Gateways_Ogone_Parameters::PASSWORD => $password), 'timeout' => 30));
     $xml = Pronamic_WP_Pay_Util::simplexml_load_string($result);
     if (!is_wp_error($xml)) {
         $order_response = Pronamic_WP_Pay_Gateways_Ogone_OrderResponseParser::parse($xml);
         $status = Pronamic_WP_Pay_XML_Security::filter($order_response->status);
         $return = Pronamic_WP_Pay_Gateways_Ogone_Statuses::transform($status);
     }
     return $return;
 }