You can take a look at other non merchant gateways included with Blesta for working examples of this functionality. However, here is a basic example:
Instantiate the Http object so you may POST to the gateway POST to the gateway Handle the response
e.g. something like the following:
public function validate(array $get, array $post) {
// Instantiate the Http object
if (!isset($this->Http)) {
Loader::loadComponents($this, array("Net");
$this->Http = $this->Net->create("Http");
}
// Log the response we received initially
$url = "https://domain.com/";
$this->log($url, serialize($post), "output", true);
// Log that we are about to make a request
$post_data = array(/* set any data to pass along */);
$this->log($url, serialize($post_data), "input", true);
// Post to the gateway
$response = $this->Http->post($url, http_build_query($post_data));
// Log the response from the gateway
$this->log($url, serialize($response), "output", true);
// Handle the response
if ($response == "success")
// do something
else
// do something else
return array(
// ... set return key/value pairs
);
}